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 SC_XMLSTYLE_HXX
21 : #define SC_XMLSTYLE_HXX
22 :
23 : #include <xmloff/maptype.hxx>
24 : #include <xmloff/xmlaustp.hxx>
25 : #include <xmloff/xmltypes.hxx>
26 : #include <xmloff/xmlprmap.hxx>
27 : #include <xmloff/prhdlfac.hxx>
28 : #include <xmloff/styleexp.hxx>
29 : #include <xmloff/xmlexppr.hxx>
30 : #include <xmloff/contextid.hxx>
31 :
32 : extern const XMLPropertyMapEntry aXMLScCellStylesProperties[];
33 : extern const XMLPropertyMapEntry aXMLScColumnStylesProperties[];
34 : extern const XMLPropertyMapEntry aXMLScRowStylesProperties[];
35 : extern const XMLPropertyMapEntry aXMLScFromXLSRowStylesProperties[];
36 : extern const XMLPropertyMapEntry aXMLScRowStylesImportProperties[];
37 : extern const XMLPropertyMapEntry aXMLScTableStylesProperties[];
38 : extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties[];
39 :
40 : //CellStyles
41 : #define XML_SC_TYPE_CELLPROTECTION (XML_SC_TYPES_START + 1)
42 : #define XML_SC_TYPE_PRINTCONTENT (XML_SC_TYPES_START + 2)
43 : #define XML_SC_TYPE_HORIJUSTIFY (XML_SC_TYPES_START + 3)
44 : #define XML_SC_TYPE_HORIJUSTIFY_METHOD (XML_SC_TYPES_START + 4)
45 : #define XML_SC_TYPE_HORIJUSTIFYSOURCE (XML_SC_TYPES_START + 5)
46 : #define XML_SC_TYPE_HORIJUSTIFYREPEAT (XML_SC_TYPES_START + 6)
47 : #define XML_SC_TYPE_ORIENTATION (XML_SC_TYPES_START + 7)
48 : #define XML_SC_TYPE_ROTATEANGLE (XML_SC_TYPES_START + 8)
49 : #define XML_SC_TYPE_ROTATEREFERENCE (XML_SC_TYPES_START + 9)
50 : #define XML_SC_TYPE_BORDERLEFT (XML_SC_TYPES_START + 10)
51 : #define XML_SC_TYPE_BORDERRIGHT (XML_SC_TYPES_START + 11)
52 : #define XML_SC_TYPE_BORDERTOP (XML_SC_TYPES_START + 12)
53 : #define XML_SC_TYPE_BORDERBOTTOM (XML_SC_TYPES_START + 13)
54 : #define XML_SC_TYPE_VERTJUSTIFY (XML_SC_TYPES_START + 14)
55 : #define XML_SC_TYPE_VERTJUSTIFY_METHOD (XML_SC_TYPES_START + 15)
56 : #define XML_SC_ISTEXTWRAPPED (XML_SC_TYPES_START + 16)
57 : #define XML_SC_TYPE_EQUAL (XML_SC_TYPES_START + 17)
58 : #define XML_SC_TYPE_VERTICAL (XML_SC_TYPES_START + 18)
59 :
60 : // CTF_SC_HORIJUSTIFY (XML_SC_CTF_START + 1)
61 : // CTF_SC_HORIJUSTIFY_SOURCE (XML_SC_CTF_START + 2)
62 : #define CTF_SC_ALLPADDING (XML_SC_CTF_START + 3)
63 : #define CTF_SC_BOTTOMPADDING (XML_SC_CTF_START + 4)
64 : #define CTF_SC_LEFTPADDING (XML_SC_CTF_START + 5)
65 : #define CTF_SC_RIGHTPADDING (XML_SC_CTF_START + 6)
66 : #define CTF_SC_TOPPADDING (XML_SC_CTF_START + 7)
67 : #define CTF_SC_ALLBORDER (XML_SC_CTF_START + 8)
68 : #define CTF_SC_LEFTBORDER (XML_SC_CTF_START + 9)
69 : #define CTF_SC_RIGHTBORDER (XML_SC_CTF_START + 10)
70 : #define CTF_SC_TOPBORDER (XML_SC_CTF_START + 11)
71 : #define CTF_SC_BOTTOMBORDER (XML_SC_CTF_START + 12)
72 : #define CTF_SC_ALLBORDERWIDTH (XML_SC_CTF_START + 13)
73 : #define CTF_SC_LEFTBORDERWIDTH (XML_SC_CTF_START + 14)
74 : #define CTF_SC_RIGHTBORDERWIDTH (XML_SC_CTF_START + 15)
75 : #define CTF_SC_TOPBORDERWIDTH (XML_SC_CTF_START + 16)
76 : #define CTF_SC_BOTTOMBORDERWIDTH (XML_SC_CTF_START + 17)
77 : #define CTF_SC_NUMBERFORMAT (XML_SC_CTF_START + 18)
78 : #define CTF_SC_MAP (XML_SC_CTF_START + 19)
79 : // CTF_SC_PARAINDENT (XML_SC_CTF_START + 20)
80 : // CTF_SC_OLDTEXTBACKGROUND (XML_SC_CTF_START + 21)
81 : #define CTF_SC_IMPORT_MAP (XML_SC_CTF_START + 22)
82 : #define CTF_SC_CELLSTYLE (XML_SC_CTF_START + 23)
83 : #define CTF_SC_VALIDATION (XML_SC_CTF_START + 24)
84 : #define CTF_SC_DIAGONALTLBR (XML_SC_CTF_START + 25)
85 : #define CTF_SC_DIAGONALTLBRWIDTH (XML_SC_CTF_START + 26)
86 : #define CTF_SC_DIAGONALBLTR (XML_SC_CTF_START + 27)
87 : #define CTF_SC_DIAGONALBLTRWIDTH (XML_SC_CTF_START + 28)
88 : #define CTF_SC_DIAGONALTLBRWIDTHS (XML_SC_CTF_START + 29)
89 : #define CTF_SC_DIAGONALBLTRWIDTHS (XML_SC_CTF_START + 30)
90 :
91 : #define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50)
92 : #define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51)
93 : #define CTF_SC_ROWBREAKBEFORE (XML_SC_CTF_START + 52)
94 : #define CTF_SC_ISVISIBLE (XML_SC_CTF_START + 53)
95 :
96 : #define CTF_SC_MASTERPAGENAME (XML_SC_CTF_START + 53)
97 : #define CTF_SC_HYPERLINK (XML_SC_CTF_START + 54)
98 :
99 : //ColumnStyles
100 : #define XML_SC_TYPE_BREAKBEFORE (XML_SC_TYPES_START + 50)
101 :
102 : class ScXMLExport;
103 :
104 : class ScXMLCellExportPropertyMapper : public SvXMLExportPropertyMapper
105 : {
106 : protected:
107 : /** Application-specific filter. By default do nothing. */
108 : virtual void ContextFilter(
109 : ::std::vector< XMLPropertyState >& rProperties,
110 : ::com::sun::star::uno::Reference<
111 : ::com::sun::star::beans::XPropertySet > rPropSet ) const;
112 : public:
113 : ScXMLCellExportPropertyMapper(
114 : const UniReference< XMLPropertySetMapper >& rMapper );
115 : virtual ~ScXMLCellExportPropertyMapper();
116 : virtual void handleElementItem(
117 : SvXMLExport& rExport,
118 : const XMLPropertyState& rProperty,
119 : sal_uInt16 nFlags,
120 : const ::std::vector< XMLPropertyState > *pProperties = 0,
121 : sal_uInt32 nIdx = 0 ) const;
122 :
123 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
124 : virtual void handleSpecialItem(
125 : SvXMLAttributeList& rAttrList,
126 : const XMLPropertyState& rProperty,
127 : const SvXMLUnitConverter& rUnitConverter,
128 : const SvXMLNamespaceMap& rNamespaceMap,
129 : const ::std::vector< XMLPropertyState > *pProperties = 0,
130 : sal_uInt32 nIdx = 0 ) const;
131 : };
132 :
133 : class ScXMLRowExportPropertyMapper : public SvXMLExportPropertyMapper
134 : {
135 : protected:
136 : /** Application-specific filter. By default do nothing. */
137 : virtual void ContextFilter(
138 : ::std::vector< XMLPropertyState >& rProperties,
139 : ::com::sun::star::uno::Reference<
140 : ::com::sun::star::beans::XPropertySet > rPropSet ) const;
141 : public:
142 : ScXMLRowExportPropertyMapper(
143 : const UniReference< XMLPropertySetMapper >& rMapper );
144 : virtual ~ScXMLRowExportPropertyMapper();
145 : };
146 :
147 : class ScXMLColumnExportPropertyMapper : public SvXMLExportPropertyMapper
148 : {
149 : public:
150 : ScXMLColumnExportPropertyMapper(
151 : const UniReference< XMLPropertySetMapper >& rMapper );
152 : virtual ~ScXMLColumnExportPropertyMapper();
153 :
154 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
155 : virtual void handleSpecialItem(
156 : SvXMLAttributeList& rAttrList,
157 : const XMLPropertyState& rProperty,
158 : const SvXMLUnitConverter& rUnitConverter,
159 : const SvXMLNamespaceMap& rNamespaceMap,
160 : const ::std::vector< XMLPropertyState > *pProperties = 0,
161 : sal_uInt32 nIdx = 0 ) const;
162 : };
163 :
164 : class ScXMLTableExportPropertyMapper : public SvXMLExportPropertyMapper
165 : {
166 : protected:
167 : public:
168 : ScXMLTableExportPropertyMapper(
169 : const UniReference< XMLPropertySetMapper >& rMapper );
170 : virtual ~ScXMLTableExportPropertyMapper();
171 :
172 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
173 : virtual void handleSpecialItem(
174 : SvXMLAttributeList& rAttrList,
175 : const XMLPropertyState& rProperty,
176 : const SvXMLUnitConverter& rUnitConverter,
177 : const SvXMLNamespaceMap& rNamespaceMap,
178 : const ::std::vector< XMLPropertyState > *pProperties = 0,
179 : sal_uInt32 nIdx = 0 ) const;
180 : };
181 :
182 : class ScXMLAutoStylePoolP : public SvXMLAutoStylePoolP
183 : {
184 : ScXMLExport& rScXMLExport;
185 :
186 : virtual void exportStyleAttributes(
187 : SvXMLAttributeList& rAttrList,
188 : sal_Int32 nFamily,
189 : const ::std::vector< XMLPropertyState >& rProperties,
190 : const SvXMLExportPropertyMapper& rPropExp,
191 : const SvXMLUnitConverter& rUnitConverter,
192 : const SvXMLNamespaceMap& rNamespaceMap
193 : ) const;
194 :
195 : virtual void exportStyleContent(
196 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
197 : sal_Int32 nFamily,
198 : const ::std::vector< XMLPropertyState >& rProperties,
199 : const SvXMLExportPropertyMapper& rPropExp
200 : , const SvXMLUnitConverter& rUnitConverter,
201 : const SvXMLNamespaceMap& rNamespaceMap
202 : ) const;
203 :
204 : public:
205 : ScXMLAutoStylePoolP(ScXMLExport& rScXMLExport);
206 : virtual ~ScXMLAutoStylePoolP();
207 : };
208 :
209 : class ScXMLStyleExport : public XMLStyleExport
210 : {
211 : virtual void exportStyleAttributes(
212 : const ::com::sun::star::uno::Reference<
213 : ::com::sun::star::style::XStyle > & rStyle );
214 : virtual void exportStyleContent(
215 : const ::com::sun::star::uno::Reference<
216 : ::com::sun::star::style::XStyle > & rStyle );
217 : public:
218 : ScXMLStyleExport(
219 : SvXMLExport& rExp,
220 : const OUString& rPoolStyleName,
221 : SvXMLAutoStylePoolP *pAutoStyleP=0 );
222 : virtual ~ScXMLStyleExport();
223 : };
224 :
225 : class XMLScPropHdlFactory : public XMLPropertyHandlerFactory
226 : {
227 : public:
228 : XMLScPropHdlFactory();
229 : virtual ~XMLScPropHdlFactory();
230 : virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const;
231 : };
232 :
233 336 : class XmlScPropHdl_CellProtection : public XMLPropertyHandler
234 : {
235 : public:
236 : virtual ~XmlScPropHdl_CellProtection();
237 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
238 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
239 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
240 : };
241 :
242 336 : class XmlScPropHdl_PrintContent : public XMLPropertyHandler
243 : {
244 : public:
245 : virtual ~XmlScPropHdl_PrintContent();
246 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
247 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
248 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
249 : };
250 :
251 672 : class XmlScPropHdl_JustifyMethod : public XMLPropertyHandler
252 : {
253 : public:
254 : virtual ~XmlScPropHdl_JustifyMethod();
255 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
256 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
257 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
258 : };
259 :
260 336 : class XmlScPropHdl_HoriJustify : public XMLPropertyHandler
261 : {
262 : public:
263 : virtual ~XmlScPropHdl_HoriJustify();
264 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
265 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
266 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
267 : };
268 :
269 336 : class XmlScPropHdl_HoriJustifySource : public XMLPropertyHandler
270 : {
271 : public:
272 : virtual ~XmlScPropHdl_HoriJustifySource();
273 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
274 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
275 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
276 : };
277 :
278 336 : class XmlScPropHdl_HoriJustifyRepeat : public XMLPropertyHandler
279 : {
280 : public:
281 : virtual ~XmlScPropHdl_HoriJustifyRepeat();
282 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
283 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
284 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
285 : };
286 :
287 336 : class XmlScPropHdl_Orientation : public XMLPropertyHandler
288 : {
289 : public:
290 : virtual ~XmlScPropHdl_Orientation();
291 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
292 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
293 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
294 : };
295 :
296 336 : class XmlScPropHdl_RotateAngle : public XMLPropertyHandler
297 : {
298 : public:
299 : virtual ~XmlScPropHdl_RotateAngle();
300 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
301 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
302 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
303 : };
304 :
305 336 : class XmlScPropHdl_RotateReference : public XMLPropertyHandler
306 : {
307 : public:
308 : virtual ~XmlScPropHdl_RotateReference();
309 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
310 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
311 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
312 : };
313 :
314 336 : class XmlScPropHdl_VertJustify : public XMLPropertyHandler
315 : {
316 : public:
317 : virtual ~XmlScPropHdl_VertJustify();
318 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
319 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
320 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
321 : };
322 :
323 336 : class XmlScPropHdl_BreakBefore : public XMLPropertyHandler
324 : {
325 : public:
326 : virtual ~XmlScPropHdl_BreakBefore();
327 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
328 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
329 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
330 : };
331 :
332 336 : class XmlScPropHdl_IsTextWrapped : public XMLPropertyHandler
333 : {
334 : public:
335 : virtual ~XmlScPropHdl_IsTextWrapped();
336 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
337 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
338 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
339 : };
340 :
341 336 : class XmlScPropHdl_IsEqual : public XMLPropertyHandler
342 : {
343 : public:
344 672 : virtual ~XmlScPropHdl_IsEqual() {}
345 2 : virtual bool equals( const ::com::sun::star::uno::Any& /* r1 */, const ::com::sun::star::uno::Any& /* r2 */ ) const { return sal_True; }
346 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
347 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
348 : };
349 :
350 336 : class XmlScPropHdl_Vertical : public XMLPropertyHandler
351 : {
352 : public:
353 : virtual ~XmlScPropHdl_Vertical();
354 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const;
355 : virtual sal_Bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
356 : virtual sal_Bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const;
357 : };
358 :
359 : #endif
360 :
361 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|