1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  *   Licensed to the Apache Software Foundation (ASF) under one or more
12  *   contributor license agreements. See the NOTICE file distributed
13  *   with this work for additional information regarding copyright
14  *   ownership. The ASF licenses this file to you under the Apache
15  *   License, Version 2.0 (the "License"); you may not use this file
16  *   except in compliance with the License. You may obtain a copy of
17  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #ifndef INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
21 #define INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
22 
23 #include <sal/config.h>
24 
25 #include <memory>
26 
27 #include <xmloff/dllapi.h>
28 #include <xmloff/prhdlfac.hxx>
29 #include <rtl/ustring.hxx>
30 #include <xmloff/XMLConstantsPropertyHandler.hxx>
31 #include <xmloff/NamedBoolPropertyHdl.hxx>
32 
33 namespace xmloff
34 {
35 
36 
37     //= ORotationAngleHandler
38 
39     class XMLOFF_DLLPUBLIC ORotationAngleHandler final : public XMLPropertyHandler
40     {
41     public:
42         ORotationAngleHandler();
43 
44         virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
45         virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
46     };
47 
48 
49     //= OFontWidthHandler
50 
51     class XMLOFF_DLLPUBLIC OFontWidthHandler final : public XMLPropertyHandler
52     {
53     public:
54         OFontWidthHandler();
55 
56         virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
57         virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
58     };
59 
60 
61     //= OControlBorderHandlerBase
62 
63     class XMLOFF_DLLPUBLIC OControlBorderHandler final : public XMLPropertyHandler
64     {
65     public:
66         enum BorderFacet
67         {
68             STYLE,
69             COLOR
70         };
71 
72         OControlBorderHandler( const BorderFacet _eFacet );
73 
74         virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
75         virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
76 
77     private:
78         BorderFacet m_eFacet;
79     };
80 
81 
82     //= OControlTextEmphasisHandler
83 
84     class OControlTextEmphasisHandler final : public XMLPropertyHandler
85     {
86     public:
87         OControlTextEmphasisHandler();
88 
89         virtual bool importXML( const OUString& _rStrImpValue, css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
90         virtual bool exportXML( OUString& _rStrExpValue, const css::uno::Any& _rValue, const SvXMLUnitConverter& _rUnitConverter ) const override;
91     };
92 
93 
94     //= ImageScaleModeHandler
95 
96     class XMLOFF_DLLPUBLIC ImageScaleModeHandler final : public XMLConstantsPropertyHandler
97     {
98     public:
99         ImageScaleModeHandler();
100     };
101 
102 
103     //= OControlPropertyHandlerFactory
104 
105     class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory
106     {
107         mutable std::unique_ptr<XMLConstantsPropertyHandler>    m_pTextAlignHandler;
108         mutable std::unique_ptr<OControlBorderHandler>          m_pControlBorderStyleHandler;
109         mutable std::unique_ptr<OControlBorderHandler>          m_pControlBorderColorHandler;
110         mutable std::unique_ptr<ORotationAngleHandler>          m_pRotationAngleHandler;
111         mutable std::unique_ptr<OFontWidthHandler>              m_pFontWidthHandler;
112         mutable std::unique_ptr<XMLConstantsPropertyHandler>    m_pFontEmphasisHandler;
113         mutable std::unique_ptr<XMLConstantsPropertyHandler>    m_pFontReliefHandler;
114         mutable std::unique_ptr<XMLNamedBoolPropertyHdl>        m_pTextLineModeHandler;
115 
116     public:
117         OControlPropertyHandlerFactory();
118 
119         virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const override;
120     };
121 
122 
123 }   // namespace xmloff
124 
125 
126 #endif // INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
127 
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
129