1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlstyle.hxx,v $
10 * $Revision: 1.32.62.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XMLSTYLE_HXX
32 #define SC_XMLSTYLE_HXX
34 #include <xmloff/maptype.hxx>
35 #include <xmloff/xmlaustp.hxx>
36 #include <xmloff/xmltypes.hxx>
37 #include <xmloff/xmlprmap.hxx>
38 #include <xmloff/prhdlfac.hxx>
39 #include <xmloff/styleexp.hxx>
40 #include <xmloff/xmlexppr.hxx>
41 #include <xmloff/contextid.hxx>
43 extern const XMLPropertyMapEntry aXMLScCellStylesProperties
[];
44 extern const XMLPropertyMapEntry aXMLScColumnStylesProperties
[];
45 extern const XMLPropertyMapEntry aXMLScRowStylesProperties
[];
46 extern const XMLPropertyMapEntry aXMLScRowStylesImportProperties
[];
47 extern const XMLPropertyMapEntry aXMLScTableStylesProperties
[];
48 extern const XMLPropertyMapEntry aXMLScTableStylesImportProperties
[];
51 #define XML_SC_TYPE_CELLPROTECTION (XML_SC_TYPES_START + 1)
52 #define XML_SC_TYPE_PRINTCONTENT (XML_SC_TYPES_START + 2)
53 #define XML_SC_TYPE_HORIJUSTIFY (XML_SC_TYPES_START + 3)
54 #define XML_SC_TYPE_HORIJUSTIFYSOURCE (XML_SC_TYPES_START + 4)
55 #define XML_SC_TYPE_HORIJUSTIFYREPEAT (XML_SC_TYPES_START + 5)
56 #define XML_SC_TYPE_ORIENTATION (XML_SC_TYPES_START + 6)
57 #define XML_SC_TYPE_ROTATEANGLE (XML_SC_TYPES_START + 7)
58 #define XML_SC_TYPE_ROTATEREFERENCE (XML_SC_TYPES_START + 8)
59 #define XML_SC_TYPE_BORDERLEFT (XML_SC_TYPES_START + 9)
60 #define XML_SC_TYPE_BORDERRIGHT (XML_SC_TYPES_START + 10)
61 #define XML_SC_TYPE_BORDERTOP (XML_SC_TYPES_START + 11)
62 #define XML_SC_TYPE_BORDERBOTTOM (XML_SC_TYPES_START + 12)
63 #define XML_SC_TYPE_VERTJUSTIFY (XML_SC_TYPES_START + 13)
64 #define XML_SC_ISTEXTWRAPPED (XML_SC_TYPES_START + 14)
65 #define XML_SC_TYPE_EQUAL (XML_SC_TYPES_START + 15)
66 #define XML_SC_TYPE_VERTICAL (XML_SC_TYPES_START + 16)
68 #define CTF_SC_HORIJUSTIFY (XML_SC_CTF_START + 1)
69 #define CTF_SC_HORIJUSTIFY_SOURCE (XML_SC_CTF_START + 2)
70 #define CTF_SC_ALLPADDING (XML_SC_CTF_START + 3)
71 #define CTF_SC_BOTTOMPADDING (XML_SC_CTF_START + 4)
72 #define CTF_SC_LEFTPADDING (XML_SC_CTF_START + 5)
73 #define CTF_SC_RIGHTPADDING (XML_SC_CTF_START + 6)
74 #define CTF_SC_TOPPADDING (XML_SC_CTF_START + 7)
75 #define CTF_SC_ALLBORDER (XML_SC_CTF_START + 8)
76 #define CTF_SC_LEFTBORDER (XML_SC_CTF_START + 9)
77 #define CTF_SC_RIGHTBORDER (XML_SC_CTF_START + 10)
78 #define CTF_SC_TOPBORDER (XML_SC_CTF_START + 11)
79 #define CTF_SC_BOTTOMBORDER (XML_SC_CTF_START + 12)
80 #define CTF_SC_ALLBORDERWIDTH (XML_SC_CTF_START + 13)
81 #define CTF_SC_LEFTBORDERWIDTH (XML_SC_CTF_START + 14)
82 #define CTF_SC_RIGHTBORDERWIDTH (XML_SC_CTF_START + 15)
83 #define CTF_SC_TOPBORDERWIDTH (XML_SC_CTF_START + 16)
84 #define CTF_SC_BOTTOMBORDERWIDTH (XML_SC_CTF_START + 17)
85 #define CTF_SC_NUMBERFORMAT (XML_SC_CTF_START + 18)
86 #define CTF_SC_MAP (XML_SC_CTF_START + 19)
87 #define CTF_SC_PARAINDENT (XML_SC_CTF_START + 20)
88 #define CTF_SC_OLDTEXTBACKGROUND (XML_SC_CTF_START + 21)
89 #define CTF_SC_IMPORT_MAP (XML_SC_CTF_START + 22)
90 #define CTF_SC_CELLSTYLE (XML_SC_CTF_START + 23)
91 #define CTF_SC_VALIDATION (XML_SC_CTF_START + 24)
92 #define CTF_SC_DIAGONALTLBR (XML_SC_CTF_START + 25)
93 #define CTF_SC_DIAGONALTLBRWIDTH (XML_SC_CTF_START + 26)
94 #define CTF_SC_DIAGONALBLTR (XML_SC_CTF_START + 27)
95 #define CTF_SC_DIAGONALBLTRWIDTH (XML_SC_CTF_START + 28)
97 #define CTF_SC_ROWHEIGHT (XML_SC_CTF_START + 50)
98 #define CTF_SC_ROWOPTIMALHEIGHT (XML_SC_CTF_START + 51)
99 #define CTF_SC_ROWBREAKBEFORE (XML_SC_CTF_START + 52)
100 #define CTF_SC_ISVISIBLE (XML_SC_CTF_START + 53)
102 #define CTF_SC_MASTERPAGENAME (XML_SC_CTF_START + 53)
105 #define XML_SC_TYPE_BREAKBEFORE (XML_SC_TYPES_START + 50)
110 class ScXMLCellExportPropertyMapper
: public SvXMLExportPropertyMapper
113 /** Application-specific filter. By default do nothing. */
114 virtual void ContextFilter(
115 ::std::vector
< XMLPropertyState
>& rProperties
,
116 ::com::sun::star::uno::Reference
<
117 ::com::sun::star::beans::XPropertySet
> rPropSet
) const;
119 ScXMLCellExportPropertyMapper(
120 const UniReference
< XMLPropertySetMapper
>& rMapper
);
121 virtual ~ScXMLCellExportPropertyMapper();
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;
133 class ScXMLRowExportPropertyMapper
: public SvXMLExportPropertyMapper
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;
142 ScXMLRowExportPropertyMapper(
143 const UniReference
< XMLPropertySetMapper
>& rMapper
);
144 virtual ~ScXMLRowExportPropertyMapper();
147 class ScXMLColumnExportPropertyMapper
: public SvXMLExportPropertyMapper
150 ScXMLColumnExportPropertyMapper(
151 const UniReference
< XMLPropertySetMapper
>& rMapper
);
152 virtual ~ScXMLColumnExportPropertyMapper();
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;
164 class ScXMLTableExportPropertyMapper
: public SvXMLExportPropertyMapper
168 ScXMLTableExportPropertyMapper(
169 const UniReference
< XMLPropertySetMapper
>& rMapper
);
170 virtual ~ScXMLTableExportPropertyMapper();
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;
182 class ScXMLAutoStylePoolP
: public SvXMLAutoStylePoolP
184 ScXMLExport
& rScXMLExport
;
186 virtual void exportStyleAttributes(
187 SvXMLAttributeList
& rAttrList
,
189 const ::std::vector
< XMLPropertyState
>& rProperties
,
190 const SvXMLExportPropertyMapper
& rPropExp
,
191 const SvXMLUnitConverter
& rUnitConverter
,
192 const SvXMLNamespaceMap
& rNamespaceMap
195 virtual void exportStyleContent(
196 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XDocumentHandler
> & rHandler
,
198 const ::std::vector
< XMLPropertyState
>& rProperties
,
199 const SvXMLExportPropertyMapper
& rPropExp
200 , const SvXMLUnitConverter
& rUnitConverter
,
201 const SvXMLNamespaceMap
& rNamespaceMap
205 ScXMLAutoStylePoolP(ScXMLExport
& rScXMLExport
);
206 virtual ~ScXMLAutoStylePoolP();
209 class ScXMLStyleExport
: public XMLStyleExport
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
);
220 const ::rtl::OUString
& rPoolStyleName
,
221 SvXMLAutoStylePoolP
*pAutoStyleP
=0 );
222 virtual ~ScXMLStyleExport();
225 class XMLScPropHdlFactory
: public XMLPropertyHandlerFactory
228 XMLScPropHdlFactory();
229 virtual ~XMLScPropHdlFactory();
230 virtual const XMLPropertyHandler
* GetPropertyHandler( sal_Int32 nType
) const;
233 class XmlScPropHdl_CellProtection
: public XMLPropertyHandler
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
239 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
242 class XmlScPropHdl_PrintContent
: public XMLPropertyHandler
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
248 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
251 class XmlScPropHdl_HoriJustify
: public XMLPropertyHandler
254 virtual ~XmlScPropHdl_HoriJustify();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
257 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
260 class XmlScPropHdl_HoriJustifySource
: public XMLPropertyHandler
263 virtual ~XmlScPropHdl_HoriJustifySource();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
266 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
269 class XmlScPropHdl_HoriJustifyRepeat
: public XMLPropertyHandler
272 virtual ~XmlScPropHdl_HoriJustifyRepeat();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
275 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
278 class XmlScPropHdl_Orientation
: public XMLPropertyHandler
281 virtual ~XmlScPropHdl_Orientation();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
284 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
287 class XmlScPropHdl_RotateAngle
: public XMLPropertyHandler
290 virtual ~XmlScPropHdl_RotateAngle();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
293 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
296 class XmlScPropHdl_RotateReference
: public XMLPropertyHandler
299 virtual ~XmlScPropHdl_RotateReference();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
302 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
305 class XmlScPropHdl_VertJustify
: public XMLPropertyHandler
308 virtual ~XmlScPropHdl_VertJustify();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
311 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
314 class XmlScPropHdl_BreakBefore
: public XMLPropertyHandler
317 virtual ~XmlScPropHdl_BreakBefore();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
320 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
323 class XmlScPropHdl_IsTextWrapped
: public XMLPropertyHandler
326 virtual ~XmlScPropHdl_IsTextWrapped();
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 ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
329 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
332 class XmlScPropHdl_IsEqual
: public XMLPropertyHandler
335 virtual ~XmlScPropHdl_IsEqual() {}
336 virtual bool equals( const ::com::sun::star::uno::Any
& /* r1 */, const ::com::sun::star::uno::Any
& /* r2 */ ) const { return sal_True
; }
337 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
338 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
341 class XmlScPropHdl_Vertical
: public XMLPropertyHandler
344 virtual ~XmlScPropHdl_Vertical();
345 virtual bool equals( const ::com::sun::star::uno::Any
& r1
, const ::com::sun::star::uno::Any
& r2
) const;
346 virtual sal_Bool
importXML( const ::rtl::OUString
& rStrImpValue
, ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;
347 virtual sal_Bool
exportXML( ::rtl::OUString
& rStrExpValue
, const ::com::sun::star::uno::Any
& rValue
, const SvXMLUnitConverter
& rUnitConverter
) const;