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