/src/libreoffice/xmloff/source/draw/sdxmlexp_impl.hxx
Line | Count | Source |
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 | | #pragma once |
21 | | |
22 | | #include <xmloff/xmlexp.hxx> |
23 | | |
24 | | #include <com/sun/star/container/XNameAccess.hpp> |
25 | | #include <com/sun/star/drawing/XDrawPage.hpp> |
26 | | |
27 | | #include <o3tl/sorted_vector.hxx> |
28 | | #include <vector> |
29 | | |
30 | | namespace tools { class Rectangle; } |
31 | | |
32 | | class ImpXMLEXPPageMasterInfo; |
33 | | class ImpXMLAutoLayoutInfo; |
34 | | class XMLSdPropHdlFactory; |
35 | | class XMLShapeExportPropertyMapper; |
36 | | class XMLPageExportPropertyMapper; |
37 | | |
38 | | typedef ::std::vector< ImpXMLEXPPageMasterInfo* > ImpXMLEXPPageMasterList; |
39 | | |
40 | | enum XmlPlaceholder |
41 | | { |
42 | | XmlPlaceholderTitle, |
43 | | XmlPlaceholderOutline, |
44 | | XmlPlaceholderSubtitle, |
45 | | XmlPlaceholderGraphic, |
46 | | XmlPlaceholderObject, |
47 | | XmlPlaceholderChart, |
48 | | XmlPlaceholderTable, |
49 | | XmlPlaceholderPage, |
50 | | XmlPlaceholderNotes, |
51 | | XmlPlaceholderHandout, |
52 | | XmlPlaceholderVerticalTitle, |
53 | | XmlPlaceholderVerticalOutline |
54 | | }; |
55 | | |
56 | | typedef o3tl::sorted_vector<sal_Int32> SdXMLFormatMap; |
57 | | |
58 | | struct HeaderFooterPageSettingsImpl |
59 | | { |
60 | | OUString maStrHeaderDeclName; |
61 | | OUString maStrFooterDeclName; |
62 | | OUString maStrDateTimeDeclName; |
63 | | }; |
64 | | |
65 | | struct DateTimeDeclImpl |
66 | | { |
67 | | OUString maStrText; |
68 | | bool mbFixed; |
69 | | sal_Int32 mnFormat; |
70 | | }; |
71 | | |
72 | | class SdXMLExport : public SvXMLExport |
73 | | { |
74 | | css::uno::Reference< css::container::XNameAccess > mxDocStyleFamilies; |
75 | | css::uno::Reference< css::container::XIndexAccess > mxDocMasterPages; |
76 | | css::uno::Reference< css::container::XIndexAccess > mxDocDrawPages; |
77 | | sal_Int32 mnDocMasterPageCount; |
78 | | sal_Int32 mnDocDrawPageCount; |
79 | | sal_uInt32 mnObjectCount; |
80 | | |
81 | | // temporary infos |
82 | | std::vector< std::unique_ptr<ImpXMLEXPPageMasterInfo> > mvPageMasterInfoList; |
83 | | ImpXMLEXPPageMasterList mvPageMasterUsageList; |
84 | | ImpXMLEXPPageMasterList mvNotesPageMasterUsageList; |
85 | | ImpXMLEXPPageMasterInfo* mpHandoutPageMaster; |
86 | | std::vector< std::unique_ptr<ImpXMLAutoLayoutInfo> > mvAutoLayoutInfoList; |
87 | | |
88 | | css::uno::Sequence< OUString > maDrawPagesAutoLayoutNames; |
89 | | |
90 | | ::std::vector< OUString > maDrawPagesStyleNames; |
91 | | ::std::vector< OUString > maDrawNotesPagesStyleNames; |
92 | | ::std::vector< OUString > maMasterPagesStyleNames; |
93 | | OUString maHandoutMasterStyleName; |
94 | | ::std::vector< HeaderFooterPageSettingsImpl > maDrawPagesHeaderFooterSettings; |
95 | | ::std::vector< HeaderFooterPageSettingsImpl > maDrawNotesPagesHeaderFooterSettings; |
96 | | |
97 | | ::std::vector< OUString > maHeaderDeclsVector; |
98 | | ::std::vector< OUString > maFooterDeclsVector; |
99 | | ::std::vector< DateTimeDeclImpl > maDateTimeDeclsVector; |
100 | | |
101 | | HeaderFooterPageSettingsImpl maHandoutPageHeaderFooterSettings; |
102 | | |
103 | | rtl::Reference<XMLSdPropHdlFactory> mpSdPropHdlFactory; |
104 | | rtl::Reference<XMLShapeExportPropertyMapper> mpPropertySetMapper; |
105 | | rtl::Reference<XMLPageExportPropertyMapper> mpPresPagePropsMapper; |
106 | | |
107 | | SdXMLFormatMap maUsedDateStyles; // this is a vector with the used formatting for date fields |
108 | | SdXMLFormatMap maUsedTimeStyles; // this is a vector with the used formatting for time fields |
109 | | |
110 | | bool mbIsDraw; |
111 | | |
112 | | bool mbEmbedFonts = false; |
113 | | bool mbEmbedUsedOnly = false; |
114 | | bool mbEmbedLatinScript = true; |
115 | | bool mbEmbedAsianScript = true; |
116 | | bool mbEmbedComplexScript = true; |
117 | | |
118 | | virtual void ExportStyles_(bool bUsed) override; |
119 | | virtual void ExportAutoStyles_() override; |
120 | | virtual void ExportFontDecls_() override; |
121 | | virtual void ExportMasterStyles_() override; |
122 | | virtual void ExportContent_() override; |
123 | | virtual void ExportMeta_() override; |
124 | | |
125 | | ImpXMLEXPPageMasterInfo* ImpGetOrCreatePageMasterInfo( const css::uno::Reference< css::drawing::XDrawPage >& xMasterPage ); |
126 | | void ImpPrepPageMasterInfos(); |
127 | | void ImpWritePageMasterInfos(); |
128 | | void ImpPrepAutoLayoutInfos(); |
129 | | HeaderFooterPageSettingsImpl ImpPrepDrawPageHeaderFooterDecls( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ); |
130 | | ImpXMLEXPPageMasterInfo* ImpGetPageMasterInfoByName(std::u16string_view rName); |
131 | | |
132 | | void ImpPrepDrawPageInfos(); |
133 | | void ImpPrepMasterPageInfos(); |
134 | | void ImpWritePresentationStyles(); |
135 | | OUString ImpCreatePresPageStyleName( const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage, bool bExportBackground = true ); |
136 | | |
137 | | bool ImpPrepAutoLayoutInfo(const css::uno::Reference< css::drawing::XDrawPage >& xPage, OUString& rName); |
138 | | void ImpWriteAutoLayoutInfos(); |
139 | | void ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const tools::Rectangle& rRect); |
140 | | void ImpWriteHeaderFooterDecls(); |
141 | | void ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings ); |
142 | | |
143 | | void exportFormsElement( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ); |
144 | | void exportTheme(const css::uno::Reference<css::drawing::XDrawPage>& xDrawPage); |
145 | | void exportPresentationSettings(); |
146 | | void exportSections(); |
147 | | |
148 | | // #82003# helper function for recursive object count |
149 | | sal_uInt32 ImpRecursiveObjectCount( const css::uno::Reference< css::drawing::XShapes >& xShapes); |
150 | | |
151 | | OUString getNavigationOrder( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ); |
152 | | |
153 | | void collectAnnotationAutoStyles( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ); |
154 | | void exportAnnotations( const css::uno::Reference< css::drawing::XDrawPage >& xDrawPage ); |
155 | | |
156 | | protected: |
157 | | virtual void GetViewSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override; |
158 | | virtual void GetConfigurationSettings(css::uno::Sequence<css::beans::PropertyValue>& aProps) override; |
159 | | virtual XMLFontAutoStylePool* CreateFontAutoStylePool() override; |
160 | 47 | virtual bool getEmbedFonts() override { return mbEmbedFonts; } |
161 | 47 | virtual bool getEmbedOnlyUsedFonts() override { return mbEmbedUsedOnly; } |
162 | 47 | virtual bool getEmbedLatinScript() override { return mbEmbedLatinScript; } |
163 | 47 | virtual bool getEmbedAsianScript() override { return mbEmbedAsianScript; } |
164 | 47 | virtual bool getEmbedComplexScript() override { return mbEmbedComplexScript; } |
165 | | |
166 | | public: |
167 | | SdXMLExport( |
168 | | const css::uno::Reference< css::uno::XComponentContext >& xContext, |
169 | | OUString const & implementationName, |
170 | | bool bIsDraw, SvXMLExportFlags nExportFlags ); |
171 | | virtual ~SdXMLExport() override; |
172 | | |
173 | | void collectAutoStyles() override; |
174 | | |
175 | | // XExporter |
176 | | virtual void SAL_CALL setSourceDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; |
177 | | |
178 | | // get factories and mappers |
179 | 254 | XMLShapeExportPropertyMapper* GetPropertySetMapper() const { return mpPropertySetMapper.get(); } |
180 | 239 | XMLPageExportPropertyMapper* GetPresPagePropsMapper() const { return mpPresPagePropsMapper.get(); } |
181 | | |
182 | 69 | bool IsDraw() const { return mbIsDraw; } |
183 | 1.19k | bool IsImpress() const { return !mbIsDraw; } |
184 | | |
185 | | virtual void addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) override; |
186 | | virtual void exportDataStyles() override; |
187 | | virtual void exportAutoDataStyles() override; |
188 | | virtual OUString getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat = false ) const override; |
189 | | }; |
190 | | |
191 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |