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