Line data Source code
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_SOURCE_STYLE_XMLBAHDL_HXX
21 : #define INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
22 :
23 : #include <xmloff/xmlprhdl.hxx>
24 : #include <rtl/ustrbuf.hxx>
25 : #include <xmloff/xmltoken.hxx>
26 :
27 :
28 : /**
29 : PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
30 : */
31 : class XMLNumberPropHdl : public XMLPropertyHandler
32 : {
33 : sal_Int8 nBytes;
34 :
35 : public:
36 39103 : explicit XMLNumberPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
37 : virtual ~XMLNumberPropHdl();
38 :
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;
41 : };
42 :
43 : /**
44 : PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
45 : */
46 : class XMLNumberNonePropHdl : public XMLPropertyHandler
47 : {
48 : OUString sZeroStr;
49 : sal_Int8 nBytes;
50 : public:
51 : explicit XMLNumberNonePropHdl( sal_Int8 nB = 4 );
52 : XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString, sal_Int8 nB = 4 );
53 : virtual ~XMLNumberNonePropHdl();
54 :
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;
57 : };
58 :
59 : /**
60 : PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
61 : */
62 : class XMLMeasurePropHdl : public XMLPropertyHandler
63 : {
64 : sal_Int8 nBytes;
65 : public:
66 26012 : explicit XMLMeasurePropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
67 : virtual ~XMLMeasurePropHdl();
68 :
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;
71 : };
72 :
73 : /**
74 : PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
75 : */
76 : class XMLPercentPropHdl : public XMLPropertyHandler
77 : {
78 : sal_Int8 nBytes;
79 : public:
80 40842 : explicit XMLPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
81 : virtual ~XMLPercentPropHdl();
82 :
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;
85 : };
86 :
87 : /**
88 : PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
89 : that is mapped on a double from 0.0 to 1.0
90 : */
91 24293 : class XMLDoublePercentPropHdl : public XMLPropertyHandler
92 : {
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;
95 : };
96 :
97 : /**
98 : PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
99 : */
100 : class XMLNegPercentPropHdl : public XMLPropertyHandler
101 : {
102 : sal_Int8 nBytes;
103 : public:
104 19758 : explicit XMLNegPercentPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
105 : virtual ~XMLNegPercentPropHdl();
106 :
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;
109 : };
110 :
111 : /**
112 : PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
113 : */
114 : class XMLMeasurePxPropHdl : public XMLPropertyHandler
115 : {
116 : sal_Int8 nBytes;
117 : public:
118 8101 : explicit XMLMeasurePxPropHdl( sal_Int8 nB=4 ) : nBytes( nB ) {}
119 : virtual ~XMLMeasurePxPropHdl();
120 :
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;
123 : };
124 :
125 : /**
126 : PropertyHandler for the XML-data-type: XML_TYPE_BOOL
127 : */
128 25696 : class XMLBoolPropHdl : public XMLPropertyHandler
129 : {
130 : public:
131 : virtual ~XMLBoolPropHdl();
132 :
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;
135 : };
136 :
137 2 : class XMLBoolFalsePropHdl : public XMLBoolPropHdl
138 : {
139 : public:
140 : virtual ~XMLBoolFalsePropHdl();
141 :
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;
144 :
145 : };
146 :
147 : /**
148 : PropertyHandler for the XML-data-type: XML_TYPE_COLOR
149 : */
150 20476 : class XMLColorPropHdl : public XMLPropertyHandler
151 : {
152 : public:
153 : virtual ~XMLColorPropHdl();
154 :
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;
157 : };
158 :
159 : /**
160 : PropertyHandler for the XML-data-type: XML_TYPE_HEX
161 : */
162 10471 : class XMLHexPropHdl : public XMLPropertyHandler
163 : {
164 : public:
165 : virtual ~XMLHexPropHdl();
166 :
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;
169 : };
170 :
171 : /**
172 : PropertyHandler for the XML-data-type: XML_TYPE_STRING
173 : */
174 40478 : class XMLStringPropHdl : public XMLPropertyHandler
175 : {
176 : public:
177 : virtual ~XMLStringPropHdl();
178 :
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;
181 : };
182 :
183 : /**
184 : PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
185 : */
186 16349 : class XMLStyleNamePropHdl : public XMLStringPropHdl
187 : {
188 : public:
189 : virtual ~XMLStyleNamePropHdl();
190 :
191 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
192 : };
193 :
194 :
195 : /**
196 : PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
197 : */
198 899 : class XMLDoublePropHdl : public XMLPropertyHandler
199 : {
200 : public:
201 : virtual ~XMLDoublePropHdl();
202 :
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;
205 : };
206 :
207 : /**
208 : PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
209 : */
210 124 : class XMLNBoolPropHdl : public XMLPropertyHandler
211 : {
212 : public:
213 : virtual ~XMLNBoolPropHdl();
214 :
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;
217 : };
218 :
219 : /**
220 : PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
221 : */
222 : class XMLColorTransparentPropHdl : public XMLPropertyHandler
223 : {
224 : const OUString sTransparent;
225 :
226 : public:
227 : explicit XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID );
228 : virtual ~XMLColorTransparentPropHdl();
229 :
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;
232 : };
233 :
234 : /**
235 : PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
236 : */
237 : class XMLIsTransparentPropHdl : public XMLPropertyHandler
238 : {
239 : const OUString sTransparent;
240 : bool bTransPropValue;
241 :
242 : public:
243 : XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID,
244 : bool bTransPropValue = true );
245 : virtual ~XMLIsTransparentPropHdl();
246 :
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;
249 : };
250 :
251 : /**
252 : PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
253 : */
254 : class XMLColorAutoPropHdl : public XMLPropertyHandler
255 : {
256 : public:
257 : XMLColorAutoPropHdl();
258 : virtual ~XMLColorAutoPropHdl();
259 :
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;
262 : };
263 :
264 : /**
265 : PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
266 : */
267 : class XMLIsAutoColorPropHdl : public XMLPropertyHandler
268 : {
269 : public:
270 : XMLIsAutoColorPropHdl();
271 : virtual ~XMLIsAutoColorPropHdl();
272 :
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;
275 : };
276 :
277 :
278 : /**
279 : PropertyHandler for properties that cannot make use of importXML
280 : and exportXML methods, but can make use of the default comparison
281 : */
282 20002 : class XMLCompareOnlyPropHdl : public XMLPropertyHandler
283 : {
284 : public:
285 : virtual ~XMLCompareOnlyPropHdl();
286 :
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;
289 : };
290 :
291 : /**
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)
295 : */
296 : class XMLNumberWithoutZeroPropHdl : public XMLPropertyHandler
297 : {
298 : sal_Int8 nBytes;
299 : public:
300 : explicit XMLNumberWithoutZeroPropHdl( sal_Int8 nB = 4 );
301 : virtual ~XMLNumberWithoutZeroPropHdl();
302 :
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;
305 : };
306 :
307 : /**
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")
311 : */
312 7570 : class XMLNumberWithAutoInsteadZeroPropHdl : public XMLNumberWithoutZeroPropHdl
313 : {
314 : public:
315 : virtual ~XMLNumberWithAutoInsteadZeroPropHdl();
316 :
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;
319 : };
320 :
321 : #endif // INCLUDED_XMLOFF_SOURCE_STYLE_XMLBAHDL_HXX
322 :
323 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|