xref: /AOO41X/main/xmloff/source/draw/sdxmlexp_impl.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 _SDXMLEXP_IMPL_HXX
29*cdf0e10cSrcweir #define _SDXMLEXP_IMPL_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <xmloff/xmlexp.hxx>
32*cdf0e10cSrcweir 
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #include <com/sun/star/frame/XModel.hpp>
35*cdf0e10cSrcweir #include <com/sun/star/task/XStatusIndicator.hpp>
36*cdf0e10cSrcweir #include <com/sun/star/container/XNameAccess.hpp>
37*cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPage.hpp>
38*cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir class SvXMLUnitConverter;
43*cdf0e10cSrcweir class SvXMLExportItemMapper;
44*cdf0e10cSrcweir class SfxPoolItem;
45*cdf0e10cSrcweir class SfxItemSet;
46*cdf0e10cSrcweir class OUStrings_Impl;
47*cdf0e10cSrcweir class OUStringsSort_Impl;
48*cdf0e10cSrcweir class Rectangle;
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class ImpPresPageDrawStylePropMapper;
51*cdf0e10cSrcweir class ImpXMLEXPPageMasterList;
52*cdf0e10cSrcweir class ImpXMLEXPPageMasterInfo;
53*cdf0e10cSrcweir class ImpXMLDrawPageInfoList;
54*cdf0e10cSrcweir class ImpXMLAutoLayoutInfoList;
55*cdf0e10cSrcweir class SvXMLAutoStylePoolP;
56*cdf0e10cSrcweir class XMLSdPropHdlFactory;
57*cdf0e10cSrcweir class ImpXMLShapeStyleInfo;
58*cdf0e10cSrcweir class XMLShapeExportPropertyMapper;
59*cdf0e10cSrcweir class XMLPageExportPropertyMapper;
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
62*cdf0e10cSrcweir 
63*cdf0e10cSrcweir enum XmlPlaceholder
64*cdf0e10cSrcweir {
65*cdf0e10cSrcweir 	XmlPlaceholderTitle,
66*cdf0e10cSrcweir 	XmlPlaceholderOutline,
67*cdf0e10cSrcweir 	XmlPlaceholderSubtitle,
68*cdf0e10cSrcweir 	XmlPlaceholderText,
69*cdf0e10cSrcweir 	XmlPlaceholderGraphic,
70*cdf0e10cSrcweir 	XmlPlaceholderObject,
71*cdf0e10cSrcweir 	XmlPlaceholderChart,
72*cdf0e10cSrcweir 	XmlPlaceholderOrgchart,
73*cdf0e10cSrcweir 	XmlPlaceholderTable,
74*cdf0e10cSrcweir 	XmlPlaceholderPage,
75*cdf0e10cSrcweir 	XmlPlaceholderNotes,
76*cdf0e10cSrcweir 	XmlPlaceholderHandout,
77*cdf0e10cSrcweir 	XmlPlaceholderVerticalTitle,
78*cdf0e10cSrcweir 	XmlPlaceholderVerticalOutline
79*cdf0e10cSrcweir };
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir DECLARE_STL_STDKEY_SET( sal_Int32, SdXMLFormatMap );
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
84*cdf0e10cSrcweir 
85*cdf0e10cSrcweir struct HeaderFooterPageSettingsImpl
86*cdf0e10cSrcweir {
87*cdf0e10cSrcweir 	rtl::OUString maStrHeaderDeclName;
88*cdf0e10cSrcweir 	rtl::OUString maStrFooterDeclName;
89*cdf0e10cSrcweir 	rtl::OUString maStrDateTimeDeclName;
90*cdf0e10cSrcweir };
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir struct DateTimeDeclImpl
93*cdf0e10cSrcweir {
94*cdf0e10cSrcweir 	rtl::OUString maStrText;
95*cdf0e10cSrcweir 	sal_Bool mbFixed;
96*cdf0e10cSrcweir 	sal_Int32 mnFormat;
97*cdf0e10cSrcweir };
98*cdf0e10cSrcweir 
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir class SdXMLExport : public SvXMLExport
103*cdf0e10cSrcweir {
104*cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
105*cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
106*cdf0e10cSrcweir 	com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
107*cdf0e10cSrcweir 	sal_Int32					mnDocMasterPageCount;
108*cdf0e10cSrcweir 	sal_Int32					mnDocDrawPageCount;
109*cdf0e10cSrcweir 	sal_uInt32					mnShapeStyleInfoIndex;
110*cdf0e10cSrcweir 	sal_uInt32					mnObjectCount;
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	// temporary infos
113*cdf0e10cSrcweir 	ImpXMLEXPPageMasterList*	mpPageMasterInfoList;
114*cdf0e10cSrcweir 	ImpXMLEXPPageMasterList*	mpPageMasterUsageList;
115*cdf0e10cSrcweir 	ImpXMLEXPPageMasterList*	mpNotesPageMasterUsageList;
116*cdf0e10cSrcweir 	ImpXMLEXPPageMasterInfo*	mpHandoutPageMaster;
117*cdf0e10cSrcweir 	ImpXMLAutoLayoutInfoList*	mpAutoLayoutInfoList;
118*cdf0e10cSrcweir 
119*cdf0e10cSrcweir 	com::sun::star::uno::Sequence< ::rtl::OUString > maDrawPagesAutoLayoutNames;
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	::std::vector< ::rtl::OUString >		maDrawPagesStyleNames;
122*cdf0e10cSrcweir 	::std::vector< ::rtl::OUString >		maDrawNotesPagesStyleNames;
123*cdf0e10cSrcweir 	::std::vector< ::rtl::OUString >		maMasterPagesStyleNames;
124*cdf0e10cSrcweir 	::rtl::OUString							maHandoutMasterStyleName;
125*cdf0e10cSrcweir 	::std::vector< HeaderFooterPageSettingsImpl >	maDrawPagesHeaderFooterSettings;
126*cdf0e10cSrcweir 	::std::vector< HeaderFooterPageSettingsImpl >	maDrawNotesPagesHeaderFooterSettings;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	::std::vector< ::rtl::OUString >		maHeaderDeclsVector;
129*cdf0e10cSrcweir 	::std::vector< ::rtl::OUString >		maFooterDeclsVector;
130*cdf0e10cSrcweir 	::std::vector< DateTimeDeclImpl >		maDateTimeDeclsVector;
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	HeaderFooterPageSettingsImpl			maHandoutPageHeaderFooterSettings;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir 	XMLSdPropHdlFactory*				mpSdPropHdlFactory;
135*cdf0e10cSrcweir 	XMLShapeExportPropertyMapper*		mpPropertySetMapper;
136*cdf0e10cSrcweir 	XMLPageExportPropertyMapper*		mpPresPagePropsMapper;
137*cdf0e10cSrcweir 
138*cdf0e10cSrcweir 	SdXMLFormatMap	maUsedDateStyles;			// this is a vector with the used formatings for date fields
139*cdf0e10cSrcweir 	SdXMLFormatMap	maUsedTimeStyles;			// this is a vector with the used formatings for time fields
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	sal_Bool					mbIsDraw;
142*cdf0e10cSrcweir 	sal_Bool					mbFamilyGraphicUsed;
143*cdf0e10cSrcweir 	sal_Bool					mbFamilyPresentationUsed;
144*cdf0e10cSrcweir 
145*cdf0e10cSrcweir 	const rtl::OUString			msZIndex;
146*cdf0e10cSrcweir 	const rtl::OUString			msEmptyPres;
147*cdf0e10cSrcweir 	const rtl::OUString			msModel;
148*cdf0e10cSrcweir 	const rtl::OUString			msStartShape;
149*cdf0e10cSrcweir 	const rtl::OUString			msEndShape;
150*cdf0e10cSrcweir 	const rtl::OUString			msPageLayoutNames;
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	virtual void _ExportStyles(sal_Bool bUsed);
153*cdf0e10cSrcweir 	virtual void _ExportAutoStyles();
154*cdf0e10cSrcweir 	virtual void _ExportMasterStyles();
155*cdf0e10cSrcweir 	virtual void _ExportContent();
156*cdf0e10cSrcweir 	// #82003#
157*cdf0e10cSrcweir 	virtual void _ExportMeta();
158*cdf0e10cSrcweir 
159*cdf0e10cSrcweir 	ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
160*cdf0e10cSrcweir 	void ImpPrepPageMasterInfos();
161*cdf0e10cSrcweir 	void ImpPrepDrawMasterInfos();
162*cdf0e10cSrcweir 	void ImpWritePageMasterInfos();
163*cdf0e10cSrcweir 	void ImpPrepAutoLayoutInfos();
164*cdf0e10cSrcweir 	HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage );
165*cdf0e10cSrcweir 	ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const rtl::OUString& rName);
166*cdf0e10cSrcweir 
167*cdf0e10cSrcweir 	void ImpPrepDrawPageInfos();
168*cdf0e10cSrcweir 	void ImpPrepMasterPageInfos();
169*cdf0e10cSrcweir 	void ImpWritePresentationStyles();
170*cdf0e10cSrcweir 	::rtl::OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true );
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir 	sal_Bool ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, rtl::OUString& rName);
173*cdf0e10cSrcweir 	void ImpWriteAutoLayoutInfos();
174*cdf0e10cSrcweir 	void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect);
175*cdf0e10cSrcweir 	void ImpWriteHeaderFooterDecls();
176*cdf0e10cSrcweir 	void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 	void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage );
179*cdf0e10cSrcweir 	void exportPresentationSettings();
180*cdf0e10cSrcweir 
181*cdf0e10cSrcweir 	// #82003# helper function for recursive object count
182*cdf0e10cSrcweir 	sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes);
183*cdf0e10cSrcweir 
184*cdf0e10cSrcweir 	rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 	void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
187*cdf0e10cSrcweir 	void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
188*cdf0e10cSrcweir 
189*cdf0e10cSrcweir protected:
190*cdf0e10cSrcweir 	virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
191*cdf0e10cSrcweir 	virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
192*cdf0e10cSrcweir 
193*cdf0e10cSrcweir public:
194*cdf0e10cSrcweir 	// #110680#
195*cdf0e10cSrcweir 	SdXMLExport(
196*cdf0e10cSrcweir 		const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
197*cdf0e10cSrcweir 		sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
198*cdf0e10cSrcweir 	virtual ~SdXMLExport();
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	void SetProgress(sal_Int32 nProg);
201*cdf0e10cSrcweir 
202*cdf0e10cSrcweir 	// XExporter
203*cdf0e10cSrcweir 	virtual void SAL_CALL setSourceDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
204*cdf0e10cSrcweir 
205*cdf0e10cSrcweir 	// get factories and mappers
206*cdf0e10cSrcweir 	XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
207*cdf0e10cSrcweir 	XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
208*cdf0e10cSrcweir 	XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	sal_Bool IsDraw() const { return mbIsDraw; }
211*cdf0e10cSrcweir 	sal_Bool IsImpress() const { return !mbIsDraw; }
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir 	sal_Bool IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; }
214*cdf0e10cSrcweir 	void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = sal_True; }
215*cdf0e10cSrcweir 	sal_Bool IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; }
216*cdf0e10cSrcweir 	void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = sal_True; }
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 	virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
219*cdf0e10cSrcweir 	virtual void exportDataStyles();
220*cdf0e10cSrcweir 	virtual void exportAutoDataStyles();
221*cdf0e10cSrcweir 	virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
222*cdf0e10cSrcweir 
223*cdf0e10cSrcweir     // XServiceInfo ( : SvXMLExport )
224*cdf0e10cSrcweir     virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
225*cdf0e10cSrcweir };
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir #endif	//  _SDXMLEXP_HXX
228*cdf0e10cSrcweir 
229