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 0 : struct HeaderFooterPageSettingsImpl
71 : {
72 : rtl::OUString maStrHeaderDeclName;
73 : rtl::OUString maStrFooterDeclName;
74 : rtl::OUString maStrDateTimeDeclName;
75 : };
76 :
77 0 : struct DateTimeDeclImpl
78 : {
79 : rtl::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< ::rtl::OUString > maDrawPagesAutoLayoutNames;
105 :
106 : ::std::vector< ::rtl::OUString > maDrawPagesStyleNames;
107 : ::std::vector< ::rtl::OUString > maDrawNotesPagesStyleNames;
108 : ::std::vector< ::rtl::OUString > maMasterPagesStyleNames;
109 : ::rtl::OUString maHandoutMasterStyleName;
110 : ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings;
111 : ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings;
112 :
113 : ::std::vector< ::rtl::OUString > maHeaderDeclsVector;
114 : ::std::vector< ::rtl::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 rtl::OUString msZIndex;
131 : const rtl::OUString msEmptyPres;
132 : const rtl::OUString msModel;
133 : const rtl::OUString msStartShape;
134 : const rtl::OUString msEndShape;
135 : const rtl::OUString msPageLayoutNames;
136 :
137 : virtual void _ExportStyles(sal_Bool bUsed);
138 : virtual void _ExportAutoStyles();
139 : virtual void _ExportMasterStyles();
140 : virtual void _ExportContent();
141 : // #82003#
142 : virtual void _ExportMeta();
143 :
144 : ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xMasterPage );
145 : void ImpPrepPageMasterInfos();
146 : void ImpPrepDrawMasterInfos();
147 : void ImpWritePageMasterInfos();
148 : void ImpPrepAutoLayoutInfos();
149 : HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xDrawPage );
150 : ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(const rtl::OUString& rName);
151 :
152 : void ImpPrepDrawPageInfos();
153 : void ImpPrepMasterPageInfos();
154 : void ImpWritePresentationStyles();
155 : ::rtl::OUString ImpCreatePresPageStyleName( com::sun::star::uno::Reference<com::sun::star::drawing::XDrawPage> xDrawPage, bool bExportBackground = true );
156 :
157 : sal_Bool ImpPrepAutoLayoutInfo(const com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage >& xPage, rtl::OUString& rName);
158 : void ImpWriteAutoLayoutInfos();
159 : void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const Rectangle& rRect);
160 : void ImpWriteHeaderFooterDecls();
161 : void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings );
162 :
163 : void exportFormsElement( com::sun::star::uno::Reference< com::sun::star::drawing::XDrawPage > xDrawPage );
164 : void exportPresentationSettings();
165 :
166 : // #82003# helper function for recursive object count
167 : sal_uInt32 ImpRecursiveObjectCount( com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > xShapes);
168 :
169 : rtl::OUString getNavigationOrder( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
170 :
171 : void collectAnnotationAutoStyles( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
172 : void exportAnnotations( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage );
173 :
174 : protected:
175 : virtual void GetViewSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
176 : virtual void GetConfigurationSettings(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& aProps);
177 :
178 : public:
179 : // #110680#
180 : SdXMLExport(
181 : const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceFactory,
182 : sal_Bool bIsDraw, sal_uInt16 nExportFlags = EXPORT_ALL );
183 : virtual ~SdXMLExport();
184 :
185 : void SetProgress(sal_Int32 nProg);
186 :
187 : // XExporter
188 : 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);
189 :
190 : // get factories and mappers
191 : XMLSdPropHdlFactory* GetSdPropHdlFactory() const { return mpSdPropHdlFactory; }
192 0 : XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper; }
193 0 : XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper; }
194 :
195 0 : sal_Bool IsDraw() const { return mbIsDraw; }
196 0 : sal_Bool IsImpress() const { return !mbIsDraw; }
197 :
198 : sal_Bool IsFamilyGraphicUsed() const { return mbFamilyGraphicUsed; }
199 : void SetFamilyGraphicUsed() { mbFamilyGraphicUsed = sal_True; }
200 : sal_Bool IsFamilyPresentationUsed() const { return mbFamilyPresentationUsed; }
201 : void SetFamilyPresentationUsed() { mbFamilyPresentationUsed = sal_True; }
202 :
203 : virtual void addDataStyle(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False );
204 : virtual void exportDataStyles();
205 : virtual void exportAutoDataStyles();
206 : virtual rtl::OUString getDataStyleName(const sal_Int32 nNumberFormat, sal_Bool bTimeFormat = sal_False ) const;
207 :
208 : // XServiceInfo ( : SvXMLExport )
209 : virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException );
210 : };
211 :
212 : #endif // _SDXMLEXP_HXX
213 :
214 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|