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: ximpstyl.hxx,v $
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 _XIMPSTYLE_HXX
32 #define _XIMPSTYLE_HXX
34 #include <xmloff/xmlictxt.hxx>
35 #include "sdxmlimp_impl.hxx"
36 #include "ximppage.hxx"
37 #include <xmloff/xmlstyle.hxx>
38 #include <com/sun/star/view/PaperOrientation.hpp>
40 class SvNumberFormatter
;
41 class SvXMLNumFmtHelper
;
43 //////////////////////////////////////////////////////////////////////////////
44 // special style:style context inside style:page-master context
46 class SdXMLPageMasterStyleContext
: public SvXMLStyleContext
48 sal_Int32 mnBorderBottom
;
49 sal_Int32 mnBorderLeft
;
50 sal_Int32 mnBorderRight
;
51 sal_Int32 mnBorderTop
;
54 com::sun::star::view::PaperOrientation meOrientation
;
56 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
57 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
62 SdXMLPageMasterStyleContext(
65 const rtl::OUString
& rLName
,
66 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
67 virtual ~SdXMLPageMasterStyleContext();
69 sal_Int32
GetBorderBottom() const { return mnBorderBottom
; }
70 sal_Int32
GetBorderLeft() const { return mnBorderLeft
; }
71 sal_Int32
GetBorderRight() const { return mnBorderRight
; }
72 sal_Int32
GetBorderTop() const { return mnBorderTop
; }
73 sal_Int32
GetWidth() const { return mnWidth
; }
74 sal_Int32
GetHeight() const { return mnHeight
; }
75 com::sun::star::view::PaperOrientation
GetOrientation() const { return meOrientation
; }
78 //////////////////////////////////////////////////////////////////////////////
79 // style:page-master context
81 class SdXMLPageMasterContext
: public SvXMLStyleContext
84 SdXMLPageMasterStyleContext
*mpPageMasterStyle
;
86 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
87 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
92 SdXMLPageMasterContext(
95 const rtl::OUString
& rLName
,
96 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
97 virtual ~SdXMLPageMasterContext();
99 virtual SvXMLImportContext
*CreateChildContext(
100 sal_uInt16 nPrefix
, const rtl::OUString
& rLocalName
,
101 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
103 const rtl::OUString
& GetName() const { return msName
; }
104 const SdXMLPageMasterStyleContext
* GetPageMasterStyle() const { return mpPageMasterStyle
; }
107 //////////////////////////////////////////////////////////////////////////////
108 // style:masterpage context
110 class SdXMLMasterPageContext
: public SdXMLGenericPageContext
112 rtl::OUString msPageMasterName
;
113 rtl::OUString msName
;
114 rtl::OUString msDisplayName
;
115 rtl::OUString msStyleName
;
120 SdXMLMasterPageContext(
121 SdXMLImport
& rImport
,
123 const rtl::OUString
& rLName
,
124 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
125 com::sun::star::uno::Reference
< com::sun::star::drawing::XShapes
>& rShapes
);
126 virtual ~SdXMLMasterPageContext();
128 virtual SvXMLImportContext
*CreateChildContext(
129 sal_uInt16 nPrefix
, const rtl::OUString
& rLocalName
,
130 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
132 virtual void EndElement();
134 const rtl::OUString
& GetPageMasterName() const { return msPageMasterName
; }
135 const rtl::OUString
& GetEncodedName() const { return msName
; }
136 const rtl::OUString
& GetDisplayName() const { return msDisplayName
; }
139 DECLARE_LIST(ImpMasterPageList
, SdXMLMasterPageContext
*)
141 //////////////////////////////////////////////////////////////////////////////
142 // presentation:placeholder context
144 class SdXMLPresentationPlaceholderContext
: public SvXMLImportContext
146 rtl::OUString msName
;
152 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
153 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
156 SdXMLPresentationPlaceholderContext(
157 SdXMLImport
& rImport
,
159 const rtl::OUString
& rLName
,
160 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
161 virtual ~SdXMLPresentationPlaceholderContext();
163 const rtl::OUString
& GetName() const { return msName
; }
164 sal_Int32
GetX() const { return mnX
; }
165 sal_Int32
GetY() const { return mnY
; }
166 sal_Int32
GetWidth() const { return mnWidth
; }
167 sal_Int32
GetHeight() const { return mnHeight
; }
169 DECLARE_LIST(ImpPlaceholderList
, SdXMLPresentationPlaceholderContext
*)
171 //////////////////////////////////////////////////////////////////////////////
172 // style:presentation-page-layout context
174 class SdXMLPresentationPageLayoutContext
: public SvXMLStyleContext
176 rtl::OUString msName
;
177 ImpPlaceholderList maList
;
180 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
181 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
186 SdXMLPresentationPageLayoutContext(
187 SdXMLImport
& rImport
,
189 const rtl::OUString
& rLName
,
190 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
191 virtual ~SdXMLPresentationPageLayoutContext();
193 virtual SvXMLImportContext
*CreateChildContext(
194 sal_uInt16 nPrefix
, const rtl::OUString
& rLocalName
,
195 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
197 virtual void EndElement();
198 sal_uInt16
GetTypeId() const { return mnTypeId
; }
201 //////////////////////////////////////////////////////////////////////////////
202 // office:styles context
204 class SdXMLStylesContext
: public SvXMLStylesContext
206 UniReference
< SvXMLImportPropertyMapper
> xPresImpPropMapper
;
207 sal_Bool mbIsAutoStyle
;
208 SvXMLNumFmtHelper
* mpNumFmtHelper
;
209 SvNumberFormatter
* mpNumFormatter
;
211 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
212 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
214 void ImpSetGraphicStyles() const;
215 void ImpSetCellStyles() const;
216 void ImpSetGraphicStyles( com::sun::star::uno::Reference
< com::sun::star::container::XNameAccess
>& xPageStyles
,
217 sal_uInt16 nFamily
, const UniString
& rPrefix
) const;
220 virtual SvXMLStyleContext
* CreateStyleChildContext(
222 const rtl::OUString
& rLocalName
,
223 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
225 virtual SvXMLStyleContext
*CreateStyleStyleChildContext(
228 const rtl::OUString
& rLocalName
,
229 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
231 virtual SvXMLStyleContext
*CreateDefaultStyleStyleChildContext(
232 sal_uInt16 nFamily
, sal_uInt16 nPrefix
,
233 const ::rtl::OUString
& rLocalName
,
234 const ::com::sun::star::uno::Reference
<
235 ::com::sun::star::xml::sax::XAttributeList
> & xAttrList
);
240 SdXMLImport
& rImport
,
242 const rtl::OUString
& rLName
,
243 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
244 sal_Bool bIsAutoStyle
);
245 virtual ~SdXMLStylesContext();
247 virtual sal_uInt16
GetFamily( const rtl::OUString
& rFamily
) const;
248 virtual void EndElement();
249 virtual UniReference
< SvXMLImportPropertyMapper
> GetImportPropertyMapper(sal_uInt16 nFamily
) const;
251 void SetMasterPageStyles(SdXMLMasterPageContext
& rMaster
) const;
253 ::com::sun::star::uno::Reference
< ::com::sun::star::container::XNameAccess
> getPageLayouts() const;
256 //////////////////////////////////////////////////////////////////////////////
257 // office:master-styles context
259 class SdXMLMasterStylesContext
: public SvXMLImportContext
261 ImpMasterPageList maMasterPageList
;
263 const SdXMLImport
& GetSdImport() const { return (const SdXMLImport
&)GetImport(); }
264 SdXMLImport
& GetSdImport() { return (SdXMLImport
&)GetImport(); }
269 SdXMLMasterStylesContext(
270 SdXMLImport
& rImport
,
272 const rtl::OUString
& rLName
);
273 virtual ~SdXMLMasterStylesContext();
275 virtual SvXMLImportContext
* CreateChildContext(
277 const rtl::OUString
& rLocalName
,
278 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
280 const ImpMasterPageList
& GetMasterPageList() const { return maMasterPageList
; }
283 //////////////////////////////////////////////////////////////////////////////
284 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
286 class SdXMLHeaderFooterDeclContext
: public SvXMLStyleContext
289 SdXMLHeaderFooterDeclContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
,
290 const ::rtl::OUString
& rLName
,
291 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
);
293 virtual BOOL
IsTransient() const;
294 virtual void EndElement();
295 virtual void Characters( const ::rtl::OUString
& rChars
);
298 ::rtl::OUString maStrName
;
299 ::rtl::OUString maStrText
;
300 ::rtl::OUString maStrDateTimeFormat
;
305 #endif // _XIMPSTYLE_HXX