nss: upgrade to release 3.73
[LibreOffice.git] / xmloff / source / draw / sdxmlexp.cxx
blob4fcfed5bb73197507ce13461a8dbc96f1ef36c9e
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <xmloff/autolayout.hxx>
21 #include <xmloff/unointerfacetouniqueidentifiermapper.hxx>
22 #include <xmloff/namespacemap.hxx>
23 #include <xmloff/xmlnamespace.hxx>
24 #include <xmloff/xmluconv.hxx>
25 #include <xmloff/xmltoken.hxx>
26 #include <com/sun/star/lang/XMultiServiceFactory.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/office/XAnnotationAccess.hpp>
31 #include <com/sun/star/uno/Any.hxx>
32 #include "sdxmlexp_impl.hxx"
33 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
34 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
35 #include <com/sun/star/presentation/XHandoutMasterSupplier.hpp>
36 #include <com/sun/star/container/XIndexContainer.hpp>
37 #include <com/sun/star/view/PaperOrientation.hpp>
38 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
40 #include <com/sun/star/form/XFormsSupplier2.hpp>
41 #include <com/sun/star/presentation/XPresentationPage.hpp>
42 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
43 #include <com/sun/star/text/XText.hpp>
44 #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
45 #include <com/sun/star/container/XNamed.hpp>
46 #include <com/sun/star/util/Duration.hpp>
47 #include <com/sun/star/util/MeasureUnit.hpp>
48 #include <rtl/ustrbuf.hxx>
49 #include <sal/log.hxx>
50 #include <tools/diagnose_ex.h>
51 #include <tools/gen.hxx>
52 #include <sax/tools/converter.hxx>
53 #include <xmloff/xmlaustp.hxx>
54 #include <xmloff/families.hxx>
55 #include <xmloff/styleexp.hxx>
56 #include <xmloff/settingsstore.hxx>
57 #include <xmloff/table/XMLTableExport.hxx>
58 #include <xmloff/ProgressBarHelper.hxx>
59 #include "sdpropls.hxx"
60 #include <xmloff/xmlexppr.hxx>
62 #include <PropertySetMerger.hxx>
63 #include "layerexp.hxx"
65 #include "XMLNumberStylesExport.hxx"
67 #include <xmloff/animationexport.hxx>
69 #include <com/sun/star/document/XDocumentProperties.hpp>
70 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
72 using namespace ::com::sun::star;
73 using namespace ::com::sun::star::uno;
74 using namespace ::com::sun::star::beans;
75 using namespace ::com::sun::star::util;
76 using namespace ::com::sun::star::container;
77 using namespace ::com::sun::star::drawing;
78 using namespace ::com::sun::star::office;
79 using namespace ::com::sun::star::presentation;
80 using namespace ::com::sun::star::geometry;
81 using namespace ::com::sun::star::text;
82 using namespace ::xmloff::token;
84 class ImpXMLEXPPageMasterInfo
86 sal_Int32 mnBorderBottom;
87 sal_Int32 mnBorderLeft;
88 sal_Int32 mnBorderRight;
89 sal_Int32 mnBorderTop;
90 sal_Int32 mnWidth;
91 sal_Int32 mnHeight;
92 view::PaperOrientation meOrientation;
93 OUString msName;
94 OUString msMasterPageName;
96 public:
97 ImpXMLEXPPageMasterInfo(const SdXMLExport& rExp, const Reference<XDrawPage>& xPage);
98 bool operator==(const ImpXMLEXPPageMasterInfo& rInfo) const;
99 void SetName(const OUString& rStr);
101 const OUString& GetName() const { return msName; }
102 const OUString& GetMasterPageName() const { return msMasterPageName; }
104 sal_Int32 GetBorderBottom() const { return mnBorderBottom; }
105 sal_Int32 GetBorderLeft() const { return mnBorderLeft; }
106 sal_Int32 GetBorderRight() const { return mnBorderRight; }
107 sal_Int32 GetBorderTop() const { return mnBorderTop; }
108 sal_Int32 GetWidth() const { return mnWidth; }
109 sal_Int32 GetHeight() const { return mnHeight; }
110 view::PaperOrientation GetOrientation() const { return meOrientation; }
113 ImpXMLEXPPageMasterInfo::ImpXMLEXPPageMasterInfo(
114 const SdXMLExport& rExp,
115 const Reference<XDrawPage>& xPage)
116 : mnBorderBottom(0),
117 mnBorderLeft(0),
118 mnBorderRight(0),
119 mnBorderTop(0),
120 mnWidth(0),
121 mnHeight(0),
122 meOrientation(rExp.IsDraw() ? view::PaperOrientation_PORTRAIT : view::PaperOrientation_LANDSCAPE)
124 Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
125 if(xPropSet.is())
127 Any aAny;
129 Reference< beans::XPropertySetInfo > xPropsInfo( xPropSet->getPropertySetInfo() );
130 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("BorderBottom"))
132 aAny = xPropSet->getPropertyValue("BorderBottom");
133 aAny >>= mnBorderBottom;
135 aAny = xPropSet->getPropertyValue("BorderLeft");
136 aAny >>= mnBorderLeft;
138 aAny = xPropSet->getPropertyValue("BorderRight");
139 aAny >>= mnBorderRight;
141 aAny = xPropSet->getPropertyValue("BorderTop");
142 aAny >>= mnBorderTop;
145 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("Width"))
147 aAny = xPropSet->getPropertyValue("Width");
148 aAny >>= mnWidth;
150 aAny = xPropSet->getPropertyValue("Height");
151 aAny >>= mnHeight;
154 if( xPropsInfo.is() && xPropsInfo->hasPropertyByName("Orientation"))
156 aAny = xPropSet->getPropertyValue("Orientation");
157 aAny >>= meOrientation;
161 Reference <container::XNamed> xMasterNamed(xPage, UNO_QUERY);
162 if(xMasterNamed.is())
164 msMasterPageName = xMasterNamed->getName();
168 bool ImpXMLEXPPageMasterInfo::operator==(const ImpXMLEXPPageMasterInfo& rInfo) const
170 return ((mnBorderBottom == rInfo.mnBorderBottom)
171 && (mnBorderLeft == rInfo.mnBorderLeft)
172 && (mnBorderRight == rInfo.mnBorderRight)
173 && (mnBorderTop == rInfo.mnBorderTop)
174 && (mnWidth == rInfo.mnWidth)
175 && (mnHeight == rInfo.mnHeight)
176 && (meOrientation == rInfo.meOrientation));
179 void ImpXMLEXPPageMasterInfo::SetName(const OUString& rStr)
181 msName = rStr;
184 #define IMP_AUTOLAYOUT_INFO_MAX (35L)
186 class ImpXMLAutoLayoutInfo
188 sal_uInt16 mnType;
189 ImpXMLEXPPageMasterInfo* mpPageMasterInfo;
190 OUString msLayoutName;
191 tools::Rectangle maTitleRect;
192 tools::Rectangle maPresRect;
193 sal_Int32 mnGapX;
194 sal_Int32 mnGapY;
196 public:
197 ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf);
199 sal_uInt16 GetLayoutType() const { return mnType; }
200 ImpXMLEXPPageMasterInfo* GetPageMasterInfo() const { return mpPageMasterInfo; }
201 sal_Int32 GetGapX() const { return mnGapX; }
202 sal_Int32 GetGapY() const { return mnGapY; }
204 const OUString& GetLayoutName() const { return msLayoutName; }
205 void SetLayoutName(const OUString& rNew) { msLayoutName = rNew; }
207 const tools::Rectangle& GetTitleRectangle() const { return maTitleRect; }
208 const tools::Rectangle& GetPresRectangle() const { return maPresRect; }
210 static bool IsCreateNecessary(sal_uInt16 nTyp);
213 bool ImpXMLAutoLayoutInfo::IsCreateNecessary(sal_uInt16 nTyp)
215 if(nTyp == 5 /* AUTOLAYOUT_ORG */
216 || nTyp == 20 /* AUTOLAYOUT_NONE */
217 || nTyp >= IMP_AUTOLAYOUT_INFO_MAX)
218 return false;
219 return true;
222 ImpXMLAutoLayoutInfo::ImpXMLAutoLayoutInfo(sal_uInt16 nTyp, ImpXMLEXPPageMasterInfo* pInf)
223 : mnType(nTyp)
224 , mpPageMasterInfo(pInf)
225 , mnGapX(0)
226 , mnGapY(0)
228 // create full info (initialize with typical values)
229 Point aPagePos(0,0);
230 Size aPageSize(28000, 21000);
231 Size aPageInnerSize(28000, 21000);
233 if(mpPageMasterInfo)
235 aPagePos = Point(mpPageMasterInfo->GetBorderLeft(), mpPageMasterInfo->GetBorderTop());
236 aPageSize = Size(mpPageMasterInfo->GetWidth(), mpPageMasterInfo->GetHeight());
237 aPageInnerSize = aPageSize;
238 aPageInnerSize.AdjustWidth(-(mpPageMasterInfo->GetBorderLeft() + mpPageMasterInfo->GetBorderRight()));
239 aPageInnerSize.AdjustHeight(-(mpPageMasterInfo->GetBorderTop() + mpPageMasterInfo->GetBorderBottom()));
242 // title rectangle aligning
243 Point aTitlePos(aPagePos);
244 Size aTitleSize(aPageInnerSize);
246 if(mnType == 21 /* AUTOLAYOUT_NOTES */)
248 aTitleSize.setHeight(static_cast<tools::Long>(aTitleSize.Height() / 2.5));
249 Point aPos = aTitlePos;
250 aPos.AdjustY( tools::Long( aTitleSize.Height() * 0.083 ) );
251 Size aPartArea = aTitleSize;
252 Size aSize;
254 // scale handout rectangle using actual page size
255 double fH = static_cast<double>(aPartArea.Width()) / aPageSize.Width();
256 double fV = static_cast<double>(aPartArea.Height()) / aPageSize.Height();
258 if ( fH > fV )
259 fH = fV;
260 aSize.setWidth( static_cast<tools::Long>(fH * aPageSize.Width()) );
261 aSize.setHeight( static_cast<tools::Long>(fH * aPageSize.Height()) );
263 aPos.AdjustX((aPartArea.Width() - aSize.Width()) / 2);
264 aPos.AdjustY((aPartArea.Height()- aSize.Height())/ 2);
266 aTitlePos = aPos;
267 aTitleSize = aSize;
269 else if(mnType == AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT || mnType == AUTOLAYOUT_VTITLE_VCONTENT)
271 Point aClassicTPos(
272 aTitlePos.X() + tools::Long( aTitleSize.Width() * 0.0735 ),
273 aTitlePos.Y() + tools::Long( aTitleSize.Height() * 0.083 ));
274 Size aClassicTSize(
275 tools::Long( aTitleSize.Width() * 0.854 ),
276 tools::Long( aTitleSize.Height() * 0.167 ));
277 Point aLPos(aPagePos);
278 Size aLSize(aPageInnerSize);
279 Point aClassicLPos(
280 aLPos.X() + tools::Long( aLSize.Width() * 0.0735 ),
281 aLPos.Y() + tools::Long( aLSize.Height() * 0.472 ));
282 Size aClassicLSize(
283 tools::Long( aLSize.Width() * 0.854 ),
284 tools::Long( aLSize.Height() * 0.444 ));
286 aTitlePos.setX( (aClassicTPos.X() + aClassicTSize.Width()) - aClassicTSize.Height() );
287 aTitlePos.setY( aClassicTPos.Y() );
288 aTitleSize.setWidth( aClassicTSize.Height() );
289 aTitleSize.setHeight( (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y() );
291 else
293 aTitlePos.AdjustX( tools::Long( aTitleSize.Width() * 0.0735 ) );
294 aTitlePos.AdjustY( tools::Long( aTitleSize.Height() * 0.083 ) );
295 aTitleSize.setWidth( tools::Long( aTitleSize.Width() * 0.854 ) );
296 aTitleSize.setHeight( tools::Long( aTitleSize.Height() * 0.167 ) );
299 maTitleRect.SetPos(aTitlePos);
300 maTitleRect.SetSize(aTitleSize);
302 // layout rectangle aligning
303 Point aLayoutPos(aPagePos);
304 Size aLayoutSize(aPageInnerSize);
306 if(mnType == 21 /* AUTOLAYOUT_NOTES */)
308 aLayoutPos.AdjustX( tools::Long( aLayoutSize.Width() * 0.0735 ) );
309 aLayoutPos.AdjustY( tools::Long( aLayoutSize.Height() * 0.472 ) );
310 aLayoutSize.setWidth( tools::Long( aLayoutSize.Width() * 0.854 ) );
311 aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.444 ) );
313 else if((mnType >= 22 && mnType <= 26) || (mnType == 31)) // AUTOLAYOUT_HANDOUT*
315 // keep info for inner area in maPresRect, put info for gap size
316 // to maTitleRect position
317 mnGapX = (aPageSize.Width() - aPageInnerSize.Width()) / 2;
318 mnGapY = (aPageSize.Height() - aPageInnerSize.Height()) / 2;
320 if(!mnGapX)
321 mnGapX = aPageSize.Width() / 10;
323 if(!mnGapY)
324 mnGapY = aPageSize.Height() / 10;
326 if(mnGapX < aPageInnerSize.Width() / 10)
327 mnGapX = aPageInnerSize.Width() / 10;
329 if(mnGapY < aPageInnerSize.Height() / 10)
330 mnGapY = aPageInnerSize.Height() / 10;
332 else if(mnType == AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT || mnType == AUTOLAYOUT_VTITLE_VCONTENT)
334 Point aClassicTPos(
335 aTitlePos.X() + tools::Long( aTitleSize.Width() * 0.0735 ),
336 aTitlePos.Y() + tools::Long( aTitleSize.Height() * 0.083 ));
337 Size aClassicTSize(
338 tools::Long( aTitleSize.Width() * 0.854 ),
339 tools::Long( aTitleSize.Height() * 0.167 ));
340 Point aClassicLPos(
341 aLayoutPos.X() + tools::Long( aLayoutSize.Width() * 0.0735 ),
342 aLayoutPos.Y() + tools::Long( aLayoutSize.Height() * 0.472 ));
343 Size aClassicLSize(
344 tools::Long( aLayoutSize.Width() * 0.854 ),
345 tools::Long( aLayoutSize.Height() * 0.444 ));
347 aLayoutPos.setX( aClassicLPos.X() );
348 aLayoutPos.setY( aClassicTPos.Y() );
349 aLayoutSize.setWidth( (aClassicLPos.X() + aClassicLSize.Width())
350 - (aClassicTSize.Height() + (aClassicLPos.Y() - (aClassicTPos.Y() + aClassicTSize.Height()))));
351 aLayoutSize.setHeight( (aClassicLPos.Y() + aClassicLSize.Height()) - aClassicTPos.Y() );
353 else if( mnType == AUTOLAYOUT_ONLY_TEXT )
355 aLayoutPos = aTitlePos;
356 aLayoutSize.setWidth( aTitleSize.Width() );
357 aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.825 ) );
359 else
361 aLayoutPos.AdjustX( tools::Long( aLayoutSize.Width() * 0.0735 ) );
362 aLayoutPos.AdjustY( tools::Long( aLayoutSize.Height() * 0.278 ) );
363 aLayoutSize.setWidth( tools::Long( aLayoutSize.Width() * 0.854 ) );
364 aLayoutSize.setHeight( tools::Long( aLayoutSize.Height() * 0.630 ) );
367 maPresRect.SetPos(aLayoutPos);
368 maPresRect.SetSize(aLayoutSize);
371 constexpr OUStringLiteral gsPageLayoutNames( u"PageLayoutNames" );
373 SdXMLExport::SdXMLExport(
374 const css::uno::Reference< css::uno::XComponentContext >& xContext,
375 OUString const & implementationName,
376 bool bIsDraw, SvXMLExportFlags nExportFlags )
377 : SvXMLExport( xContext, implementationName, util::MeasureUnit::CM,
378 bIsDraw ? XML_GRAPHICS : XML_PRESENTATION, nExportFlags ),
379 mnDocMasterPageCount(0),
380 mnDocDrawPageCount(0),
381 mnObjectCount(0),
382 mpHandoutPageMaster(nullptr),
383 mbIsDraw(bIsDraw)
388 // XExporter
389 void SAL_CALL SdXMLExport::setSourceDocument( const Reference< lang::XComponent >& xDoc )
391 SvXMLExport::setSourceDocument( xDoc );
393 // prepare factory parts
394 mpSdPropHdlFactory = new XMLSdPropHdlFactory( GetModel(), *this );
396 // construct PropertySetMapper
397 rtl::Reference < XMLPropertySetMapper > xMapper = new XMLShapePropertySetMapper( mpSdPropHdlFactory.get(), true);
399 // get or create text paragraph export
400 GetTextParagraphExport();
401 mpPropertySetMapper = new XMLShapeExportPropertyMapper( xMapper, *this );
403 // chain text attributes
404 mpPropertySetMapper->ChainExportMapper(XMLTextParagraphExport::CreateParaExtPropMapper(*this));
406 // construct PresPagePropsMapper
407 xMapper = new XMLPropertySetMapper(aXMLSDPresPageProps, mpSdPropHdlFactory.get(), true);
409 mpPresPagePropsMapper = new XMLPageExportPropertyMapper( xMapper, *this );
411 // add family name
412 GetAutoStylePool()->AddFamily(
413 XmlStyleFamily::SD_GRAPHICS_ID,
414 OUString(XML_STYLE_FAMILY_SD_GRAPHICS_NAME),
415 GetPropertySetMapper(),
416 OUString(XML_STYLE_FAMILY_SD_GRAPHICS_PREFIX));
417 GetAutoStylePool()->AddFamily(
418 XmlStyleFamily::SD_PRESENTATION_ID,
419 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
420 GetPropertySetMapper(),
421 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_PREFIX));
422 GetAutoStylePool()->AddFamily(
423 XmlStyleFamily::SD_DRAWINGPAGE_ID,
424 OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME),
425 GetPresPagePropsMapper(),
426 OUString(XML_STYLE_FAMILY_SD_DRAWINGPAGE_PREFIX));
427 // prepare access to styles
428 Reference< style::XStyleFamiliesSupplier > xFamSup( GetModel(), UNO_QUERY );
429 if(xFamSup.is())
431 mxDocStyleFamilies = xFamSup->getStyleFamilies();
434 // prepare access to master pages
435 Reference < drawing::XMasterPagesSupplier > xMasterPagesSupplier(GetModel(), UNO_QUERY);
436 if(xMasterPagesSupplier.is())
438 mxDocMasterPages = xMasterPagesSupplier->getMasterPages();
439 if(mxDocMasterPages.is())
441 mnDocMasterPageCount = mxDocMasterPages->getCount();
442 maMasterPagesStyleNames.insert( maMasterPagesStyleNames.begin(), mnDocMasterPageCount, "" );
446 // prepare access to draw pages
447 Reference <XDrawPagesSupplier> xDrawPagesSupplier(GetModel(), UNO_QUERY);
448 if(xDrawPagesSupplier.is())
450 mxDocDrawPages = xDrawPagesSupplier->getDrawPages();
451 if(mxDocDrawPages.is())
453 mnDocDrawPageCount = mxDocDrawPages->getCount();
454 maDrawPagesStyleNames.insert( maDrawPagesStyleNames.begin(), mnDocDrawPageCount, "" );
455 maDrawNotesPagesStyleNames.insert( maDrawNotesPagesStyleNames.begin(), mnDocDrawPageCount, "" );
456 if( !mbIsDraw )
457 maDrawPagesAutoLayoutNames.realloc( mnDocDrawPageCount + 1 );
459 HeaderFooterPageSettingsImpl aEmptySettings;
460 maDrawPagesHeaderFooterSettings.insert( maDrawPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
461 maDrawNotesPagesHeaderFooterSettings.insert( maDrawNotesPagesHeaderFooterSettings.begin(), mnDocDrawPageCount, aEmptySettings );
465 // #82003# count all draw objects for use with progress bar.
466 // #88245# init mnObjectCount once, use counter itself as flag. It
467 // is initialized to 0.
468 if(!mnObjectCount)
470 if( IsImpress() )
472 // #91587# add handout master count
473 Reference<presentation::XHandoutMasterSupplier> xHandoutSupp(GetModel(), UNO_QUERY);
474 if(xHandoutSupp.is())
476 Reference<XDrawPage> xHandoutPage(xHandoutSupp->getHandoutMasterPage());
477 if(xHandoutPage.is() && xHandoutPage->getCount())
478 mnObjectCount += ImpRecursiveObjectCount(xHandoutPage);
482 if(mxDocMasterPages.is())
484 for(sal_Int32 a(0); a < mnDocMasterPageCount; a++)
486 Any aAny(mxDocMasterPages->getByIndex(a));
487 Reference< drawing::XShapes > xMasterPage;
489 if((aAny >>= xMasterPage) && xMasterPage.is())
491 mnObjectCount += ImpRecursiveObjectCount(xMasterPage);
494 if( IsImpress() )
496 // #91587# take notes pages from master pages into account
497 Reference<presentation::XPresentationPage> xPresPage;
498 if((aAny >>= xPresPage) && xPresPage.is())
500 Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
501 if(xNotesPage.is() && xNotesPage->getCount())
502 mnObjectCount += ImpRecursiveObjectCount(xNotesPage);
508 if(mxDocDrawPages.is())
510 for(sal_Int32 a(0); a < mnDocDrawPageCount; a++)
512 Any aAny(mxDocDrawPages->getByIndex(a));
513 Reference< drawing::XShapes > xPage;
515 if((aAny >>= xPage) && xPage.is())
517 mnObjectCount += ImpRecursiveObjectCount(xPage);
520 if( IsImpress() )
522 // #91587# take notes pages from draw pages into account
523 Reference<presentation::XPresentationPage> xPresPage;
524 if((aAny >>= xPresPage) && xPresPage.is())
526 Reference<XDrawPage> xNotesPage(xPresPage->getNotesPage());
527 if(xNotesPage.is() && xNotesPage->getCount())
528 mnObjectCount += ImpRecursiveObjectCount(xNotesPage);
534 // #82003# init progress bar
535 GetProgressBarHelper()->SetReference(mnObjectCount);
538 // add namespaces
539 GetNamespaceMap_().Add(
540 GetXMLToken(XML_NP_PRESENTATION),
541 GetXMLToken(XML_N_PRESENTATION),
542 XML_NAMESPACE_PRESENTATION);
544 GetNamespaceMap_().Add(
545 GetXMLToken(XML_NP_SMIL),
546 GetXMLToken(XML_N_SMIL_COMPAT),
547 XML_NAMESPACE_SMIL);
549 GetNamespaceMap_().Add(
550 GetXMLToken(XML_NP_ANIMATION),
551 GetXMLToken(XML_N_ANIMATION),
552 XML_NAMESPACE_ANIMATION);
554 if (getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED)
556 GetNamespaceMap_().Add(
557 GetXMLToken(XML_NP_OFFICE_EXT),
558 GetXMLToken(XML_N_OFFICE_EXT),
559 XML_NAMESPACE_OFFICE_EXT);
562 GetShapeExport()->enableLayerExport();
564 // #88546# enable progress bar increments
565 GetShapeExport()->enableHandleProgressBar();
568 // #82003# helper function for recursive object count
569 sal_uInt32 SdXMLExport::ImpRecursiveObjectCount(const Reference< drawing::XShapes >& xShapes)
571 sal_uInt32 nRetval(0);
573 if(xShapes.is())
575 sal_Int32 nCount = xShapes->getCount();
577 for(sal_Int32 a(0); a < nCount; a++)
579 Any aAny(xShapes->getByIndex(a));
580 Reference< drawing::XShapes > xGroup;
582 if((aAny >>= xGroup) && xGroup.is())
584 // #93180# count group objects, too.
585 nRetval += 1 + ImpRecursiveObjectCount(xGroup);
587 else
589 nRetval++;
594 return nRetval;
597 SdXMLExport::~SdXMLExport()
599 // cleanup factory, decrease refcount. Should lead to destruction.
600 mpSdPropHdlFactory.clear();
602 // cleanup mapper, decrease refcount. Should lead to destruction.
603 mpPropertySetMapper.clear();
605 // cleanup presPage mapper, decrease refcount. Should lead to destruction.
606 mpPresPagePropsMapper.clear();
608 mvPageMasterInfoList.clear();
610 // clear auto-layout infos
611 mvAutoLayoutInfoList.clear();
614 void SdXMLExport::ImpPrepAutoLayoutInfos()
616 if(!IsImpress())
617 return;
619 OUString aStr;
621 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
622 if( xHandoutSupp.is() )
624 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
625 if( xHandoutPage.is() )
627 if(ImpPrepAutoLayoutInfo(xHandoutPage, aStr))
628 maDrawPagesAutoLayoutNames[0] = aStr;
632 // prepare name creation
633 for (sal_Int32 nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
635 Any aAny(mxDocDrawPages->getByIndex(nCnt));
636 Reference<XDrawPage> xDrawPage;
638 if((aAny >>= xDrawPage) && xDrawPage.is())
640 if(ImpPrepAutoLayoutInfo(xDrawPage, aStr))
641 maDrawPagesAutoLayoutNames[nCnt+1] = aStr;
646 bool SdXMLExport::ImpPrepAutoLayoutInfo(const Reference<XDrawPage>& xPage, OUString& rName)
648 rName.clear();
649 bool bRetval(false);
651 Reference <beans::XPropertySet> xPropSet(xPage, UNO_QUERY);
652 if(xPropSet.is())
654 sal_uInt16 nType = sal_uInt16();
655 Any aAny = xPropSet->getPropertyValue("Layout");
656 if(aAny >>= nType)
658 if(ImpXMLAutoLayoutInfo::IsCreateNecessary(nType))
660 ImpXMLEXPPageMasterInfo* pInfo = nullptr;
662 // get master-page info
663 Reference < drawing::XMasterPageTarget > xMasterPageInt(xPage, UNO_QUERY);
664 if(xMasterPageInt.is())
666 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
667 if(xUsedMasterPage.is())
669 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
670 if(xMasterNamed.is())
672 OUString sMasterPageName = xMasterNamed->getName();
673 pInfo = ImpGetPageMasterInfoByName(sMasterPageName);
678 // create entry and look for existence
679 ImpXMLAutoLayoutInfo* pNew;
680 auto it = std::find_if(mvAutoLayoutInfoList.begin(), mvAutoLayoutInfoList.end(),
681 [=](std::unique_ptr<ImpXMLAutoLayoutInfo> const & rInfo) { return nType == rInfo->GetLayoutType() && pInfo == rInfo->GetPageMasterInfo(); });
682 if (it != mvAutoLayoutInfoList.end())
684 pNew = it->get();
686 else
688 pNew = new ImpXMLAutoLayoutInfo(nType, pInfo);
689 mvAutoLayoutInfoList.emplace_back( pNew );
690 OUString sNewName =
691 "AL" + OUString::number(mvAutoLayoutInfoList.size() - 1) +
692 "T" + OUString::number(nType);
693 pNew->SetLayoutName(sNewName);
696 rName = pNew->GetLayoutName();
697 bRetval = true;
702 return bRetval;
705 void SdXMLExport::ImpWriteAutoLayoutInfos()
707 for(const auto & pInfo : mvAutoLayoutInfoList)
709 if(pInfo)
711 // prepare presentation-page layout attributes, style-name
712 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, pInfo->GetLayoutName());
714 // write draw-style attributes
715 SvXMLElementExport aDSE(*this, XML_NAMESPACE_STYLE, XML_PRESENTATION_PAGE_LAYOUT, true, true);
717 // write presentation placeholders
718 switch(pInfo->GetLayoutType())
720 case AUTOLAYOUT_TITLE :
722 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
723 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
724 break;
726 case AUTOLAYOUT_TITLE_CONTENT :
728 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
729 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, pInfo->GetPresRectangle());
730 break;
732 case AUTOLAYOUT_CHART :
734 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
735 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, pInfo->GetPresRectangle());
736 break;
738 case AUTOLAYOUT_TITLE_2CONTENT :
740 tools::Rectangle aLeft(pInfo->GetPresRectangle());
741 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
742 tools::Rectangle aRight(aLeft);
743 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
745 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
746 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
747 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
748 break;
750 case AUTOLAYOUT_TEXTCHART :
752 tools::Rectangle aLeft(pInfo->GetPresRectangle());
753 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
754 tools::Rectangle aRight(aLeft);
755 aRight.SetLeft( tools::Long(aRight.Left() + aRight.GetWidth() * 1.05) );
757 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
758 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
759 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aRight);
760 break;
762 case AUTOLAYOUT_TEXTCLIP :
764 tools::Rectangle aLeft(pInfo->GetPresRectangle());
765 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
766 tools::Rectangle aRight(aLeft);
767 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
769 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
770 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
771 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aRight);
772 break;
774 case AUTOLAYOUT_CHARTTEXT :
776 tools::Rectangle aLeft(pInfo->GetPresRectangle());
777 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
778 tools::Rectangle aRight(aLeft);
779 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
781 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
782 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aLeft);
783 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
784 break;
786 case AUTOLAYOUT_TAB :
788 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
789 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTable, pInfo->GetPresRectangle());
790 break;
792 case AUTOLAYOUT_CLIPTEXT :
794 tools::Rectangle aLeft(pInfo->GetPresRectangle());
795 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
796 tools::Rectangle aRight(aLeft);
797 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
799 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
800 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
801 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
802 break;
804 case AUTOLAYOUT_TEXTOBJ :
806 tools::Rectangle aLeft(pInfo->GetPresRectangle());
807 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
808 tools::Rectangle aRight(aLeft);
809 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
811 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
812 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
813 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRight);
814 break;
816 case AUTOLAYOUT_OBJ :
818 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
819 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, pInfo->GetPresRectangle());
820 break;
822 case AUTOLAYOUT_TITLE_CONTENT_2CONTENT :
824 tools::Rectangle aLeft(pInfo->GetPresRectangle());
825 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
826 tools::Rectangle aRightTop(aLeft);
827 aRightTop.SetLeft(tools::Long(aRightTop.Left() + aRightTop.GetWidth() * 1.05));
828 aRightTop.setHeight(tools::Long(aRightTop.GetHeight() * 0.477));
829 tools::Rectangle aRightBottom(aRightTop);
830 aRightBottom.SetTop(tools::Long(aRightBottom.Top() + aRightBottom.GetHeight() * 1.095));
832 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
833 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aLeft);
834 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightTop);
835 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aRightBottom);
836 break;
838 case AUTOLAYOUT_OBJTEXT :
840 tools::Rectangle aLeft(pInfo->GetPresRectangle());
841 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
842 tools::Rectangle aRight(aLeft);
843 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
845 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
846 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeft);
847 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
848 break;
850 case AUTOLAYOUT_TITLE_CONTENT_OVER_CONTENT :
852 tools::Rectangle aTop(pInfo->GetPresRectangle());
853 aTop.setHeight(tools::Long(aTop.GetHeight() * 0.477));
854 tools::Rectangle aBottom(aTop);
855 aBottom.SetTop(tools::Long(aBottom.Top() + aBottom.GetHeight() * 1.095));
857 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
858 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTop);
859 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
860 break;
862 case AUTOLAYOUT_TITLE_2CONTENT_CONTENT :
864 tools::Rectangle aLeftTop(pInfo->GetPresRectangle());
865 aLeftTop.setWidth(tools::Long(aLeftTop.GetWidth() * 0.488));
866 tools::Rectangle aRight(aLeftTop);
867 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
868 aLeftTop.setHeight(tools::Long(aLeftTop.GetHeight() * 0.477));
869 tools::Rectangle aLeftBottom(aLeftTop);
870 aLeftBottom.SetTop(tools::Long(aLeftBottom.Top() + aLeftBottom.GetHeight() * 1.095));
872 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
873 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftTop);
874 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aLeftBottom);
875 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aRight);
876 break;
878 case AUTOLAYOUT_TITLE_2CONTENT_OVER_CONTENT :
880 tools::Rectangle aTopLeft(pInfo->GetPresRectangle());
881 aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477));
882 tools::Rectangle aBottom(aTopLeft);
883 aBottom.SetTop(tools::Long(aBottom.Top() + aBottom.GetHeight() * 1.095));
884 aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488));
885 tools::Rectangle aTopRight(aTopLeft);
886 aTopRight.SetLeft(tools::Long(aTopRight.Left() + aTopRight.GetWidth() * 1.05));
888 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
889 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
890 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
891 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aBottom);
892 break;
894 case AUTOLAYOUT_TEXTOVEROBJ :
896 tools::Rectangle aTop(pInfo->GetPresRectangle());
897 aTop.setHeight(tools::Long(aTop.GetHeight() * 0.477));
898 tools::Rectangle aBottom(aTop);
899 aBottom.SetTop(tools::Long(aBottom.Top() + aBottom.GetHeight() * 1.095));
901 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
902 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderOutline, aTop);
903 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottom);
904 break;
906 case AUTOLAYOUT_TITLE_4CONTENT :
908 tools::Rectangle aTopLeft(pInfo->GetPresRectangle());
909 aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477));
910 aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488));
911 tools::Rectangle aBottomLeft(aTopLeft);
912 aBottomLeft.SetTop(tools::Long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095));
913 tools::Rectangle aTopRight(aTopLeft);
914 aTopRight.SetLeft(tools::Long(aTopRight.Left() + aTopRight.GetWidth() * 1.05));
915 tools::Rectangle aBottomRight(aTopRight);
916 aBottomRight.SetTop(tools::Long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095));
918 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
919 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopLeft);
920 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aTopRight);
921 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomLeft);
922 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderObject, aBottomRight);
923 break;
925 case AUTOLAYOUT_TITLE_ONLY :
927 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
928 break;
930 case AUTOLAYOUT_NOTES :
932 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderPage, pInfo->GetTitleRectangle());
933 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderNotes, pInfo->GetPresRectangle());
934 break;
936 case AUTOLAYOUT_HANDOUT1 :
937 case AUTOLAYOUT_HANDOUT2 :
938 case AUTOLAYOUT_HANDOUT3 :
939 case AUTOLAYOUT_HANDOUT4 :
940 case AUTOLAYOUT_HANDOUT6 :
941 case AUTOLAYOUT_HANDOUT9 :
943 sal_Int32 nColCnt, nRowCnt;
944 sal_Int32 nGapX = pInfo->GetGapX();
945 sal_Int32 nGapY = pInfo->GetGapY();
947 switch(pInfo->GetLayoutType())
949 case 22 : nColCnt = 1; nRowCnt = 1; break;
950 case 23 : nColCnt = 1; nRowCnt = 2; break;
951 case 24 : nColCnt = 1; nRowCnt = 3; break;
952 case 25 : nColCnt = 2; nRowCnt = 2; break;
953 case 26 : nColCnt = 3; nRowCnt = 2; break;
954 case 31 : nColCnt = 3; nRowCnt = 3; break;
955 default: nColCnt = 0; nRowCnt = 0; break; // FIXME - What is correct values?
958 Size aPartSize(pInfo->GetTitleRectangle().GetSize());
959 Point aPartPos(pInfo->GetTitleRectangle().TopLeft());
961 if(aPartSize.Width() > aPartSize.Height())
963 sal_Int32 nZwi(nColCnt);
964 nColCnt = nRowCnt;
965 nRowCnt = nZwi;
968 if (nColCnt == 0 || nRowCnt == 0)
969 break;
971 aPartSize.setWidth( (aPartSize.Width() - ((nColCnt - 1) * nGapX)) / nColCnt );
972 aPartSize.setHeight( (aPartSize.Height() - ((nRowCnt - 1) * nGapY)) / nRowCnt );
974 Point aTmpPos(aPartPos);
976 for (sal_Int32 a = 0; a < nRowCnt; a++)
978 aTmpPos.setX(aPartPos.X());
980 for (sal_Int32 b = 0; b < nColCnt; b++)
982 tools::Rectangle aTmpRect(aTmpPos, aPartSize);
984 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderHandout, aTmpRect);
985 aTmpPos.AdjustX( aPartSize.Width() + nGapX );
988 aTmpPos.AdjustY( aPartSize.Height() + nGapY );
990 break;
992 case AUTOLAYOUT_VTITLE_VCONTENT_OVER_VCONTENT :
994 tools::Rectangle aTop(pInfo->GetPresRectangle());
995 aTop.setHeight(tools::Long(aTop.GetHeight() * 0.488));
996 tools::Rectangle aBottom(aTop);
997 aBottom.SetTop(tools::Long(aBottom.Top() + aBottom.GetHeight() * 1.05));
999 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1000 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aTop);
1001 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderChart, aBottom);
1002 break;
1004 case AUTOLAYOUT_VTITLE_VCONTENT :
1006 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalTitle, pInfo->GetTitleRectangle());
1007 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1008 break;
1010 case AUTOLAYOUT_TITLE_VCONTENT :
1012 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1013 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, pInfo->GetPresRectangle());
1014 break;
1016 case AUTOLAYOUT_TITLE_2VTEXT :
1018 tools::Rectangle aLeft(pInfo->GetPresRectangle());
1019 aLeft.setWidth(tools::Long(aLeft.GetWidth() * 0.488));
1020 tools::Rectangle aRight(aLeft);
1021 aRight.SetLeft(tools::Long(aRight.Left() + aRight.GetWidth() * 1.05));
1023 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1024 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aLeft);
1025 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderVerticalOutline, aRight);
1026 break;
1028 case AUTOLAYOUT_ONLY_TEXT :
1030 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderSubtitle, pInfo->GetPresRectangle());
1031 break;
1034 case AUTOLAYOUT_4CLIPART :
1036 tools::Rectangle aTopLeft(pInfo->GetPresRectangle());
1037 aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477));
1038 aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.488));
1039 tools::Rectangle aBottomLeft(aTopLeft);
1040 aBottomLeft.SetTop(tools::Long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095));
1041 tools::Rectangle aTopRight(aTopLeft);
1042 aTopRight.SetLeft(tools::Long(aTopRight.Left() + aTopRight.GetWidth() * 1.05));
1043 tools::Rectangle aBottomRight(aTopRight);
1044 aBottomRight.SetTop(tools::Long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095));
1046 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1047 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1048 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1049 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1050 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1051 break;
1054 case AUTOLAYOUT_TITLE_6CONTENT :
1056 tools::Rectangle aTopLeft(pInfo->GetPresRectangle());
1057 aTopLeft.setHeight(tools::Long(aTopLeft.GetHeight() * 0.477));
1058 aTopLeft.setWidth(tools::Long(aTopLeft.GetWidth() * 0.322));
1059 tools::Rectangle aTopCenter(aTopLeft);
1060 aTopCenter.SetLeft(tools::Long(aTopCenter.Left() + aTopCenter.GetWidth() * 1.05));
1061 tools::Rectangle aTopRight(aTopLeft);
1062 aTopRight.SetLeft(tools::Long(aTopRight.Left() + aTopRight.GetWidth() * 2 * 1.05));
1064 tools::Rectangle aBottomLeft(aTopLeft);
1065 aBottomLeft.SetTop(tools::Long(aBottomLeft.Top() + aBottomLeft.GetHeight() * 1.095));
1066 tools::Rectangle aBottomCenter(aTopCenter);
1067 aBottomCenter.SetTop(tools::Long(aBottomCenter.Top() + aBottomCenter.GetHeight() * 1.095));
1068 tools::Rectangle aBottomRight(aTopRight);
1069 aBottomRight.SetTop(tools::Long(aBottomRight.Top() + aBottomRight.GetHeight() * 1.095));
1071 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderTitle, pInfo->GetTitleRectangle());
1072 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopLeft);
1073 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopCenter);
1074 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aTopRight);
1075 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomLeft);
1076 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomCenter);
1077 ImpWriteAutoLayoutPlaceholder(XmlPlaceholderGraphic, aBottomRight);
1078 break;
1080 default:
1082 OSL_FAIL("XMLEXP: unknown autolayout export");
1083 break;
1090 void SdXMLExport::ImpWriteAutoLayoutPlaceholder(XmlPlaceholder ePl, const tools::Rectangle& rRect)
1092 OUString aStr;
1093 OUStringBuffer sStringBuffer;
1095 // prepare presentation-placeholder attributes, presentation:object
1096 switch(ePl)
1098 case XmlPlaceholderTitle: aStr = "title"; break;
1099 case XmlPlaceholderOutline: aStr = "outline"; break;
1100 case XmlPlaceholderSubtitle: aStr = "subtitle"; break;
1101 case XmlPlaceholderGraphic: aStr = "graphic"; break;
1102 case XmlPlaceholderObject: aStr = "object"; break;
1103 case XmlPlaceholderChart: aStr = "chart"; break;
1104 case XmlPlaceholderTable: aStr = "table"; break;
1105 case XmlPlaceholderPage: aStr = "page"; break;
1106 case XmlPlaceholderNotes: aStr = "notes"; break;
1107 case XmlPlaceholderHandout: aStr = "handout"; break;
1108 case XmlPlaceholderVerticalTitle: aStr = "vertical_title"; break;
1109 case XmlPlaceholderVerticalOutline: aStr = "vertical_outline"; break;
1112 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_OBJECT, aStr);
1114 // svg:x,y,width,height
1115 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Left());
1116 aStr = sStringBuffer.makeStringAndClear();
1117 AddAttribute(XML_NAMESPACE_SVG, XML_X, aStr);
1119 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer, rRect.Top());
1120 aStr = sStringBuffer.makeStringAndClear();
1121 AddAttribute(XML_NAMESPACE_SVG, XML_Y, aStr);
1123 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1124 rRect.GetWidth());
1125 aStr = sStringBuffer.makeStringAndClear();
1126 AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, aStr);
1128 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1129 rRect.GetHeight());
1130 aStr = sStringBuffer.makeStringAndClear();
1131 AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, aStr);
1133 // write presentation-placeholder
1134 SvXMLElementExport aPPL(*this, XML_NAMESPACE_PRESENTATION, XML_PLACEHOLDER, true, true);
1137 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetOrCreatePageMasterInfo( const Reference< XDrawPage >& xMasterPage )
1139 bool bDoesExist = false;
1141 ImpXMLEXPPageMasterInfo* pNewInfo = new ImpXMLEXPPageMasterInfo(*this, xMasterPage);
1143 // compare with prev page-master infos
1144 for( size_t a = 0; !bDoesExist && a < mvPageMasterInfoList.size(); a++)
1146 if ( mvPageMasterInfoList.at(a)
1147 && *mvPageMasterInfoList.at(a) == *pNewInfo
1150 delete pNewInfo;
1151 pNewInfo = mvPageMasterInfoList.at(a).get();
1152 bDoesExist = true;
1155 // add entry when not found same page-master infos
1156 if(!bDoesExist)
1157 mvPageMasterInfoList.emplace_back( pNewInfo );
1159 return pNewInfo;
1162 void SdXMLExport::ImpPrepPageMasterInfos()
1164 if( IsImpress() )
1166 // create page master info for handout master page
1168 Reference< XHandoutMasterSupplier > xHMS( GetModel(), UNO_QUERY );
1169 if( xHMS.is() )
1171 Reference< XDrawPage > xMasterPage( xHMS->getHandoutMasterPage() );
1172 if( xMasterPage.is() )
1173 mpHandoutPageMaster = ImpGetOrCreatePageMasterInfo(xMasterPage);
1177 // create page master infos for master pages
1178 if(!mnDocMasterPageCount)
1179 return;
1181 // look for needed page-masters, create these
1182 for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
1184 Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
1185 ImpXMLEXPPageMasterInfo* pNewInfo = nullptr;
1187 if(xMasterPage.is())
1188 pNewInfo = ImpGetOrCreatePageMasterInfo(xMasterPage);
1190 mvPageMasterUsageList.push_back( pNewInfo );
1192 // look for page master of handout page
1193 if(IsImpress())
1195 pNewInfo = nullptr;
1196 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
1197 if(xPresPage.is())
1199 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
1200 if(xNotesPage.is())
1202 pNewInfo = ImpGetOrCreatePageMasterInfo(xNotesPage);
1205 mvNotesPageMasterUsageList.push_back( pNewInfo );
1210 void SdXMLExport::ImpWritePageMasterInfos()
1212 // write created page-masters, create names for these
1213 for( size_t nCnt = 0; nCnt < mvPageMasterInfoList.size(); nCnt++)
1215 ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterInfoList.at(nCnt).get();
1216 if(pInfo)
1218 // create name
1219 OUString sNewName = "PM" + OUString::number(nCnt);
1220 pInfo->SetName(sNewName);
1222 // prepare page-master attributes
1223 OUString sString;
1224 OUStringBuffer sStringBuffer;
1226 sString = sNewName;
1227 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME, sString);
1229 // write page-layout
1230 SvXMLElementExport aPME(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT, true, true);
1232 // prepare style:properties inside page-master
1233 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1234 pInfo->GetBorderTop());
1235 sString = sStringBuffer.makeStringAndClear();
1236 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_TOP, sString);
1238 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1239 pInfo->GetBorderBottom());
1240 sString = sStringBuffer.makeStringAndClear();
1241 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_BOTTOM, sString);
1243 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1244 pInfo->GetBorderLeft());
1245 sString = sStringBuffer.makeStringAndClear();
1246 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_LEFT, sString);
1248 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1249 pInfo->GetBorderRight());
1250 sString = sStringBuffer.makeStringAndClear();
1251 AddAttribute(XML_NAMESPACE_FO, XML_MARGIN_RIGHT, sString);
1253 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1254 pInfo->GetWidth());
1255 sString = sStringBuffer.makeStringAndClear();
1256 AddAttribute(XML_NAMESPACE_FO, XML_PAGE_WIDTH, sString);
1258 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
1259 pInfo->GetHeight());
1260 sString = sStringBuffer.makeStringAndClear();
1261 AddAttribute(XML_NAMESPACE_FO, XML_PAGE_HEIGHT, sString);
1263 if(pInfo->GetOrientation() == view::PaperOrientation_PORTRAIT)
1264 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_PORTRAIT);
1265 else
1266 AddAttribute(XML_NAMESPACE_STYLE, XML_PRINT_ORIENTATION, XML_LANDSCAPE);
1268 // write style:properties
1269 SvXMLElementExport aPMF(*this, XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_PROPERTIES, true, true);
1274 ImpXMLEXPPageMasterInfo* SdXMLExport::ImpGetPageMasterInfoByName(const OUString& rName)
1276 if(!rName.isEmpty())
1278 for(const auto & pInfo : mvPageMasterInfoList)
1280 if(pInfo)
1282 if(!pInfo->GetMasterPageName().isEmpty() && rName == pInfo->GetMasterPageName())
1284 return pInfo.get();
1289 return nullptr;
1292 void SdXMLExport::ImpPrepDrawPageInfos()
1294 // create draw:style-name entries for page export
1295 // containing presentation page attributes AND background attributes
1296 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1298 sal_Int32 nCnt;
1299 for(nCnt = 0; nCnt < mnDocDrawPageCount; nCnt++)
1301 Reference<XDrawPage> xDrawPage;
1302 mxDocDrawPages->getByIndex(nCnt) >>= xDrawPage;
1303 maDrawPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1305 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
1306 if(xPresPage.is())
1308 maDrawNotesPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xPresPage->getNotesPage(), false );
1310 maDrawPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xDrawPage );
1311 maDrawNotesPagesHeaderFooterSettings[nCnt] = ImpPrepDrawPageHeaderFooterDecls( xPresPage->getNotesPage() );
1316 static OUString findOrAppendImpl( std::vector< OUString >& rVector, const OUString& rText, const char* pPrefix )
1318 // search rVector if there is already a string that equals rText
1319 auto aIter = std::find(rVector.begin(), rVector.end(), rText);
1320 sal_Int32 nIndex = std::distance(rVector.begin(), aIter) + 1;
1322 // if nothing is found, append the string at the end of rVector
1323 if( aIter == rVector.end() )
1324 rVector.push_back( rText );
1326 // create a reference string with pPrefix and the index of the
1327 // found or created rText
1328 return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex );
1331 static OUString findOrAppendImpl( std::vector< DateTimeDeclImpl >& rVector, const OUString& rText, bool bFixed, sal_Int32 nFormat, const char* pPrefix )
1333 // search rVector if there is already a DateTimeDeclImpl with rText,bFixed and nFormat
1334 auto aIter = std::find_if(rVector.begin(), rVector.end(),
1335 [bFixed, &rText, nFormat](const DateTimeDeclImpl& rDecl) {
1336 return (rDecl.mbFixed == bFixed) &&
1337 (!bFixed || (rDecl.maStrText == rText)) &&
1338 (bFixed || (rDecl.mnFormat == nFormat));
1340 sal_Int32 nIndex = std::distance(rVector.begin(), aIter) + 1;
1342 // if nothing is found, append a new DateTimeDeclImpl
1343 if( aIter == rVector.end() )
1345 DateTimeDeclImpl aDecl;
1346 aDecl.maStrText = rText;
1347 aDecl.mbFixed = bFixed;
1348 aDecl.mnFormat = nFormat;
1349 rVector.push_back( aDecl );
1352 // create a reference string with pPrefix and the index of the
1353 // found or created DateTimeDeclImpl
1354 return OUString::createFromAscii( pPrefix ) + OUString::number( nIndex );
1357 const char gpStrHeaderTextPrefix[] = "hdr";
1358 const char gpStrFooterTextPrefix[] = "ftr";
1359 const char gpStrDateTimeTextPrefix[] = "dtd";
1361 HeaderFooterPageSettingsImpl SdXMLExport::ImpPrepDrawPageHeaderFooterDecls( const Reference<XDrawPage>& xDrawPage )
1363 HeaderFooterPageSettingsImpl aSettings;
1365 if( xDrawPage.is() ) try
1367 Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
1368 Reference< XPropertySetInfo > xInfo( xSet->getPropertySetInfo() );
1370 OUString aStrText;
1372 const OUString aStrHeaderTextProp( "HeaderText" );
1373 if( xInfo->hasPropertyByName( aStrHeaderTextProp ) )
1375 xSet->getPropertyValue( aStrHeaderTextProp ) >>= aStrText;
1376 if( !aStrText.isEmpty() )
1377 aSettings.maStrHeaderDeclName = findOrAppendImpl( maHeaderDeclsVector, aStrText, gpStrHeaderTextPrefix );
1380 const OUString aStrFooterTextProp( "FooterText" );
1381 if( xInfo->hasPropertyByName( aStrFooterTextProp ) )
1383 xSet->getPropertyValue( aStrFooterTextProp ) >>= aStrText;
1384 if( !aStrText.isEmpty() )
1385 aSettings.maStrFooterDeclName = findOrAppendImpl( maFooterDeclsVector, aStrText, gpStrFooterTextPrefix );
1388 const OUString aStrDateTimeTextProp( "DateTimeText" );
1389 if( xInfo->hasPropertyByName( aStrDateTimeTextProp ) )
1391 bool bFixed = false;
1392 sal_Int32 nFormat = 0;
1393 xSet->getPropertyValue( aStrDateTimeTextProp ) >>= aStrText;
1394 xSet->getPropertyValue("IsDateTimeFixed") >>= bFixed;
1395 xSet->getPropertyValue("DateTimeFormat") >>= nFormat;
1397 if( !bFixed || !aStrText.isEmpty() )
1399 aSettings.maStrDateTimeDeclName = findOrAppendImpl( maDateTimeDeclsVector, aStrText, bFixed, nFormat, gpStrDateTimeTextPrefix );
1400 if( !bFixed )
1401 addDataStyle( nFormat );
1405 catch(const Exception&)
1407 TOOLS_WARN_EXCEPTION("xmloff.draw", "");
1410 return aSettings;
1413 void SdXMLExport::ImpWriteHeaderFooterDecls()
1415 OUStringBuffer sBuffer;
1417 if( !maHeaderDeclsVector.empty() )
1419 // export header decls
1420 const OUString aPrefix( gpStrHeaderTextPrefix );
1421 sal_Int32 nIndex = 1;
1422 for( const auto& rDecl : maHeaderDeclsVector )
1424 sBuffer.append( aPrefix );
1425 sBuffer.append( nIndex );
1426 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1428 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_HEADER_DECL, true, true);
1429 Characters(rDecl);
1430 ++nIndex;
1434 if( !maFooterDeclsVector.empty() )
1436 // export footer decls
1437 const OUString aPrefix( gpStrFooterTextPrefix );
1438 sal_Int32 nIndex = 1;
1439 for( const auto& rDecl : maFooterDeclsVector )
1441 sBuffer.append( aPrefix );
1442 sBuffer.append( nIndex );
1443 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1445 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_FOOTER_DECL, false, false);
1446 Characters(rDecl);
1447 ++nIndex;
1451 if( maDateTimeDeclsVector.empty() )
1452 return;
1454 // export footer decls
1455 const OUString aPrefix( gpStrDateTimeTextPrefix );
1456 sal_Int32 nIndex = 1;
1457 for( const auto& rDecl : maDateTimeDeclsVector )
1459 sBuffer.append( aPrefix );
1460 sBuffer.append( nIndex );
1461 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_NAME, sBuffer.makeStringAndClear());
1463 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_SOURCE, rDecl.mbFixed ? XML_FIXED : XML_CURRENT_DATE );
1465 if( !rDecl.mbFixed )
1466 AddAttribute( XML_NAMESPACE_STYLE, XML_DATA_STYLE_NAME, getDataStyleName( rDecl.mnFormat ) );
1468 SvXMLElementExport aElem(*this, XML_NAMESPACE_PRESENTATION, XML_DATE_TIME_DECL, false, false);
1469 if( rDecl.mbFixed )
1470 Characters(rDecl.maStrText);
1472 ++nIndex;
1476 void SdXMLExport::ImplExportHeaderFooterDeclAttributes( const HeaderFooterPageSettingsImpl& aSettings )
1478 if( !aSettings.maStrHeaderDeclName.isEmpty() )
1479 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_HEADER_NAME, aSettings.maStrHeaderDeclName );
1481 if( !aSettings.maStrFooterDeclName.isEmpty() )
1482 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_FOOTER_NAME, aSettings.maStrFooterDeclName );
1484 if( !aSettings.maStrDateTimeDeclName.isEmpty() )
1485 AddAttribute( XML_NAMESPACE_PRESENTATION, XML_USE_DATE_TIME_NAME, aSettings.maStrDateTimeDeclName );
1488 OUString SdXMLExport::ImpCreatePresPageStyleName( const Reference<XDrawPage>& xDrawPage, bool bExportBackground /* = true */ )
1490 // create name
1491 OUString sStyleName;
1493 // create style for this page and add to auto style pool
1495 Reference< beans::XPropertySet > xPropSet1(xDrawPage, UNO_QUERY);
1496 if(xPropSet1.is())
1498 Reference< beans::XPropertySet > xPropSet;
1500 if( bExportBackground )
1502 // since the background items are in a different propertyset
1503 // which itself is a property of the pages property set
1504 // we now merge these two propertysets if possible to simulate
1505 // a single propertyset with all draw page properties
1506 const OUString aBackground("Background");
1507 Reference< beans::XPropertySet > xPropSet2;
1508 Reference< beans::XPropertySetInfo > xInfo( xPropSet1->getPropertySetInfo() );
1509 if( xInfo.is() && xInfo->hasPropertyByName( aBackground ) )
1511 Any aAny( xPropSet1->getPropertyValue( aBackground ) );
1512 aAny >>= xPropSet2;
1515 if( xPropSet2.is() )
1516 xPropSet = PropertySetMerger_CreateInstance( xPropSet1, xPropSet2 );
1517 else
1518 xPropSet = xPropSet1;
1520 else
1522 xPropSet = xPropSet1;
1525 const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPresPagePropsMapper() );
1527 std::vector<XMLPropertyState> aPropStates(aMapperRef->Filter(*this, xPropSet));
1529 if( !aPropStates.empty() )
1531 // there are filtered properties -> hard attributes
1532 // try to find this style in AutoStylePool
1533 sStyleName = GetAutoStylePool()->Find(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, aPropStates);
1535 if(sStyleName.isEmpty())
1537 // Style did not exist, add it to AutoStalePool
1538 sStyleName = GetAutoStylePool()->Add(XmlStyleFamily::SD_DRAWINGPAGE_ID, sStyleName, aPropStates);
1543 return sStyleName;
1546 void SdXMLExport::ImpPrepMasterPageInfos()
1548 // create draw:style-name entries for master page export
1549 // containing only background attributes
1550 // fixed family for page-styles is "drawing-page" (XML_STYLE_FAMILY_SD_DRAWINGPAGE_NAME)
1552 sal_Int32 nCnt;
1553 for( nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1555 Reference<XDrawPage> xDrawPage;
1556 mxDocMasterPages->getByIndex(nCnt) >>= xDrawPage;
1557 maMasterPagesStyleNames[nCnt] = ImpCreatePresPageStyleName( xDrawPage );
1560 if( !IsImpress() )
1561 return;
1563 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
1564 if( xHandoutSupp.is() )
1566 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
1567 if( xHandoutPage.is() )
1569 maHandoutPageHeaderFooterSettings = ImpPrepDrawPageHeaderFooterDecls( xHandoutPage );
1570 maHandoutMasterStyleName = ImpCreatePresPageStyleName( xHandoutPage, false );
1575 void SdXMLExport::ImpWritePresentationStyles()
1577 if(!IsImpress())
1578 return;
1580 for (sal_Int32 nCnt = 0; nCnt < mnDocMasterPageCount; nCnt++)
1582 Any aAny(mxDocMasterPages->getByIndex(nCnt));
1583 Reference<container::XNamed> xNamed;
1585 if(aAny >>= xNamed)
1587 // write presentation styles (ONLY if presentation)
1588 if(IsImpress() && mxDocStyleFamilies.is() && xNamed.is())
1590 rtl::Reference<XMLStyleExport> aStEx(new XMLStyleExport(*this, GetAutoStylePool().get()));
1591 const rtl::Reference< SvXMLExportPropertyMapper > aMapperRef( GetPropertySetMapper() );
1593 OUString aPrefix( xNamed->getName() + "-" );
1595 aStEx->exportStyleFamily(xNamed->getName(),
1596 OUString(XML_STYLE_FAMILY_SD_PRESENTATION_NAME),
1597 aMapperRef, false,
1598 XmlStyleFamily::SD_PRESENTATION_ID, &aPrefix);
1604 void SdXMLExport::ExportMeta_()
1606 uno::Sequence<beans::NamedValue> stats { { "ObjectCount", uno::makeAny(mnObjectCount) } };
1608 // update document statistics at the model
1609 uno::Reference<document::XDocumentPropertiesSupplier> xPropSup(GetModel(),
1610 uno::UNO_QUERY_THROW);
1611 uno::Reference<document::XDocumentProperties> xDocProps(
1612 xPropSup->getDocumentProperties());
1613 if (xDocProps.is()) {
1614 xDocProps->setDocumentStatistics(stats);
1617 // call parent
1618 SvXMLExport::ExportMeta_();
1621 void SdXMLExport::ExportFontDecls_()
1623 GetFontAutoStylePool(); // make sure the pool is created
1624 SvXMLExport::ExportFontDecls_();
1627 void SdXMLExport::ExportContent_()
1629 // export <pres:header-decl>, <pres:footer-decl> and <pres:date-time-decl> elements
1630 ImpWriteHeaderFooterDecls();
1632 // page export
1633 for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
1635 uno::Reference<drawing::XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), uno::UNO_QUERY );
1637 // set progress view
1638 if(GetStatusIndicator().is())
1639 GetStatusIndicator()->setValue(((nPageInd + 1) * 100) / mnDocDrawPageCount);
1641 if(xDrawPage.is())
1643 // prepare page attributes, name of page
1644 Reference < container::XNamed > xNamed(xDrawPage, UNO_QUERY);
1645 if(xNamed.is())
1646 AddAttribute(XML_NAMESPACE_DRAW, XML_NAME, xNamed->getName());
1648 // draw:style-name (presentation page attributes AND background attributes)
1649 if( !maDrawPagesStyleNames[nPageInd].isEmpty() )
1650 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
1651 maDrawPagesStyleNames[nPageInd]);
1653 // draw:master-page-name
1654 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
1655 if(xMasterPageInt.is())
1657 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
1658 if(xUsedMasterPage.is())
1660 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
1661 if(xMasterNamed.is())
1663 AddAttribute(XML_NAMESPACE_DRAW, XML_MASTER_PAGE_NAME,
1664 EncodeStyleName( xMasterNamed->getName()) );
1669 // presentation:page-layout-name
1670 if( IsImpress() && !maDrawPagesAutoLayoutNames[nPageInd+1].isEmpty())
1672 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, maDrawPagesAutoLayoutNames[nPageInd+1] );
1675 Reference< beans::XPropertySet > xProps( xDrawPage, UNO_QUERY );
1676 if( xProps.is() )
1680 OUString aBookmarkURL;
1681 xProps->getPropertyValue("BookmarkURL") >>= aBookmarkURL;
1683 if( !aBookmarkURL.isEmpty() )
1685 sal_Int32 nIndex = aBookmarkURL.lastIndexOf( '#' );
1686 if( nIndex != -1 )
1688 OUString aFileName( aBookmarkURL.copy( 0, nIndex ) );
1689 OUString aBookmarkName( aBookmarkURL.copy( nIndex+1 ) );
1691 aBookmarkURL = GetRelativeReference( aFileName ) + "#" + aBookmarkName;
1694 AddAttribute ( XML_NAMESPACE_XLINK, XML_HREF, aBookmarkURL);
1695 AddAttribute ( XML_NAMESPACE_XLINK, XML_TYPE, XML_SIMPLE );
1696 AddAttribute ( XML_NAMESPACE_XLINK, XML_SHOW, XML_REPLACE );
1697 AddAttribute ( XML_NAMESPACE_XLINK, XML_ACTUATE, XML_ONREQUEST );
1700 catch(const Exception&)
1702 OSL_FAIL(" no \"BookmarkURL\" property at page?" );
1706 if( IsImpress() )
1707 ImplExportHeaderFooterDeclAttributes( maDrawPagesHeaderFooterSettings[nPageInd] );
1709 OUString sNavigationOrder( getNavigationOrder( xDrawPage ) );
1710 if( !sNavigationOrder.isEmpty() )
1711 AddAttribute ( XML_NAMESPACE_DRAW, XML_NAV_ORDER, sNavigationOrder );
1713 rtl::Reference< xmloff::AnimationsExporter > xAnimationsExporter;
1714 uno::Reference< css::animations::XAnimationNodeSupplier > xAnimNodeSupplier;
1716 // prepare animation export
1717 if(IsImpress())
1719 if( getExportFlags() & SvXMLExportFlags::OASIS )
1721 // export new animations for oasis format
1722 xAnimNodeSupplier.set( xDrawPage, UNO_QUERY );
1724 // prepare animations exporter if impress
1725 if(xAnimNodeSupplier.is())
1727 xAnimationsExporter = new xmloff::AnimationsExporter( *this, xProps );
1728 xAnimationsExporter->prepare( xAnimNodeSupplier->getAnimationNode() );
1731 else
1733 // export old animations for ooo format
1734 rtl::Reference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter();
1735 GetShapeExport()->setAnimationsExporter( xAnimExport );
1739 // write draw:id
1740 const OUString aPageId = getInterfaceToIdentifierMapper().getIdentifier( xDrawPage );
1741 if( !aPageId.isEmpty() )
1743 AddAttributeIdLegacy(XML_NAMESPACE_DRAW, aPageId);
1746 // write page
1747 SvXMLElementExport aDPG(*this, XML_NAMESPACE_DRAW, XML_PAGE, true, true);
1749 // write optional office:forms
1750 exportFormsElement( xDrawPage );
1752 // write graphic objects on this page (if any)
1753 if(xDrawPage.is() && xDrawPage->getCount())
1754 GetShapeExport()->exportShapes( xDrawPage );
1756 // write animations and presentation notes (ONLY if presentation)
1757 if(IsImpress())
1759 if(xAnimNodeSupplier.is())
1761 xAnimationsExporter->exportAnimations( xAnimNodeSupplier->getAnimationNode() );
1763 else
1765 // animations
1766 rtl::Reference< XMLAnimationsExporter > xAnimExport( GetShapeExport()->getAnimationsExporter() );
1767 if( xAnimExport.is() )
1768 xAnimExport->exportAnimations( *this );
1770 xAnimExport = nullptr;
1771 GetShapeExport()->setAnimationsExporter( xAnimExport );
1774 // presentations
1775 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
1776 if(xPresPage.is())
1778 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
1779 if(xNotesPage.is())
1781 if( !maDrawNotesPagesStyleNames[nPageInd].isEmpty() )
1782 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maDrawNotesPagesStyleNames[nPageInd]);
1784 ImplExportHeaderFooterDeclAttributes( maDrawNotesPagesHeaderFooterSettings[nPageInd] );
1786 // write presentation notes
1787 SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true);
1789 // write optional office:forms
1790 exportFormsElement( xNotesPage );
1792 // write shapes per se
1793 GetShapeExport()->exportShapes( xNotesPage );
1798 exportAnnotations( xDrawPage );
1802 if( IsImpress() )
1803 exportPresentationSettings();
1806 void SdXMLExport::exportPresentationSettings()
1810 Reference< XPresentationSupplier > xPresSupplier( GetModel(), UNO_QUERY );
1811 if( !xPresSupplier.is() )
1812 return;
1814 Reference< XPropertySet > xPresProps( xPresSupplier->getPresentation(), UNO_QUERY );
1815 if( !xPresProps.is() )
1816 return;
1818 bool bHasAttr = false;
1820 bool bTemp = false;
1822 // export range
1823 xPresProps->getPropertyValue("IsShowAll") >>= bTemp;
1824 if( !bTemp )
1826 OUString aFirstPage;
1827 xPresProps->getPropertyValue("FirstPage") >>= aFirstPage;
1828 if( !aFirstPage.isEmpty() )
1830 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_PAGE, aFirstPage );
1831 bHasAttr = true;
1833 else
1835 OUString aCustomShow;
1836 xPresProps->getPropertyValue("CustomShow") >>= aCustomShow;
1837 if( !aCustomShow.isEmpty() )
1839 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW, aCustomShow );
1840 bHasAttr = true;
1845 xPresProps->getPropertyValue("IsEndless") >>= bTemp;
1846 if( bTemp )
1848 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ENDLESS, XML_TRUE );
1849 bHasAttr = true;
1851 sal_Int32 nPause = 0;
1852 xPresProps->getPropertyValue("Pause") >>= nPause;
1854 util::Duration aDuration;
1855 aDuration.Seconds = static_cast<sal_uInt16>(nPause);
1857 OUStringBuffer aOut;
1858 ::sax::Converter::convertDuration(aOut, aDuration);
1859 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAUSE, aOut.makeStringAndClear() );
1862 xPresProps->getPropertyValue("AllowAnimations") >>= bTemp;
1863 if( !bTemp )
1865 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_ANIMATIONS, XML_DISABLED );
1866 bHasAttr = true;
1869 xPresProps->getPropertyValue("IsAlwaysOnTop") >>= bTemp;
1870 if( bTemp )
1872 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_STAY_ON_TOP, XML_TRUE );
1873 bHasAttr = true;
1876 xPresProps->getPropertyValue("IsAutomatic") >>= bTemp;
1877 if( bTemp )
1879 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FORCE_MANUAL, XML_TRUE );
1880 bHasAttr = true;
1883 xPresProps->getPropertyValue("IsFullScreen") >>= bTemp;
1884 if( !bTemp )
1886 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_FULL_SCREEN, XML_FALSE );
1887 bHasAttr = true;
1890 // We need to always export this attribute, because the import had the wrong default (tdf#108824)
1891 xPresProps->getPropertyValue("IsMouseVisible") >>= bTemp;
1892 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_VISIBLE, bTemp ? XML_TRUE : XML_FALSE);
1893 bHasAttr = true;
1895 xPresProps->getPropertyValue("StartWithNavigator") >>= bTemp;
1896 if( bTemp )
1898 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_START_WITH_NAVIGATOR, XML_TRUE );
1899 bHasAttr = true;
1902 xPresProps->getPropertyValue("UsePen") >>= bTemp;
1903 if( bTemp )
1905 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_MOUSE_AS_PEN, XML_TRUE );
1906 bHasAttr = true;
1909 xPresProps->getPropertyValue("IsTransitionOnClick") >>= bTemp;
1910 if( !bTemp )
1912 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_TRANSITION_ON_CLICK, XML_DISABLED );
1913 bHasAttr = true;
1916 xPresProps->getPropertyValue("IsShowLogo") >>= bTemp;
1917 if( bTemp )
1919 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_SHOW_LOGO, XML_TRUE );
1920 bHasAttr = true;
1923 Reference< container::XNameContainer > xShows;
1924 Sequence< OUString > aShowNames;
1925 bool bHasNames = false;
1927 Reference< XCustomPresentationSupplier > xSup( GetModel(), UNO_QUERY );
1928 if( xSup.is() )
1930 xShows = xSup->getCustomPresentations();
1931 if( xShows.is() )
1933 aShowNames = xShows->getElementNames();
1934 bHasNames = aShowNames.hasElements();
1938 if( bHasAttr || bHasNames )
1940 SvXMLElementExport aSettings(*this, XML_NAMESPACE_PRESENTATION, XML_SETTINGS, true, true);
1942 if( !bHasNames )
1943 return;
1945 Reference< XIndexContainer > xShow;
1946 Reference< XNamed > xPageName;
1948 OUStringBuffer sTmp;
1950 for( const auto& rShowName : std::as_const(aShowNames) )
1952 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_NAME, rShowName );
1954 xShows->getByName( rShowName ) >>= xShow;
1955 SAL_WARN_IF( !xShow.is(), "xmloff", "invalid custom show!" );
1956 if( !xShow.is() )
1957 continue;
1959 const sal_Int32 nPageCount = xShow->getCount();
1960 for( sal_Int32 nPage = 0; nPage < nPageCount; nPage++ )
1962 xShow->getByIndex( nPage ) >>= xPageName;
1964 if( !xPageName.is() )
1965 continue;
1967 if( !sTmp.isEmpty() )
1968 sTmp.append( ',' );
1969 sTmp.append( xPageName->getName() );
1973 if( !sTmp.isEmpty() )
1974 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PAGES, sTmp.makeStringAndClear() );
1976 SvXMLElementExport aShows(*this, XML_NAMESPACE_PRESENTATION, XML_SHOW, true, true);
1980 catch(const uno::Exception&)
1982 TOOLS_WARN_EXCEPTION("xmloff.draw", "while exporting <presentation:settings>");
1986 void SdXMLExport::ExportStyles_(bool bUsed)
1988 GetPropertySetMapper()->SetAutoStyles( false );
1990 // export fill styles
1991 SvXMLExport::ExportStyles_( bUsed );
1993 // write draw:style-name for object graphic-styles
1994 GetShapeExport()->ExportGraphicDefaults();
1996 // do not export in ODF 1.1 or older
1997 if (getSaneDefaultVersion() >= SvtSaveOptions::ODFSVER_012)
1998 GetShapeExport()->GetShapeTableExport()->exportTableStyles();
2000 // write presentation styles
2001 ImpWritePresentationStyles();
2003 // prepare draw:auto-layout-name for page export
2004 ImpPrepAutoLayoutInfos();
2006 // write draw:auto-layout-name for page export
2007 ImpWriteAutoLayoutInfos();
2009 Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2010 if( xInfoSet.is() )
2012 Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2014 if( xInfoSetInfo->hasPropertyByName( gsPageLayoutNames ) )
2016 xInfoSet->setPropertyValue( gsPageLayoutNames, Any(maDrawPagesAutoLayoutNames) );
2021 void SdXMLExport::collectAutoStyles()
2023 SvXMLExport::collectAutoStyles();
2024 if (mbAutoStylesCollected)
2025 return;
2027 Reference< beans::XPropertySet > xInfoSet( getExportInfo() );
2028 if( xInfoSet.is() )
2030 Reference< beans::XPropertySetInfo > xInfoSetInfo( xInfoSet->getPropertySetInfo() );
2032 if( xInfoSetInfo->hasPropertyByName( gsPageLayoutNames ) )
2034 xInfoSet->getPropertyValue( gsPageLayoutNames ) >>= maDrawPagesAutoLayoutNames;
2038 GetPropertySetMapper()->SetAutoStyles( true );
2040 if( getExportFlags() & SvXMLExportFlags::STYLES )
2042 // #80012# PageMaster export moved from _ExportStyles
2043 // prepare page-master infos
2044 ImpPrepPageMasterInfos();
2046 // prepare draw:style-name for master page export
2047 ImpPrepMasterPageInfos();
2050 if( getExportFlags() & SvXMLExportFlags::CONTENT )
2052 // prepare draw:style-name for page export
2053 ImpPrepDrawPageInfos();
2056 if( getExportFlags() & SvXMLExportFlags::STYLES )
2058 // create auto style infos for shapes on master handout page
2059 if( IsImpress() )
2061 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2062 if( xHandoutSupp.is() )
2064 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2065 if( xHandoutPage.is() && xHandoutPage->getCount())
2066 GetShapeExport()->collectShapesAutoStyles( xHandoutPage );
2070 // create auto style infos for objects on master pages
2071 for(sal_Int32 nMPageId(0); nMPageId < mnDocMasterPageCount; nMPageId++)
2073 Reference< XDrawPage > xMasterPage(mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2075 if( xMasterPage.is() )
2077 // collect layer information
2078 GetFormExport()->examineForms( xMasterPage );
2080 // get MasterPage Name
2081 OUString aMasterPageNamePrefix;
2082 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2083 if(xNamed.is())
2085 aMasterPageNamePrefix = xNamed->getName();
2087 if(!aMasterPageNamePrefix.isEmpty())
2089 aMasterPageNamePrefix += "-";
2091 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2093 if(xMasterPage.is() && xMasterPage->getCount())
2094 GetShapeExport()->collectShapesAutoStyles( xMasterPage );
2096 if(IsImpress())
2098 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2099 if(xPresPage.is())
2101 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2102 if(xNotesPage.is())
2104 // collect layer information
2105 GetFormExport()->examineForms( xNotesPage );
2107 if(xNotesPage->getCount())
2108 GetShapeExport()->collectShapesAutoStyles( xNotesPage );
2112 collectAnnotationAutoStyles(xMasterPage);
2117 if( getExportFlags() & SvXMLExportFlags::CONTENT )
2119 // prepare animations exporter if impress
2120 if(IsImpress() && (!(getExportFlags() & SvXMLExportFlags::OASIS)) )
2122 rtl::Reference< XMLAnimationsExporter > xAnimExport = new XMLAnimationsExporter();
2123 GetShapeExport()->setAnimationsExporter( xAnimExport );
2126 // create auto style infos for objects on pages
2127 for(sal_Int32 nPageInd(0); nPageInd < mnDocDrawPageCount; nPageInd++)
2129 Reference<XDrawPage> xDrawPage( mxDocDrawPages->getByIndex(nPageInd), UNO_QUERY );
2130 if( xDrawPage.is() )
2132 // collect layer information
2133 GetFormExport()->examineForms( xDrawPage );
2135 // get MasterPage Name
2136 OUString aMasterPageNamePrefix;
2137 Reference < drawing::XMasterPageTarget > xMasterPageInt(xDrawPage, UNO_QUERY);
2138 if(xMasterPageInt.is())
2140 Reference<XDrawPage> xUsedMasterPage(xMasterPageInt->getMasterPage());
2141 if(xUsedMasterPage.is())
2143 Reference < container::XNamed > xMasterNamed(xUsedMasterPage, UNO_QUERY);
2144 if(xMasterNamed.is())
2146 aMasterPageNamePrefix = xMasterNamed->getName();
2150 if(!aMasterPageNamePrefix.isEmpty())
2152 aMasterPageNamePrefix += "-";
2155 GetShapeExport()->setPresentationStylePrefix( aMasterPageNamePrefix );
2157 // prepare object infos
2158 if(xDrawPage.is() && xDrawPage->getCount())
2159 GetShapeExport()->collectShapesAutoStyles( xDrawPage );
2161 // prepare presentation notes page object infos (ONLY if presentation)
2162 if(IsImpress())
2164 Reference< presentation::XPresentationPage > xPresPage(xDrawPage, UNO_QUERY);
2165 if(xPresPage.is())
2167 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2168 if(xNotesPage.is())
2170 // collect layer information
2171 GetFormExport()->examineForms( xNotesPage );
2173 if(xNotesPage->getCount())
2174 GetShapeExport()->collectShapesAutoStyles( xNotesPage );
2179 collectAnnotationAutoStyles( xDrawPage );
2182 if (IsImpress())
2184 rtl::Reference< XMLAnimationsExporter > xAnimExport;
2185 GetShapeExport()->setAnimationsExporter( xAnimExport );
2189 mbAutoStylesCollected = true;
2192 void SdXMLExport::ExportAutoStyles_()
2194 collectAutoStyles();
2196 if( getExportFlags() & SvXMLExportFlags::STYLES )
2198 // write page-master infos
2199 ImpWritePageMasterInfos();
2202 // export draw-page styles
2203 GetAutoStylePool()->exportXML( XmlStyleFamily::SD_DRAWINGPAGE_ID );
2205 exportAutoDataStyles();
2207 GetShapeExport()->exportAutoStyles();
2209 SvXMLExportFlags nContentAutostyles = SvXMLExportFlags::CONTENT | SvXMLExportFlags::AUTOSTYLES;
2210 if ( ( getExportFlags() & nContentAutostyles ) == nContentAutostyles )
2211 GetFormExport()->exportAutoStyles( );
2213 // ...for text
2214 GetTextParagraphExport()->exportTextAutoStyles();
2217 void SdXMLExport::ExportMasterStyles_()
2219 // export layer
2220 SdXMLayerExporter::exportLayer( *this );
2222 // export handout master page if impress
2223 if( IsImpress() )
2225 Reference< presentation::XHandoutMasterSupplier > xHandoutSupp( GetModel(), UNO_QUERY );
2226 if( xHandoutSupp.is() )
2228 Reference< XDrawPage > xHandoutPage( xHandoutSupp->getHandoutMasterPage() );
2229 if( xHandoutPage.is() )
2231 // presentation:page-layout-name
2232 if( IsImpress() && !maDrawPagesAutoLayoutNames[0].isEmpty())
2234 AddAttribute(XML_NAMESPACE_PRESENTATION, XML_PRESENTATION_PAGE_LAYOUT_NAME, EncodeStyleName( maDrawPagesAutoLayoutNames[0] ));
2237 ImpXMLEXPPageMasterInfo* pInfo = mpHandoutPageMaster;
2238 if(pInfo)
2240 const OUString& sString = pInfo->GetName();
2241 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2244 // draw:style-name
2245 if( !maHandoutMasterStyleName.isEmpty() )
2246 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME, maHandoutMasterStyleName);
2248 ImplExportHeaderFooterDeclAttributes( maHandoutPageHeaderFooterSettings );
2250 // write masterpage
2251 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_HANDOUT_MASTER, true, true);
2253 // write graphic objects on this master page (if any)
2254 if(xHandoutPage.is() && xHandoutPage->getCount())
2255 GetShapeExport()->exportShapes( xHandoutPage );
2260 // export MasterPages in master-styles section
2261 for (sal_Int32 nMPageId = 0; nMPageId < mnDocMasterPageCount; nMPageId++)
2263 Reference< XDrawPage > xMasterPage( mxDocMasterPages->getByIndex(nMPageId), UNO_QUERY );
2264 if(xMasterPage.is())
2266 // prepare masterpage attributes
2267 Reference < container::XNamed > xNamed(xMasterPage, UNO_QUERY);
2268 if(xNamed.is())
2270 bool bEncoded = false;
2271 OUString sMasterPageName = xNamed->getName();
2272 AddAttribute(XML_NAMESPACE_STYLE, XML_NAME,
2273 EncodeStyleName( sMasterPageName, &bEncoded ));
2274 if( bEncoded )
2275 AddAttribute(
2276 XML_NAMESPACE_STYLE, XML_DISPLAY_NAME,
2277 sMasterPageName );
2280 ImpXMLEXPPageMasterInfo* pInfo = mvPageMasterUsageList.at( nMPageId );
2281 if(pInfo)
2283 const OUString& sString = pInfo->GetName();
2284 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString );
2287 // draw:style-name (background attributes)
2288 if( !maMasterPagesStyleNames[nMPageId].isEmpty() )
2289 AddAttribute(XML_NAMESPACE_DRAW, XML_STYLE_NAME,
2290 maMasterPagesStyleNames[nMPageId]);
2292 // write masterpage
2293 SvXMLElementExport aMPG(*this, XML_NAMESPACE_STYLE, XML_MASTER_PAGE, true, true);
2295 // write optional office:forms
2296 exportFormsElement( xMasterPage );
2298 // write graphic objects on this master page (if any)
2299 if(xMasterPage.is() && xMasterPage->getCount())
2300 GetShapeExport()->exportShapes( xMasterPage );
2302 // write presentation notes (ONLY if presentation)
2303 if(IsImpress())
2305 Reference< presentation::XPresentationPage > xPresPage(xMasterPage, UNO_QUERY);
2306 if(xPresPage.is())
2308 Reference< XDrawPage > xNotesPage(xPresPage->getNotesPage());
2309 if(xNotesPage.is())
2311 ImpXMLEXPPageMasterInfo* pMasterInfo = mvNotesPageMasterUsageList.at( nMPageId );
2312 if(pMasterInfo)
2314 const OUString& sString = pMasterInfo->GetName();
2315 AddAttribute(XML_NAMESPACE_STYLE, XML_PAGE_LAYOUT_NAME, sString);
2318 // write presentation notes
2319 SvXMLElementExport aPSY(*this, XML_NAMESPACE_PRESENTATION, XML_NOTES, true, true);
2321 // write optional office:forms
2322 exportFormsElement( xNotesPage );
2324 // write shapes per se
2325 GetShapeExport()->exportShapes( xNotesPage );
2329 exportAnnotations( xMasterPage );
2334 void SdXMLExport::exportFormsElement( const Reference< XDrawPage >& xDrawPage )
2336 if( !xDrawPage.is() )
2337 return;
2339 Reference< form::XFormsSupplier2 > xFormsSupplier( xDrawPage, UNO_QUERY );
2340 if ( xFormsSupplier.is() && xFormsSupplier->hasForms() )
2342 // write masterpage
2343 ::xmloff::OOfficeFormsExport aForms(*this);
2344 GetFormExport()->exportForms( xDrawPage );
2347 if(! GetFormExport()->seekPage( xDrawPage ) )
2349 OSL_FAIL( "OFormLayerXMLExport::seekPage failed!" );
2353 void SdXMLExport::GetViewSettings(uno::Sequence<beans::PropertyValue>& rProps)
2355 Reference< beans::XPropertySet > xPropSet( GetModel(), UNO_QUERY );
2356 if( !xPropSet.is() )
2357 return;
2359 awt::Rectangle aVisArea;
2360 xPropSet->getPropertyValue("VisibleArea") >>= aVisArea;
2362 rProps.realloc(4);
2363 beans::PropertyValue* pProps = rProps.getArray();
2365 pProps[0].Name = "VisibleAreaTop";
2366 pProps[0].Value <<= aVisArea.Y;
2367 pProps[1].Name = "VisibleAreaLeft";
2368 pProps[1].Value <<= aVisArea.X;
2369 pProps[2].Name = "VisibleAreaWidth";
2370 pProps[2].Value <<= aVisArea.Width;
2371 pProps[3].Name = "VisibleAreaHeight";
2372 pProps[3].Value <<= aVisArea.Height;
2376 void SdXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>& rProps)
2378 Reference< lang::XMultiServiceFactory > xFac( GetModel(), UNO_QUERY );
2379 if( !xFac.is() )
2380 return;
2382 Reference< beans::XPropertySet > xProps( xFac->createInstance("com.sun.star.document.Settings"), UNO_QUERY );
2383 if( xProps.is() )
2384 SvXMLUnitConverter::convertPropertySet( rProps, xProps );
2385 DocumentSettingsSerializer *pFilter(dynamic_cast<DocumentSettingsSerializer *>(xProps.get()));
2386 if (!pFilter)
2387 return;
2388 const uno::Reference< embed::XStorage > xStorage(GetTargetStorage());
2389 if (!xStorage.is())
2390 return;
2391 rProps = pFilter->filterStreamsToStorage(xStorage, rProps);
2394 void SdXMLExport::addDataStyle(const sal_Int32 nNumberFormat, bool bTimeFormat )
2396 sal_Int32 nFormat = nNumberFormat;
2397 if( (nNumberFormat > 1) && (nNumberFormat <= 0x0f) )
2398 nFormat -= 2;
2400 if( bTimeFormat )
2402 maUsedTimeStyles.insert( nFormat );
2404 else
2406 maUsedDateStyles.insert( nFormat );
2410 void SdXMLExport::exportDataStyles()
2412 // there are no data styles to export in draw/impress yet
2415 void SdXMLExport::exportAutoDataStyles()
2417 for( const auto& rUsedDateStyle : maUsedDateStyles )
2418 SdXMLNumberStylesExporter::exportDateStyle( *this, rUsedDateStyle );
2420 for( const auto& rUsedTimeStyle : maUsedTimeStyles )
2421 SdXMLNumberStylesExporter::exportTimeStyle( *this, rUsedTimeStyle );
2423 if(HasFormExport())
2424 GetFormExport()->exportAutoControlNumberStyles();
2427 OUString SdXMLExport::getDataStyleName(const sal_Int32 nNumberFormat, bool bTimeFormat ) const
2429 if( bTimeFormat )
2431 return SdXMLNumberStylesExporter::getTimeStyleName( nNumberFormat );
2433 else
2435 return SdXMLNumberStylesExporter::getDateStyleName( nNumberFormat );
2439 OUString SdXMLExport::getNavigationOrder( const Reference< XDrawPage >& xDrawPage )
2441 OUStringBuffer sNavOrder;
2444 Reference< XPropertySet > xSet( xDrawPage, UNO_QUERY_THROW );
2445 Reference< XIndexAccess > xNavOrder( xSet->getPropertyValue("NavigationOrder"), UNO_QUERY_THROW );
2447 Reference< XIndexAccess > xZOrderAccess = xDrawPage;
2449 // only export navigation order if it is different from the z-order
2450 if( (xNavOrder.get() != xZOrderAccess.get()) && (xNavOrder->getCount() == xDrawPage->getCount()) )
2452 sal_Int32 nIndex;
2453 const sal_Int32 nCount = xNavOrder->getCount();
2454 for( nIndex = 0; nIndex < nCount; ++nIndex )
2456 OUString sId( getInterfaceToIdentifierMapper().registerReference( Reference< XInterface >( xNavOrder->getByIndex( nIndex ), UNO_QUERY ) ) );
2457 if( !sId.isEmpty() )
2459 if( !sNavOrder.isEmpty() )
2460 sNavOrder.append( ' ' );
2461 sNavOrder.append( sId );
2466 catch(const Exception&)
2469 return sNavOrder.makeStringAndClear();
2472 void SdXMLExport::collectAnnotationAutoStyles( const Reference<XDrawPage>& xDrawPage )
2474 Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2475 if( !xAnnotationAccess.is() ) return;
2479 Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2480 if( xAnnotationEnumeration.is() )
2482 while( xAnnotationEnumeration->hasMoreElements() )
2484 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_SET_THROW );
2485 Reference< XText > xText( xAnnotation->getTextRange() );
2486 if(xText.is() && !xText->getString().isEmpty())
2487 GetTextParagraphExport()->collectTextAutoStyles( xText );
2491 catch(const Exception&)
2493 TOOLS_WARN_EXCEPTION("xmloff.draw",
2494 "exception caught during export of annotation auto styles");
2498 void SdXMLExport::exportAnnotations( const Reference<XDrawPage>& xDrawPage )
2500 // do not export in standard ODF 1.3 or older
2501 if ((getSaneDefaultVersion() & SvtSaveOptions::ODFSVER_EXTENDED) == 0)
2503 return;
2506 Reference< XAnnotationAccess > xAnnotationAccess( xDrawPage, UNO_QUERY );
2507 if( !xAnnotationAccess.is() )
2508 return;
2512 Reference< XAnnotationEnumeration > xAnnotationEnumeration( xAnnotationAccess->createAnnotationEnumeration() );
2513 if( xAnnotationEnumeration.is() && xAnnotationEnumeration->hasMoreElements() )
2515 OUStringBuffer sStringBuffer;
2518 Reference< XAnnotation > xAnnotation( xAnnotationEnumeration->nextElement(), UNO_SET_THROW );
2520 RealPoint2D aPosition( xAnnotation->getPosition() );
2522 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2523 static_cast<sal_Int32>( aPosition.X * 100 ) );
2524 AddAttribute(XML_NAMESPACE_SVG, XML_X, sStringBuffer.makeStringAndClear());
2526 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2527 static_cast<sal_Int32>( aPosition.Y * 100 ) );
2528 AddAttribute(XML_NAMESPACE_SVG, XML_Y, sStringBuffer.makeStringAndClear());
2530 RealSize2D aSize( xAnnotation->getSize() );
2532 if( aSize.Width || aSize.Height )
2534 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2535 static_cast<sal_Int32>( aSize.Width * 100 ) );
2536 AddAttribute(XML_NAMESPACE_SVG, XML_WIDTH, sStringBuffer.makeStringAndClear());
2537 GetMM100UnitConverter().convertMeasureToXML(sStringBuffer,
2538 static_cast<sal_Int32>( aSize.Height * 100 ) );
2539 AddAttribute(XML_NAMESPACE_SVG, XML_HEIGHT, sStringBuffer.makeStringAndClear());
2542 // annotation element + content
2543 SvXMLElementExport aElem(*this, XML_NAMESPACE_OFFICE_EXT, XML_ANNOTATION, false, true);
2545 // author
2546 OUString aAuthor( xAnnotation->getAuthor() );
2547 if( !aAuthor.isEmpty() )
2549 SvXMLElementExport aCreatorElem( *this, XML_NAMESPACE_DC, XML_CREATOR, true, false );
2550 Characters(aAuthor);
2553 // initials
2554 OUString aInitials( xAnnotation->getInitials() );
2555 if( !aInitials.isEmpty() )
2557 // OFFICE-3776 export meta:creator-initials for ODF 1.3
2558 SvXMLElementExport aInitialsElem( *this,
2559 (SvtSaveOptions::ODFSVER_013 <= getSaneDefaultVersion())
2560 ? XML_NAMESPACE_META
2561 : XML_NAMESPACE_LO_EXT,
2562 (SvtSaveOptions::ODFSVER_013 <= getSaneDefaultVersion())
2563 ? XML_CREATOR_INITIALS
2564 : XML_SENDER_INITIALS,
2565 true, false );
2566 Characters(aInitials);
2570 // date time
2571 css::util::DateTime aDate( xAnnotation->getDateTime() );
2572 ::sax::Converter::convertDateTime(sStringBuffer, aDate, nullptr, true);
2573 SvXMLElementExport aDateElem( *this, XML_NAMESPACE_DC, XML_DATE, true, false );
2574 Characters(sStringBuffer.makeStringAndClear());
2577 css::uno::Reference < css::text::XText > xText( xAnnotation->getTextRange() );
2578 if( xText.is() )
2579 GetTextParagraphExport()->exportText( xText );
2581 while( xAnnotationEnumeration->hasMoreElements() );
2584 catch(const Exception&)
2586 TOOLS_WARN_EXCEPTION("xmloff.draw", "exception caught during export of annotations");
2590 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2591 com_sun_star_comp_Impress_XMLOasisExporter_get_implementation(
2592 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2594 return cppu::acquire(new SdXMLExport(
2595 pCtx, "XMLImpressExportOasis", false,
2596 SvXMLExportFlags::OASIS | SvXMLExportFlags::META | SvXMLExportFlags::STYLES
2597 | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES
2598 | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS | SvXMLExportFlags::SETTINGS
2599 | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED));
2602 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2603 com_sun_star_comp_Impress_XMLOasisStylesExporter_get_implementation(
2604 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2606 return cppu::acquire(new SdXMLExport(
2607 pCtx, "XMLImpressStylesExportOasis", false,
2608 SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES
2609 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::FONTDECLS));
2612 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2613 com_sun_star_comp_Impress_XMLOasisContentExporter_get_implementation(
2614 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2616 return cppu::acquire(new SdXMLExport(pCtx, "XMLImpressContentExportOasis", false,
2617 SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES
2618 | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS
2619 | SvXMLExportFlags::FONTDECLS));
2622 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2623 com_sun_star_comp_Impress_XMLOasisMetaExporter_get_implementation(
2624 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2626 return cppu::acquire(new SdXMLExport(pCtx, "XMLImpressMetaExportOasis", false,
2627 SvXMLExportFlags::OASIS | SvXMLExportFlags::META));
2630 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2631 com_sun_star_comp_Impress_XMLOasisSettingsExporter_get_implementation(
2632 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2634 return cppu::acquire(new SdXMLExport(pCtx, "XMLImpressSettingsExportOasis", false,
2635 SvXMLExportFlags::OASIS | SvXMLExportFlags::SETTINGS));
2638 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2639 com_sun_star_comp_Impress_XMLExporter_get_implementation(uno::XComponentContext* pCtx,
2640 uno::Sequence<uno::Any> const& /*rSeq*/)
2642 return cppu::acquire(new SdXMLExport(
2643 pCtx, "XMLImpressExportOOO", false,
2644 SvXMLExportFlags::META | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES
2645 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS
2646 | SvXMLExportFlags::SETTINGS | SvXMLExportFlags::FONTDECLS
2647 | SvXMLExportFlags::EMBEDDED));
2650 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2651 com_sun_star_comp_Draw_XMLExporter_get_implementation(uno::XComponentContext* pCtx,
2652 uno::Sequence<uno::Any> const& /*rSeq*/)
2654 return cppu::acquire(new SdXMLExport(
2655 pCtx, "XMLDrawExportOOO", true,
2656 SvXMLExportFlags::META | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES
2657 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS
2658 | SvXMLExportFlags::SETTINGS | SvXMLExportFlags::FONTDECLS
2659 | SvXMLExportFlags::EMBEDDED));
2662 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2663 com_sun_star_comp_Draw_XMLOasisSettingsExporter_get_implementation(
2664 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2666 return cppu::acquire(new SdXMLExport(pCtx, "XMLDrawSettingsExportOasis", true,
2667 SvXMLExportFlags::OASIS | SvXMLExportFlags::SETTINGS));
2670 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2671 com_sun_star_comp_Draw_XMLOasisMetaExporter_get_implementation(
2672 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2674 return cppu::acquire(new SdXMLExport(pCtx, "XMLDrawMetaExportOasis", true,
2675 SvXMLExportFlags::OASIS | SvXMLExportFlags::META));
2678 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2679 com_sun_star_comp_Draw_XMLOasisContentExporter_get_implementation(
2680 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2682 return cppu::acquire(new SdXMLExport(pCtx, "XMLDrawContentExportOasis", true,
2683 SvXMLExportFlags::OASIS | SvXMLExportFlags::AUTOSTYLES
2684 | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS
2685 | SvXMLExportFlags::FONTDECLS));
2688 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2689 com_sun_star_comp_Draw_XMLOasisStylesExporter_get_implementation(
2690 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2692 return cppu::acquire(new SdXMLExport(
2693 pCtx, "XMLDrawStylesExportOasis", true,
2694 SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES | SvXMLExportFlags::MASTERSTYLES
2695 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::FONTDECLS));
2698 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2699 com_sun_star_comp_Draw_XMLOasisExporter_get_implementation(uno::XComponentContext* pCtx,
2700 uno::Sequence<uno::Any> const& /*rSeq*/)
2702 return cppu::acquire(new SdXMLExport(
2703 pCtx, "XMLDrawExportOasis", true,
2704 SvXMLExportFlags::OASIS | SvXMLExportFlags::META | SvXMLExportFlags::STYLES
2705 | SvXMLExportFlags::MASTERSTYLES | SvXMLExportFlags::AUTOSTYLES
2706 | SvXMLExportFlags::CONTENT | SvXMLExportFlags::SCRIPTS | SvXMLExportFlags::SETTINGS
2707 | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED));
2710 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2711 com_sun_star_comp_DrawingLayer_XMLExporter_get_implementation(
2712 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2714 return cppu::acquire(
2715 new SdXMLExport(pCtx, "XMLDrawingLayerExport", true,
2716 SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES
2717 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT
2718 | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED));
2721 extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2722 com_sun_star_comp_Impress_XMLClipboardExporter_get_implementation(
2723 uno::XComponentContext* pCtx, uno::Sequence<uno::Any> const& /*rSeq*/)
2725 return cppu::acquire(
2726 new SdXMLExport(pCtx, "XMLImpressClipboardExport", /*bIsDraw=*/false,
2727 SvXMLExportFlags::OASIS | SvXMLExportFlags::STYLES
2728 | SvXMLExportFlags::AUTOSTYLES | SvXMLExportFlags::CONTENT
2729 | SvXMLExportFlags::FONTDECLS | SvXMLExportFlags::EMBEDDED));
2732 XMLFontAutoStylePool* SdXMLExport::CreateFontAutoStylePool()
2734 bool bEmbedFonts = false;
2735 bool bEmbedUsedOnly = false;
2736 bool bEmbedLatinScript = true;
2737 bool bEmbedAsianScript = true;
2738 bool bEmbedComplexScript = true;
2740 if (getExportFlags() & SvXMLExportFlags::CONTENT)
2744 Reference<lang::XMultiServiceFactory> xFactory(GetModel(), UNO_QUERY);
2745 Reference<beans::XPropertySet> xProps;
2746 Reference<beans::XPropertySetInfo> xInfo;
2748 if (xFactory.is())
2749 xProps.set(xFactory->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
2750 if (xProps.is())
2751 xInfo = xProps->getPropertySetInfo();
2752 if (xInfo.is() && xProps.is())
2754 if (xInfo->hasPropertyByName("EmbedFonts"))
2755 xProps->getPropertyValue("EmbedFonts") >>= bEmbedFonts;
2756 if (xInfo->hasPropertyByName("EmbedOnlyUsedFonts"))
2757 xProps->getPropertyValue("EmbedOnlyUsedFonts") >>= bEmbedUsedOnly;
2758 if (xInfo->hasPropertyByName("EmbedLatinScriptFonts"))
2759 xProps->getPropertyValue("EmbedLatinScriptFonts") >>= bEmbedLatinScript;
2760 if (xInfo->hasPropertyByName("EmbedAsianScriptFonts"))
2761 xProps->getPropertyValue("EmbedAsianScriptFonts") >>= bEmbedAsianScript;
2762 if (xInfo->hasPropertyByName("EmbedComplexScriptFonts"))
2763 xProps->getPropertyValue("EmbedComplexScriptFonts") >>= bEmbedComplexScript;
2765 } catch(...)
2767 // clipboard document doesn't have shell so throws from getPropertyValue
2768 // gallery elements may not support com.sun.star.document.Settings so throws from createInstance
2772 XMLFontAutoStylePool *pPool = new XMLFontAutoStylePool( *this, bEmbedFonts );
2773 pPool->setEmbedOnlyUsedFonts(bEmbedUsedOnly);
2774 pPool->setEmbedFontScripts(bEmbedLatinScript, bEmbedAsianScript, bEmbedComplexScript);
2776 Reference< beans::XPropertySet > xProps( GetModel(), UNO_QUERY );
2777 if ( xProps.is() ) {
2778 Sequence<Any> aAnySeq;
2779 if( xProps->getPropertyValue("Fonts") >>= aAnySeq )
2781 if( aAnySeq.getLength() % 5 == 0 )
2783 int nLen = aAnySeq.getLength() / 5;
2784 int nSeqIndex = 0;
2785 for( int i = 0; i < nLen; i++ )
2787 OUString sFamilyName, sStyleName;
2788 sal_Int16 eFamily(FAMILY_DONTKNOW),
2789 ePitch(PITCH_DONTKNOW),
2790 eCharSet(RTL_TEXTENCODING_DONTKNOW);
2792 aAnySeq[nSeqIndex++] >>= sFamilyName;
2793 aAnySeq[nSeqIndex++] >>= sStyleName;
2794 aAnySeq[nSeqIndex++] >>= eFamily;
2795 aAnySeq[nSeqIndex++] >>= ePitch;
2796 aAnySeq[nSeqIndex++] >>= eCharSet;
2798 pPool->Add( sFamilyName, sStyleName, FontFamily( eFamily ), FontPitch( ePitch ), rtl_TextEncoding( eCharSet ) );
2804 return pPool;
2807 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */