xref: /aoo41x/main/xmloff/source/draw/ximpstyl.hxx (revision ecfe53c5)
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 _XIMPSTYLE_HXX
25 #define _XIMPSTYLE_HXX
26 
27 #include <xmloff/xmlictxt.hxx>
28 #include "sdxmlimp_impl.hxx"
29 #include "ximppage.hxx"
30 #include <xmloff/xmlstyle.hxx>
31 #include <com/sun/star/view/PaperOrientation.hpp>
32 
33 class SvNumberFormatter;
34 class SvXMLNumFmtHelper;
35 
36 //////////////////////////////////////////////////////////////////////////////
37 // special style:style context inside style:page-master context
38 
39 class SdXMLPageMasterStyleContext: public SvXMLStyleContext
40 {
41 	sal_Int32					mnBorderBottom;
42 	sal_Int32					mnBorderLeft;
43 	sal_Int32					mnBorderRight;
44 	sal_Int32					mnBorderTop;
45 	sal_Int32					mnWidth;
46 	sal_Int32					mnHeight;
47 	com::sun::star::view::PaperOrientation meOrientation;
48 
GetSdImport() const49 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()50 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
51 
52 public:
53 	TYPEINFO();
54 
55 	SdXMLPageMasterStyleContext(
56 		SdXMLImport& rImport,
57 		sal_uInt16 nPrfx,
58 		const rtl::OUString& rLName,
59 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
60 	virtual ~SdXMLPageMasterStyleContext();
61 
GetBorderBottom() const62 	sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
GetBorderLeft() const63 	sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
GetBorderRight() const64 	sal_Int32 GetBorderRight() const { return mnBorderRight; }
GetBorderTop() const65 	sal_Int32 GetBorderTop() const { return mnBorderTop; }
GetWidth() const66 	sal_Int32 GetWidth() const { return mnWidth; }
GetHeight() const67 	sal_Int32 GetHeight() const { return mnHeight; }
GetOrientation() const68 	com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
69 };
70 
71 //////////////////////////////////////////////////////////////////////////////
72 // style:page-master context
73 
74 class SdXMLPageMasterContext: public SvXMLStyleContext
75 {
76 	rtl::OUString				msName;
77 	SdXMLPageMasterStyleContext*mpPageMasterStyle;
78 
GetSdImport() const79 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()80 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
81 
82 public:
83 	TYPEINFO();
84 
85 	SdXMLPageMasterContext(
86 		SdXMLImport& rImport,
87 		sal_uInt16 nPrfx,
88 		const rtl::OUString& rLName,
89 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
90 	virtual ~SdXMLPageMasterContext();
91 
92 	virtual SvXMLImportContext *CreateChildContext(
93 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
94 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
95 
GetName() const96 	const rtl::OUString& GetName() const { return msName; }
GetPageMasterStyle() const97 	const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
98 };
99 
100 //////////////////////////////////////////////////////////////////////////////
101 // style:masterpage context
102 
103 class SdXMLMasterPageContext: public SdXMLGenericPageContext
104 {
105 	rtl::OUString				msPageMasterName;
106 	rtl::OUString				msName;
107 	rtl::OUString				msDisplayName;
108 	rtl::OUString				msStyleName;
109 
110 public:
111 	TYPEINFO();
112 
113 	SdXMLMasterPageContext(
114 		SdXMLImport& rImport,
115 		sal_uInt16 nPrfx,
116 		const rtl::OUString& rLName,
117 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
118 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
119 	virtual ~SdXMLMasterPageContext();
120 
121 	virtual SvXMLImportContext *CreateChildContext(
122 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
123 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
124 
125 	virtual void EndElement();
126 
GetPageMasterName() const127 	const rtl::OUString& GetPageMasterName() const { return msPageMasterName; }
GetEncodedName() const128 	const rtl::OUString& GetEncodedName() const { return msName; }
GetDisplayName() const129 	const rtl::OUString& GetDisplayName() const { return msDisplayName; }
130 
131 };
132 DECLARE_LIST(ImpMasterPageList, SdXMLMasterPageContext*)
133 
134 //////////////////////////////////////////////////////////////////////////////
135 // presentation:placeholder context
136 
137 class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
138 {
139 	rtl::OUString				msName;
140 	sal_Int32					mnX;
141 	sal_Int32					mnY;
142 	sal_Int32					mnWidth;
143 	sal_Int32					mnHeight;
144 
GetSdImport() const145 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()146 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
147 
148 public:
149 	SdXMLPresentationPlaceholderContext(
150 		SdXMLImport& rImport,
151 		sal_uInt16 nPrfx,
152 		const rtl::OUString& rLName,
153 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
154 	virtual ~SdXMLPresentationPlaceholderContext();
155 
GetName() const156 	const rtl::OUString& GetName() const { return msName; }
GetX() const157 	sal_Int32 GetX() const { return mnX; }
GetY() const158 	sal_Int32 GetY() const { return mnY; }
GetWidth() const159 	sal_Int32 GetWidth() const { return mnWidth; }
GetHeight() const160 	sal_Int32 GetHeight() const { return mnHeight; }
161 };
162 DECLARE_LIST(ImpPlaceholderList, SdXMLPresentationPlaceholderContext*)
163 
164 //////////////////////////////////////////////////////////////////////////////
165 // style:presentation-page-layout context
166 
167 class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
168 {
169 	rtl::OUString				msName;
170 	ImpPlaceholderList			maList;
171 	sal_uInt16					mnTypeId;
172 
GetSdImport() const173 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()174 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
175 
176 public:
177 	TYPEINFO();
178 
179 	SdXMLPresentationPageLayoutContext(
180 		SdXMLImport& rImport,
181 		sal_uInt16 nPrfx,
182 		const rtl::OUString& rLName,
183 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
184 	virtual ~SdXMLPresentationPageLayoutContext();
185 
186 	virtual SvXMLImportContext *CreateChildContext(
187 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
188 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
189 
190 	virtual void EndElement();
GetTypeId() const191 	sal_uInt16 GetTypeId() const { return mnTypeId; }
192 };
193 
194 //////////////////////////////////////////////////////////////////////////////
195 // office:styles context
196 
197 class SdXMLStylesContext : public SvXMLStylesContext
198 {
199 	UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
200 	sal_Bool					mbIsAutoStyle;
201 	SvXMLNumFmtHelper*			mpNumFmtHelper;
202 	SvNumberFormatter*			mpNumFormatter;
203 
GetSdImport() const204 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()205 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
206 
207 	void ImpSetGraphicStyles() const;
208 	void ImpSetCellStyles() const;
209 	void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
210 		sal_uInt16 nFamily, const UniString& rPrefix) const;
211 
212 protected:
213 	virtual SvXMLStyleContext* CreateStyleChildContext(
214 		sal_uInt16 nPrefix,
215 		const rtl::OUString& rLocalName,
216 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
217 
218 	virtual SvXMLStyleContext *CreateStyleStyleChildContext(
219 		sal_uInt16 nFamily,
220 		sal_uInt16 nPrefix,
221 		const rtl::OUString& rLocalName,
222 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
223 
224 	virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
225 		sal_uInt16 nFamily, sal_uInt16 nPrefix,
226 		const ::rtl::OUString& rLocalName,
227 		const ::com::sun::star::uno::Reference<
228 			::com::sun::star::xml::sax::XAttributeList > & xAttrList );
229 public:
230 	TYPEINFO();
231 
232 	SdXMLStylesContext(
233 		SdXMLImport& rImport,
234 		sal_uInt16 nPrfx,
235 		const rtl::OUString& rLName,
236 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
237 		sal_Bool bIsAutoStyle);
238 	virtual ~SdXMLStylesContext();
239 
240 	virtual sal_uInt16 GetFamily( const rtl::OUString& rFamily ) const;
241 	virtual void EndElement();
242 	virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const;
243 
244 	void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
245 
246 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
247 };
248 
249 //////////////////////////////////////////////////////////////////////////////
250 // office:master-styles context
251 //
252 class SdXMLMasterStylesContext : public SvXMLImportContext
253 {
254 	ImpMasterPageList			maMasterPageList;
255 
GetSdImport() const256 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()257 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
258 
259 public:
260 	TYPEINFO();
261 
262 	SdXMLMasterStylesContext(
263 		SdXMLImport& rImport,
264 		sal_uInt16 nPrfx,
265 		const rtl::OUString& rLName);
266 	virtual ~SdXMLMasterStylesContext();
267 
268 	virtual SvXMLImportContext* CreateChildContext(
269 		sal_uInt16 nPrefix,
270 		const rtl::OUString& rLocalName,
271 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
272 
GetMasterPageList() const273 	const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
274 };
275 
276 //////////////////////////////////////////////////////////////////////////////
277 // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
278 
279 class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
280 {
281 public:
282 	SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
283 		const ::rtl::OUString& rLName,
284 		const ::com::sun::star::uno::Reference<	::com::sun::star::xml::sax::XAttributeList >& xAttrList );
285 
286 	virtual sal_Bool IsTransient() const;
287 	virtual void EndElement();
288 	virtual void Characters( const ::rtl::OUString& rChars );
289 
290 private:
291 	::rtl::OUString	maStrName;
292 	::rtl::OUString maStrText;
293 	::rtl::OUString maStrDateTimeFormat;
294 	sal_Bool		mbFixed;
295 };
296 
297 
298 #endif	//  _XIMPSTYLE_HXX
299