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