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