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 : bool bEnableFoFontFamily,
110 : ::std::vector< XMLPropertyState >& rProperties,
111 : ::com::sun::star::uno::Reference<
112 : ::com::sun::star::beans::XPropertySet > rPropSet ) const SAL_OVERRIDE;
113 : public:
114 : ScXMLCellExportPropertyMapper(
115 : const UniReference< XMLPropertySetMapper >& rMapper );
116 : virtual ~ScXMLCellExportPropertyMapper();
117 : virtual void handleElementItem(
118 : SvXMLExport& rExport,
119 : const XMLPropertyState& rProperty,
120 : sal_uInt16 nFlags,
121 : const ::std::vector< XMLPropertyState > *pProperties = 0,
122 : sal_uInt32 nIdx = 0 ) const SAL_OVERRIDE;
123 :
124 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
125 : virtual void handleSpecialItem(
126 : SvXMLAttributeList& rAttrList,
127 : const XMLPropertyState& rProperty,
128 : const SvXMLUnitConverter& rUnitConverter,
129 : const SvXMLNamespaceMap& rNamespaceMap,
130 : const ::std::vector< XMLPropertyState > *pProperties = 0,
131 : sal_uInt32 nIdx = 0 ) const SAL_OVERRIDE;
132 : };
133 :
134 : class ScXMLRowExportPropertyMapper : public SvXMLExportPropertyMapper
135 : {
136 : protected:
137 : /** Application-specific filter. By default do nothing. */
138 : virtual void ContextFilter(
139 : bool bEnableFoFontFamily,
140 : ::std::vector< XMLPropertyState >& rProperties,
141 : ::com::sun::star::uno::Reference<
142 : ::com::sun::star::beans::XPropertySet > rPropSet ) const SAL_OVERRIDE;
143 : public:
144 : ScXMLRowExportPropertyMapper(
145 : const UniReference< XMLPropertySetMapper >& rMapper );
146 : virtual ~ScXMLRowExportPropertyMapper();
147 : };
148 :
149 : class ScXMLColumnExportPropertyMapper : public SvXMLExportPropertyMapper
150 : {
151 : public:
152 : ScXMLColumnExportPropertyMapper(
153 : const UniReference< XMLPropertySetMapper >& rMapper );
154 : virtual ~ScXMLColumnExportPropertyMapper();
155 :
156 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
157 : virtual void handleSpecialItem(
158 : SvXMLAttributeList& rAttrList,
159 : const XMLPropertyState& rProperty,
160 : const SvXMLUnitConverter& rUnitConverter,
161 : const SvXMLNamespaceMap& rNamespaceMap,
162 : const ::std::vector< XMLPropertyState > *pProperties = 0,
163 : sal_uInt32 nIdx = 0 ) const SAL_OVERRIDE;
164 : };
165 :
166 : class ScXMLTableExportPropertyMapper : public SvXMLExportPropertyMapper
167 : {
168 : protected:
169 : public:
170 : ScXMLTableExportPropertyMapper(
171 : const UniReference< XMLPropertySetMapper >& rMapper );
172 : virtual ~ScXMLTableExportPropertyMapper();
173 :
174 : /** this method is called for every item that has the MID_FLAG_SPECIAL_ITEM_EXPORT flag set */
175 : virtual void handleSpecialItem(
176 : SvXMLAttributeList& rAttrList,
177 : const XMLPropertyState& rProperty,
178 : const SvXMLUnitConverter& rUnitConverter,
179 : const SvXMLNamespaceMap& rNamespaceMap,
180 : const ::std::vector< XMLPropertyState > *pProperties = 0,
181 : sal_uInt32 nIdx = 0 ) const SAL_OVERRIDE;
182 : };
183 :
184 : class ScXMLAutoStylePoolP : public SvXMLAutoStylePoolP
185 : {
186 : ScXMLExport& rScXMLExport;
187 :
188 : virtual void exportStyleAttributes(
189 : SvXMLAttributeList& rAttrList,
190 : sal_Int32 nFamily,
191 : const ::std::vector< XMLPropertyState >& rProperties,
192 : const SvXMLExportPropertyMapper& rPropExp,
193 : const SvXMLUnitConverter& rUnitConverter,
194 : const SvXMLNamespaceMap& rNamespaceMap
195 : ) const SAL_OVERRIDE;
196 :
197 : virtual void exportStyleContent(
198 : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XDocumentHandler > & rHandler,
199 : sal_Int32 nFamily,
200 : const ::std::vector< XMLPropertyState >& rProperties,
201 : const SvXMLExportPropertyMapper& rPropExp
202 : , const SvXMLUnitConverter& rUnitConverter,
203 : const SvXMLNamespaceMap& rNamespaceMap
204 : ) const SAL_OVERRIDE;
205 :
206 : public:
207 : ScXMLAutoStylePoolP(ScXMLExport& rScXMLExport);
208 : virtual ~ScXMLAutoStylePoolP();
209 : };
210 :
211 : class ScXMLStyleExport : public XMLStyleExport
212 : {
213 : virtual void exportStyleAttributes(
214 : const ::com::sun::star::uno::Reference<
215 : ::com::sun::star::style::XStyle > & rStyle ) SAL_OVERRIDE;
216 : virtual void exportStyleContent(
217 : const ::com::sun::star::uno::Reference<
218 : ::com::sun::star::style::XStyle > & rStyle ) SAL_OVERRIDE;
219 : public:
220 : ScXMLStyleExport(
221 : SvXMLExport& rExp,
222 : const OUString& rPoolStyleName,
223 : SvXMLAutoStylePoolP *pAutoStyleP=0 );
224 : virtual ~ScXMLStyleExport();
225 : };
226 :
227 : class XMLScPropHdlFactory : public XMLPropertyHandlerFactory
228 : {
229 : public:
230 : XMLScPropHdlFactory();
231 : virtual ~XMLScPropHdlFactory();
232 : virtual const XMLPropertyHandler* GetPropertyHandler( sal_Int32 nType ) const SAL_OVERRIDE;
233 : };
234 :
235 488 : class XmlScPropHdl_CellProtection : public XMLPropertyHandler
236 : {
237 : public:
238 : virtual ~XmlScPropHdl_CellProtection();
239 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
240 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
241 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
242 : };
243 :
244 488 : class XmlScPropHdl_PrintContent : public XMLPropertyHandler
245 : {
246 : public:
247 : virtual ~XmlScPropHdl_PrintContent();
248 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
249 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
250 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
251 : };
252 :
253 976 : class XmlScPropHdl_JustifyMethod : public XMLPropertyHandler
254 : {
255 : public:
256 : virtual ~XmlScPropHdl_JustifyMethod();
257 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
258 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
259 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
260 : };
261 :
262 488 : class XmlScPropHdl_HoriJustify : public XMLPropertyHandler
263 : {
264 : public:
265 : virtual ~XmlScPropHdl_HoriJustify();
266 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
267 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
268 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
269 : };
270 :
271 488 : class XmlScPropHdl_HoriJustifySource : public XMLPropertyHandler
272 : {
273 : public:
274 : virtual ~XmlScPropHdl_HoriJustifySource();
275 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
276 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
277 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
278 : };
279 :
280 488 : class XmlScPropHdl_HoriJustifyRepeat : public XMLPropertyHandler
281 : {
282 : public:
283 : virtual ~XmlScPropHdl_HoriJustifyRepeat();
284 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
285 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
286 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
287 : };
288 :
289 488 : class XmlScPropHdl_Orientation : public XMLPropertyHandler
290 : {
291 : public:
292 : virtual ~XmlScPropHdl_Orientation();
293 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
294 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
295 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
296 : };
297 :
298 488 : class XmlScPropHdl_RotateAngle : public XMLPropertyHandler
299 : {
300 : public:
301 : virtual ~XmlScPropHdl_RotateAngle();
302 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
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 488 : class XmlScPropHdl_RotateReference : public XMLPropertyHandler
308 : {
309 : public:
310 : virtual ~XmlScPropHdl_RotateReference();
311 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
312 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
313 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
314 : };
315 :
316 488 : class XmlScPropHdl_VertJustify : public XMLPropertyHandler
317 : {
318 : public:
319 : virtual ~XmlScPropHdl_VertJustify();
320 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
321 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
322 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
323 : };
324 :
325 488 : class XmlScPropHdl_BreakBefore : public XMLPropertyHandler
326 : {
327 : public:
328 : virtual ~XmlScPropHdl_BreakBefore();
329 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
330 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
331 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
332 : };
333 :
334 488 : class XmlScPropHdl_IsTextWrapped : public XMLPropertyHandler
335 : {
336 : public:
337 : virtual ~XmlScPropHdl_IsTextWrapped();
338 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
339 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
340 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
341 : };
342 :
343 488 : class XmlScPropHdl_IsEqual : public XMLPropertyHandler
344 : {
345 : public:
346 976 : virtual ~XmlScPropHdl_IsEqual() {}
347 17 : virtual bool equals( const ::com::sun::star::uno::Any& /* r1 */, const ::com::sun::star::uno::Any& /* r2 */ ) const SAL_OVERRIDE { return true; }
348 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
349 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
350 : };
351 :
352 488 : class XmlScPropHdl_Vertical : public XMLPropertyHandler
353 : {
354 : public:
355 : virtual ~XmlScPropHdl_Vertical();
356 : virtual bool equals( const ::com::sun::star::uno::Any& r1, const ::com::sun::star::uno::Any& r2 ) const SAL_OVERRIDE;
357 : virtual bool importXML( const OUString& rStrImpValue, ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
358 : virtual bool exportXML( OUString& rStrExpValue, const ::com::sun::star::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const SAL_OVERRIDE;
359 : };
360 :
361 : #endif
362 :
363 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|