bump product version to 5.0.4.1
[LibreOffice.git] / xmloff / source / style / xmlbahdl.hxx
blobb3bbdf518385dc139f19507a7360ed7fa69766e1
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_SOURCE_STYLE_XMLBAHDL_HXX
21 #define INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
23 #include <xmloff/xmlprhdl.hxx>
24 #include <rtl/ustrbuf.hxx>
25 #include <xmloff/xmltoken.hxx>
28 /**
29 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
31 class XMLNumberPropHdl : public XMLPropertyHandler
33 sal_Int8 nBytes;
35 public:
36 XMLNumberPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
37 virtual ~XMLNumberPropHdl();
39 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
40 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
43 /**
44 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
46 class XMLNumberNonePropHdl : public XMLPropertyHandler
48 OUString sZeroStr;
49 sal_Int8 nBytes;
50 public:
51 XMLNumberNonePropHdl( sal_Int8 nB = 4 );
52 XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString, sal_Int8 nB = 4 );
53 virtual ~XMLNumberNonePropHdl();
55 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
56 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
59 /**
60 PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
62 class XMLMeasurePropHdl : public XMLPropertyHandler
64 sal_Int8 nBytes;
65 public:
66 XMLMeasurePropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
67 virtual ~XMLMeasurePropHdl();
69 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
70 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
73 /**
74 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
76 class XMLPercentPropHdl : public XMLPropertyHandler
78 sal_Int8 nBytes;
79 public:
80 XMLPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
81 virtual ~XMLPercentPropHdl();
83 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
84 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
87 /**
88 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
89 that is mapped on a double from 0.0 to 1.0
91 class XMLDoublePercentPropHdl : public XMLPropertyHandler
93 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
94 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
97 /**
98 PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
100 class XMLNegPercentPropHdl : public XMLPropertyHandler
102 sal_Int8 nBytes;
103 public:
104 XMLNegPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
105 virtual ~XMLNegPercentPropHdl();
107 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
108 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
112 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
114 class XMLMeasurePxPropHdl : public XMLPropertyHandler
116 sal_Int8 nBytes;
117 public:
118 XMLMeasurePxPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
119 virtual ~XMLMeasurePxPropHdl();
121 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
122 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
126 PropertyHandler for the XML-data-type: XML_TYPE_BOOL
128 class XMLBoolPropHdl : public XMLPropertyHandler
130 public:
131 virtual ~XMLBoolPropHdl();
133 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
134 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
137 class XMLBoolFalsePropHdl : public XMLBoolPropHdl
139 public:
140 virtual ~XMLBoolFalsePropHdl();
142 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
143 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
148 PropertyHandler for the XML-data-type: XML_TYPE_COLOR
150 class XMLColorPropHdl : public XMLPropertyHandler
152 public:
153 virtual ~XMLColorPropHdl();
155 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
156 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
160 PropertyHandler for the XML-data-type: XML_TYPE_HEX
162 class XMLHexPropHdl : public XMLPropertyHandler
164 public:
165 virtual ~XMLHexPropHdl();
167 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
168 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
172 PropertyHandler for the XML-data-type: XML_TYPE_STRING
174 class XMLStringPropHdl : public XMLPropertyHandler
176 public:
177 virtual ~XMLStringPropHdl();
179 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
180 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
184 PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
186 class XMLStyleNamePropHdl : public XMLStringPropHdl
188 public:
189 virtual ~XMLStyleNamePropHdl();
191 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
196 PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
198 class XMLDoublePropHdl : public XMLPropertyHandler
200 public:
201 virtual ~XMLDoublePropHdl();
203 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
204 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
208 PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
210 class XMLNBoolPropHdl : public XMLPropertyHandler
212 public:
213 virtual ~XMLNBoolPropHdl();
215 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
216 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
220 PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
222 class XMLColorTransparentPropHdl : public XMLPropertyHandler
224 const OUString sTransparent;
226 public:
227 XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID );
228 virtual ~XMLColorTransparentPropHdl();
230 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
231 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
235 PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
237 class XMLIsTransparentPropHdl : public XMLPropertyHandler
239 const OUString sTransparent;
240 bool bTransPropValue;
242 public:
243 XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID,
244 bool bTransPropValue = true );
245 virtual ~XMLIsTransparentPropHdl();
247 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
248 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
252 PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
254 class XMLColorAutoPropHdl : public XMLPropertyHandler
256 public:
257 XMLColorAutoPropHdl();
258 virtual ~XMLColorAutoPropHdl();
260 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
261 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
265 PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
267 class XMLIsAutoColorPropHdl : public XMLPropertyHandler
269 public:
270 XMLIsAutoColorPropHdl();
271 virtual ~XMLIsAutoColorPropHdl();
273 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
274 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
279 PropertyHandler for properties that cannot make use of importXML
280 and exportXML methods, but can make use of the default comparison
282 class XMLCompareOnlyPropHdl : public XMLPropertyHandler
284 public:
285 virtual ~XMLCompareOnlyPropHdl();
287 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
288 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
292 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
293 Reads/writes numeric properties, but fails for the value zero
294 (i.e., a value 0 property will not be written)
296 class XMLNumberWithoutZeroPropHdl : public XMLPropertyHandler
298 sal_Int8 nBytes;
299 public:
300 XMLNumberWithoutZeroPropHdl( sal_Int8 nB = 4 );
301 virtual ~XMLNumberWithoutZeroPropHdl();
303 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
304 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
308 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
309 Reads/writes numeric properties with special handling for "void" value
310 (i.e., void property will be written as "auto")
312 class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
314 public:
315 virtual ~XMLNumberWithAutoInsteadZeroPropHdl();
317 virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
318 virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
321 #endif // INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
323 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */