1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SOURCE_STYLE_XMLBAHDL_HXX
21 #define INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
23 #include <xmloff/xmlprhdl.hxx>
24 #include <xmloff/xmltoken.hxx>
28 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
30 class XMLNumberPropHdl
: public XMLPropertyHandler
35 explicit XMLNumberPropHdl( sal_Int8 nB
) : nBytes( nB
) {}
36 virtual ~XMLNumberPropHdl() override
;
38 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
39 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
43 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
45 class XMLNumberNonePropHdl
: public XMLPropertyHandler
50 explicit XMLNumberNonePropHdl( sal_Int8 nB
= 4 );
51 XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString
, sal_Int8 nB
);
52 virtual ~XMLNumberNonePropHdl() override
;
54 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
55 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
59 PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
61 class XMLMeasurePropHdl
: public XMLPropertyHandler
65 explicit XMLMeasurePropHdl( sal_Int8 nB
) : nBytes( nB
) {}
66 virtual ~XMLMeasurePropHdl() override
;
68 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
69 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
73 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
75 class XMLPercentPropHdl
: public XMLPropertyHandler
79 explicit XMLPercentPropHdl( sal_Int8 nB
) : nBytes( nB
) {}
80 virtual ~XMLPercentPropHdl() override
;
82 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
83 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
87 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
88 that is mapped on a double from 0.0 to 1.0
90 class XMLDoublePercentPropHdl
: public XMLPropertyHandler
92 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
93 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
97 PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
99 class XMLNegPercentPropHdl
: public XMLPropertyHandler
103 explicit XMLNegPercentPropHdl( sal_Int8 nB
) : nBytes( nB
) {}
104 virtual ~XMLNegPercentPropHdl() override
;
106 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
107 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
111 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
113 class XMLMeasurePxPropHdl
: public XMLPropertyHandler
117 explicit XMLMeasurePxPropHdl( sal_Int8 nB
) : nBytes( nB
) {}
118 virtual ~XMLMeasurePxPropHdl() override
;
120 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
121 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
125 PropertyHandler for the XML-data-type: XML_TYPE_BOOL
127 class XMLBoolPropHdl
: public XMLPropertyHandler
130 virtual ~XMLBoolPropHdl() override
;
132 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
133 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
136 class XMLBoolFalsePropHdl
: public XMLBoolPropHdl
139 virtual ~XMLBoolFalsePropHdl() override
;
141 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
142 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
147 PropertyHandler for the XML-data-type: XML_TYPE_COLOR
149 class XMLColorPropHdl
: public XMLPropertyHandler
152 virtual ~XMLColorPropHdl() override
;
154 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
155 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
159 PropertyHandler for the XML-data-type: XML_TYPE_HEX
161 class XMLHexPropHdl
: public XMLPropertyHandler
164 virtual ~XMLHexPropHdl() override
;
166 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
167 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
171 PropertyHandler for the XML-data-type: XML_TYPE_STRING
173 class XMLStringPropHdl
: public XMLPropertyHandler
176 virtual ~XMLStringPropHdl() override
;
178 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
179 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
183 PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
185 class XMLStyleNamePropHdl
: public XMLStringPropHdl
188 virtual ~XMLStyleNamePropHdl() override
;
190 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
195 PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
197 class XMLDoublePropHdl
: public XMLPropertyHandler
200 virtual ~XMLDoublePropHdl() override
;
202 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
203 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
207 PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
209 class XMLNBoolPropHdl
: public XMLPropertyHandler
212 virtual ~XMLNBoolPropHdl() override
;
214 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
215 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
219 PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
221 class XMLColorTransparentPropHdl
: public XMLPropertyHandler
223 const OUString sTransparent
;
226 explicit XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent
= xmloff::token::XML_TOKEN_INVALID
);
227 virtual ~XMLColorTransparentPropHdl() override
;
229 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
230 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
234 PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
236 class XMLIsTransparentPropHdl
: public XMLPropertyHandler
238 const OUString sTransparent
;
239 bool bTransPropValue
;
242 XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent
= xmloff::token::XML_TOKEN_INVALID
,
243 bool bTransPropValue
= true );
244 virtual ~XMLIsTransparentPropHdl() override
;
246 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
247 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
251 PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
253 class XMLColorAutoPropHdl
: public XMLPropertyHandler
256 XMLColorAutoPropHdl();
257 virtual ~XMLColorAutoPropHdl() override
;
259 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
260 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
264 PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
266 class XMLIsAutoColorPropHdl
: public XMLPropertyHandler
269 XMLIsAutoColorPropHdl();
270 virtual ~XMLIsAutoColorPropHdl() override
;
272 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
273 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
278 PropertyHandler for properties that cannot make use of importXML
279 and exportXML methods, but can make use of the default comparison
281 class XMLCompareOnlyPropHdl
: public XMLPropertyHandler
284 virtual ~XMLCompareOnlyPropHdl() override
;
286 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
287 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
291 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
292 Reads/writes numeric properties, but fails for the value zero
293 (i.e., a value 0 property will not be written)
295 class XMLNumberWithoutZeroPropHdl
: public XMLPropertyHandler
299 explicit XMLNumberWithoutZeroPropHdl( sal_Int8 nB
);
300 virtual ~XMLNumberWithoutZeroPropHdl() override
;
302 virtual bool importXML( const OUString
& rStrImpValue
, css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
303 virtual bool exportXML( OUString
& rStrExpValue
, const css::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const override
;
306 #endif // INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
308 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */