1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
29 #ifndef _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
30 #define _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
32 #include <xmloff/xmlprhdl.hxx>
33 #include <rtl/ustrbuf.hxx>
34 #include <xmloff/xmltoken.hxx>
38 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
40 class XMLNumberPropHdl
: public XMLPropertyHandler
45 XMLNumberPropHdl( sal_Int8 nB
=4 ) : nBytes( nB
) {}
46 virtual ~XMLNumberPropHdl();
48 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
49 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
53 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
55 class XMLNumberNonePropHdl
: public XMLPropertyHandler
57 ::rtl::OUString sZeroStr
;
60 XMLNumberNonePropHdl( sal_Int8 nB
= 4 );
61 XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString
, sal_Int8 nB
= 4 );
62 virtual ~XMLNumberNonePropHdl();
64 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
65 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
69 PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
71 class XMLMeasurePropHdl
: public XMLPropertyHandler
75 XMLMeasurePropHdl( sal_Int8 nB
=4 ) : nBytes( nB
) {}
76 virtual ~XMLMeasurePropHdl();
78 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
79 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
83 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
85 class XMLPercentPropHdl
: public XMLPropertyHandler
89 XMLPercentPropHdl( sal_Int8 nB
=4 ) : nBytes( nB
) {}
90 virtual ~XMLPercentPropHdl();
92 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
93 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
97 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
98 that is mapped on a double from 0.0 to 1.0
100 class XMLDoublePercentPropHdl
: public XMLPropertyHandler
102 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
103 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
107 PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
109 class XMLNegPercentPropHdl
: public XMLPropertyHandler
113 XMLNegPercentPropHdl( sal_Int8 nB
=4 ) : nBytes( nB
) {}
114 virtual ~XMLNegPercentPropHdl();
116 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
117 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
121 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
123 class XMLMeasurePxPropHdl
: public XMLPropertyHandler
127 XMLMeasurePxPropHdl( sal_Int8 nB
=4 ) : nBytes( nB
) {}
128 virtual ~XMLMeasurePxPropHdl();
130 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
131 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
135 PropertyHandler for the XML-data-type: XML_TYPE_BOOL
137 class XMLBoolPropHdl
: public XMLPropertyHandler
140 virtual ~XMLBoolPropHdl();
142 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
143 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
146 class XMLBoolFalsePropHdl
: public XMLBoolPropHdl
149 virtual ~XMLBoolFalsePropHdl();
151 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
152 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
157 PropertyHandler for the XML-data-type: XML_TYPE_COLOR
159 class XMLColorPropHdl
: public XMLPropertyHandler
162 virtual ~XMLColorPropHdl();
164 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
165 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
169 PropertyHandler for the XML-data-type: XML_TYPE_HEX
171 class XMLHexPropHdl
: public XMLPropertyHandler
174 virtual ~XMLHexPropHdl();
176 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
177 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
181 PropertyHandler for the XML-data-type: XML_TYPE_STRING
183 class XMLStringPropHdl
: public XMLPropertyHandler
186 virtual ~XMLStringPropHdl();
188 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
189 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
193 PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
195 class XMLStyleNamePropHdl
: public XMLStringPropHdl
198 virtual ~XMLStyleNamePropHdl();
200 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
205 PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
207 class XMLDoublePropHdl
: public XMLPropertyHandler
210 virtual ~XMLDoublePropHdl();
212 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
213 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
217 PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
219 class XMLNBoolPropHdl
: public XMLPropertyHandler
222 virtual ~XMLNBoolPropHdl();
224 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
225 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
229 PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
231 class XMLColorTransparentPropHdl
: public XMLPropertyHandler
233 const ::rtl::OUString sTransparent
;
236 XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent
= xmloff::token::XML_TOKEN_INVALID
);
237 virtual ~XMLColorTransparentPropHdl();
239 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
240 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
244 PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
246 class XMLIsTransparentPropHdl
: public XMLPropertyHandler
248 const ::rtl::OUString sTransparent
;
249 sal_Bool bTransPropValue
;
252 XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent
= xmloff::token::XML_TOKEN_INVALID
,
253 sal_Bool bTransPropValue
= sal_True
);
254 virtual ~XMLIsTransparentPropHdl();
256 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
257 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
261 PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
263 class XMLColorAutoPropHdl
: public XMLPropertyHandler
266 XMLColorAutoPropHdl();
267 virtual ~XMLColorAutoPropHdl();
269 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
270 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
274 PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
276 class XMLIsAutoColorPropHdl
: public XMLPropertyHandler
279 XMLIsAutoColorPropHdl();
280 virtual ~XMLIsAutoColorPropHdl();
282 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
283 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
288 PropertyHandler for properties that cannot make use of importXML
289 and exportXML methods, but can make use of the default comparison
291 class XMLCompareOnlyPropHdl
: public XMLPropertyHandler
294 virtual ~XMLCompareOnlyPropHdl();
296 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
297 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
301 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
302 Reads/writes numeric properties, but fails for the value zero
303 (i.e., a value 0 property will not be written)
305 class XMLNumberWithoutZeroPropHdl
: public XMLPropertyHandler
309 XMLNumberWithoutZeroPropHdl( sal_Int8 nB
= 4 );
310 virtual ~XMLNumberWithoutZeroPropHdl();
312 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
313 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
317 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER16_AUTO
318 Reads/writes numeric properties with special handling for the value zero
319 (i.e., a value 0 property will be written as "auto")
321 class XMLNumberWithAutoInsteadZeroPropHdl
: public XMLNumberWithoutZeroPropHdl
324 virtual ~XMLNumberWithAutoInsteadZeroPropHdl();
326 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
327 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
330 #endif // _XMLOFF_PROPERTYHANDLER_BASICTYPES_HXX
332 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */