/src/libreoffice/xmloff/source/draw/sdxmlexp.cxx
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 | | #include <sal/config.h> |
21 | | |
22 | | #include <string_view> |
23 | | |
24 | | #include <xmloff/autolayout.hxx> |
25 | | #include <xmloff/unointerfacetouniqueidentifiermapper.hxx> |
26 | | #include <xmloff/namespacemap.hxx> |
27 | | #include <xmloff/xmlnamespace.hxx> |
28 | | #include <xmloff/xmluconv.hxx> |
29 | | #include <xmloff/xmltoken.hxx> |
30 | | #include <com/sun/star/lang/XMultiServiceFactory.hpp> |
31 | | #include <com/sun/star/presentation/XPresentationSupplier.hpp> |
32 | | #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp> |
33 | | #include <com/sun/star/geometry/RealPoint2D.hpp> |
34 | | #include <com/sun/star/office/XAnnotationAccess.hpp> |
35 | | #include <com/sun/star/uno/Any.hxx> |
36 | | #include "sdxmlexp_impl.hxx" |
37 | | #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> |
38 | | #include <com/sun/star/drawing/XMasterPagesSupplier.hpp> |
39 | | #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp> |
40 | | #include <com/sun/star/container/XIndexContainer.hpp> |
41 | | #include <com/sun/star/view/PaperOrientation.hpp> |
42 | | #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> |
43 | | |
44 | | #include <com/sun/star/form/XFormsSupplier2.hpp> |
45 | | #include <com/sun/star/presentation/XPresentationPage.hpp> |
46 | | #include <com/sun/star/drawing/XMasterPageTarget.hpp> |
47 | | #include <com/sun/star/text/XText.hpp> |
48 | | #include <com/sun/star/animations/XAnimationNodeSupplier.hpp> |
49 | | #include <com/sun/star/container/XNamed.hpp> |
50 | | #include <com/sun/star/util/Duration.hpp> |
51 | | #include <com/sun/star/util/MeasureUnit.hpp> |
52 | | #include <rtl/ustrbuf.hxx> |
53 | | #include <sal/log.hxx> |
54 | | #include <comphelper/diagnose_ex.hxx> |
55 | | #include <tools/gen.hxx> |
56 | | #include <sax/tools/converter.hxx> |
57 | | #include <xmloff/xmlaustp.hxx> |
58 | | #include <xmloff/families.hxx> |
59 | | #include <xmloff/styleexp.hxx> |
60 | | #include <xmloff/settingsstore.hxx> |
61 | | #include <xmloff/table/XMLTableExport.hxx> |
62 | | #include <xmloff/ProgressBarHelper.hxx> |
63 | | #include "sdpropls.hxx" |
64 | | #include <xmloff/xmlexppr.hxx> |
65 | | |
66 | | #include <PropertySetMerger.hxx> |
67 | | #include "layerexp.hxx" |
68 | | |
69 | | #include "XMLNumberStylesExport.hxx" |
70 | | |
71 | | #include <xmloff/animationexport.hxx> |
72 | | |
73 | | #include <com/sun/star/document/XDocumentProperties.hpp> |
74 | | #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp> |
75 | | #include <docmodel/uno/UnoTheme.hxx> |
76 | | |
77 | | using namespace ::com::sun::star; |
78 | | using namespace ::com::sun::star::uno; |
79 | | using namespace ::com::sun::star::beans; |
80 | | using namespace ::com::sun::star::util; |
81 | | using namespace ::com::sun::star::container; |
82 | | using namespace ::com::sun::star::drawing; |
83 | | using namespace ::com::sun::star::office; |
84 | | using namespace ::com::sun::star::presentation; |
85 | | using namespace ::com::sun::star::geometry; |
86 | | using namespace ::com::sun::star::text; |
87 | | using namespace ::xmloff::token; |
88 | | |
89 | | class ImpXMLEXPPageMasterInfo |
90 | | { |
91 | | sal_Int32 mnBorderBottom; |
92 | | sal_Int32 mnBorderLeft; |
93 | | sal_Int32 mnBorderRight; |
94 | | sal_Int32 mnBorderTop; |
95 | | sal_Int32 mnWidth; |
96 | | sal_Int32 mnHeight; |
97 | | view::PaperOrientation meOrientation; |
98 | | OUString msName; |
99 | | OUString msMasterPageName; |
100 | | |
101 | | public: |
102 | | ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage); |
103 | | bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const; |
104 | | void SetName(const OUString& rStr); |
105 | | |
106 | 138 | const OUString& GetName() const { return msName; } |
107 | 0 | const OUString& GetMasterPageName() const { return msMasterPageName; } |
108 | | |
109 | 138 | sal_Int32 GetBorderBottom() const { return mnBorderBottom; } |
110 | 138 | sal_Int32 GetBorderLeft() const { return mnBorderLeft; } |
111 | 138 | sal_Int32 GetBorderRight() const { return mnBorderRight; } |
112 | 138 | sal_Int32 GetBorderTop() const { return mnBorderTop; } |
113 | 138 | sal_Int32 GetWidth() const { return mnWidth; } |
114 | 138 | sal_Int32 GetHeight() const { return mnHeight; } |
115 | 138 | view::PaperOrientation GetOrientation() const { return meOrientation; } |
116 | | }; |
117 | | |
118 | | ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo( |
119 | | const SdXMLExport& rExp, |
120 | | const Reference<XDrawPage>& xPage) |
121 | 162 | : mnBorderBottom(0), |
122 | 162 | mnBorderLeft(0), |
123 | 162 | mnBorderRight(0), |
124 | 162 | mnBorderTop(0), |
125 | 162 | mnWidth(0), |
126 | 162 | mnHeight(0), |
127 | 162 | meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE) |
128 | 162 | { |
129 | 162 | Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY); |
130 | 162 | if(xPropSet.is()) |
131 | 162 | { |
132 | 162 | Any aAny; |
133 | | |
134 | 162 | Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() ); |
135 | 162 | if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(u"BorderBottom"_ustr)) |
136 | 162 | { |
137 | 162 | aAny = xPropSet->getPropertyValue(u"BorderBottom"_ustr); |
138 | 162 | aAny >>= mnBorderBottom; |
139 | | |
140 | 162 | aAny = xPropSet->getPropertyValue(u"BorderLeft"_ustr); |
141 | 162 | aAny >>= mnBorderLeft; |
142 | | |
143 | 162 | aAny = xPropSet->getPropertyValue(u"BorderRight"_ustr); |
144 | 162 | aAny >>= mnBorderRight; |
145 | | |
146 | 162 | aAny = xPropSet->getPropertyValue(u"BorderTop"_ustr); |
147 | 162 | aAny >>= mnBorderTop; |
148 | 162 | } |
149 | | |
150 | 162 | if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(u"Width"_ustr)) |
151 | 162 | { |
152 | 162 | aAny = xPropSet->getPropertyValue(u"Width"_ustr); |
153 | 162 | aAny >>= mnWidth; |
154 | | |
155 | 162 | aAny = xPropSet->getPropertyValue(u"Height"_ustr); |
156 | 162 | aAny >>= mnHeight; |
157 | 162 | } |
158 | | |
159 | 162 | if( xPropsInfo.is() && xPropsInfo->hasPropertyByName(u"Orientation"_ustr)) |
160 | 162 | { |
161 | 162 | aAny = xPropSet->getPropertyValue(u"Orientation"_ustr); |
162 | 162 | aAny >>= meOrientation; |
163 | 162 | } |
164 | 162 | } |
165 | | |
166 | 162 | Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY); |
167 | 162 | if(xMasterNamed.is()) |
168 | 162 | { |
169 | 162 | msMasterPageName = xMasterNamed->getName(); |
170 | 162 | } |
171 | 162 | } |
172 | | |
173 | | bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const |
174 | 0 | { |
175 | 0 | return ((mnBorderBottom == rInfo.mnBorderBottom) |
176 | 0 | && (mnBorderLeft == rInfo.mnBorderLeft) |
177 | 0 | && (mnBorderRight == rInfo.mnBorderRight) |
178 | 0 | && (mnBorderTop == rInfo.mnBorderTop) |
179 | 0 | && (mnWidth == rInfo.mnWidth) |
180 | 0 | && (mnHeight == rInfo.mnHeight) |
181 | 0 | && (meOrientation == rInfo.meOrientation)); |
182 | 0 | } |
183 | | |
184 | | void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr) |
185 | 138 | { |
186 | 138 | msName = rStr; |
187 | 138 | } |
188 | | |
189 | 0 | #define IMP_AUTOLAYOUT_INFO_MAX (35L) |
190 | | |
191 | | class ImpXMLAutoLayoutInfo |
192 | | { |
193 | | sal_uInt16 mnType; |
194 | | ImpXMLEXPPageMasterInfo* mpPageMasterInfo; |
195 | | OUString msLayoutName; |
196 | | tools::Rectangle maTitleRect; |
197 | | tools::Rectangle maPresRect; |
198 | | sal_Int32 mnGapX; |
199 | | sal_Int32 mnGapY; |
200 | | |
201 | | public: |
202 | | ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf); |
203 | | |
204 | 0 | sal_uInt16 GetLayoutType() const { return mnType; } |
205 | 0 | ImpXMLEXPPageMasterInfo* GetPageMasterInfo() const { return mpPageMasterInfo; } |
206 | 0 | sal_Int32 GetGapX() const { return mnGapX; } |
207 | 0 | sal_Int32 GetGapY() const { return mnGapY; } |
208 | | |
209 | 0 | const OUString& GetLayoutName() const { return msLayoutName; } |
210 | 0 | void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; } |
211 | | |
212 | 0 | const tools::Rectangle& GetTitleRectangle() const { return maTitleRect; } |
213 | 0 | const tools::Rectangle& GetPresRectangle() const { return maPresRect; } |
214 | | |
215 | | static bool IsCreateNecessary(sal_uInt16 nTyp); |
216 | | }; |
217 | | |
218 | | bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp) |
219 | 0 | { |
220 | 0 | if(nTyp == 5 /* AUTOLAYOUT_ORG */ |
221 | 0 | || nTyp == 20 /* AUTOLAYOUT_NONE */ |
222 | 0 | || nTyp >= IMP_AUTOLAYOUT_INFO_MAX) |
223 | 0 | return false; |
224 | 0 | return true; |
225 | 0 | } |
226 | | |
227 | | ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf) |
228 | 0 | : mnType(nTyp) |
229 | 0 | , mpPageMasterInfo(pInf) |
230 | 0 | , mnGapX(0) |
231 | 0 | , mnGapY(0) |
232 | 0 | { |
233 | | // create full info (initialize with typical values) |
234 | 0 | Point aPagePos(0,0); |
235 | 0 | Size aPageSize(28000, 21000); |
236 | 0 | Size aPageInnerSize(28000, 21000); |
237 | |
|
238 | 0 | if(mpPageMasterInfo) |
239 | 0 | { |
240 | 0 | aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop()); |
241 | 0 | aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight()); |
242 | 0 | aPageInnerSize = aPageSize; |
243 | 0 | aPageInnerSize.AdjustWidth(-(mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight())); |
244 | 0 | aPageInnerSize.AdjustHeight(-(mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom())); |
245 | 0 | } |
246 | | |
247 | | // title rectangle aligning |
248 | 0 | Point aTitlePos(aPagePos); |
249 | 0 | Size aTitleSize(aPageInnerSize); |
250 | |
|
251 | 0 | if(mnType == 21 /* AUTOLAYOUT_NOTES */) |
252 | 0 | { |
253 | 0 | aTitleSize.setHeight(static_cast<tools::Long>(aTitleSize.Height() / 2.5)); |
254 | 0 | Point aPos = aTitlePos; |
255 | 0 | aPos.AdjustY( tools::Long( aTitleSize.Height() * 0.083 ) ); |
256 | 0 | Size aPartArea = aTitleSize; |
257 | 0 | Size aSize; |
258 | | |
259 | | // scale handout rectangle using actual page size |
260 | 0 | double fH = static_cast<double>(aPartArea.Width()) / aPageSize.Width(); |
261 | 0 | double fV = static_cast<double>(aPartArea.Height()) / aPageSize.Height(); |
262 | |
|
263 | 0 | if ( fH > fV ) |
264 | 0 | fH = fV; |
265 | 0 | aSize.setWidth( static_cast<tools::Long>(fH * aPageSize.Width()) ); |
266 | 0 | aSize.setHeight( static_cast<tools::Long>(fH * aPageSize.Height()) ); |
267 | |
|
268 | 0 | aPos.AdjustX((aPartArea.Width() - aSize.Width()) / 2); |
269 | 0 | aPos.AdjustY((aPartArea.Height()- aSize.Height())/ 2); |
270 | |
|
271 | 0 | aTitlePos = aPos; |
272 | 0 | aTitleSize = aSize; |
273 | 0 | } |
274 | 0 | else if(mnType == AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT || mnType == AUTOLAYOUT_VTITLE_VCONTENT) |
275 | 0 | { |
276 | 0 | Point aClassicTPos( |
277 | 0 | aTitlePos.X() + tools::Long( aTitleSize.Width() * 0.0735 ), |
278 | 0 | aTitlePos.Y() + tools::Long( aTitleSize.Height() * 0.083 )); |
279 | 0 | Size aClassicTSize( |
280 | 0 | tools::Long( aTitleSize.Width() * 0.854 ), |
281 | 0 | tools::Long( aTitleSize.Height() * 0.167 )); |
282 | 0 | Point aLPos(aPagePos); |
283 | 0 | Size aLSize(aPageInnerSize); |
284 | 0 | Point aClassicLPos( |
285 | 0 | aLPos.X() + tools::Long( aLSize.Width() * 0.0735 ), |
286 | 0 | aLPos.Y() + tools::Long( aLSize.Height() * 0.472 )); |
287 | 0 | Size aClassicLSize( |
288 | 0 | tools::Long( aLSize.Width() * 0.854 ), |
289 | 0 | tools::Long( aLSize.Height() * 0.444 )); |
290 | |
|
291 | 0 | aTitlePos.setX( (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height() ); |
292 | 0 | aTitlePos.setY( aClassicTPos.Y() ); |
293 | 0 | aTitleSize.setWidth( aClassicTSize.Height() ); |
294 | 0 | aTitleSize.setHeight( (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y() ); |
295 | 0 | } |
296 | 0 | else |
297 | 0 | { |
298 | 0 | aTitlePos.AdjustX( tools::Long( aTitleSize.Width() * 0.0735 ) ); |
299 | 0 | aTitlePos.AdjustY( tools::Long( aTitleSize.Height() * 0.083 ) ); |
300 | 0 | aTitleSize.setWidth( tools::Long( aTitleSize.Width() * 0.854 ) ); |
301 | 0 | aTitleSize.setHeight( tools::Long( aTitleSize.Height() * 0.167 ) ); |
302 | 0 | } |
303 | |
|
304 | 0 | maTitleRect.SetPos(aTitlePos); |
305 | 0 | maTitleRect.SetSize(aTitleSize); |
306 | | |
307 | | // layout rectangle aligning |
308 | 0 | Point aLayoutPos(aPagePos); |
309 | 0 | Size aLayoutSize(aPageInnerSize); |
310 | |
|
311 | 0 | if(mnType == 21 /* AUTOLAYOUT_NOTES */) |
312 | 0 | { |
313 | 0 | aLayoutPos.AdjustX( tools::Long( aLayoutSize.Width() * 0.0735 ) ); |
314 | 0 | aLayoutPos.AdjustY( tools::Long( aLayoutSize.Height() * 0.472 ) ); |
315 | 0 | aLayoutSize.setWidth( tools::Long( aLayoutSize.Width() * 0.854 ) ); |
316 | 0 | aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.444 ) ); |
317 | 0 | } |
318 | 0 | else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT* |
319 | 0 | { |
320 | | // keep info for inner area in maPresRect, put info for gap size |
321 | | // to maTitleRect position |
322 | 0 | mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2; |
323 | 0 | mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2; |
324 | |
|
325 | 0 | if(!mnGapX) |
326 | 0 | mnGapX = aPageSize.Width() / 10; |
327 | |
|
328 | 0 | if(!mnGapY) |
329 | 0 | mnGapY = aPageSize.Height() / 10; |
330 | |
|
331 | 0 | if(mnGapX < aPageInnerSize.Width() / 10) |
332 | 0 | mnGapX = aPageInnerSize.Width() / 10; |
333 | |
|
334 | 0 | if(mnGapY < aPageInnerSize.Height() / 10) |
335 | 0 | mnGapY = aPageInnerSize.Height() / 10; |
336 | 0 | } |
337 | 0 | else if(mnType == AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT || mnType == AUTOLAYOUT_VTITLE_VCONTENT) |
338 | 0 | { |
339 | 0 | Point aClassicTPos( |
340 | 0 | aTitlePos.X() + tools::Long( aTitleSize.Width() * 0.0735 ), |
341 | 0 | aTitlePos.Y() + tools::Long( aTitleSize.Height() * 0.083 )); |
342 | 0 | Size aClassicTSize( |
343 | 0 | tools::Long( aTitleSize.Width() * 0.854 ), |
344 | 0 | tools::Long( aTitleSize.Height() * 0.167 )); |
345 | 0 | Point aClassicLPos( |
346 | 0 | aLayoutPos.X() + tools::Long( aLayoutSize.Width() * 0.0735 ), |
347 | 0 | aLayoutPos.Y() + tools::Long( aLayoutSize.Height() * 0.472 )); |
348 | 0 | Size aClassicLSize( |
349 | 0 | tools::Long( aLayoutSize.Width() * 0.854 ), |
350 | 0 | tools::Long( aLayoutSize.Height() * 0.444 )); |
351 | |
|
352 | 0 | aLayoutPos.setX( aClassicLPos.X() ); |
353 | 0 | aLayoutPos.setY( aClassicTPos.Y() ); |
354 | 0 | aLayoutSize.setWidth( (aClassicLPos.X() + aClassicLSize.Width()) |
355 | 0 | - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height())))); |
356 | 0 | aLayoutSize.setHeight( (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y() ); |
357 | 0 | } |
358 | 0 | else if( mnType == AUTOLAYOUT_ONLY_TEXT ) |
359 | 0 | { |
360 | 0 | aLayoutPos = aTitlePos; |
361 | 0 | aLayoutSize.setWidth( aTitleSize.Width() ); |
362 | 0 | aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.825 ) ); |
363 | 0 | } |
364 | 0 | else |
365 | 0 | { |
366 | 0 | aLayoutPos.AdjustX( tools::Long( aLayoutSize.Width() * 0.0735 ) ); |
367 | 0 | aLayoutPos.AdjustY( tools::Long( aLayoutSize.Height() * 0.278 ) ); |
368 | 0 | aLayoutSize.setWidth( tools::Long( aLayoutSize.Width() * 0.854 ) ); |
369 | 0 | aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.630 ) ); |
370 | 0 | } |
371 | |
|
372 | 0 | maPresRect.SetPos(aLayoutPos); |
373 | 0 | maPresRect.SetSize(aLayoutSize); |
374 | 0 | } |
375 | | |
376 | | constexpr OUString gsPageLayoutNames( u"PageLayoutNames"_ustr ); |
377 | | |
378 | | SdXMLExport::SdXMLExport( |
379 | | const css::uno::Reference< css::uno::XComponentContext >& xContext, |
380 | | OUString const & implementationName, |
381 | | bool bIsDraw, SvXMLExportFlags nExportFlags ) |
382 | 162 | : SvXMLExport( xContext, implementationName, util::MeasureUnit::CM, |
383 | 162 | bIsDraw ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ), |
384 | 162 | mnDocMasterPageCount(0), |
385 | 162 | mnDocDrawPageCount(0), |
386 | 162 | mnObjectCount(0), |
387 | 162 | mpHandoutPageMaster(nullptr), |
388 | 162 | mbIsDraw(bIsDraw) |
389 | 162 | { |
390 | | |
391 | 162 | } |
392 | | |
393 | | // XExporter |
394 | | void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc ) |
395 | 162 | { |
396 | 162 | SvXMLExport::setSourceDocument( xDoc ); |
397 | | |
398 | | // prepare factory parts |
399 | 162 | mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this ); |
400 | | |
401 | | // construct PropertySetMapper |
402 | 162 | rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( mpSdPropHdlFactory, true); |
403 | | |
404 | | // get or create text paragraph export |
405 | 162 | GetTextParagraphExport(); |
406 | 162 | mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this ); |
407 | | |
408 | | // chain text attributes |
409 | 162 | mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this)); |
410 | | |
411 | | // construct PresPagePropsMapper |
412 | 162 | xMapper = new XMLPropertySetMapper(aXMLSDPresPageProps, mpSdPropHdlFactory, true); |
413 | | |
414 | 162 | mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this ); |
415 | | |
416 | | // add family name |
417 | 162 | GetAutoStylePool()->AddFamily( |
418 | 162 | XmlStyleFamily::SD_GRAPHICS_ID, |
419 | 162 | XML_STYLE_FAMILY_SD_GRAPHICS_NAME, |
420 | 162 | GetPropertySetMapper(), |
421 | 162 | XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX); |
422 | 162 | GetAutoStylePool()->AddFamily( |
423 | 162 | XmlStyleFamily::SD_PRESENTATION_ID, |
424 | 162 | XML_STYLE_FAMILY_SD_PRESENTATION_NAME, |
425 | 162 | GetPropertySetMapper(), |
426 | 162 | XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX); |
427 | 162 | GetAutoStylePool()->AddFamily( |
428 | 162 | XmlStyleFamily::SD_DRAWINGPAGE_ID, |
429 | 162 | XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME, |
430 | 162 | GetPresPagePropsMapper(), |
431 | 162 | XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX); |
432 | | // prepare access to styles |
433 | 162 | Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY ); |
434 | 162 | if(xFamSup.is()) |
435 | 162 | { |
436 | 162 | mxDocStyleFamilies = xFamSup->getStyleFamilies(); |
437 | 162 | } |
438 | | |
439 | | // prepare access to master pages |
440 | 162 | Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY); |
441 | 162 | if(xMasterPagesSupplier.is()) |
442 | 162 | { |
443 | 162 | mxDocMasterPages = xMasterPagesSupplier->getMasterPages(); |
444 | 162 | if(mxDocMasterPages.is()) |
445 | 162 | { |
446 | 162 | mnDocMasterPageCount = mxDocMasterPages->getCount(); |
447 | 162 | maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, u""_ustr ); |
448 | 162 | } |
449 | 162 | } |
450 | | |
451 | | // prepare access to draw pages |
452 | 162 | Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY); |
453 | 162 | if(xDrawPagesSupplier.is()) |
454 | 162 | { |
455 | 162 | mxDocDrawPages = xDrawPagesSupplier->getDrawPages(); |
456 | 162 | if(mxDocDrawPages.is()) |
457 | 162 | { |
458 | 162 | mnDocDrawPageCount = mxDocDrawPages->getCount(); |
459 | 162 | maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, u""_ustr ); |
460 | 162 | maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, u""_ustr ); |
461 | 162 | if( !mbIsDraw ) |
462 | 0 | maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 ); |
463 | | |
464 | 162 | HeaderFooterPageSettingsImpl aEmptySettings; |
465 | 162 | maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings ); |
466 | 162 | maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings ); |
467 | 162 | } |
468 | 162 | } |
469 | | |
470 | | // #82003# count all draw objects for use with progress bar. |
471 | | // #88245# init mnObjectCount once, use counter itself as flag. It |
472 | | // is initialized to 0. |
473 | 162 | if(!mnObjectCount) |
474 | 162 | { |
475 | 162 | if( IsImpress() ) |
476 | 0 | { |
477 | | // #91587# add handout master count |
478 | 0 | Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY); |
479 | 0 | if(xHandoutSupp.is()) |
480 | 0 | { |
481 | 0 | Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage()); |
482 | 0 | if(xHandoutPage.is() && xHandoutPage->getCount()) |
483 | 0 | mnObjectCount += ImpRecursiveObjectCount(xHandoutPage); |
484 | 0 | } |
485 | 0 | } |
486 | | |
487 | 162 | if(mxDocMasterPages.is()) |
488 | 162 | { |
489 | 324 | for(sal_Int32 a(0); a < mnDocMasterPageCount; a++) |
490 | 162 | { |
491 | 162 | Any aAny(mxDocMasterPages->getByIndex(a)); |
492 | 162 | Reference< drawing::XShapes > xMasterPage; |
493 | | |
494 | 162 | if((aAny >>= xMasterPage) && xMasterPage.is()) |
495 | 162 | { |
496 | 162 | mnObjectCount += ImpRecursiveObjectCount(xMasterPage); |
497 | 162 | } |
498 | | |
499 | 162 | if( IsImpress() ) |
500 | 0 | { |
501 | | // #91587# take notes pages from master pages into account |
502 | 0 | Reference<presentation::XPresentationPage> xPresPage; |
503 | 0 | if((aAny >>= xPresPage) && xPresPage.is()) |
504 | 0 | { |
505 | 0 | Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage()); |
506 | 0 | if(xNotesPage.is() && xNotesPage->getCount()) |
507 | 0 | mnObjectCount += ImpRecursiveObjectCount(xNotesPage); |
508 | 0 | } |
509 | 0 | } |
510 | 162 | } |
511 | 162 | } |
512 | | |
513 | 162 | if(mxDocDrawPages.is()) |
514 | 162 | { |
515 | 408 | for(sal_Int32 a(0); a < mnDocDrawPageCount; a++) |
516 | 246 | { |
517 | 246 | Any aAny(mxDocDrawPages->getByIndex(a)); |
518 | 246 | Reference< drawing::XShapes > xPage; |
519 | | |
520 | 246 | if((aAny >>= xPage) && xPage.is()) |
521 | 246 | { |
522 | 246 | mnObjectCount += ImpRecursiveObjectCount(xPage); |
523 | 246 | } |
524 | | |
525 | 246 | if( IsImpress() ) |
526 | 0 | { |
527 | | // #91587# take notes pages from draw pages into account |
528 | 0 | Reference<presentation::XPresentationPage> xPresPage; |
529 | 0 | if((aAny >>= xPresPage) && xPresPage.is()) |
530 | 0 | { |
531 | 0 | Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage()); |
532 | 0 | if(xNotesPage.is() && xNotesPage->getCount()) |
533 | 0 | mnObjectCount += ImpRecursiveObjectCount(xNotesPage); |
534 | 0 | } |
535 | 0 | } |
536 | 246 | } |
537 | 162 | } |
538 | | |
539 | | // #82003# init progress bar |
540 | 162 | GetProgressBarHelper()->SetReference(mnObjectCount); |
541 | 162 | } |
542 | | |
543 | | // add namespaces |
544 | 162 | GetNamespaceMap_().Add( |
545 | 162 | GetXMLToken(XML_NP_PRESENTATION), |
546 | 162 | GetXMLToken(XML_N_PRESENTATION), |
547 | 162 | XML_NAMESPACE_PRESENTATION); |
548 | | |
549 | 162 | GetNamespaceMap_().Add( |
550 | 162 | GetXMLToken(XML_NP_SMIL), |
551 | 162 | GetXMLToken(XML_N_SMIL_COMPAT), |
552 | 162 | XML_NAMESPACE_SMIL); |
553 | | |
554 | 162 | GetNamespaceMap_().Add( |
555 | 162 | GetXMLToken(XML_NP_ANIMATION), |
556 | 162 | GetXMLToken(XML_N_ANIMATION), |
557 | 162 | XML_NAMESPACE_ANIMATION); |
558 | | |
559 | 162 | if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) |
560 | 162 | { |
561 | 162 | GetNamespaceMap_().Add( |
562 | 162 | GetXMLToken(XML_NP_OFFICE_EXT), |
563 | 162 | GetXMLToken(XML_N_OFFICE_EXT), |
564 | 162 | XML_NAMESPACE_OFFICE_EXT); |
565 | 162 | } |
566 | | |
567 | 162 | GetShapeExport()->enableLayerExport(); |
568 | | |
569 | | // #88546# enable progress bar increments |
570 | 162 | GetShapeExport()->enableHandleProgressBar(); |
571 | 162 | } |
572 | | |
573 | | // #82003# helper function for recursive object count |
574 | | sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(const Reference< drawing::XShapes >& xShapes) |
575 | 408 | { |
576 | 408 | sal_uInt32 nRetval(0); |
577 | | |
578 | 408 | if(xShapes.is()) |
579 | 408 | { |
580 | 408 | sal_Int32 nCount = xShapes->getCount(); |
581 | | |
582 | 654 | for(sal_Int32 a(0); a < nCount; a++) |
583 | 246 | { |
584 | 246 | Any aAny(xShapes->getByIndex(a)); |
585 | 246 | Reference< drawing::XShapes > xGroup; |
586 | | |
587 | 246 | if((aAny >>= xGroup) && xGroup.is()) |
588 | 0 | { |
589 | | // #93180# count group objects, too. |
590 | 0 | nRetval += 1 + ImpRecursiveObjectCount(xGroup); |
591 | 0 | } |
592 | 246 | else |
593 | 246 | { |
594 | 246 | nRetval++; |
595 | 246 | } |
596 | 246 | } |
597 | 408 | } |
598 | | |
599 | 408 | return nRetval; |
600 | 408 | } |
601 | | |
602 | | SdXMLExport::~SdXMLExport() |
603 | 162 | { |
604 | | // cleanup factory, decrease refcount. Should lead to destruction. |
605 | 162 | mpSdPropHdlFactory.clear(); |
606 | | |
607 | | // cleanup mapper, decrease refcount. Should lead to destruction. |
608 | 162 | mpPropertySetMapper.clear(); |
609 | | |
610 | | // cleanup presPage mapper, decrease refcount. Should lead to destruction. |
611 | 162 | mpPresPagePropsMapper.clear(); |
612 | | |
613 | 162 | mvPageMasterInfoList.clear(); |
614 | | |
615 | | // clear auto-layout infos |
616 | 162 | mvAutoLayoutInfoList.clear(); |
617 | 162 | } |
618 | | |
619 | | void SdXMLExport::ImpPrepAutoLayoutInfos() |
620 | 138 | { |
621 | 138 | if(!IsImpress()) |
622 | 138 | return; |
623 | | |
624 | 0 | OUString aStr; |
625 | 0 | auto DrawPagesAutoLayoutNamesRange = asNonConstRange(maDrawPagesAutoLayoutNames); |
626 | 0 | Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); |
627 | 0 | if( xHandoutSupp.is() ) |
628 | 0 | { |
629 | 0 | Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() ); |
630 | 0 | if( xHandoutPage.is() ) |
631 | 0 | { |
632 | 0 | if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr)) |
633 | 0 | DrawPagesAutoLayoutNamesRange[0] = aStr; |
634 | 0 | } |
635 | 0 | } |
636 | | |
637 | | // prepare name creation |
638 | 0 | for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++) |
639 | 0 | { |
640 | 0 | Any aAny(mxDocDrawPages->getByIndex(nCnt)); |
641 | 0 | Reference<XDrawPage> xDrawPage; |
642 | |
|
643 | 0 | if((aAny >>= xDrawPage) && xDrawPage.is()) |
644 | 0 | { |
645 | 0 | if(ImpPrepAutoLayoutInfo(xDrawPage, aStr)) |
646 | 0 | DrawPagesAutoLayoutNamesRange[nCnt+1] = aStr; |
647 | 0 | } |
648 | 0 | } |
649 | 0 | } |
650 | | |
651 | | bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName) |
652 | 0 | { |
653 | 0 | rName.clear(); |
654 | 0 | bool bRetval(false); |
655 | |
|
656 | 0 | Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY); |
657 | 0 | if(xPropSet.is()) |
658 | 0 | { |
659 | 0 | sal_uInt16 nType = sal_uInt16(); |
660 | 0 | Any aAny = xPropSet->getPropertyValue(u"Layout"_ustr); |
661 | 0 | if(aAny >>= nType) |
662 | 0 | { |
663 | 0 | if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType)) |
664 | 0 | { |
665 | 0 | ImpXMLEXPPageMasterInfo* pInfo = nullptr; |
666 | | |
667 | | // get master-page info |
668 | 0 | Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY); |
669 | 0 | if(xMasterPageInt.is()) |
670 | 0 | { |
671 | 0 | Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage()); |
672 | 0 | if(xUsedMasterPage.is()) |
673 | 0 | { |
674 | 0 | Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY); |
675 | 0 | if(xMasterNamed.is()) |
676 | 0 | { |
677 | 0 | OUString sMasterPageName = xMasterNamed->getName(); |
678 | 0 | pInfo = ImpGetPageMasterInfoByName(sMasterPageName); |
679 | 0 | } |
680 | 0 | } |
681 | 0 | } |
682 | | |
683 | | // create entry and look for existence |
684 | 0 | ImpXMLAutoLayoutInfo* pNew; |
685 | 0 | auto it = std::find_if(mvAutoLayoutInfoList.begin(), mvAutoLayoutInfoList.end(), |
686 | 0 | [=](std::unique_ptr<ImpXMLAutoLayoutInfo> const & rInfo) { return nType == rInfo->GetLayoutType() && pInfo == rInfo->GetPageMasterInfo(); }); |
687 | 0 | if (it != mvAutoLayoutInfoList.end()) |
688 | 0 | { |
689 | 0 | pNew = it->get(); |
690 | 0 | } |
691 | 0 | else |
692 | 0 | { |
693 | 0 | pNew = new ImpXMLAutoLayoutInfo(nType, pInfo); |
694 | 0 | mvAutoLayoutInfoList.emplace_back( pNew ); |
695 | 0 | OUString sNewName = |
696 | 0 | "AL" + OUString::number(mvAutoLayoutInfoList.size() - 1) + |
697 | 0 | "T" + OUString::number(nType); |
698 | 0 | pNew->SetLayoutName(sNewName); |
699 | 0 | } |
700 | |
|
701 | 0 | rName = pNew->GetLayoutName(); |
702 | 0 | bRetval = true; |
703 | 0 | } |
704 | 0 | } |
705 | 0 | } |
706 | |
|
707 | 0 | return bRetval; |
708 | 0 | } |
709 | | |
710 | | void SdXMLExport::ImpWriteAutoLayoutInfos() |
711 | 138 | { |
712 | 138 | for(const auto & pInfo : mvAutoLayoutInfoList) |
713 | 0 | { |
714 | 0 | if(pInfo) |
715 | 0 | { |
716 | | // prepare presentation-page layout attributes, style-name |
717 | 0 | AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName()); |
718 | | |
719 | | // write draw-style attributes |
720 | 0 | SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, true, true); |
721 | | |
722 | | // write presentation placeholders |
723 | 0 | switch(pInfo->GetLayoutType()) |
724 | 0 | { |
725 | 0 | case AUTOLAYOUT_TITLE : |
726 | 0 | { |
727 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
728 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); |
729 | 0 | break; |
730 | 0 | } |
731 | 0 | case AUTOLAYOUT_TITLE_CONTENT : |
732 | 0 | { |
733 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
734 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle()); |
735 | 0 | break; |
736 | 0 | } |
737 | 0 | case AUTOLAYOUT_CHART : |
738 | 0 | { |
739 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
740 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle()); |
741 | 0 | break; |
742 | 0 | } |
743 | 0 | case AUTOLAYOUT_TITLE_2CONTENT : |
744 | 0 | { |
745 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
746 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
747 | 0 | tools::Rectangle aRight(aLeft); |
748 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
749 | |
|
750 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
751 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); |
752 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); |
753 | 0 | break; |
754 | 0 | } |
755 | 0 | case AUTOLAYOUT_TEXTCHART : |
756 | 0 | { |
757 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
758 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
759 | 0 | tools::Rectangle aRight(aLeft); |
760 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
761 | |
|
762 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
763 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); |
764 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight); |
765 | 0 | break; |
766 | 0 | } |
767 | 0 | case AUTOLAYOUT_TEXTCLIP : |
768 | 0 | { |
769 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
770 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
771 | 0 | tools::Rectangle aRight(aLeft); |
772 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
773 | |
|
774 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
775 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); |
776 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight); |
777 | 0 | break; |
778 | 0 | } |
779 | 0 | case AUTOLAYOUT_CHARTTEXT : |
780 | 0 | { |
781 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
782 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
783 | 0 | tools::Rectangle aRight(aLeft); |
784 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
785 | |
|
786 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
787 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft); |
788 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); |
789 | 0 | break; |
790 | 0 | } |
791 | 0 | case AUTOLAYOUT_TAB : |
792 | 0 | { |
793 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
794 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle()); |
795 | 0 | break; |
796 | 0 | } |
797 | 0 | case AUTOLAYOUT_CLIPTEXT : |
798 | 0 | { |
799 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
800 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
801 | 0 | tools::Rectangle aRight(aLeft); |
802 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
803 | |
|
804 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
805 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); |
806 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); |
807 | 0 | break; |
808 | 0 | } |
809 | 0 | case AUTOLAYOUT_TEXTOBJ : |
810 | 0 | { |
811 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
812 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
813 | 0 | tools::Rectangle aRight(aLeft); |
814 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
815 | |
|
816 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
817 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); |
818 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight); |
819 | 0 | break; |
820 | 0 | } |
821 | 0 | case AUTOLAYOUT_OBJ : |
822 | 0 | { |
823 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
824 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle()); |
825 | 0 | break; |
826 | 0 | } |
827 | 0 | case AUTOLAYOUT_TITLE_CONTENT_2CONTENT : |
828 | 0 | { |
829 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
830 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
831 | 0 | tools::Rectangle aRightTop(aLeft); |
832 | 0 | aRightTop.AdjustLeft(aRightTop.GetWidth() * 1.05); |
833 | 0 | aRightTop.setHeight(tools::Long(aRightTop.GetHeight() * 0.477)); |
834 | 0 | tools::Rectangle aRightBottom(aRightTop); |
835 | 0 | aRightBottom.AdjustTop(aRightBottom.GetHeight() * 1.095); |
836 | |
|
837 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
838 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft); |
839 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop); |
840 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom); |
841 | 0 | break; |
842 | 0 | } |
843 | 0 | case AUTOLAYOUT_OBJTEXT : |
844 | 0 | { |
845 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
846 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
847 | 0 | tools::Rectangle aRight(aLeft); |
848 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
849 | |
|
850 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
851 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft); |
852 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); |
853 | 0 | break; |
854 | 0 | } |
855 | 0 | case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT : |
856 | 0 | { |
857 | 0 | tools::Rectangle aTop(pInfo->GetPresRectangle()); |
858 | 0 | aTop.setHeight(tools::Long(aTop.GetHeight() * 0.477)); |
859 | 0 | tools::Rectangle aBottom(aTop); |
860 | 0 | aBottom.AdjustTop(aBottom.GetHeight() * 1.095); |
861 | |
|
862 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
863 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop); |
864 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); |
865 | 0 | break; |
866 | 0 | } |
867 | 0 | case AUTOLAYOUT_TITLE_2CONTENT_CONTENT : |
868 | 0 | { |
869 | 0 | tools::Rectangle aLeftTop(pInfo->GetPresRectangle()); |
870 | 0 | aLeftTop.setWidth(tools::Long(aLeftTop.GetWidth() * 0.488)); |
871 | 0 | tools::Rectangle aRight(aLeftTop); |
872 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
873 | 0 | aLeftTop.setHeight(tools::Long(aLeftTop.GetHeight() * 0.477)); |
874 | 0 | tools::Rectangle aLeftBottom(aLeftTop); |
875 | 0 | aLeftBottom.AdjustTop(aLeftBottom.GetHeight() * 1.095); |
876 | |
|
877 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
878 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop); |
879 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom); |
880 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight); |
881 | 0 | break; |
882 | 0 | } |
883 | 0 | case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT : |
884 | 0 | { |
885 | 0 | tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); |
886 | 0 | aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477)); |
887 | 0 | tools::Rectangle aBottom(aTopLeft); |
888 | 0 | aBottom.AdjustTop(aBottom.GetHeight() * 1.095); |
889 | 0 | aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488)); |
890 | 0 | tools::Rectangle aTopRight(aTopLeft); |
891 | 0 | aTopRight.AdjustLeft(aTopRight.GetWidth() * 1.05); |
892 | |
|
893 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
894 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); |
895 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); |
896 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom); |
897 | 0 | break; |
898 | 0 | } |
899 | 0 | case AUTOLAYOUT_TEXTOVEROBJ : |
900 | 0 | { |
901 | 0 | tools::Rectangle aTop(pInfo->GetPresRectangle()); |
902 | 0 | aTop.setHeight(tools::Long(aTop.GetHeight() * 0.477)); |
903 | 0 | tools::Rectangle aBottom(aTop); |
904 | 0 | aBottom.AdjustTop(aBottom.GetHeight() * 1.095); |
905 | |
|
906 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
907 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop); |
908 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom); |
909 | 0 | break; |
910 | 0 | } |
911 | 0 | case AUTOLAYOUT_TITLE_4CONTENT : |
912 | 0 | { |
913 | 0 | tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); |
914 | 0 | aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477)); |
915 | 0 | aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488)); |
916 | 0 | tools::Rectangle aBottomLeft(aTopLeft); |
917 | 0 | aBottomLeft.AdjustTop(aBottomLeft.GetHeight() * 1.095); |
918 | 0 | tools::Rectangle aTopRight(aTopLeft); |
919 | 0 | aTopRight.AdjustLeft(aTopRight.GetWidth() * 1.05); |
920 | 0 | tools::Rectangle aBottomRight(aTopRight); |
921 | 0 | aBottomRight.AdjustTop(aBottomRight.GetHeight() * 1.095); |
922 | |
|
923 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
924 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft); |
925 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight); |
926 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft); |
927 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight); |
928 | 0 | break; |
929 | 0 | } |
930 | 0 | case AUTOLAYOUT_TITLE_ONLY : |
931 | 0 | { |
932 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
933 | 0 | break; |
934 | 0 | } |
935 | 0 | case AUTOLAYOUT_NOTES : |
936 | 0 | { |
937 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle()); |
938 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle()); |
939 | 0 | break; |
940 | 0 | } |
941 | 0 | case AUTOLAYOUT_HANDOUT1 : |
942 | 0 | case AUTOLAYOUT_HANDOUT2 : |
943 | 0 | case AUTOLAYOUT_HANDOUT3 : |
944 | 0 | case AUTOLAYOUT_HANDOUT4 : |
945 | 0 | case AUTOLAYOUT_HANDOUT6 : |
946 | 0 | case AUTOLAYOUT_HANDOUT9 : |
947 | 0 | { |
948 | 0 | sal_Int32 nColCnt, nRowCnt; |
949 | 0 | sal_Int32 nGapX = pInfo->GetGapX(); |
950 | 0 | sal_Int32 nGapY = pInfo->GetGapY(); |
951 | |
|
952 | 0 | switch(pInfo->GetLayoutType()) |
953 | 0 | { |
954 | 0 | case 22 : nColCnt = 1; nRowCnt = 1; break; |
955 | 0 | case 23 : nColCnt = 1; nRowCnt = 2; break; |
956 | 0 | case 24 : nColCnt = 1; nRowCnt = 3; break; |
957 | 0 | case 25 : nColCnt = 2; nRowCnt = 2; break; |
958 | 0 | case 26 : nColCnt = 3; nRowCnt = 2; break; |
959 | 0 | case 31 : nColCnt = 3; nRowCnt = 3; break; |
960 | 0 | default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values? |
961 | 0 | } |
962 | | |
963 | 0 | Size aPartSize(pInfo->GetTitleRectangle().GetSize()); |
964 | 0 | Point aPartPos(pInfo->GetTitleRectangle().TopLeft()); |
965 | |
|
966 | 0 | if(aPartSize.Width() > aPartSize.Height()) |
967 | 0 | { |
968 | 0 | sal_Int32 nZwi(nColCnt); |
969 | 0 | nColCnt = nRowCnt; |
970 | 0 | nRowCnt = nZwi; |
971 | 0 | } |
972 | |
|
973 | 0 | if (nColCnt == 0 || nRowCnt == 0) |
974 | 0 | break; |
975 | | |
976 | 0 | aPartSize.setWidth( (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt ); |
977 | 0 | aPartSize.setHeight( (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt ); |
978 | |
|
979 | 0 | Point aTmpPos(aPartPos); |
980 | |
|
981 | 0 | for (sal_Int32 a = 0; a < nRowCnt; a++) |
982 | 0 | { |
983 | 0 | aTmpPos.setX(aPartPos.X()); |
984 | |
|
985 | 0 | for (sal_Int32 b = 0; b < nColCnt; b++) |
986 | 0 | { |
987 | 0 | tools::Rectangle aTmpRect(aTmpPos, aPartSize); |
988 | |
|
989 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect); |
990 | 0 | aTmpPos.AdjustX( aPartSize.Width() + nGapX ); |
991 | 0 | } |
992 | |
|
993 | 0 | aTmpPos.AdjustY( aPartSize.Height() + nGapY ); |
994 | 0 | } |
995 | 0 | break; |
996 | 0 | } |
997 | 0 | case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT : |
998 | 0 | { |
999 | 0 | tools::Rectangle aTop(pInfo->GetPresRectangle()); |
1000 | 0 | aTop.setHeight(tools::Long(aTop.GetHeight() * 0.488)); |
1001 | 0 | tools::Rectangle aBottom(aTop); |
1002 | 0 | aBottom.AdjustTop(aBottom.GetHeight() * 1.05); |
1003 | |
|
1004 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); |
1005 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop); |
1006 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom); |
1007 | 0 | break; |
1008 | 0 | } |
1009 | 0 | case AUTOLAYOUT_VTITLE_VCONTENT : |
1010 | 0 | { |
1011 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle()); |
1012 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); |
1013 | 0 | break; |
1014 | 0 | } |
1015 | 0 | case AUTOLAYOUT_TITLE_VCONTENT : |
1016 | 0 | { |
1017 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
1018 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle()); |
1019 | 0 | break; |
1020 | 0 | } |
1021 | 0 | case AUTOLAYOUT_TITLE_2VTEXT : |
1022 | 0 | { |
1023 | 0 | tools::Rectangle aLeft(pInfo->GetPresRectangle()); |
1024 | 0 | aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488)); |
1025 | 0 | tools::Rectangle aRight(aLeft); |
1026 | 0 | aRight.AdjustLeft(aRight.GetWidth() * 1.05); |
1027 | |
|
1028 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
1029 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft); |
1030 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight); |
1031 | 0 | break; |
1032 | 0 | } |
1033 | 0 | case AUTOLAYOUT_ONLY_TEXT : |
1034 | 0 | { |
1035 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle()); |
1036 | 0 | break; |
1037 | 0 | } |
1038 | | |
1039 | 0 | case AUTOLAYOUT_4CLIPART : |
1040 | 0 | { |
1041 | 0 | tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); |
1042 | 0 | aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477)); |
1043 | 0 | aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488)); |
1044 | 0 | tools::Rectangle aBottomLeft(aTopLeft); |
1045 | 0 | aBottomLeft.AdjustTop(aBottomLeft.GetHeight() * 1.095); |
1046 | 0 | tools::Rectangle aTopRight(aTopLeft); |
1047 | 0 | aTopRight.AdjustLeft(aTopRight.GetWidth() * 1.05); |
1048 | 0 | tools::Rectangle aBottomRight(aTopRight); |
1049 | 0 | aBottomRight.AdjustTop(aBottomRight.GetHeight() * 1.095); |
1050 | |
|
1051 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
1052 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); |
1053 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); |
1054 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); |
1055 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); |
1056 | 0 | break; |
1057 | 0 | } |
1058 | | |
1059 | 0 | case AUTOLAYOUT_TITLE_6CONTENT : |
1060 | 0 | { |
1061 | 0 | tools::Rectangle aTopLeft(pInfo->GetPresRectangle()); |
1062 | 0 | aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477)); |
1063 | 0 | aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.322)); |
1064 | 0 | tools::Rectangle aTopCenter(aTopLeft); |
1065 | 0 | aTopCenter.AdjustLeft(aTopCenter.GetWidth() * 1.05); |
1066 | 0 | tools::Rectangle aTopRight(aTopLeft); |
1067 | 0 | aTopRight.AdjustLeft(aTopRight.GetWidth() * 2 * 1.05); |
1068 | |
|
1069 | 0 | tools::Rectangle aBottomLeft(aTopLeft); |
1070 | 0 | aBottomLeft.AdjustTop(aBottomLeft.GetHeight() * 1.095); |
1071 | 0 | tools::Rectangle aBottomCenter(aTopCenter); |
1072 | 0 | aBottomCenter.AdjustTop(aBottomCenter.GetHeight() * 1.095); |
1073 | 0 | tools::Rectangle aBottomRight(aTopRight); |
1074 | 0 | aBottomRight.AdjustTop(aBottomRight.GetHeight() * 1.095); |
1075 | |
|
1076 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle()); |
1077 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft); |
1078 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter); |
1079 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight); |
1080 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft); |
1081 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter); |
1082 | 0 | ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight); |
1083 | 0 | break; |
1084 | 0 | } |
1085 | 0 | default: |
1086 | 0 | { |
1087 | 0 | OSL_FAIL("XMLEXP: unknown autolayout export"); |
1088 | 0 | break; |
1089 | 0 | } |
1090 | 0 | } |
1091 | 0 | } |
1092 | 0 | } |
1093 | 138 | } |
1094 | | |
1095 | | void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const tools::Rectangle& rRect) |
1096 | 0 | { |
1097 | 0 | OUString aStr; |
1098 | 0 | OUStringBuffer sStringBuffer; |
1099 | | |
1100 | | // prepare presentation-placeholder attributes, presentation:object |
1101 | 0 | switch(ePl) |
1102 | 0 | { |
1103 | 0 | case XmlPlaceholderTitle: aStr = "title"; break; |
1104 | 0 | case XmlPlaceholderOutline: aStr = "outline"; break; |
1105 | 0 | case XmlPlaceholderSubtitle: aStr = "subtitle"; break; |
1106 | 0 | case XmlPlaceholderGraphic: aStr = "graphic"; break; |
1107 | 0 | case XmlPlaceholderObject: aStr = "object"; break; |
1108 | 0 | case XmlPlaceholderChart: aStr = "chart"; break; |
1109 | 0 | case XmlPlaceholderTable: aStr = "table"; break; |
1110 | 0 | case XmlPlaceholderPage: aStr = "page"; break; |
1111 | 0 | case XmlPlaceholderNotes: aStr = "notes"; break; |
1112 | 0 | case XmlPlaceholderHandout: aStr = "handout"; break; |
1113 | 0 | case XmlPlaceholderVerticalTitle: aStr = "vertical_title"; break; |
1114 | 0 | case XmlPlaceholderVerticalOutline: aStr = "vertical_outline"; break; |
1115 | 0 | } |
1116 | | |
1117 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr); |
1118 | | |
1119 | | // svg:x,y,width,height |
1120 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Left()); |
1121 | 0 | aStr = sStringBuffer.makeStringAndClear(); |
1122 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr); |
1123 | |
|
1124 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Top()); |
1125 | 0 | aStr = sStringBuffer.makeStringAndClear(); |
1126 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr); |
1127 | |
|
1128 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1129 | 0 | rRect.GetWidth()); |
1130 | 0 | aStr = sStringBuffer.makeStringAndClear(); |
1131 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr); |
1132 | |
|
1133 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1134 | 0 | rRect.GetHeight()); |
1135 | 0 | aStr = sStringBuffer.makeStringAndClear(); |
1136 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr); |
1137 | | |
1138 | | // write presentation-placeholder |
1139 | 0 | SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, true, true); |
1140 | 0 | } |
1141 | | |
1142 | | ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( const Reference< XDrawPage >& xMasterPage ) |
1143 | 162 | { |
1144 | 162 | bool bDoesExist = false; |
1145 | | |
1146 | 162 | ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage); |
1147 | | |
1148 | | // compare with prev page-master infos |
1149 | 162 | for( size_t a = 0; !bDoesExist && a < mvPageMasterInfoList.size(); a++) |
1150 | 0 | { |
1151 | 0 | if ( mvPageMasterInfoList.at(a) |
1152 | 0 | && *mvPageMasterInfoList.at(a) == *pNewInfo |
1153 | 0 | ) |
1154 | 0 | { |
1155 | 0 | delete pNewInfo; |
1156 | 0 | pNewInfo = mvPageMasterInfoList.at(a).get(); |
1157 | 0 | bDoesExist = true; |
1158 | 0 | } |
1159 | 0 | } |
1160 | | // add entry when not found same page-master infos |
1161 | 162 | if(!bDoesExist) |
1162 | 162 | mvPageMasterInfoList.emplace_back( pNewInfo ); |
1163 | | |
1164 | 162 | return pNewInfo; |
1165 | 162 | } |
1166 | | |
1167 | | void SdXMLExport::ImpPrepPageMasterInfos() |
1168 | 162 | { |
1169 | 162 | if( IsImpress() ) |
1170 | 0 | { |
1171 | | // create page master info for handout master page |
1172 | |
|
1173 | 0 | Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY ); |
1174 | 0 | if( xHMS.is() ) |
1175 | 0 | { |
1176 | 0 | Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() ); |
1177 | 0 | if( xMasterPage.is() ) |
1178 | 0 | mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage); |
1179 | 0 | } |
1180 | 0 | } |
1181 | | |
1182 | | // create page master infos for master pages |
1183 | 162 | if(!mnDocMasterPageCount) |
1184 | 0 | return; |
1185 | | |
1186 | | // look for needed page-masters, create these |
1187 | 324 | for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++) |
1188 | 162 | { |
1189 | 162 | Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY ); |
1190 | 162 | ImpXMLEXPPageMasterInfo* pNewInfo = nullptr; |
1191 | | |
1192 | 162 | if(xMasterPage.is()) |
1193 | 162 | pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage); |
1194 | | |
1195 | 162 | mvPageMasterUsageList.push_back( pNewInfo ); |
1196 | | |
1197 | | // look for page master of handout page |
1198 | 162 | if(IsImpress()) |
1199 | 0 | { |
1200 | 0 | pNewInfo = nullptr; |
1201 | 0 | Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY); |
1202 | 0 | if(xPresPage.is()) |
1203 | 0 | { |
1204 | 0 | Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage()); |
1205 | 0 | if(xNotesPage.is()) |
1206 | 0 | { |
1207 | 0 | pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage); |
1208 | 0 | } |
1209 | 0 | } |
1210 | 0 | mvNotesPageMasterUsageList.push_back( pNewInfo ); |
1211 | 0 | } |
1212 | 162 | } |
1213 | 162 | } |
1214 | | |
1215 | | void SdXMLExport::ImpWritePageMasterInfos() |
1216 | 138 | { |
1217 | | // write created page-masters, create names for these |
1218 | 276 | for( size_t nCnt = 0; nCnt < mvPageMasterInfoList.size(); nCnt++) |
1219 | 138 | { |
1220 | 138 | ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterInfoList.at(nCnt).get(); |
1221 | 138 | if(pInfo) |
1222 | 138 | { |
1223 | | // create name |
1224 | 138 | OUString sNewName = "PM" + OUString::number(nCnt); |
1225 | 138 | pInfo->SetName(sNewName); |
1226 | | |
1227 | | // prepare page-master attributes |
1228 | 138 | OUString sString; |
1229 | 138 | OUStringBuffer sStringBuffer; |
1230 | | |
1231 | 138 | sString = sNewName; |
1232 | 138 | AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString); |
1233 | | |
1234 | | // write page-layout |
1235 | 138 | SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, true, true); |
1236 | | |
1237 | | // prepare style:properties inside page-master |
1238 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1239 | 138 | pInfo->GetBorderTop()); |
1240 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1241 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString); |
1242 | | |
1243 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1244 | 138 | pInfo->GetBorderBottom()); |
1245 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1246 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString); |
1247 | | |
1248 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1249 | 138 | pInfo->GetBorderLeft()); |
1250 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1251 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString); |
1252 | | |
1253 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1254 | 138 | pInfo->GetBorderRight()); |
1255 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1256 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString); |
1257 | | |
1258 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1259 | 138 | pInfo->GetWidth()); |
1260 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1261 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString); |
1262 | | |
1263 | 138 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
1264 | 138 | pInfo->GetHeight()); |
1265 | 138 | sString = sStringBuffer.makeStringAndClear(); |
1266 | 138 | AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString); |
1267 | | |
1268 | 138 | if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT) |
1269 | 44 | AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT); |
1270 | 94 | else |
1271 | 94 | AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE); |
1272 | | |
1273 | | // write style:properties |
1274 | 138 | SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, true, true); |
1275 | 138 | } |
1276 | 138 | } |
1277 | 138 | } |
1278 | | |
1279 | | ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(std::u16string_view rName) |
1280 | 0 | { |
1281 | 0 | if(!rName.empty()) |
1282 | 0 | { |
1283 | 0 | for(const auto & pInfo : mvPageMasterInfoList) |
1284 | 0 | { |
1285 | 0 | if(pInfo) |
1286 | 0 | { |
1287 | 0 | if(!pInfo->GetMasterPageName().isEmpty() && rName == pInfo->GetMasterPageName()) |
1288 | 0 | { |
1289 | 0 | return pInfo.get(); |
1290 | 0 | } |
1291 | 0 | } |
1292 | 0 | } |
1293 | 0 | } |
1294 | 0 | return nullptr; |
1295 | 0 | } |
1296 | | |
1297 | | void SdXMLExport::ImpPrepDrawPageInfos() |
1298 | 162 | { |
1299 | | // create draw:style-name entries for page export |
1300 | | // containing presentation page attributes AND background attributes |
1301 | | // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME) |
1302 | | |
1303 | 162 | sal_Int32 nCnt; |
1304 | 408 | for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++) |
1305 | 246 | { |
1306 | 246 | Reference<XDrawPage> xDrawPage; |
1307 | 246 | mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage; |
1308 | 246 | maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage ); |
1309 | | |
1310 | 246 | Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY); |
1311 | 246 | if(xPresPage.is()) |
1312 | 0 | { |
1313 | 0 | maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false ); |
1314 | |
|
1315 | 0 | maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage ); |
1316 | 0 | maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() ); |
1317 | 0 | } |
1318 | 246 | } |
1319 | 162 | } |
1320 | | |
1321 | | static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, std::u16string_view pPrefix ) |
1322 | 0 | { |
1323 | | // search rVector if there is already a string that equals rText |
1324 | 0 | auto aIter = std::find(rVector.begin(), rVector.end(), rText); |
1325 | 0 | sal_Int32 nIndex = std::distance(rVector.begin(), aIter) + 1; |
1326 | | |
1327 | | // if nothing is found, append the string at the end of rVector |
1328 | 0 | if( aIter == rVector.end() ) |
1329 | 0 | rVector.push_back( rText ); |
1330 | | |
1331 | | // create a reference string with pPrefix and the index of the |
1332 | | // found or created rText |
1333 | 0 | return pPrefix + OUString::number( nIndex ); |
1334 | 0 | } |
1335 | | |
1336 | | static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, bool bFixed, sal_Int32 nFormat, std::u16string_view pPrefix ) |
1337 | 0 | { |
1338 | | // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat |
1339 | 0 | auto aIter = std::find_if(rVector.begin(), rVector.end(), |
1340 | 0 | [bFixed, &rText, nFormat](const DateTimeDeclImpl& rDecl) { |
1341 | 0 | return (rDecl.mbFixed == bFixed) && |
1342 | 0 | (!bFixed || (rDecl.maStrText == rText)) && |
1343 | 0 | (bFixed || (rDecl.mnFormat == nFormat)); |
1344 | 0 | }); |
1345 | 0 | sal_Int32 nIndex = std::distance(rVector.begin(), aIter) + 1; |
1346 | | |
1347 | | // if nothing is found, append a new DateTimeDeclImpl |
1348 | 0 | if( aIter == rVector.end() ) |
1349 | 0 | { |
1350 | 0 | DateTimeDeclImpl aDecl; |
1351 | 0 | aDecl.maStrText = rText; |
1352 | 0 | aDecl.mbFixed = bFixed; |
1353 | 0 | aDecl.mnFormat = nFormat; |
1354 | 0 | rVector.push_back( aDecl ); |
1355 | 0 | } |
1356 | | |
1357 | | // create a reference string with pPrefix and the index of the |
1358 | | // found or created DateTimeDeclImpl |
1359 | 0 | return pPrefix + OUString::number( nIndex ); |
1360 | 0 | } |
1361 | | |
1362 | | constexpr OUString gpStrHeaderTextPrefix = u"hdr"_ustr; |
1363 | | constexpr OUString gpStrFooterTextPrefix = u"ftr"_ustr; |
1364 | | constexpr OUString gpStrDateTimeTextPrefix = u"dtd"_ustr; |
1365 | | |
1366 | | HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage ) |
1367 | 0 | { |
1368 | 0 | HeaderFooterPageSettingsImpl aSettings; |
1369 | |
|
1370 | 0 | if( xDrawPage.is() ) try |
1371 | 0 | { |
1372 | 0 | Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW ); |
1373 | 0 | Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() ); |
1374 | |
|
1375 | 0 | OUString aStrText; |
1376 | |
|
1377 | 0 | static constexpr OUString aStrHeaderTextProp( u"HeaderText"_ustr ); |
1378 | 0 | if( xInfo->hasPropertyByName( aStrHeaderTextProp ) ) |
1379 | 0 | { |
1380 | 0 | xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText; |
1381 | 0 | if( !aStrText.isEmpty() ) |
1382 | 0 | aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix ); |
1383 | 0 | } |
1384 | |
|
1385 | 0 | static constexpr OUString aStrFooterTextProp( u"FooterText"_ustr ); |
1386 | 0 | if( xInfo->hasPropertyByName( aStrFooterTextProp ) ) |
1387 | 0 | { |
1388 | 0 | xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText; |
1389 | 0 | if( !aStrText.isEmpty() ) |
1390 | 0 | aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix ); |
1391 | 0 | } |
1392 | |
|
1393 | 0 | static constexpr OUString aStrDateTimeTextProp( u"DateTimeText"_ustr ); |
1394 | 0 | if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) ) |
1395 | 0 | { |
1396 | 0 | bool bFixed = false; |
1397 | 0 | sal_Int32 nFormat = 0; |
1398 | 0 | xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText; |
1399 | 0 | xSet->getPropertyValue(u"IsDateTimeFixed"_ustr) >>= bFixed; |
1400 | 0 | xSet->getPropertyValue(u"DateTimeFormat"_ustr) >>= nFormat; |
1401 | |
|
1402 | 0 | if( !bFixed || !aStrText.isEmpty() ) |
1403 | 0 | { |
1404 | 0 | aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix ); |
1405 | 0 | if( !bFixed ) |
1406 | 0 | addDataStyle( nFormat ); |
1407 | 0 | } |
1408 | 0 | } |
1409 | 0 | } |
1410 | 0 | catch(const Exception&) |
1411 | 0 | { |
1412 | 0 | TOOLS_WARN_EXCEPTION("xmloff.draw", ""); |
1413 | 0 | } |
1414 | | |
1415 | 0 | return aSettings; |
1416 | 0 | } |
1417 | | |
1418 | | void SdXMLExport::ImpWriteHeaderFooterDecls() |
1419 | 138 | { |
1420 | 138 | OUStringBuffer sBuffer; |
1421 | | |
1422 | 138 | if( !maHeaderDeclsVector.empty() ) |
1423 | 0 | { |
1424 | | // export header decls |
1425 | 0 | const OUString aPrefix( gpStrHeaderTextPrefix ); |
1426 | 0 | sal_Int32 nIndex = 1; |
1427 | 0 | for( const auto& rDecl : maHeaderDeclsVector ) |
1428 | 0 | { |
1429 | 0 | sBuffer.append( aPrefix + OUString::number( nIndex ) ); |
1430 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear()); |
1431 | |
|
1432 | 0 | SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, true, true); |
1433 | 0 | Characters(rDecl); |
1434 | 0 | ++nIndex; |
1435 | 0 | } |
1436 | 0 | } |
1437 | | |
1438 | 138 | if( !maFooterDeclsVector.empty() ) |
1439 | 0 | { |
1440 | | // export footer decls |
1441 | 0 | const OUString aPrefix( gpStrFooterTextPrefix ); |
1442 | 0 | sal_Int32 nIndex = 1; |
1443 | 0 | for( const auto& rDecl : maFooterDeclsVector ) |
1444 | 0 | { |
1445 | 0 | sBuffer.append( aPrefix + OUString::number( nIndex ) ); |
1446 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear()); |
1447 | |
|
1448 | 0 | SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, false, false); |
1449 | 0 | Characters(rDecl); |
1450 | 0 | ++nIndex; |
1451 | 0 | } |
1452 | 0 | } |
1453 | | |
1454 | 138 | if( maDateTimeDeclsVector.empty() ) |
1455 | 138 | return; |
1456 | | |
1457 | | // export footer decls |
1458 | 0 | const OUString aPrefix( gpStrDateTimeTextPrefix ); |
1459 | 0 | sal_Int32 nIndex = 1; |
1460 | 0 | for( const auto& rDecl : maDateTimeDeclsVector ) |
1461 | 0 | { |
1462 | 0 | sBuffer.append( aPrefix + OUString::number( nIndex ) ); |
1463 | 0 | AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear()); |
1464 | |
|
1465 | 0 | AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE ); |
1466 | |
|
1467 | 0 | if( !rDecl.mbFixed ) |
1468 | 0 | AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) ); |
1469 | |
|
1470 | 0 | SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, false, false); |
1471 | 0 | if( rDecl.mbFixed ) |
1472 | 0 | Characters(rDecl.maStrText); |
1473 | |
|
1474 | 0 | ++nIndex; |
1475 | 0 | } |
1476 | 0 | } |
1477 | | |
1478 | | void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings ) |
1479 | 0 | { |
1480 | 0 | if( !aSettings.maStrHeaderDeclName.isEmpty() ) |
1481 | 0 | AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName ); |
1482 | |
|
1483 | 0 | if( !aSettings.maStrFooterDeclName.isEmpty() ) |
1484 | 0 | AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName ); |
1485 | |
|
1486 | 0 | if( !aSettings.maStrDateTimeDeclName.isEmpty() ) |
1487 | 0 | AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName ); |
1488 | 0 | } |
1489 | | |
1490 | | OUString SdXMLExport::ImpCreatePresPageStyleName( const Reference<XDrawPage>& xDrawPage, bool bExportBackground /* = true */ ) |
1491 | 408 | { |
1492 | | // create name |
1493 | 408 | OUString sStyleName; |
1494 | | |
1495 | | // create style for this page and add to auto style pool |
1496 | | |
1497 | 408 | Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY); |
1498 | 408 | if(xPropSet1.is()) |
1499 | 408 | { |
1500 | 408 | Reference< beans::XPropertySet > xPropSet; |
1501 | | |
1502 | 408 | if( bExportBackground ) |
1503 | 408 | { |
1504 | | // since the background items are in a different propertyset |
1505 | | // which itself is a property of the pages property set |
1506 | | // we now merge these two propertysets if possible to simulate |
1507 | | // a single propertyset with all draw page properties |
1508 | 408 | static constexpr OUString aBackground(u"Background"_ustr); |
1509 | 408 | Reference< beans::XPropertySet > xPropSet2; |
1510 | 408 | Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() ); |
1511 | 408 | if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) ) |
1512 | 408 | { |
1513 | 408 | Any aAny( xPropSet1->getPropertyValue( aBackground ) ); |
1514 | 408 | aAny >>= xPropSet2; |
1515 | 408 | } |
1516 | | |
1517 | 408 | if( xPropSet2.is() ) |
1518 | 162 | xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 ); |
1519 | 246 | else |
1520 | 246 | xPropSet = std::move(xPropSet1); |
1521 | 408 | } |
1522 | 0 | else |
1523 | 0 | { |
1524 | 0 | xPropSet = std::move(xPropSet1); |
1525 | 0 | } |
1526 | | |
1527 | 408 | const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() ); |
1528 | | |
1529 | 408 | std::vector<XMLPropertyState> aPropStates(aMapperRef->Filter(*this, xPropSet)); |
1530 | | |
1531 | 408 | if( !aPropStates.empty() ) |
1532 | 408 | { |
1533 | | // there are filtered properties -> hard attributes |
1534 | | // try to find this style in AutoStylePool |
1535 | 408 | sStyleName = GetAutoStylePool()->Find(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, aPropStates); |
1536 | | |
1537 | 408 | if(sStyleName.isEmpty()) |
1538 | 324 | { |
1539 | | // Style did not exist, add it to AutoStalePool |
1540 | 324 | sStyleName = GetAutoStylePool()->Add(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, std::move(aPropStates)); |
1541 | 324 | } |
1542 | 408 | } |
1543 | 408 | } |
1544 | | |
1545 | 408 | return sStyleName; |
1546 | 408 | } |
1547 | | |
1548 | | void SdXMLExport::ImpPrepMasterPageInfos() |
1549 | 162 | { |
1550 | | // create draw:style-name entries for master page export |
1551 | | // containing only background attributes |
1552 | | // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME) |
1553 | | |
1554 | 162 | sal_Int32 nCnt; |
1555 | 324 | for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++) |
1556 | 162 | { |
1557 | 162 | Reference<XDrawPage> xDrawPage; |
1558 | 162 | mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage; |
1559 | 162 | maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage ); |
1560 | 162 | } |
1561 | | |
1562 | 162 | if( !IsImpress() ) |
1563 | 162 | return; |
1564 | | |
1565 | 0 | Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); |
1566 | 0 | if( xHandoutSupp.is() ) |
1567 | 0 | { |
1568 | 0 | Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() ); |
1569 | 0 | if( xHandoutPage.is() ) |
1570 | 0 | { |
1571 | 0 | maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage ); |
1572 | 0 | maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false ); |
1573 | 0 | } |
1574 | 0 | } |
1575 | 0 | } |
1576 | | |
1577 | | void SdXMLExport::ImpWritePresentationStyles() |
1578 | 138 | { |
1579 | 138 | if(!IsImpress()) |
1580 | 138 | return; |
1581 | | |
1582 | 0 | for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++) |
1583 | 0 | { |
1584 | 0 | Any aAny(mxDocMasterPages->getByIndex(nCnt)); |
1585 | 0 | Reference<container::XNamed> xNamed; |
1586 | |
|
1587 | 0 | if(aAny >>= xNamed) |
1588 | 0 | { |
1589 | | // write presentation styles (ONLY if presentation) |
1590 | 0 | if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is()) |
1591 | 0 | { |
1592 | 0 | rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(*this, GetAutoStylePool().get())); |
1593 | 0 | const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() ); |
1594 | |
|
1595 | 0 | OUString aPrefix( xNamed->getName() + "-" ); |
1596 | |
|
1597 | 0 | aStEx->exportStyleFamily(xNamed->getName(), |
1598 | 0 | XML_STYLE_FAMILY_SD_PRESENTATION_NAME, |
1599 | 0 | aMapperRef, false, |
1600 | 0 | XmlStyleFamily::SD_PRESENTATION_ID, &aPrefix); |
1601 | 0 | } |
1602 | 0 | } |
1603 | 0 | } |
1604 | 0 | } |
1605 | | |
1606 | | void SdXMLExport::ExportMeta_() |
1607 | 162 | { |
1608 | 162 | uno::Sequence<beans::NamedValue> stats { { u"ObjectCount"_ustr, uno::Any(mnObjectCount) } }; |
1609 | | |
1610 | | // update document statistics at the model |
1611 | 162 | uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(), |
1612 | 162 | uno::UNO_QUERY_THROW); |
1613 | 162 | uno::Reference<document::XDocumentProperties> xDocProps( |
1614 | 162 | xPropSup->getDocumentProperties()); |
1615 | 162 | if (xDocProps.is()) { |
1616 | 162 | xDocProps->setDocumentStatistics(stats); |
1617 | 162 | } |
1618 | | |
1619 | | // call parent |
1620 | 162 | SvXMLExport::ExportMeta_(); |
1621 | 162 | } |
1622 | | |
1623 | | void SdXMLExport::ExportFontDecls_() |
1624 | 138 | { |
1625 | 138 | GetFontAutoStylePool(); // make sure the pool is created |
1626 | 138 | SvXMLExport::ExportFontDecls_(); |
1627 | 138 | } |
1628 | | |
1629 | | void SdXMLExport::ExportContent_() |
1630 | 138 | { |
1631 | | // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements |
1632 | 138 | ImpWriteHeaderFooterDecls(); |
1633 | | |
1634 | | // page export |
1635 | 326 | for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++) |
1636 | 188 | { |
1637 | 188 | uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY ); |
1638 | | |
1639 | | // set progress view |
1640 | 188 | if(GetStatusIndicator().is()) |
1641 | 0 | GetStatusIndicator()->setValue(((nPageInd + 1) * 100) / mnDocDrawPageCount); |
1642 | | |
1643 | 188 | if(xDrawPage.is()) |
1644 | 188 | { |
1645 | | // prepare page attributes, name of page |
1646 | 188 | Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY); |
1647 | 188 | if(xNamed.is()) |
1648 | 188 | AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName()); |
1649 | | |
1650 | | // draw:style-name (presentation page attributes AND background attributes) |
1651 | 188 | if( !maDrawPagesStyleNames[nPageInd].isEmpty() ) |
1652 | 188 | AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, |
1653 | 188 | maDrawPagesStyleNames[nPageInd]); |
1654 | | |
1655 | | // draw:master-page-name |
1656 | 188 | Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY); |
1657 | 188 | if(xMasterPageInt.is()) |
1658 | 188 | { |
1659 | 188 | Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage()); |
1660 | 188 | if(xUsedMasterPage.is()) |
1661 | 188 | { |
1662 | 188 | Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY); |
1663 | 188 | if(xMasterNamed.is()) |
1664 | 188 | { |
1665 | 188 | AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME, |
1666 | 188 | EncodeStyleName( xMasterNamed->getName()) ); |
1667 | 188 | } |
1668 | 188 | } |
1669 | 188 | } |
1670 | | |
1671 | | // presentation:page-layout-name |
1672 | 188 | if( IsImpress() && !maDrawPagesAutoLayoutNames[nPageInd+1].isEmpty()) |
1673 | 0 | { |
1674 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] ); |
1675 | 0 | } |
1676 | | |
1677 | 188 | Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY ); |
1678 | 188 | if( xProps.is() ) |
1679 | 188 | { |
1680 | 188 | try |
1681 | 188 | { |
1682 | 188 | OUString aBookmarkURL; |
1683 | 188 | xProps->getPropertyValue(u"BookmarkURL"_ustr) >>= aBookmarkURL; |
1684 | | |
1685 | 188 | if( !aBookmarkURL.isEmpty() ) |
1686 | 0 | { |
1687 | 0 | sal_Int32 nIndex = aBookmarkURL.lastIndexOf( '#' ); |
1688 | 0 | if( nIndex != -1 ) |
1689 | 0 | { |
1690 | 0 | OUString aFileName( aBookmarkURL.copy( 0, nIndex ) ); |
1691 | 0 | std::u16string_view aBookmarkName( aBookmarkURL.subView( nIndex+1 ) ); |
1692 | |
|
1693 | 0 | aBookmarkURL = GetRelativeReference( aFileName ) + "#" + aBookmarkName; |
1694 | 0 | } |
1695 | |
|
1696 | 0 | AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL); |
1697 | 0 | AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE ); |
1698 | 0 | AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE ); |
1699 | 0 | AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST ); |
1700 | 0 | } |
1701 | 188 | } |
1702 | 188 | catch(const Exception&) |
1703 | 188 | { |
1704 | 0 | OSL_FAIL(" no \"BookmarkURL\" property at page?" ); |
1705 | 0 | } |
1706 | 188 | } |
1707 | | |
1708 | 188 | if( IsImpress() ) |
1709 | 0 | ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] ); |
1710 | | |
1711 | 188 | OUString sNavigationOrder( getNavigationOrder( xDrawPage ) ); |
1712 | 188 | if( !sNavigationOrder.isEmpty() ) |
1713 | 0 | AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder ); |
1714 | | |
1715 | 188 | rtl::Reference< xmloff::AnimationsExporter > xAnimationsExporter; |
1716 | 188 | uno::Reference< css::animations::XAnimationNodeSupplier > xAnimNodeSupplier; |
1717 | | |
1718 | | // prepare animation export |
1719 | 188 | if(IsImpress()) |
1720 | 0 | { |
1721 | 0 | if( getExportFlags() & SvXMLExportFlags::OASIS ) |
1722 | 0 | { |
1723 | | // export new animations for oasis format |
1724 | 0 | xAnimNodeSupplier.set( xDrawPage, UNO_QUERY ); |
1725 | | |
1726 | | // prepare animations exporter if impress |
1727 | 0 | if(xAnimNodeSupplier.is()) |
1728 | 0 | { |
1729 | 0 | xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps ); |
1730 | 0 | xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() ); |
1731 | 0 | } |
1732 | 0 | } |
1733 | 0 | else |
1734 | 0 | { |
1735 | | // export old animations for ooo format |
1736 | 0 | rtl::Reference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter(); |
1737 | 0 | GetShapeExport()->setAnimationsExporter( xAnimExport ); |
1738 | 0 | } |
1739 | 0 | } |
1740 | | |
1741 | | // write draw:id |
1742 | 188 | const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage ); |
1743 | 188 | if( !aPageId.isEmpty() ) |
1744 | 0 | { |
1745 | 0 | AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId); |
1746 | 0 | } |
1747 | | |
1748 | | // write page |
1749 | 188 | SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, true, true); |
1750 | | |
1751 | | // write optional office:forms |
1752 | 188 | exportFormsElement( xDrawPage ); |
1753 | | |
1754 | | // write graphic objects on this page (if any) |
1755 | 188 | if(xDrawPage.is() && xDrawPage->getCount()) |
1756 | 188 | GetShapeExport()->exportShapes( xDrawPage ); |
1757 | | |
1758 | | // write animations and presentation notes (ONLY if presentation) |
1759 | 188 | if(IsImpress()) |
1760 | 0 | { |
1761 | 0 | if(xAnimNodeSupplier.is()) |
1762 | 0 | { |
1763 | 0 | xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() ); |
1764 | 0 | } |
1765 | 0 | else |
1766 | 0 | { |
1767 | | // animations |
1768 | 0 | rtl::Reference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() ); |
1769 | 0 | if( xAnimExport.is() ) |
1770 | 0 | xAnimExport->exportAnimations( *this ); |
1771 | |
|
1772 | 0 | xAnimExport = nullptr; |
1773 | 0 | GetShapeExport()->setAnimationsExporter( xAnimExport ); |
1774 | 0 | } |
1775 | | |
1776 | | // presentations |
1777 | 0 | Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY); |
1778 | 0 | if(xPresPage.is()) |
1779 | 0 | { |
1780 | 0 | Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage()); |
1781 | 0 | if(xNotesPage.is()) |
1782 | 0 | { |
1783 | 0 | if( !maDrawNotesPagesStyleNames[nPageInd].isEmpty() ) |
1784 | 0 | AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]); |
1785 | |
|
1786 | 0 | ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] ); |
1787 | | |
1788 | | // write presentation notes |
1789 | 0 | SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true); |
1790 | | |
1791 | | // write optional office:forms |
1792 | 0 | exportFormsElement( xNotesPage ); |
1793 | | |
1794 | | // write shapes per se |
1795 | 0 | GetShapeExport()->exportShapes( xNotesPage ); |
1796 | 0 | } |
1797 | 0 | } |
1798 | 0 | } |
1799 | | |
1800 | 188 | exportAnnotations( xDrawPage ); |
1801 | 188 | } |
1802 | 188 | } |
1803 | | |
1804 | 138 | if( IsImpress() ) |
1805 | 0 | { |
1806 | 0 | exportSections(); |
1807 | 0 | exportPresentationSettings(); |
1808 | 0 | } |
1809 | 138 | } |
1810 | | |
1811 | | void SdXMLExport::exportSections() |
1812 | 0 | { |
1813 | 0 | if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0) |
1814 | 0 | return; |
1815 | | |
1816 | 0 | try |
1817 | 0 | { |
1818 | 0 | uno::Reference<beans::XPropertySet> xDocProps(GetModel(), uno::UNO_QUERY); |
1819 | 0 | if (!xDocProps.is()) |
1820 | 0 | return; |
1821 | | |
1822 | 0 | uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo(); |
1823 | 0 | if (!xPropsInfo.is() || !xPropsInfo->hasPropertyByName(u"SlideSections"_ustr)) |
1824 | 0 | return; |
1825 | | |
1826 | 0 | uno::Sequence<beans::PropertyValue> aSectionList; |
1827 | 0 | xDocProps->getPropertyValue(u"SlideSections"_ustr) >>= aSectionList; |
1828 | |
|
1829 | 0 | if (!aSectionList.hasElements()) |
1830 | 0 | return; |
1831 | | |
1832 | 0 | SvXMLElementExport aSectionListElem(*this, XML_NAMESPACE_LO_EXT, XML_SECTION_LIST, |
1833 | 0 | true, true); |
1834 | |
|
1835 | 0 | for (const auto& rSectionProp : aSectionList) |
1836 | 0 | { |
1837 | 0 | uno::Sequence<beans::PropertyValue> aSectionProps; |
1838 | 0 | rSectionProp.Value >>= aSectionProps; |
1839 | |
|
1840 | 0 | OUString sSectionName; |
1841 | 0 | OUString sSectionId; |
1842 | 0 | uno::Sequence<OUString> aSlideNames; |
1843 | |
|
1844 | 0 | for (const auto& rProp : aSectionProps) |
1845 | 0 | { |
1846 | 0 | if (rProp.Name == "Name") |
1847 | 0 | rProp.Value >>= sSectionName; |
1848 | 0 | else if (rProp.Name == "Id") |
1849 | 0 | rProp.Value >>= sSectionId; |
1850 | 0 | else if (rProp.Name == "SlideNameList") |
1851 | 0 | rProp.Value >>= aSlideNames; |
1852 | 0 | } |
1853 | |
|
1854 | 0 | AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, sSectionName); |
1855 | 0 | if (!sSectionId.isEmpty()) |
1856 | 0 | AddAttribute(XML_NAMESPACE_LO_EXT, XML_IDENTIFIER, sSectionId); |
1857 | 0 | SvXMLElementExport aSectionElem(*this, XML_NAMESPACE_LO_EXT, XML_SECTION, |
1858 | 0 | true, true); |
1859 | | |
1860 | | // Write slide page names |
1861 | 0 | for (const OUString& rSlideName : aSlideNames) |
1862 | 0 | { |
1863 | 0 | AddAttribute(XML_NAMESPACE_LO_EXT, XML_NAME, rSlideName); |
1864 | 0 | SvXMLElementExport aSlideElem(*this, XML_NAMESPACE_LO_EXT, XML_SECTION_SLIDE, true, |
1865 | 0 | true); |
1866 | 0 | } |
1867 | 0 | } |
1868 | 0 | } |
1869 | 0 | catch (const uno::Exception&) |
1870 | 0 | { |
1871 | 0 | TOOLS_WARN_EXCEPTION("xmloff.draw", "while exporting sections"); |
1872 | 0 | } |
1873 | 0 | } |
1874 | | |
1875 | | void SdXMLExport::exportPresentationSettings() |
1876 | 0 | { |
1877 | 0 | try |
1878 | 0 | { |
1879 | 0 | Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY ); |
1880 | 0 | if( !xPresSupplier.is() ) |
1881 | 0 | return; |
1882 | | |
1883 | 0 | Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY ); |
1884 | 0 | if( !xPresProps.is() ) |
1885 | 0 | return; |
1886 | | |
1887 | 0 | bool bHasAttr = false; |
1888 | |
|
1889 | 0 | bool bTemp = false; |
1890 | | |
1891 | | // export range |
1892 | 0 | xPresProps->getPropertyValue(u"IsShowAll"_ustr) >>= bTemp; |
1893 | 0 | if( !bTemp ) |
1894 | 0 | { |
1895 | 0 | OUString aFirstPage; |
1896 | 0 | xPresProps->getPropertyValue(u"FirstPage"_ustr) >>= aFirstPage; |
1897 | 0 | if( !aFirstPage.isEmpty() ) |
1898 | 0 | { |
1899 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage ); |
1900 | 0 | bHasAttr = true; |
1901 | 0 | } |
1902 | 0 | else |
1903 | 0 | { |
1904 | 0 | OUString aCustomShow; |
1905 | 0 | xPresProps->getPropertyValue(u"CustomShow"_ustr) >>= aCustomShow; |
1906 | 0 | if( !aCustomShow.isEmpty() ) |
1907 | 0 | { |
1908 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow ); |
1909 | 0 | bHasAttr = true; |
1910 | 0 | } |
1911 | 0 | } |
1912 | 0 | } |
1913 | |
|
1914 | 0 | xPresProps->getPropertyValue(u"IsEndless"_ustr) >>= bTemp; |
1915 | 0 | if( bTemp ) |
1916 | 0 | { |
1917 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE ); |
1918 | 0 | bHasAttr = true; |
1919 | |
|
1920 | 0 | sal_Int32 nPause = 0; |
1921 | 0 | xPresProps->getPropertyValue(u"Pause"_ustr) >>= nPause; |
1922 | |
|
1923 | 0 | util::Duration aDuration; |
1924 | 0 | aDuration.Seconds = static_cast<sal_uInt16>(nPause); |
1925 | |
|
1926 | 0 | OUStringBuffer aOut; |
1927 | 0 | ::sax::Converter::convertDuration(aOut, aDuration); |
1928 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() ); |
1929 | 0 | } |
1930 | |
|
1931 | 0 | xPresProps->getPropertyValue(u"AllowAnimations"_ustr) >>= bTemp; |
1932 | 0 | if( !bTemp ) |
1933 | 0 | { |
1934 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED ); |
1935 | 0 | bHasAttr = true; |
1936 | 0 | } |
1937 | |
|
1938 | 0 | xPresProps->getPropertyValue(u"IsAlwaysOnTop"_ustr) >>= bTemp; |
1939 | 0 | if( bTemp ) |
1940 | 0 | { |
1941 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE ); |
1942 | 0 | bHasAttr = true; |
1943 | 0 | } |
1944 | |
|
1945 | 0 | xPresProps->getPropertyValue(u"IsAutomatic"_ustr) >>= bTemp; |
1946 | 0 | if( bTemp ) |
1947 | 0 | { |
1948 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE ); |
1949 | 0 | bHasAttr = true; |
1950 | 0 | } |
1951 | |
|
1952 | 0 | xPresProps->getPropertyValue(u"IsFullScreen"_ustr) >>= bTemp; |
1953 | 0 | if( !bTemp ) |
1954 | 0 | { |
1955 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE ); |
1956 | 0 | bHasAttr = true; |
1957 | 0 | } |
1958 | | |
1959 | | // We need to always export this attribute, because the import had the wrong default (tdf#108824) |
1960 | 0 | xPresProps->getPropertyValue(u"IsMouseVisible"_ustr) >>= bTemp; |
1961 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, bTemp ? XML_TRUE : XML_FALSE); |
1962 | 0 | bHasAttr = true; |
1963 | |
|
1964 | 0 | xPresProps->getPropertyValue(u"StartWithNavigator"_ustr) >>= bTemp; |
1965 | 0 | if( bTemp ) |
1966 | 0 | { |
1967 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE ); |
1968 | 0 | bHasAttr = true; |
1969 | 0 | } |
1970 | |
|
1971 | 0 | xPresProps->getPropertyValue(u"UsePen"_ustr) >>= bTemp; |
1972 | 0 | if( bTemp ) |
1973 | 0 | { |
1974 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE ); |
1975 | 0 | bHasAttr = true; |
1976 | 0 | } |
1977 | |
|
1978 | 0 | xPresProps->getPropertyValue(u"IsTransitionOnClick"_ustr) >>= bTemp; |
1979 | 0 | if( !bTemp ) |
1980 | 0 | { |
1981 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED ); |
1982 | 0 | bHasAttr = true; |
1983 | 0 | } |
1984 | |
|
1985 | 0 | xPresProps->getPropertyValue(u"IsShowLogo"_ustr) >>= bTemp; |
1986 | 0 | if( bTemp ) |
1987 | 0 | { |
1988 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE ); |
1989 | 0 | bHasAttr = true; |
1990 | 0 | } |
1991 | |
|
1992 | 0 | Reference< container::XNameContainer > xShows; |
1993 | 0 | Sequence< OUString > aShowNames; |
1994 | 0 | bool bHasNames = false; |
1995 | |
|
1996 | 0 | Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY ); |
1997 | 0 | if( xSup.is() ) |
1998 | 0 | { |
1999 | 0 | xShows = xSup->getCustomPresentations(); |
2000 | 0 | if( xShows.is() ) |
2001 | 0 | { |
2002 | 0 | aShowNames = xShows->getElementNames(); |
2003 | 0 | bHasNames = aShowNames.hasElements(); |
2004 | 0 | } |
2005 | 0 | } |
2006 | |
|
2007 | 0 | if( bHasAttr || bHasNames ) |
2008 | 0 | { |
2009 | 0 | SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, true, true); |
2010 | |
|
2011 | 0 | if( !bHasNames ) |
2012 | 0 | return; |
2013 | | |
2014 | 0 | Reference< XIndexContainer > xShow; |
2015 | 0 | Reference< XNamed > xPageName; |
2016 | |
|
2017 | 0 | OUStringBuffer sTmp; |
2018 | |
|
2019 | 0 | for (const auto& rShowName : aShowNames) |
2020 | 0 | { |
2021 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, rShowName ); |
2022 | |
|
2023 | 0 | xShows->getByName( rShowName ) >>= xShow; |
2024 | 0 | SAL_WARN_IF( !xShow.is(), "xmloff", "invalid custom show!" ); |
2025 | 0 | if( !xShow.is() ) |
2026 | 0 | continue; |
2027 | | |
2028 | 0 | const sal_Int32 nPageCount = xShow->getCount(); |
2029 | 0 | for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ ) |
2030 | 0 | { |
2031 | 0 | xShow->getByIndex( nPage ) >>= xPageName; |
2032 | |
|
2033 | 0 | if( !xPageName.is() ) |
2034 | 0 | continue; |
2035 | | |
2036 | 0 | if( !sTmp.isEmpty() ) |
2037 | 0 | sTmp.append( ',' ); |
2038 | 0 | sTmp.append( xPageName->getName() ); |
2039 | |
|
2040 | 0 | } |
2041 | |
|
2042 | 0 | if( !sTmp.isEmpty() ) |
2043 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() ); |
2044 | |
|
2045 | 0 | SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, true, true); |
2046 | 0 | } |
2047 | 0 | } |
2048 | 0 | } |
2049 | 0 | catch(const uno::Exception&) |
2050 | 0 | { |
2051 | 0 | TOOLS_WARN_EXCEPTION("xmloff.draw", "while exporting <presentation:settings>"); |
2052 | 0 | } |
2053 | 0 | } |
2054 | | |
2055 | | void SdXMLExport::ExportStyles_(bool bUsed) |
2056 | 138 | { |
2057 | 138 | GetPropertySetMapper()->SetAutoStyles( false ); |
2058 | | |
2059 | | // export fill styles |
2060 | 138 | SvXMLExport::ExportStyles_( bUsed ); |
2061 | | |
2062 | | // write draw:style-name for object graphic-styles |
2063 | 138 | GetShapeExport()->ExportGraphicDefaults(); |
2064 | | |
2065 | | // do not export in ODF 1.1 or older |
2066 | 138 | if (getSaneDefaultVersion() >= SvtSaveOptions::ODFSVER_012) |
2067 | 138 | GetShapeExport()->GetShapeTableExport()->exportTableStyles(); |
2068 | | |
2069 | | // write presentation styles |
2070 | 138 | ImpWritePresentationStyles(); |
2071 | | |
2072 | | // prepare draw:auto-layout-name for page export |
2073 | 138 | ImpPrepAutoLayoutInfos(); |
2074 | | |
2075 | | // write draw:auto-layout-name for page export |
2076 | 138 | ImpWriteAutoLayoutInfos(); |
2077 | | |
2078 | 138 | Reference< beans::XPropertySet > xInfoSet( getExportInfo() ); |
2079 | 138 | if( xInfoSet.is() ) |
2080 | 138 | { |
2081 | 138 | Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() ); |
2082 | | |
2083 | 138 | if( xInfoSetInfo->hasPropertyByName( gsPageLayoutNames ) ) |
2084 | 0 | { |
2085 | 0 | xInfoSet->setPropertyValue( gsPageLayoutNames, Any(maDrawPagesAutoLayoutNames) ); |
2086 | 0 | } |
2087 | 138 | } |
2088 | 138 | } |
2089 | | |
2090 | | void SdXMLExport::collectAutoStyles() |
2091 | 438 | { |
2092 | 438 | SvXMLExport::collectAutoStyles(); |
2093 | 438 | if (mbAutoStylesCollected) |
2094 | 276 | return; |
2095 | | |
2096 | 162 | Reference< beans::XPropertySet > xInfoSet( getExportInfo() ); |
2097 | 162 | if( xInfoSet.is() ) |
2098 | 162 | { |
2099 | 162 | Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() ); |
2100 | | |
2101 | 162 | if( xInfoSetInfo->hasPropertyByName( gsPageLayoutNames ) ) |
2102 | 0 | { |
2103 | 0 | xInfoSet->getPropertyValue( gsPageLayoutNames ) >>= maDrawPagesAutoLayoutNames; |
2104 | 0 | } |
2105 | 162 | } |
2106 | | |
2107 | 162 | GetPropertySetMapper()->SetAutoStyles( true ); |
2108 | | |
2109 | 162 | if( getExportFlags() & SvXMLExportFlags::STYLES ) |
2110 | 162 | { |
2111 | | // #80012# PageMaster export moved from _ExportStyles |
2112 | | // prepare page-master infos |
2113 | 162 | ImpPrepPageMasterInfos(); |
2114 | | |
2115 | | // prepare draw:style-name for master page export |
2116 | 162 | ImpPrepMasterPageInfos(); |
2117 | 162 | } |
2118 | | |
2119 | 162 | if( getExportFlags() & SvXMLExportFlags::CONTENT ) |
2120 | 162 | { |
2121 | | // prepare draw:style-name for page export |
2122 | 162 | ImpPrepDrawPageInfos(); |
2123 | 162 | } |
2124 | | |
2125 | 162 | if( getExportFlags() & SvXMLExportFlags::STYLES ) |
2126 | 162 | { |
2127 | | // create auto style infos for shapes on master handout page |
2128 | 162 | if( IsImpress() ) |
2129 | 0 | { |
2130 | 0 | Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); |
2131 | 0 | if( xHandoutSupp.is() ) |
2132 | 0 | { |
2133 | 0 | Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() ); |
2134 | 0 | if( xHandoutPage.is() && xHandoutPage->getCount()) |
2135 | 0 | GetShapeExport()->collectShapesAutoStyles( xHandoutPage ); |
2136 | 0 | } |
2137 | 0 | } |
2138 | | |
2139 | | // create auto style infos for objects on master pages |
2140 | 324 | for(sal_Int32 nMPageId(0); nMPageId < mnDocMasterPageCount; nMPageId++) |
2141 | 162 | { |
2142 | 162 | Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY ); |
2143 | | |
2144 | 162 | if( xMasterPage.is() ) |
2145 | 162 | { |
2146 | | // collect layer information |
2147 | 162 | GetFormExport()->examineForms( xMasterPage ); |
2148 | | |
2149 | | // get MasterPage Name |
2150 | 162 | OUString aMasterPageNamePrefix; |
2151 | 162 | Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY); |
2152 | 162 | if(xNamed.is()) |
2153 | 162 | { |
2154 | 162 | aMasterPageNamePrefix = xNamed->getName(); |
2155 | 162 | } |
2156 | 162 | if(!aMasterPageNamePrefix.isEmpty()) |
2157 | 162 | { |
2158 | 162 | aMasterPageNamePrefix += "-"; |
2159 | 162 | } |
2160 | 162 | GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix ); |
2161 | | |
2162 | 162 | if(xMasterPage.is() && xMasterPage->getCount()) |
2163 | 0 | GetShapeExport()->collectShapesAutoStyles( xMasterPage ); |
2164 | | |
2165 | 162 | if(IsImpress()) |
2166 | 0 | { |
2167 | 0 | Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY); |
2168 | 0 | if(xPresPage.is()) |
2169 | 0 | { |
2170 | 0 | Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage()); |
2171 | 0 | if(xNotesPage.is()) |
2172 | 0 | { |
2173 | | // collect layer information |
2174 | 0 | GetFormExport()->examineForms( xNotesPage ); |
2175 | |
|
2176 | 0 | if(xNotesPage->getCount()) |
2177 | 0 | GetShapeExport()->collectShapesAutoStyles( xNotesPage ); |
2178 | 0 | } |
2179 | 0 | } |
2180 | 0 | } |
2181 | 162 | collectAnnotationAutoStyles(xMasterPage); |
2182 | 162 | } |
2183 | 162 | } |
2184 | 162 | } |
2185 | | |
2186 | 162 | if( getExportFlags() & SvXMLExportFlags::CONTENT ) |
2187 | 162 | { |
2188 | | // prepare animations exporter if impress |
2189 | 162 | if(IsImpress() && (!(getExportFlags() & SvXMLExportFlags::OASIS)) ) |
2190 | 0 | { |
2191 | 0 | rtl::Reference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter(); |
2192 | 0 | GetShapeExport()->setAnimationsExporter( xAnimExport ); |
2193 | 0 | } |
2194 | | |
2195 | | // create auto style infos for objects on pages |
2196 | 375 | for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++) |
2197 | 213 | { |
2198 | 213 | Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY ); |
2199 | 213 | if( xDrawPage.is() ) |
2200 | 213 | { |
2201 | | // collect layer information |
2202 | 213 | GetFormExport()->examineForms( xDrawPage ); |
2203 | | |
2204 | | // get MasterPage Name |
2205 | 213 | OUString aMasterPageNamePrefix; |
2206 | 213 | Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY); |
2207 | 213 | if(xMasterPageInt.is()) |
2208 | 213 | { |
2209 | 213 | Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage()); |
2210 | 213 | if(xUsedMasterPage.is()) |
2211 | 213 | { |
2212 | 213 | Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY); |
2213 | 213 | if(xMasterNamed.is()) |
2214 | 213 | { |
2215 | 213 | aMasterPageNamePrefix = xMasterNamed->getName(); |
2216 | 213 | } |
2217 | 213 | } |
2218 | 213 | } |
2219 | 213 | if(!aMasterPageNamePrefix.isEmpty()) |
2220 | 213 | { |
2221 | 213 | aMasterPageNamePrefix += "-"; |
2222 | 213 | } |
2223 | | |
2224 | 213 | GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix ); |
2225 | | |
2226 | | // prepare object infos |
2227 | 213 | if(xDrawPage.is() && xDrawPage->getCount()) |
2228 | 213 | GetShapeExport()->collectShapesAutoStyles( xDrawPage ); |
2229 | | |
2230 | | // prepare presentation notes page object infos (ONLY if presentation) |
2231 | 213 | if(IsImpress()) |
2232 | 0 | { |
2233 | 0 | Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY); |
2234 | 0 | if(xPresPage.is()) |
2235 | 0 | { |
2236 | 0 | Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage()); |
2237 | 0 | if(xNotesPage.is()) |
2238 | 0 | { |
2239 | | // collect layer information |
2240 | 0 | GetFormExport()->examineForms( xNotesPage ); |
2241 | |
|
2242 | 0 | if(xNotesPage->getCount()) |
2243 | 0 | GetShapeExport()->collectShapesAutoStyles( xNotesPage ); |
2244 | 0 | } |
2245 | 0 | } |
2246 | 0 | } |
2247 | | |
2248 | 213 | collectAnnotationAutoStyles( xDrawPage ); |
2249 | 213 | } |
2250 | 213 | } |
2251 | 162 | if (IsImpress()) |
2252 | 0 | { |
2253 | 0 | rtl::Reference< XMLAnimationsExporter > xAnimExport; |
2254 | 0 | GetShapeExport()->setAnimationsExporter( xAnimExport ); |
2255 | 0 | } |
2256 | 162 | } |
2257 | | |
2258 | 162 | mbAutoStylesCollected = true; |
2259 | 162 | } |
2260 | | |
2261 | | void SdXMLExport::ExportAutoStyles_() |
2262 | 138 | { |
2263 | 138 | collectAutoStyles(); |
2264 | | |
2265 | 138 | if( getExportFlags() & SvXMLExportFlags::STYLES ) |
2266 | 138 | { |
2267 | | // write page-master infos |
2268 | 138 | ImpWritePageMasterInfos(); |
2269 | 138 | } |
2270 | | |
2271 | | // export draw-page styles |
2272 | 138 | GetAutoStylePool()->exportXML( XmlStyleFamily::SD_DRAWINGPAGE_ID ); |
2273 | | |
2274 | 138 | exportAutoDataStyles(); |
2275 | | |
2276 | 138 | GetShapeExport()->exportAutoStyles(); |
2277 | | |
2278 | 138 | SvXMLExportFlags nContentAutostyles = SvXMLExportFlags::CONTENT | SvXMLExportFlags::AUTOSTYLES; |
2279 | 138 | if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles ) |
2280 | 138 | GetFormExport()->exportAutoStyles( ); |
2281 | | |
2282 | | // ...for text |
2283 | 138 | GetTextParagraphExport()->exportTextAutoStyles(); |
2284 | 138 | } |
2285 | | |
2286 | | void SdXMLExport::ExportMasterStyles_() |
2287 | 138 | { |
2288 | | // export layer |
2289 | 138 | SdXMLayerExporter::exportLayer( *this ); |
2290 | | |
2291 | | // export handout master page if impress |
2292 | 138 | if( IsImpress() ) |
2293 | 0 | { |
2294 | 0 | Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY ); |
2295 | 0 | if( xHandoutSupp.is() ) |
2296 | 0 | { |
2297 | 0 | Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() ); |
2298 | 0 | if( xHandoutPage.is() ) |
2299 | 0 | { |
2300 | | // presentation:page-layout-name |
2301 | 0 | if( IsImpress() && !maDrawPagesAutoLayoutNames[0].isEmpty()) |
2302 | 0 | { |
2303 | 0 | AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] )); |
2304 | 0 | } |
2305 | |
|
2306 | 0 | ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster; |
2307 | 0 | if(pInfo) |
2308 | 0 | { |
2309 | 0 | const OUString& sString = pInfo->GetName(); |
2310 | 0 | AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString ); |
2311 | 0 | } |
2312 | | |
2313 | | // draw:style-name |
2314 | 0 | if( !maHandoutMasterStyleName.isEmpty() ) |
2315 | 0 | AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName); |
2316 | |
|
2317 | 0 | ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings ); |
2318 | | |
2319 | | // write masterpage |
2320 | 0 | SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, true, true); |
2321 | | |
2322 | | // write graphic objects on this master page (if any) |
2323 | 0 | if(xHandoutPage.is() && xHandoutPage->getCount()) |
2324 | 0 | GetShapeExport()->exportShapes( xHandoutPage ); |
2325 | 0 | } |
2326 | 0 | } |
2327 | 0 | } |
2328 | | |
2329 | | // export MasterPages in master-styles section |
2330 | 276 | for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++) |
2331 | 138 | { |
2332 | 138 | Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY ); |
2333 | 138 | if(xMasterPage.is()) |
2334 | 138 | { |
2335 | | // prepare masterpage attributes |
2336 | 138 | Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY); |
2337 | 138 | if(xNamed.is()) |
2338 | 138 | { |
2339 | 138 | bool bEncoded = false; |
2340 | 138 | OUString sMasterPageName = xNamed->getName(); |
2341 | 138 | AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, |
2342 | 138 | EncodeStyleName( sMasterPageName, &bEncoded )); |
2343 | 138 | if( bEncoded ) |
2344 | 0 | AddAttribute( |
2345 | 0 | XML_NAMESPACE_STYLE, XML_DISPLAY_NAME, |
2346 | 0 | sMasterPageName ); |
2347 | 138 | } |
2348 | | |
2349 | 138 | ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterUsageList.at( nMPageId ); |
2350 | 138 | if(pInfo) |
2351 | 138 | { |
2352 | 138 | const OUString& sString = pInfo->GetName(); |
2353 | 138 | AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString ); |
2354 | 138 | } |
2355 | | |
2356 | | // draw:style-name (background attributes) |
2357 | 138 | if( !maMasterPagesStyleNames[nMPageId].isEmpty() ) |
2358 | 138 | AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, |
2359 | 138 | maMasterPagesStyleNames[nMPageId]); |
2360 | | |
2361 | | // write masterpage |
2362 | 138 | SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, true, true); |
2363 | | |
2364 | | // write optional office:forms |
2365 | 138 | exportFormsElement( xMasterPage ); |
2366 | | |
2367 | | // write optional loext:theme |
2368 | 138 | exportTheme(xMasterPage); |
2369 | | |
2370 | | // write graphic objects on this master page (if any) |
2371 | 138 | if(xMasterPage.is() && xMasterPage->getCount()) |
2372 | 0 | GetShapeExport()->exportShapes( xMasterPage ); |
2373 | | |
2374 | | // write presentation notes (ONLY if presentation) |
2375 | 138 | if(IsImpress()) |
2376 | 0 | { |
2377 | 0 | Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY); |
2378 | 0 | if(xPresPage.is()) |
2379 | 0 | { |
2380 | 0 | Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage()); |
2381 | 0 | if(xNotesPage.is()) |
2382 | 0 | { |
2383 | 0 | ImpXMLEXPPageMasterInfo* pMasterInfo = mvNotesPageMasterUsageList.at( nMPageId ); |
2384 | 0 | if(pMasterInfo) |
2385 | 0 | { |
2386 | 0 | const OUString& sString = pMasterInfo->GetName(); |
2387 | 0 | AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString); |
2388 | 0 | } |
2389 | | |
2390 | | // write presentation notes |
2391 | 0 | SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true); |
2392 | | |
2393 | | // write optional office:forms |
2394 | 0 | exportFormsElement( xNotesPage ); |
2395 | | |
2396 | | // write shapes per se |
2397 | 0 | GetShapeExport()->exportShapes( xNotesPage ); |
2398 | 0 | } |
2399 | 0 | } |
2400 | 0 | } |
2401 | 138 | exportAnnotations( xMasterPage ); |
2402 | 138 | } |
2403 | 138 | } |
2404 | 138 | } |
2405 | | |
2406 | | void SdXMLExport::exportFormsElement( const Reference< XDrawPage >& xDrawPage ) |
2407 | 326 | { |
2408 | 326 | if( !xDrawPage.is() ) |
2409 | 0 | return; |
2410 | | |
2411 | 326 | Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY ); |
2412 | 326 | if ( xFormsSupplier.is() && xFormsSupplier->hasForms() ) |
2413 | 0 | { |
2414 | | // write masterpage |
2415 | 0 | ::xmloff::OOfficeFormsExport aForms(*this); |
2416 | 0 | GetFormExport()->exportForms( xDrawPage ); |
2417 | 0 | } |
2418 | | |
2419 | 326 | if(! GetFormExport()->seekPage( xDrawPage ) ) |
2420 | 0 | { |
2421 | 0 | OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" ); |
2422 | 0 | } |
2423 | 326 | } |
2424 | | |
2425 | | void SdXMLExport::exportTheme(const uno::Reference<drawing::XDrawPage>& xDrawPage) |
2426 | 138 | { |
2427 | 138 | if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0) |
2428 | 0 | { |
2429 | | // Do not export in standard ODF 1.3 or older. |
2430 | 0 | return; |
2431 | 0 | } |
2432 | | |
2433 | 138 | uno::Reference<beans::XPropertySet> xPropertySet(xDrawPage, uno::UNO_QUERY); |
2434 | 138 | if (!xPropertySet.is()) |
2435 | 0 | return; |
2436 | | |
2437 | 138 | uno::Reference<util::XTheme> xTheme; |
2438 | 138 | xPropertySet->getPropertyValue(u"Theme"_ustr) >>= xTheme; |
2439 | 138 | if (!xTheme.is()) |
2440 | 0 | return; |
2441 | | |
2442 | 138 | auto* pUnoTheme = dynamic_cast<UnoTheme*>(xTheme.get()); |
2443 | 138 | if (!pUnoTheme) |
2444 | 0 | return; |
2445 | | |
2446 | 138 | auto pTheme = pUnoTheme->getTheme(); |
2447 | 138 | if (!pTheme) |
2448 | 0 | return; |
2449 | | |
2450 | 138 | ExportThemeElement(pTheme); |
2451 | 138 | } |
2452 | | |
2453 | | void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps) |
2454 | 162 | { |
2455 | 162 | Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY ); |
2456 | 162 | if( !xPropSet.is() ) |
2457 | 0 | return; |
2458 | | |
2459 | 162 | awt::Rectangle aVisArea; |
2460 | 162 | xPropSet->getPropertyValue(u"VisibleArea"_ustr) >>= aVisArea; |
2461 | | |
2462 | 162 | rProps.realloc(4); |
2463 | 162 | beans::PropertyValue* pProps = rProps.getArray(); |
2464 | | |
2465 | 162 | pProps[0].Name = "VisibleAreaTop"; |
2466 | 162 | pProps[0].Value <<= aVisArea.Y; |
2467 | 162 | pProps[1].Name = "VisibleAreaLeft"; |
2468 | 162 | pProps[1].Value <<= aVisArea.X; |
2469 | 162 | pProps[2].Name = "VisibleAreaWidth"; |
2470 | 162 | pProps[2].Value <<= aVisArea.Width; |
2471 | 162 | pProps[3].Name = "VisibleAreaHeight"; |
2472 | 162 | pProps[3].Value <<= aVisArea.Height; |
2473 | | |
2474 | 162 | } |
2475 | | |
2476 | | void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps) |
2477 | 162 | { |
2478 | 162 | Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY ); |
2479 | 162 | if( !xFac.is() ) |
2480 | 0 | return; |
2481 | | |
2482 | 162 | Reference< beans::XPropertySet > xProps( xFac->createInstance(u"com.sun.star.document.Settings"_ustr), UNO_QUERY ); |
2483 | 162 | if( xProps.is() ) |
2484 | 162 | SvXMLUnitConverter::convertPropertySet( rProps, xProps ); |
2485 | 162 | DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get())); |
2486 | 162 | if (!pFilter) |
2487 | 0 | return; |
2488 | 162 | const uno::Reference< embed::XStorage > xStorage(GetTargetStorage()); |
2489 | 162 | if (!xStorage.is()) |
2490 | 162 | return; |
2491 | 0 | rProps = pFilter->filterStreamsToStorage(xStorage, rProps); |
2492 | 0 | } |
2493 | | |
2494 | | void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat ) |
2495 | 0 | { |
2496 | 0 | sal_Int32 nFormat = nNumberFormat; |
2497 | 0 | if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) ) |
2498 | 0 | nFormat -= 2; |
2499 | |
|
2500 | 0 | if( bTimeFormat ) |
2501 | 0 | { |
2502 | 0 | maUsedTimeStyles.insert( nFormat ); |
2503 | 0 | } |
2504 | 0 | else |
2505 | 0 | { |
2506 | 0 | maUsedDateStyles.insert( nFormat ); |
2507 | 0 | } |
2508 | 0 | } |
2509 | | |
2510 | | void SdXMLExport::exportDataStyles() |
2511 | 0 | { |
2512 | | // there are no data styles to export in draw/impress yet |
2513 | 0 | } |
2514 | | |
2515 | | void SdXMLExport::exportAutoDataStyles() |
2516 | 138 | { |
2517 | 138 | for( const auto& rUsedDateStyle : maUsedDateStyles ) |
2518 | 0 | SdXMLNumberStylesExporter::exportDateStyle( *this, rUsedDateStyle ); |
2519 | | |
2520 | 138 | for( const auto& rUsedTimeStyle : maUsedTimeStyles ) |
2521 | 0 | SdXMLNumberStylesExporter::exportTimeStyle( *this, rUsedTimeStyle ); |
2522 | | |
2523 | 138 | if(HasFormExport()) |
2524 | 138 | GetFormExport()->exportAutoControlNumberStyles(); |
2525 | 138 | } |
2526 | | |
2527 | | OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat ) const |
2528 | 0 | { |
2529 | 0 | if( bTimeFormat ) |
2530 | 0 | { |
2531 | 0 | return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat ); |
2532 | 0 | } |
2533 | 0 | else |
2534 | 0 | { |
2535 | 0 | return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat ); |
2536 | 0 | } |
2537 | 0 | } |
2538 | | |
2539 | | OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage ) |
2540 | 188 | { |
2541 | 188 | OUStringBuffer sNavOrder; |
2542 | 188 | try |
2543 | 188 | { |
2544 | 188 | Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW ); |
2545 | 188 | Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue(u"NavigationOrder"_ustr), UNO_QUERY_THROW ); |
2546 | | |
2547 | 188 | Reference< XIndexAccess > xZOrderAccess = xDrawPage; |
2548 | | |
2549 | | // only export navigation order if it is different from the z-order |
2550 | 188 | if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) ) |
2551 | 0 | { |
2552 | 0 | sal_Int32 nIndex; |
2553 | 0 | const sal_Int32 nCount = xNavOrder->getCount(); |
2554 | 0 | for( nIndex = 0; nIndex < nCount; ++nIndex ) |
2555 | 0 | { |
2556 | 0 | OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) ); |
2557 | 0 | if( !sId.isEmpty() ) |
2558 | 0 | { |
2559 | 0 | if( !sNavOrder.isEmpty() ) |
2560 | 0 | sNavOrder.append( ' ' ); |
2561 | 0 | sNavOrder.append( sId ); |
2562 | 0 | } |
2563 | 0 | } |
2564 | 0 | } |
2565 | 188 | } |
2566 | 188 | catch(const Exception&) |
2567 | 188 | { |
2568 | 0 | } |
2569 | 188 | return sNavOrder.makeStringAndClear(); |
2570 | 188 | } |
2571 | | |
2572 | | void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage ) |
2573 | 351 | { |
2574 | 351 | Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); |
2575 | 351 | if( !xAnnotationAccess.is() ) return; |
2576 | | |
2577 | 351 | try |
2578 | 351 | { |
2579 | 351 | Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); |
2580 | 351 | if( xAnnotationEnumeration.is() ) |
2581 | 351 | { |
2582 | 354 | while( xAnnotationEnumeration->hasMoreElements() ) |
2583 | 3 | { |
2584 | 3 | Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_SET_THROW ); |
2585 | 3 | Reference< XText > xText( xAnnotation->getTextRange() ); |
2586 | 3 | if(xText.is() && !xText->getString().isEmpty()) |
2587 | 3 | GetTextParagraphExport()->collectTextAutoStyles( xText ); |
2588 | 3 | } |
2589 | 351 | } |
2590 | 351 | } |
2591 | 351 | catch(const Exception&) |
2592 | 351 | { |
2593 | 0 | TOOLS_WARN_EXCEPTION("xmloff.draw", |
2594 | 0 | "exception caught during export of annotation auto styles"); |
2595 | 0 | } |
2596 | 351 | } |
2597 | | |
2598 | | void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage ) |
2599 | 326 | { |
2600 | | // do not export in standard ODF 1.3 or older |
2601 | 326 | if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0) |
2602 | 0 | { |
2603 | 0 | return; |
2604 | 0 | } |
2605 | | |
2606 | 326 | Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY ); |
2607 | 326 | if( !xAnnotationAccess.is() ) |
2608 | 0 | return; |
2609 | | |
2610 | 326 | try |
2611 | 326 | { |
2612 | 326 | Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() ); |
2613 | 326 | if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() ) |
2614 | 3 | { |
2615 | 3 | bool bRemovePersonalInfo = SvtSecurityOptions::IsOptionSet( |
2616 | 3 | SvtSecurityOptions::EOption::DocWarnRemovePersonalInfo ) && !SvtSecurityOptions::IsOptionSet( |
2617 | 0 | SvtSecurityOptions::EOption::DocWarnKeepNoteAuthorDateInfo); |
2618 | | |
2619 | 3 | OUStringBuffer sStringBuffer; |
2620 | 3 | do |
2621 | 3 | { |
2622 | 3 | Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_SET_THROW ); |
2623 | | |
2624 | 3 | RealPoint2D aPosition( xAnnotation->getPosition() ); |
2625 | | |
2626 | 3 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
2627 | 3 | static_cast<sal_Int32>( aPosition.X * 100 ) ); |
2628 | 3 | AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear()); |
2629 | | |
2630 | 3 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
2631 | 3 | static_cast<sal_Int32>( aPosition.Y * 100 ) ); |
2632 | 3 | AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear()); |
2633 | | |
2634 | 3 | RealSize2D aSize( xAnnotation->getSize() ); |
2635 | | |
2636 | 3 | if( aSize.Width || aSize.Height ) |
2637 | 0 | { |
2638 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
2639 | 0 | static_cast<sal_Int32>( aSize.Width * 100 ) ); |
2640 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear()); |
2641 | 0 | GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, |
2642 | 0 | static_cast<sal_Int32>( aSize.Height * 100 ) ); |
2643 | 0 | AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear()); |
2644 | 0 | } |
2645 | | |
2646 | | // annotation element + content |
2647 | 3 | SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, false, true); |
2648 | | |
2649 | | // author |
2650 | 3 | OUString aAuthor( xAnnotation->getAuthor() ); |
2651 | 3 | if( !aAuthor.isEmpty() ) |
2652 | 3 | { |
2653 | 3 | SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, true, false ); |
2654 | 3 | Characters( bRemovePersonalInfo |
2655 | 3 | ? "Author" + OUString::number( SvXMLExport::GetInfoID(aAuthor) ) |
2656 | 3 | : aAuthor ); |
2657 | 3 | } |
2658 | | |
2659 | | // initials |
2660 | 3 | OUString aInitials( xAnnotation->getInitials() ); |
2661 | 3 | if( !aInitials.isEmpty() ) |
2662 | 0 | { |
2663 | | // OFFICE-3776 export meta:creator-initials for ODF 1.3 |
2664 | 0 | SvXMLElementExport aInitialsElem( *this, |
2665 | 0 | (SvtSaveOptions::ODFSVER_013 <= getSaneDefaultVersion()) |
2666 | 0 | ? XML_NAMESPACE_META |
2667 | 0 | : XML_NAMESPACE_LO_EXT, |
2668 | 0 | (SvtSaveOptions::ODFSVER_013 <= getSaneDefaultVersion()) |
2669 | 0 | ? XML_CREATOR_INITIALS |
2670 | 0 | : XML_SENDER_INITIALS, |
2671 | 0 | true, false ); |
2672 | 0 | Characters( bRemovePersonalInfo |
2673 | 0 | ? OUString::number( SvXMLExport::GetInfoID(aInitials) ) |
2674 | 0 | : aInitials ); |
2675 | 0 | } |
2676 | | |
2677 | 3 | { |
2678 | | // date time |
2679 | 3 | css::util::DateTime aDate( bRemovePersonalInfo |
2680 | 3 | ? css::util::DateTime(0, 0, 0, 0, 1, 1, 1970, true) // Epoch time |
2681 | 3 | : xAnnotation->getDateTime() ); |
2682 | 3 | ::sax::Converter::convertDateTime(sStringBuffer, aDate, nullptr, true); |
2683 | 3 | SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, true, false ); |
2684 | 3 | Characters( sStringBuffer.makeStringAndClear() ); |
2685 | 3 | } |
2686 | | |
2687 | 3 | css::uno::Reference < css::text::XText > xText( xAnnotation->getTextRange() ); |
2688 | 3 | if( xText.is() ) |
2689 | 3 | GetTextParagraphExport()->exportText( xText ); |
2690 | 3 | } |
2691 | 3 | while( xAnnotationEnumeration->hasMoreElements() ); |
2692 | 3 | } |
2693 | 326 | } |
2694 | 326 | catch(const Exception&) |
2695 | 326 | { |
2696 | 0 | TOOLS_WARN_EXCEPTION("xmloff.draw", "exception caught during export of annotations"); |
2697 | 0 | } |
2698 | 326 | } |
2699 | | |
2700 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2701 | | com_sun_star_comp_Impress_XMLOasisExporter_get_implementation( |
2702 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2703 | 0 | { |
2704 | 0 | return cppu::acquire(new SdXMLExport( |
2705 | 0 | pCtx, u"XMLImpressExportOasis"_ustr, false, |
2706 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::META | SvXMLExportFlags::STYLES |
2707 | 0 | | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES |
2708 | 0 | | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS | SvXMLExportFlags::SETTINGS |
2709 | 0 | | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED)); |
2710 | 0 | } |
2711 | | |
2712 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2713 | | com_sun_star_comp_Impress_XMLOasisStylesExporter_get_implementation( |
2714 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2715 | 0 | { |
2716 | 0 | return cppu::acquire(new SdXMLExport( |
2717 | 0 | pCtx, u"XMLImpressStylesExportOasis"_ustr, false, |
2718 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES |
2719 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::FONTDECLS)); |
2720 | 0 | } |
2721 | | |
2722 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2723 | | com_sun_star_comp_Impress_XMLOasisContentExporter_get_implementation( |
2724 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2725 | 0 | { |
2726 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLImpressContentExportOasis"_ustr, false, |
2727 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES |
2728 | 0 | | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS |
2729 | 0 | | SvXMLExportFlags::FONTDECLS)); |
2730 | 0 | } |
2731 | | |
2732 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2733 | | com_sun_star_comp_Impress_XMLOasisMetaExporter_get_implementation( |
2734 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2735 | 0 | { |
2736 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLImpressMetaExportOasis"_ustr, false, |
2737 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::META)); |
2738 | 0 | } |
2739 | | |
2740 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2741 | | com_sun_star_comp_Impress_XMLOasisSettingsExporter_get_implementation( |
2742 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2743 | 0 | { |
2744 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLImpressSettingsExportOasis"_ustr, false, |
2745 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::SETTINGS)); |
2746 | 0 | } |
2747 | | |
2748 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2749 | | com_sun_star_comp_Impress_XMLExporter_get_implementation(uno::XComponentContext* pCtx, |
2750 | | uno::Sequence<uno::Any> const& /*rSeq*/) |
2751 | 0 | { |
2752 | 0 | return cppu::acquire(new SdXMLExport( |
2753 | 0 | pCtx, u"XMLImpressExportOOO"_ustr, false, |
2754 | 0 | SvXMLExportFlags::META | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES |
2755 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS |
2756 | 0 | | SvXMLExportFlags::SETTINGS | SvXMLExportFlags::FONTDECLS |
2757 | 0 | | SvXMLExportFlags::EMBEDDED)); |
2758 | 0 | } |
2759 | | |
2760 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2761 | | com_sun_star_comp_Draw_XMLExporter_get_implementation(uno::XComponentContext* pCtx, |
2762 | | uno::Sequence<uno::Any> const& /*rSeq*/) |
2763 | 0 | { |
2764 | 0 | return cppu::acquire(new SdXMLExport( |
2765 | 0 | pCtx, u"XMLDrawExportOOO"_ustr, true, |
2766 | 0 | SvXMLExportFlags::META | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES |
2767 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS |
2768 | 0 | | SvXMLExportFlags::SETTINGS | SvXMLExportFlags::FONTDECLS |
2769 | 0 | | SvXMLExportFlags::EMBEDDED)); |
2770 | 0 | } |
2771 | | |
2772 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2773 | | com_sun_star_comp_Draw_XMLOasisSettingsExporter_get_implementation( |
2774 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2775 | 0 | { |
2776 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLDrawSettingsExportOasis"_ustr, true, |
2777 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::SETTINGS)); |
2778 | 0 | } |
2779 | | |
2780 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2781 | | com_sun_star_comp_Draw_XMLOasisMetaExporter_get_implementation( |
2782 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2783 | 0 | { |
2784 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLDrawMetaExportOasis"_ustr, true, |
2785 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::META)); |
2786 | 0 | } |
2787 | | |
2788 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2789 | | com_sun_star_comp_Draw_XMLOasisContentExporter_get_implementation( |
2790 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2791 | 0 | { |
2792 | 0 | return cppu::acquire(new SdXMLExport(pCtx, u"XMLDrawContentExportOasis"_ustr, true, |
2793 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES |
2794 | 0 | | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS |
2795 | 0 | | SvXMLExportFlags::FONTDECLS)); |
2796 | 0 | } |
2797 | | |
2798 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2799 | | com_sun_star_comp_Draw_XMLOasisStylesExporter_get_implementation( |
2800 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2801 | 0 | { |
2802 | 0 | return cppu::acquire(new SdXMLExport( |
2803 | 0 | pCtx, u"XMLDrawStylesExportOasis"_ustr, true, |
2804 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES |
2805 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::FONTDECLS)); |
2806 | 0 | } |
2807 | | |
2808 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2809 | | com_sun_star_comp_Draw_XMLOasisExporter_get_implementation(uno::XComponentContext* pCtx, |
2810 | | uno::Sequence<uno::Any> const& /*rSeq*/) |
2811 | 162 | { |
2812 | 162 | return cppu::acquire(new SdXMLExport( |
2813 | 162 | pCtx, u"XMLDrawExportOasis"_ustr, true, |
2814 | 162 | SvXMLExportFlags::OASIS | SvXMLExportFlags::META | SvXMLExportFlags::STYLES |
2815 | 162 | | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES |
2816 | 162 | | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS | SvXMLExportFlags::SETTINGS |
2817 | 162 | | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED)); |
2818 | 162 | } |
2819 | | |
2820 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2821 | | com_sun_star_comp_DrawingLayer_XMLExporter_get_implementation( |
2822 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2823 | 0 | { |
2824 | 0 | return cppu::acquire( |
2825 | 0 | new SdXMLExport(pCtx, u"XMLDrawingLayerExport"_ustr, true, |
2826 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES |
2827 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT |
2828 | 0 | | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED)); |
2829 | 0 | } |
2830 | | |
2831 | | extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface* |
2832 | | com_sun_star_comp_Impress_XMLClipboardExporter_get_implementation( |
2833 | | uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/) |
2834 | 0 | { |
2835 | 0 | return cppu::acquire( |
2836 | 0 | new SdXMLExport(pCtx, u"XMLImpressClipboardExport"_ustr, /*bIsDraw=*/false, |
2837 | 0 | SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES |
2838 | 0 | | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT |
2839 | 0 | | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED)); |
2840 | 0 | } |
2841 | | |
2842 | | XMLFontAutoStylePool* SdXMLExport::CreateFontAutoStylePool() |
2843 | 162 | { |
2844 | 162 | try |
2845 | 162 | { |
2846 | 162 | Reference<lang::XMultiServiceFactory> xFactory(GetModel(), UNO_QUERY); |
2847 | 162 | Reference<beans::XPropertySet> xProps; |
2848 | 162 | Reference<beans::XPropertySetInfo> xInfo; |
2849 | | |
2850 | 162 | if (xFactory.is()) |
2851 | 162 | xProps.set(xFactory->createInstance(u"com.sun.star.document.Settings"_ustr), UNO_QUERY); |
2852 | 162 | if (xProps.is()) |
2853 | 162 | xInfo = xProps->getPropertySetInfo(); |
2854 | 162 | if (xInfo.is() && xProps.is()) |
2855 | 162 | { |
2856 | 162 | if (xInfo->hasPropertyByName(u"EmbedFonts"_ustr)) |
2857 | 162 | xProps->getPropertyValue(u"EmbedFonts"_ustr) >>= mbEmbedFonts; |
2858 | 162 | if (xInfo->hasPropertyByName(u"EmbedOnlyUsedFonts"_ustr)) |
2859 | 162 | xProps->getPropertyValue(u"EmbedOnlyUsedFonts"_ustr) >>= mbEmbedUsedOnly; |
2860 | 162 | if (xInfo->hasPropertyByName(u"EmbedLatinScriptFonts"_ustr)) |
2861 | 162 | xProps->getPropertyValue(u"EmbedLatinScriptFonts"_ustr) >>= mbEmbedLatinScript; |
2862 | 162 | if (xInfo->hasPropertyByName(u"EmbedAsianScriptFonts"_ustr)) |
2863 | 162 | xProps->getPropertyValue(u"EmbedAsianScriptFonts"_ustr) >>= mbEmbedAsianScript; |
2864 | 162 | if (xInfo->hasPropertyByName(u"EmbedComplexScriptFonts"_ustr)) |
2865 | 162 | xProps->getPropertyValue(u"EmbedComplexScriptFonts"_ustr) >>= mbEmbedComplexScript; |
2866 | 162 | } |
2867 | 162 | } catch(...) |
2868 | 162 | { |
2869 | | // clipboard document doesn't have shell so throws from getPropertyValue |
2870 | | // gallery elements may not support com.sun.star.document.Settings so throws from createInstance |
2871 | 0 | } |
2872 | | |
2873 | 162 | if (decomposePDF()) |
2874 | 162 | { |
2875 | 162 | mbEmbedFonts = true; |
2876 | 162 | mbEmbedUsedOnly = true; |
2877 | 162 | } |
2878 | | |
2879 | 162 | XMLFontAutoStylePool* pPool = new XMLFontAutoStylePool(*this); |
2880 | | |
2881 | 162 | pPool->addModelFonts(Reference<beans::XPropertySet>(GetModel(), UNO_QUERY)); |
2882 | | |
2883 | 162 | return pPool; |
2884 | 162 | } |
2885 | | |
2886 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |