Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef _SDXMLEXP_IMPL_HXX
21 : #define _SDXMLEXP_IMPL_HXX
22 :
23 : #include <xmloff/xmlexp.hxx>
24 :
25 : #include <com/sun/star/frame/XModel.hpp>
26 : #include <com/sun/star/task/XStatusIndicator.hpp>
27 : #include <com/sun/star/container/XNameAccess.hpp>
28 : #include <com/sun/star/drawing/XDrawPage.hpp>
29 : #include <comphelper/stl_types.hxx>
30 :
31 : #include <vector>
32 :
33 : //////////////////////////////////////////////////////////////////////////////
34 :
35 : class Rectangle;
36 :
37 : class ImpXMLEXPPageMasterInfo;
38 : class ImpXMLAutoLayoutInfo;
39 : class XMLSdPropHdlFactory;
40 : class XMLShapeExportPropertyMapper;
41 : class XMLPageExportPropertyMapper;
42 :
43 : typedef ::std::vector< ImpXMLEXPPageMasterInfo* > ImpXMLEXPPageMasterList;
44 : typedef ::std::vector< ImpXMLAutoLayoutInfo* > ImpXMLAutoLayoutInfoList;
45 :
46 : //////////////////////////////////////////////////////////////////////////////
47 :
48 : enum XmlPlaceholder
49 : {
50 : XmlPlaceholderTitle,
51 : XmlPlaceholderOutline,
52 : XmlPlaceholderSubtitle,
53 : XmlPlaceholderText,
54 : XmlPlaceholderGraphic,
55 : XmlPlaceholderObject,
56 : XmlPlaceholderChart,
57 : XmlPlaceholderOrgchart,
58 : XmlPlaceholderTable,
59 : XmlPlaceholderPage,
60 : XmlPlaceholderNotes,
61 : XmlPlaceholderHandout,
62 : XmlPlaceholderVerticalTitle,
63 : XmlPlaceholderVerticalOutline
64 : };
65 :
66 : DECLARE_STL_STDKEY_SET( sal_Int32, SdXMLFormatMap );
67 :
68 : //////////////////////////////////////////////////////////////////////////////
69 :
70 308 : struct HeaderFooterPageSettingsImpl
71 : {
72 : OUString maStrHeaderDeclName;
73 : OUString maStrFooterDeclName;
74 : OUString maStrDateTimeDeclName;
75 : };
76 :
77 0 : struct DateTimeDeclImpl
78 : {
79 : OUString maStrText;
80 : sal_Bool mbFixed;
81 : sal_Int32 mnFormat;
82 : };
83 :
84 :
85 : //////////////////////////////////////////////////////////////////////////////
86 :
87 : class SdXMLExport : public SvXMLExport
88 : {
89 : com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDocStyleFamilies;
90 : com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocMasterPages;
91 : com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess > mxDocDrawPages;
92 : sal_Int32 mnDocMasterPageCount;
93 : sal_Int32 mnDocDrawPageCount;
94 : sal_uInt32 mnShapeStyleInfoIndex;
95 : sal_uInt32 mnObjectCount;
96 :
97 : // temporary infos
98 : ImpXMLEXPPageMasterList* mpPageMasterInfoList;
99 : ImpXMLEXPPageMasterList* mpPageMasterUsageList;
100 : ImpXMLEXPPageMasterList* mpNotesPageMasterUsageList;
101 : ImpXMLEXPPageMasterInfo* mpHandoutPageMaster;
102 : ImpXMLAutoLayoutInfoList* mpAutoLayoutInfoList;
103 :
104 : com::sun::star::uno::Sequence< OUString > maDrawPagesAutoLayoutNames;
105 :
106 : ::std::vector< OUString > maDrawPagesStyleNames;
107 : ::std::vector< OUString > maDrawNotesPagesStyleNames;
108 : ::std::vector< OUString > maMasterPagesStyleNames;
109 : OUString maHandoutMasterStyleName;
110 : ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings;
111 : ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings;
112 :
113 : ::std::vector< OUString > maHeaderDeclsVector;
114 : ::std::vector< OUString > maFooterDeclsVector;
115 : ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector;
116 :
117 : HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings;
118 :
119 : XMLSdPropHdlFactory* mpSdPropHdlFactory;
120 : XMLShapeExportPropertyMapper* mpPropertySetMapper;
121 : XMLPageExportPropertyMapper* mpPresPagePropsMapper;
122 :
123 : SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formatings for date fields
124 : SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formatings for time fields
125 :
126 : sal_Bool mbIsDraw;
127 : sal_Bool mbFamilyGraphicUsed;
128 : sal_Bool mbFamilyPresentationUsed;
129 :
130 : const OUString msZIndex;
131 : const OUString msEmptyPres;
132 : const OUString msModel;
133 : const OUString msStartShape;
134 : const OUString msEndShape;
135 : const OUString msPageLayoutNames;
136 :
137 : virtual void _ExportStyles(sal_Bool bUsed);
138 : virtual void _ExportAutoStyles();
139 : virtual void _ExportFontDecls();
140 : virtual void _ExportMasterStyles();
141 : virtual void _ExportContent();
142 : // #82003#
143 : virtual void _ExportMeta();
144 :
145 : ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
146 : void ImpPrepPageMasterInfos();
147 : void ImpPrepDrawMasterInfos();
148 : void ImpWritePageMasterInfos();
149 : void ImpPrepAutoLayoutInfos();
150 : HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage );
151 : ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const OUString& rName);
152 :
153 : void ImpPrepDrawPageInfos();
154 : void ImpPrepMasterPageInfos();
155 : void ImpWritePresentationStyles();
156 : OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true );
157 :
158 : sal_Bool ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, OUString& rName);
159 : void ImpWriteAutoLayoutInfos();
160 : void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect);
161 : void ImpWriteHeaderFooterDecls();
162 : void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings );
163 :
164 : void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage );
165 : void exportPresentationSettings();
166 :
167 : // #82003# helper function for recursive object count
168 : sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes);
169 :
170 : OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
171 :
172 : void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
173 : void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
174 :
175 : protected:
176 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
177 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
178 : virtual XMLFontAutoStylePool* CreateFontAutoStylePool();
179 :
180 : public:
181 : SdXMLExport(
182 : const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
183 : sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
184 : virtual ~SdXMLExport();
185 :
186 : void SetProgress(sal_Int32 nProg);
187 :
188 : // XExporter
189 : 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);
190 :
191 : // get factories and mappers
192 : XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
193 76 : XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
194 47 : XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
195 :
196 10 : sal_Bool IsDraw() const { return mbIsDraw; }
197 207 : sal_Bool IsImpress() const { return !mbIsDraw; }
198 :
199 : sal_Bool IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; }
200 : void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = sal_True; }
201 : sal_Bool IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; }
202 : void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = sal_True; }
203 :
204 : virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
205 : virtual void exportDataStyles();
206 : virtual void exportAutoDataStyles();
207 : virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
208 :
209 : // XServiceInfo ( : SvXMLExport )
210 : virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
211 : };
212 :
213 : #endif // _SDXMLEXP_HXX
214 :
215 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|