lok: avoid expensive fetching of a property.
[LibreOffice.git] / include / xmloff / controlpropertyhdl.hxx
blob6ec2cb2dab1e3cd331808b31a5c828f2183b159c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
21 #define INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
23 #include <sal/config.h>
25 #include <memory>
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>
33 namespace xmloff
37 //= ORotationAngleHandler
39 class XMLOFF_DLLPUBLIC ORotationAngleHandler final : public XMLPropertyHandler
41 public:
42 ORotationAngleHandler();
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;
49 //= OFontWidthHandler
51 class XMLOFF_DLLPUBLIC OFontWidthHandler final : public XMLPropertyHandler
53 public:
54 OFontWidthHandler();
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;
61 //= OControlBorderHandlerBase
63 class XMLOFF_DLLPUBLIC OControlBorderHandler final : public XMLPropertyHandler
65 public:
66 enum BorderFacet
68 STYLE,
69 COLOR
72 OControlBorderHandler( const BorderFacet _eFacet );
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;
77 private:
78 BorderFacet m_eFacet;
82 //= OControlTextEmphasisHandler
84 class OControlTextEmphasisHandler final : public XMLPropertyHandler
86 public:
87 OControlTextEmphasisHandler();
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;
94 //= ImageScaleModeHandler
96 class XMLOFF_DLLPUBLIC ImageScaleModeHandler final : public XMLConstantsPropertyHandler
98 public:
99 ImageScaleModeHandler();
103 //= OControlPropertyHandlerFactory
105 class XMLOFF_DLLPUBLIC OControlPropertyHandlerFactory : public XMLPropertyHandlerFactory
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;
116 public:
117 OControlPropertyHandlerFactory();
119 virtual const XMLPropertyHandler* GetPropertyHandler(sal_Int32 _nType) const override;
123 } // namespace xmloff
126 #endif // INCLUDED_XMLOFF_CONTROLPROPERTYHDL_HXX
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */