xref: /aoo41x/main/xmloff/source/draw/ximpstyl.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _XIMPSTYLE_HXX
29 #define _XIMPSTYLE_HXX
30 
31 #include <xmloff/xmlictxt.hxx>
32 #include "sdxmlimp_impl.hxx"
33 #include "ximppage.hxx"
34 #include <xmloff/xmlstyle.hxx>
35 #include <com/sun/star/view/PaperOrientation.hpp>
36 
37 class SvNumberFormatter;
38 class SvXMLNumFmtHelper;
39 
40 //////////////////////////////////////////////////////////////////////////////
41 // special style:style context inside style:page-master context
42 
43 class SdXMLPageMasterStyleContext: public SvXMLStyleContext
44 {
45 	sal_Int32					mnBorderBottom;
46 	sal_Int32					mnBorderLeft;
47 	sal_Int32					mnBorderRight;
48 	sal_Int32					mnBorderTop;
49 	sal_Int32					mnWidth;
50 	sal_Int32					mnHeight;
51 	com::sun::star::view::PaperOrientation meOrientation;
52 
53 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
54 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
55 
56 public:
57 	TYPEINFO();
58 
59 	SdXMLPageMasterStyleContext(
60 		SdXMLImport& rImport,
61 		sal_uInt16 nPrfx,
62 		const rtl::OUString& rLName,
63 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
64 	virtual ~SdXMLPageMasterStyleContext();
65 
66 	sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
67 	sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
68 	sal_Int32 GetBorderRight() const { return mnBorderRight; }
69 	sal_Int32 GetBorderTop() const { return mnBorderTop; }
70 	sal_Int32 GetWidth() const { return mnWidth; }
71 	sal_Int32 GetHeight() const { return mnHeight; }
72 	com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
73 };
74 
75 //////////////////////////////////////////////////////////////////////////////
76 // style:page-master context
77 
78 class SdXMLPageMasterContext: public SvXMLStyleContext
79 {
80 	rtl::OUString				msName;
81 	SdXMLPageMasterStyleContext*mpPageMasterStyle;
82 
83 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
84 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
85 
86 public:
87 	TYPEINFO();
88 
89 	SdXMLPageMasterContext(
90 		SdXMLImport& rImport,
91 		sal_uInt16 nPrfx,
92 		const rtl::OUString& rLName,
93 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
94 	virtual ~SdXMLPageMasterContext();
95 
96 	virtual SvXMLImportContext *CreateChildContext(
97 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
98 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
99 
100 	const rtl::OUString& GetName() const { return msName; }
101 	const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
102 };
103 
104 //////////////////////////////////////////////////////////////////////////////
105 // style:masterpage context
106 
107 class SdXMLMasterPageContext: public SdXMLGenericPageContext
108 {
109 	rtl::OUString				msPageMasterName;
110 	rtl::OUString				msName;
111 	rtl::OUString				msDisplayName;
112 	rtl::OUString				msStyleName;
113 
114 public:
115 	TYPEINFO();
116 
117 	SdXMLMasterPageContext(
118 		SdXMLImport& rImport,
119 		sal_uInt16 nPrfx,
120 		const rtl::OUString& rLName,
121 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
122 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
123 	virtual ~SdXMLMasterPageContext();
124 
125 	virtual SvXMLImportContext *CreateChildContext(
126 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
127 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
128 
129 	virtual void EndElement();
130 
131 	const rtl::OUString& GetPageMasterName() const { return msPageMasterName; }
132 	const rtl::OUString& GetEncodedName() const { return msName; }
133 	const rtl::OUString& GetDisplayName() const { return msDisplayName; }
134 
135 };
136 DECLARE_LIST(ImpMasterPageList, SdXMLMasterPageContext*)
137 
138 //////////////////////////////////////////////////////////////////////////////
139 // presentation:placeholder context
140 
141 class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
142 {
143 	rtl::OUString				msName;
144 	sal_Int32					mnX;
145 	sal_Int32					mnY;
146 	sal_Int32					mnWidth;
147 	sal_Int32					mnHeight;
148 
149 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
150 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
151 
152 public:
153 	SdXMLPresentationPlaceholderContext(
154 		SdXMLImport& rImport,
155 		sal_uInt16 nPrfx,
156 		const rtl::OUString& rLName,
157 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
158 	virtual ~SdXMLPresentationPlaceholderContext();
159 
160 	const rtl::OUString& GetName() const { return msName; }
161 	sal_Int32 GetX() const { return mnX; }
162 	sal_Int32 GetY() const { return mnY; }
163 	sal_Int32 GetWidth() const { return mnWidth; }
164 	sal_Int32 GetHeight() const { return mnHeight; }
165 };
166 DECLARE_LIST(ImpPlaceholderList, SdXMLPresentationPlaceholderContext*)
167 
168 //////////////////////////////////////////////////////////////////////////////
169 // style:presentation-page-layout context
170 
171 class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
172 {
173 	rtl::OUString				msName;
174 	ImpPlaceholderList			maList;
175 	sal_uInt16					mnTypeId;
176 
177 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
178 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
179 
180 public:
181 	TYPEINFO();
182 
183 	SdXMLPresentationPageLayoutContext(
184 		SdXMLImport& rImport,
185 		sal_uInt16 nPrfx,
186 		const rtl::OUString& rLName,
187 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
188 	virtual ~SdXMLPresentationPageLayoutContext();
189 
190 	virtual SvXMLImportContext *CreateChildContext(
191 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
192 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
193 
194 	virtual void EndElement();
195 	sal_uInt16 GetTypeId() const { return mnTypeId; }
196 };
197 
198 //////////////////////////////////////////////////////////////////////////////
199 // office:styles context
200 
201 class SdXMLStylesContext : public SvXMLStylesContext
202 {
203 	UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
204 	sal_Bool					mbIsAutoStyle;
205 	SvXMLNumFmtHelper*			mpNumFmtHelper;
206 	SvNumberFormatter*			mpNumFormatter;
207 
208 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
209 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
210 
211 	void ImpSetGraphicStyles() const;
212 	void ImpSetCellStyles() const;
213 	void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
214 		sal_uInt16 nFamily, const UniString& rPrefix) const;
215 
216 protected:
217 	virtual SvXMLStyleContext* CreateStyleChildContext(
218 		sal_uInt16 nPrefix,
219 		const rtl::OUString& rLocalName,
220 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
221 
222 	virtual SvXMLStyleContext *CreateStyleStyleChildContext(
223 		sal_uInt16 nFamily,
224 		sal_uInt16 nPrefix,
225 		const rtl::OUString& rLocalName,
226 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
227 
228 	virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
229 		sal_uInt16 nFamily, sal_uInt16 nPrefix,
230 		const ::rtl::OUString& rLocalName,
231 		const ::com::sun::star::uno::Reference<
232 			::com::sun::star::xml::sax::XAttributeList > & xAttrList );
233 public:
234 	TYPEINFO();
235 
236 	SdXMLStylesContext(
237 		SdXMLImport& rImport,
238 		sal_uInt16 nPrfx,
239 		const rtl::OUString& rLName,
240 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
241 		sal_Bool bIsAutoStyle);
242 	virtual ~SdXMLStylesContext();
243 
244 	virtual sal_uInt16 GetFamily( const rtl::OUString& rFamily ) const;
245 	virtual void EndElement();
246 	virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const;
247 
248 	void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
249 
250 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
251 };
252 
253 //////////////////////////////////////////////////////////////////////////////
254 // office:master-styles context
255 //
256 class SdXMLMasterStylesContext : public SvXMLImportContext
257 {
258 	ImpMasterPageList			maMasterPageList;
259 
260 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
261 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
262 
263 public:
264 	TYPEINFO();
265 
266 	SdXMLMasterStylesContext(
267 		SdXMLImport& rImport,
268 		sal_uInt16 nPrfx,
269 		const rtl::OUString& rLName);
270 	virtual ~SdXMLMasterStylesContext();
271 
272 	virtual SvXMLImportContext* CreateChildContext(
273 		sal_uInt16 nPrefix,
274 		const rtl::OUString& rLocalName,
275 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
276 
277 	const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
278 };
279 
280 //////////////////////////////////////////////////////////////////////////////
281 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
282 
283 class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
284 {
285 public:
286 	SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
287 		const ::rtl::OUString& rLName,
288 		const ::com::sun::star::uno::Reference<	::com::sun::star::xml::sax::XAttributeList >& xAttrList );
289 
290 	virtual sal_Bool IsTransient() const;
291 	virtual void EndElement();
292 	virtual void Characters( const ::rtl::OUString& rChars );
293 
294 private:
295 	::rtl::OUString	maStrName;
296 	::rtl::OUString maStrText;
297 	::rtl::OUString maStrDateTimeFormat;
298 	sal_Bool		mbFixed;
299 };
300 
301 
302 #endif	//  _XIMPSTYLE_HXX
303