xref: /aoo41x/main/xmloff/source/draw/ximpstyl.hxx (revision ecfe53c5)
1*ecfe53c5SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*ecfe53c5SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*ecfe53c5SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*ecfe53c5SAndrew Rist  * distributed with this work for additional information
6*ecfe53c5SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*ecfe53c5SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*ecfe53c5SAndrew Rist  * "License"); you may not use this file except in compliance
9*ecfe53c5SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*ecfe53c5SAndrew Rist  *
11*ecfe53c5SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*ecfe53c5SAndrew Rist  *
13*ecfe53c5SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*ecfe53c5SAndrew Rist  * software distributed under the License is distributed on an
15*ecfe53c5SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*ecfe53c5SAndrew Rist  * KIND, either express or implied.  See the License for the
17*ecfe53c5SAndrew Rist  * specific language governing permissions and limitations
18*ecfe53c5SAndrew Rist  * under the License.
19*ecfe53c5SAndrew Rist  *
20*ecfe53c5SAndrew Rist  *************************************************************/
21*ecfe53c5SAndrew Rist 
22*ecfe53c5SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _XIMPSTYLE_HXX
25cdf0e10cSrcweir #define _XIMPSTYLE_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <xmloff/xmlictxt.hxx>
28cdf0e10cSrcweir #include "sdxmlimp_impl.hxx"
29cdf0e10cSrcweir #include "ximppage.hxx"
30cdf0e10cSrcweir #include <xmloff/xmlstyle.hxx>
31cdf0e10cSrcweir #include <com/sun/star/view/PaperOrientation.hpp>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class SvNumberFormatter;
34cdf0e10cSrcweir class SvXMLNumFmtHelper;
35cdf0e10cSrcweir 
36cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
37cdf0e10cSrcweir // special style:style context inside style:page-master context
38cdf0e10cSrcweir 
39cdf0e10cSrcweir class SdXMLPageMasterStyleContext: public SvXMLStyleContext
40cdf0e10cSrcweir {
41cdf0e10cSrcweir 	sal_Int32					mnBorderBottom;
42cdf0e10cSrcweir 	sal_Int32					mnBorderLeft;
43cdf0e10cSrcweir 	sal_Int32					mnBorderRight;
44cdf0e10cSrcweir 	sal_Int32					mnBorderTop;
45cdf0e10cSrcweir 	sal_Int32					mnWidth;
46cdf0e10cSrcweir 	sal_Int32					mnHeight;
47cdf0e10cSrcweir 	com::sun::star::view::PaperOrientation meOrientation;
48cdf0e10cSrcweir 
GetSdImport() const49cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()50cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
51cdf0e10cSrcweir 
52cdf0e10cSrcweir public:
53cdf0e10cSrcweir 	TYPEINFO();
54cdf0e10cSrcweir 
55cdf0e10cSrcweir 	SdXMLPageMasterStyleContext(
56cdf0e10cSrcweir 		SdXMLImport& rImport,
57cdf0e10cSrcweir 		sal_uInt16 nPrfx,
58cdf0e10cSrcweir 		const rtl::OUString& rLName,
59cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
60cdf0e10cSrcweir 	virtual ~SdXMLPageMasterStyleContext();
61cdf0e10cSrcweir 
GetBorderBottom() const62cdf0e10cSrcweir 	sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
GetBorderLeft() const63cdf0e10cSrcweir 	sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
GetBorderRight() const64cdf0e10cSrcweir 	sal_Int32 GetBorderRight() const { return mnBorderRight; }
GetBorderTop() const65cdf0e10cSrcweir 	sal_Int32 GetBorderTop() const { return mnBorderTop; }
GetWidth() const66cdf0e10cSrcweir 	sal_Int32 GetWidth() const { return mnWidth; }
GetHeight() const67cdf0e10cSrcweir 	sal_Int32 GetHeight() const { return mnHeight; }
GetOrientation() const68cdf0e10cSrcweir 	com::sun::star::view::PaperOrientation GetOrientation() const { return meOrientation; }
69cdf0e10cSrcweir };
70cdf0e10cSrcweir 
71cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
72cdf0e10cSrcweir // style:page-master context
73cdf0e10cSrcweir 
74cdf0e10cSrcweir class SdXMLPageMasterContext: public SvXMLStyleContext
75cdf0e10cSrcweir {
76cdf0e10cSrcweir 	rtl::OUString				msName;
77cdf0e10cSrcweir 	SdXMLPageMasterStyleContext*mpPageMasterStyle;
78cdf0e10cSrcweir 
GetSdImport() const79cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()80cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
81cdf0e10cSrcweir 
82cdf0e10cSrcweir public:
83cdf0e10cSrcweir 	TYPEINFO();
84cdf0e10cSrcweir 
85cdf0e10cSrcweir 	SdXMLPageMasterContext(
86cdf0e10cSrcweir 		SdXMLImport& rImport,
87cdf0e10cSrcweir 		sal_uInt16 nPrfx,
88cdf0e10cSrcweir 		const rtl::OUString& rLName,
89cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
90cdf0e10cSrcweir 	virtual ~SdXMLPageMasterContext();
91cdf0e10cSrcweir 
92cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
93cdf0e10cSrcweir 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
94cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
95cdf0e10cSrcweir 
GetName() const96cdf0e10cSrcweir 	const rtl::OUString& GetName() const { return msName; }
GetPageMasterStyle() const97cdf0e10cSrcweir 	const SdXMLPageMasterStyleContext* GetPageMasterStyle() const { return mpPageMasterStyle; }
98cdf0e10cSrcweir };
99cdf0e10cSrcweir 
100cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
101cdf0e10cSrcweir // style:masterpage context
102cdf0e10cSrcweir 
103cdf0e10cSrcweir class SdXMLMasterPageContext: public SdXMLGenericPageContext
104cdf0e10cSrcweir {
105cdf0e10cSrcweir 	rtl::OUString				msPageMasterName;
106cdf0e10cSrcweir 	rtl::OUString				msName;
107cdf0e10cSrcweir 	rtl::OUString				msDisplayName;
108cdf0e10cSrcweir 	rtl::OUString				msStyleName;
109cdf0e10cSrcweir 
110cdf0e10cSrcweir public:
111cdf0e10cSrcweir 	TYPEINFO();
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	SdXMLMasterPageContext(
114cdf0e10cSrcweir 		SdXMLImport& rImport,
115cdf0e10cSrcweir 		sal_uInt16 nPrfx,
116cdf0e10cSrcweir 		const rtl::OUString& rLName,
117cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
118cdf0e10cSrcweir 		com::sun::star::uno::Reference< com::sun::star::drawing::XShapes >& rShapes);
119cdf0e10cSrcweir 	virtual ~SdXMLMasterPageContext();
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
122cdf0e10cSrcweir 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
123cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
124cdf0e10cSrcweir 
125cdf0e10cSrcweir 	virtual void EndElement();
126cdf0e10cSrcweir 
GetPageMasterName() const127cdf0e10cSrcweir 	const rtl::OUString& GetPageMasterName() const { return msPageMasterName; }
GetEncodedName() const128cdf0e10cSrcweir 	const rtl::OUString& GetEncodedName() const { return msName; }
GetDisplayName() const129cdf0e10cSrcweir 	const rtl::OUString& GetDisplayName() const { return msDisplayName; }
130cdf0e10cSrcweir 
131cdf0e10cSrcweir };
132cdf0e10cSrcweir DECLARE_LIST(ImpMasterPageList, SdXMLMasterPageContext*)
133cdf0e10cSrcweir 
134cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
135cdf0e10cSrcweir // presentation:placeholder context
136cdf0e10cSrcweir 
137cdf0e10cSrcweir class SdXMLPresentationPlaceholderContext: public SvXMLImportContext
138cdf0e10cSrcweir {
139cdf0e10cSrcweir 	rtl::OUString				msName;
140cdf0e10cSrcweir 	sal_Int32					mnX;
141cdf0e10cSrcweir 	sal_Int32					mnY;
142cdf0e10cSrcweir 	sal_Int32					mnWidth;
143cdf0e10cSrcweir 	sal_Int32					mnHeight;
144cdf0e10cSrcweir 
GetSdImport() const145cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()146cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
147cdf0e10cSrcweir 
148cdf0e10cSrcweir public:
149cdf0e10cSrcweir 	SdXMLPresentationPlaceholderContext(
150cdf0e10cSrcweir 		SdXMLImport& rImport,
151cdf0e10cSrcweir 		sal_uInt16 nPrfx,
152cdf0e10cSrcweir 		const rtl::OUString& rLName,
153cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
154cdf0e10cSrcweir 	virtual ~SdXMLPresentationPlaceholderContext();
155cdf0e10cSrcweir 
GetName() const156cdf0e10cSrcweir 	const rtl::OUString& GetName() const { return msName; }
GetX() const157cdf0e10cSrcweir 	sal_Int32 GetX() const { return mnX; }
GetY() const158cdf0e10cSrcweir 	sal_Int32 GetY() const { return mnY; }
GetWidth() const159cdf0e10cSrcweir 	sal_Int32 GetWidth() const { return mnWidth; }
GetHeight() const160cdf0e10cSrcweir 	sal_Int32 GetHeight() const { return mnHeight; }
161cdf0e10cSrcweir };
162cdf0e10cSrcweir DECLARE_LIST(ImpPlaceholderList, SdXMLPresentationPlaceholderContext*)
163cdf0e10cSrcweir 
164cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
165cdf0e10cSrcweir // style:presentation-page-layout context
166cdf0e10cSrcweir 
167cdf0e10cSrcweir class SdXMLPresentationPageLayoutContext: public SvXMLStyleContext
168cdf0e10cSrcweir {
169cdf0e10cSrcweir 	rtl::OUString				msName;
170cdf0e10cSrcweir 	ImpPlaceholderList			maList;
171cdf0e10cSrcweir 	sal_uInt16					mnTypeId;
172cdf0e10cSrcweir 
GetSdImport() const173cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()174cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
175cdf0e10cSrcweir 
176cdf0e10cSrcweir public:
177cdf0e10cSrcweir 	TYPEINFO();
178cdf0e10cSrcweir 
179cdf0e10cSrcweir 	SdXMLPresentationPageLayoutContext(
180cdf0e10cSrcweir 		SdXMLImport& rImport,
181cdf0e10cSrcweir 		sal_uInt16 nPrfx,
182cdf0e10cSrcweir 		const rtl::OUString& rLName,
183cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
184cdf0e10cSrcweir 	virtual ~SdXMLPresentationPageLayoutContext();
185cdf0e10cSrcweir 
186cdf0e10cSrcweir 	virtual SvXMLImportContext *CreateChildContext(
187cdf0e10cSrcweir 		sal_uInt16 nPrefix, const rtl::OUString& rLocalName,
188cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	virtual void EndElement();
GetTypeId() const191cdf0e10cSrcweir 	sal_uInt16 GetTypeId() const { return mnTypeId; }
192cdf0e10cSrcweir };
193cdf0e10cSrcweir 
194cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
195cdf0e10cSrcweir // office:styles context
196cdf0e10cSrcweir 
197cdf0e10cSrcweir class SdXMLStylesContext : public SvXMLStylesContext
198cdf0e10cSrcweir {
199cdf0e10cSrcweir 	UniReference< SvXMLImportPropertyMapper > xPresImpPropMapper;
200cdf0e10cSrcweir 	sal_Bool					mbIsAutoStyle;
201cdf0e10cSrcweir 	SvXMLNumFmtHelper*			mpNumFmtHelper;
202cdf0e10cSrcweir 	SvNumberFormatter*			mpNumFormatter;
203cdf0e10cSrcweir 
GetSdImport() const204cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()205cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
206cdf0e10cSrcweir 
207cdf0e10cSrcweir 	void ImpSetGraphicStyles() const;
208cdf0e10cSrcweir 	void ImpSetCellStyles() const;
209cdf0e10cSrcweir 	void ImpSetGraphicStyles( com::sun::star::uno::Reference< com::sun::star::container::XNameAccess >& xPageStyles,
210cdf0e10cSrcweir 		sal_uInt16 nFamily, const UniString& rPrefix) const;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir protected:
213cdf0e10cSrcweir 	virtual SvXMLStyleContext* CreateStyleChildContext(
214cdf0e10cSrcweir 		sal_uInt16 nPrefix,
215cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
216cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
217cdf0e10cSrcweir 
218cdf0e10cSrcweir 	virtual SvXMLStyleContext *CreateStyleStyleChildContext(
219cdf0e10cSrcweir 		sal_uInt16 nFamily,
220cdf0e10cSrcweir 		sal_uInt16 nPrefix,
221cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
222cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList);
223cdf0e10cSrcweir 
224cdf0e10cSrcweir 	virtual SvXMLStyleContext *CreateDefaultStyleStyleChildContext(
225cdf0e10cSrcweir 		sal_uInt16 nFamily, sal_uInt16 nPrefix,
226cdf0e10cSrcweir 		const ::rtl::OUString& rLocalName,
227cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<
228cdf0e10cSrcweir 			::com::sun::star::xml::sax::XAttributeList > & xAttrList );
229cdf0e10cSrcweir public:
230cdf0e10cSrcweir 	TYPEINFO();
231cdf0e10cSrcweir 
232cdf0e10cSrcweir 	SdXMLStylesContext(
233cdf0e10cSrcweir 		SdXMLImport& rImport,
234cdf0e10cSrcweir 		sal_uInt16 nPrfx,
235cdf0e10cSrcweir 		const rtl::OUString& rLName,
236cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList,
237cdf0e10cSrcweir 		sal_Bool bIsAutoStyle);
238cdf0e10cSrcweir 	virtual ~SdXMLStylesContext();
239cdf0e10cSrcweir 
240cdf0e10cSrcweir 	virtual sal_uInt16 GetFamily( const rtl::OUString& rFamily ) const;
241cdf0e10cSrcweir 	virtual void EndElement();
242cdf0e10cSrcweir 	virtual UniReference< SvXMLImportPropertyMapper > GetImportPropertyMapper(sal_uInt16 nFamily) const;
243cdf0e10cSrcweir 
244cdf0e10cSrcweir 	void SetMasterPageStyles(SdXMLMasterPageContext& rMaster) const;
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > getPageLayouts() const;
247cdf0e10cSrcweir };
248cdf0e10cSrcweir 
249cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
250cdf0e10cSrcweir // office:master-styles context
251cdf0e10cSrcweir //
252cdf0e10cSrcweir class SdXMLMasterStylesContext : public SvXMLImportContext
253cdf0e10cSrcweir {
254cdf0e10cSrcweir 	ImpMasterPageList			maMasterPageList;
255cdf0e10cSrcweir 
GetSdImport() const256cdf0e10cSrcweir 	const SdXMLImport& GetSdImport() const { return (const SdXMLImport&)GetImport(); }
GetSdImport()257cdf0e10cSrcweir 	SdXMLImport& GetSdImport() { return (SdXMLImport&)GetImport(); }
258cdf0e10cSrcweir 
259cdf0e10cSrcweir public:
260cdf0e10cSrcweir 	TYPEINFO();
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	SdXMLMasterStylesContext(
263cdf0e10cSrcweir 		SdXMLImport& rImport,
264cdf0e10cSrcweir 		sal_uInt16 nPrfx,
265cdf0e10cSrcweir 		const rtl::OUString& rLName);
266cdf0e10cSrcweir 	virtual ~SdXMLMasterStylesContext();
267cdf0e10cSrcweir 
268cdf0e10cSrcweir 	virtual SvXMLImportContext* CreateChildContext(
269cdf0e10cSrcweir 		sal_uInt16 nPrefix,
270cdf0e10cSrcweir 		const rtl::OUString& rLocalName,
271cdf0e10cSrcweir 		const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >& xAttrList );
272cdf0e10cSrcweir 
GetMasterPageList() const273cdf0e10cSrcweir 	const ImpMasterPageList& GetMasterPageList() const { return maMasterPageList; }
274cdf0e10cSrcweir };
275cdf0e10cSrcweir 
276cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
277cdf0e10cSrcweir // <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl>
278cdf0e10cSrcweir 
279cdf0e10cSrcweir class SdXMLHeaderFooterDeclContext : public SvXMLStyleContext
280cdf0e10cSrcweir {
281cdf0e10cSrcweir public:
282cdf0e10cSrcweir 	SdXMLHeaderFooterDeclContext( SvXMLImport& rImport, sal_uInt16 nPrfx,
283cdf0e10cSrcweir 		const ::rtl::OUString& rLName,
284cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference<	::com::sun::star::xml::sax::XAttributeList >& xAttrList );
285cdf0e10cSrcweir 
286cdf0e10cSrcweir 	virtual sal_Bool IsTransient() const;
287cdf0e10cSrcweir 	virtual void EndElement();
288cdf0e10cSrcweir 	virtual void Characters( const ::rtl::OUString& rChars );
289cdf0e10cSrcweir 
290cdf0e10cSrcweir private:
291cdf0e10cSrcweir 	::rtl::OUString	maStrName;
292cdf0e10cSrcweir 	::rtl::OUString maStrText;
293cdf0e10cSrcweir 	::rtl::OUString maStrDateTimeFormat;
294cdf0e10cSrcweir 	sal_Bool		mbFixed;
295cdf0e10cSrcweir };
296cdf0e10cSrcweir 
297cdf0e10cSrcweir 
298cdf0e10cSrcweir #endif	//  _XIMPSTYLE_HXX
299