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