bump product version to 7.6.3.2-android
[LibreOffice.git] / xmloff / source / style / xmlbahdl.hxx
blob09e392d6cc6b72c4cf36c2148936af2de35908bb
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 #pragma once
22 #include <xmloff/xmlprhdl.hxx>
23 #include <xmloff/xmltoken.hxx>
26 /**
27 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER
29 class XMLNumberPropHdl : public XMLPropertyHandler
31 sal_Int8 nBytes;
33 public:
34 explicit XMLNumberPropHdl( sal_Int8 nB ) : nBytes( nB ) {}
35 virtual ~XMLNumberPropHdl() override;
37 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
38 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
41 /**
42 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NONE
44 class XMLNumberNonePropHdl : public XMLPropertyHandler
46 OUString sZeroStr;
47 sal_Int8 nBytes;
48 public:
49 explicit XMLNumberNonePropHdl( sal_Int8 nB = 4 );
50 XMLNumberNonePropHdl( enum ::xmloff::token::XMLTokenEnum eZeroString, sal_Int8 nB );
51 virtual ~XMLNumberNonePropHdl() override;
53 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
54 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
57 /**
58 PropertyHandler for the XML-data-type: XML_TYPE_MEASURE
60 class XMLMeasurePropHdl : public XMLPropertyHandler
62 sal_Int8 nBytes;
63 public:
64 explicit XMLMeasurePropHdl( sal_Int8 nB ) : nBytes( nB ) {}
65 virtual ~XMLMeasurePropHdl() override;
67 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
68 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
71 /**
72 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
74 class XMLPercentPropHdl : public XMLPropertyHandler
76 sal_Int8 nBytes;
77 public:
78 explicit XMLPercentPropHdl( sal_Int8 nB ) : nBytes( nB ) {}
79 virtual ~XMLPercentPropHdl() override;
81 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
82 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
85 /**
86 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
87 that is mapped on a double from 0.0 to 1.0
89 class XMLDoublePercentPropHdl : public XMLPropertyHandler
91 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
92 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
95 /// Maps between XML percentage and our 100th percent ints.
96 class XML100thPercentPropHdl : public XMLPropertyHandler
98 virtual bool importXML(const OUString& rStrImpValue, css::uno::Any& rValue,
99 const SvXMLUnitConverter& rUnitConverter) const override;
100 virtual bool exportXML(OUString& rStrExpValue, const css::uno::Any& rValue,
101 const SvXMLUnitConverter& rUnitConverter) const override;
105 PropertyHandler for the XML-data-type: XML_TYPE_NEG_PERCENT
107 class XMLNegPercentPropHdl : public XMLPropertyHandler
109 sal_Int8 nBytes;
110 public:
111 explicit XMLNegPercentPropHdl( sal_Int8 nB ) : nBytes( nB ) {}
112 virtual ~XMLNegPercentPropHdl() override;
114 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
115 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
119 PropertyHandler for the XML-data-type: XML_TYPE_PERCENT
121 class XMLMeasurePxPropHdl : public XMLPropertyHandler
123 sal_Int8 nBytes;
124 public:
125 explicit XMLMeasurePxPropHdl( sal_Int8 nB ) : nBytes( nB ) {}
126 virtual ~XMLMeasurePxPropHdl() override;
128 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
129 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
133 PropertyHandler for the XML-data-type: XML_TYPE_BOOL
135 class XMLBoolPropHdl : public XMLPropertyHandler
137 public:
138 virtual ~XMLBoolPropHdl() override;
140 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
141 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
144 class XMLBoolFalsePropHdl : public XMLBoolPropHdl
146 public:
147 virtual ~XMLBoolFalsePropHdl() override;
149 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
150 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
155 PropertyHandler for the XML-data-type: XML_TYPE_COLOR
157 class XMLColorPropHdl : public XMLPropertyHandler
159 public:
160 virtual ~XMLColorPropHdl() override;
162 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
163 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
167 PropertyHandler for the XML-data-type: XML_TYPE_HEX
169 class XMLHexPropHdl : public XMLPropertyHandler
171 public:
172 virtual ~XMLHexPropHdl() override;
174 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
175 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
179 PropertyHandler for the XML-data-type: XML_TYPE_STRING
181 class XMLStringPropHdl : public XMLPropertyHandler
183 public:
184 virtual ~XMLStringPropHdl() override;
186 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
187 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
191 PropertyHandler for the XML-data-type: XML_TYPE_STYLENAME
193 class XMLStyleNamePropHdl : public XMLStringPropHdl
195 public:
196 virtual ~XMLStyleNamePropHdl() override;
198 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
203 PropertyHandler for the XML-data-type: XML_TYPE_DOUBLE
205 class XMLDoublePropHdl : public XMLPropertyHandler
207 public:
208 virtual ~XMLDoublePropHdl() override;
210 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
211 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
215 PropertyHandler for the XML-data-type: XML_TYPE_NBOOL
217 class XMLNBoolPropHdl : public XMLPropertyHandler
219 public:
220 virtual ~XMLNBoolPropHdl() override;
222 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
223 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
227 PropertyHandler for the XML-data-type: XML_TYPE_COLORTRANSPARENT
229 class XMLColorTransparentPropHdl : public XMLPropertyHandler
231 const OUString sTransparent;
233 public:
234 explicit XMLColorTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID );
235 virtual ~XMLColorTransparentPropHdl() override;
237 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
238 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
242 PropertyHandler for the XML-data-type: XML_TYPE_ISTRANSPARENT
244 class XMLIsTransparentPropHdl : public XMLPropertyHandler
246 const OUString sTransparent;
247 bool bTransPropValue;
249 public:
250 XMLIsTransparentPropHdl( enum ::xmloff::token::XMLTokenEnum eTransparent = xmloff::token::XML_TOKEN_INVALID,
251 bool bTransPropValue = true );
252 virtual ~XMLIsTransparentPropHdl() override;
254 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
255 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
259 PropertyHandler for the XML-data-type: XML_TYPE_COLORAUTO
261 class XMLColorAutoPropHdl : public XMLPropertyHandler
263 public:
264 XMLColorAutoPropHdl();
265 virtual ~XMLColorAutoPropHdl() override;
267 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
268 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
272 PropertyHandler for the XML-data-type: XML_TYPE_COLORISAUTO
274 class XMLIsAutoColorPropHdl : public XMLPropertyHandler
276 public:
277 XMLIsAutoColorPropHdl();
278 virtual ~XMLIsAutoColorPropHdl() override;
280 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
281 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
286 PropertyHandler for properties that cannot make use of importXML
287 and exportXML methods, but can make use of the default comparison
289 class XMLCompareOnlyPropHdl : public XMLPropertyHandler
291 public:
292 virtual ~XMLCompareOnlyPropHdl() override;
294 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
295 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
299 PropertyHandler for the XML-data-type: XML_TYPE_NUMBER_NO_ZERO
300 Reads/writes numeric properties, but fails for the value zero
301 (i.e., a value 0 property will not be written)
303 class XMLNumberWithoutZeroPropHdl : public XMLPropertyHandler
305 sal_Int8 nBytes;
306 public:
307 explicit XMLNumberWithoutZeroPropHdl( sal_Int8 nB );
308 virtual ~XMLNumberWithoutZeroPropHdl() override;
310 virtual bool importXML( const OUString& rStrImpValue, css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
311 virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override;
314 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */