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