LibreOffice Module sd (master) 1
pptx-epptooxml.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <stdio.h>
22#include <oox/token/namespaces.hxx>
23#include <oox/token/tokens.hxx>
26#include "epptooxml.hxx"
27#include <oox/export/shapes.hxx>
28
32#include <sax/fshelper.hxx>
33#include <rtl/ustrbuf.hxx>
34#include <sal/log.hxx>
36#include <tools/datetime.hxx>
37#include <com/sun/star/animations/TransitionType.hpp>
38#include <com/sun/star/animations/TransitionSubType.hpp>
39#include <com/sun/star/beans/XPropertySetInfo.hpp>
40#include <com/sun/star/drawing/FillStyle.hpp>
41#include <com/sun/star/drawing/XDrawPages.hpp>
42#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
43#include <com/sun/star/embed/ElementModes.hpp>
44#include <com/sun/star/geometry/RealPoint2D.hpp>
45#include <com/sun/star/office/XAnnotationEnumeration.hpp>
46#include <com/sun/star/office/XAnnotationAccess.hpp>
47#include <com/sun/star/presentation/AnimationSpeed.hpp>
48#include <com/sun/star/util/DateTime.hpp>
49#include <com/sun/star/task/XStatusIndicator.hpp>
50#include <com/sun/star/frame/XModel.hpp>
51#include <com/sun/star/lang/XMultiServiceFactory.hpp>
52#include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
53#include <com/sun/star/container/XIndexContainer.hpp>
54#include <com/sun/star/container/XNamed.hpp>
55#include <com/sun/star/presentation/XPresentationSupplier.hpp>
57
58#include <oox/export/utils.hxx>
61
62#include "pptx-animations.hxx"
63#include "../ppt/pptanimations.hxx"
64
66#include <svx/svdpage.hxx>
67#include <svx/unoapi.hxx>
68#include <svx/svdogrp.hxx>
69#include <svx/ColorSets.hxx>
70#include <sdmod.hxx>
71#include <sdpage.hxx>
72
73#include <vcl/svapp.hxx>
74#include <vcl/settings.hxx>
75
76#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
77#include <com/sun/star/document/XStorageBasedDocument.hpp>
78#include <utility>
79#if OSL_DEBUG_LEVEL > 1
80#include <com/sun/star/drawing/RectanglePoint.hpp>
81#endif
82
83// presentation namespaces
84#define PNMSS FSNS(XML_xmlns, XML_a), this->getNamespaceURL(OOX_NS(dml)), \
85 FSNS(XML_xmlns, XML_p), this->getNamespaceURL(OOX_NS(ppt)), \
86 FSNS(XML_xmlns, XML_r), this->getNamespaceURL(OOX_NS(officeRel)), \
87 FSNS(XML_xmlns, XML_p14), this->getNamespaceURL(OOX_NS(p14)), \
88 FSNS(XML_xmlns, XML_p15), this->getNamespaceURL(OOX_NS(p15)), \
89 FSNS(XML_xmlns, XML_mc), this->getNamespaceURL(OOX_NS(mce))
90
91// presentationPr namespace
92#define PPRNMSS FSNS(XML_xmlns, XML_a), this->getNamespaceURL(OOX_NS(dml)), \
93 FSNS(XML_xmlns, XML_r), this->getNamespaceURL(OOX_NS(officeRel)), \
94 FSNS(XML_xmlns, XML_p), this->getNamespaceURL(OOX_NS(ppt))
95
96using namespace ::com::sun::star;
97using namespace ::com::sun::star::animations;
98using namespace ::com::sun::star::beans;
99using namespace ::com::sun::star::container;
100using namespace ::com::sun::star::drawing;
101using namespace ::com::sun::star::geometry;
102using namespace ::com::sun::star::presentation;
103using namespace ::com::sun::star::office;
104using namespace ::com::sun::star::text;
105using namespace ::com::sun::star::uno;
106using namespace ::com::sun::star::util;
107using namespace ::ppt;
108using ::com::sun::star::beans::XPropertySet;
109using ::com::sun::star::beans::XPropertySetInfo;
110using ::sax_fastparser::FSHelperPtr;
111using namespace oox::drawingml;
112using namespace oox::core;
113
114#if OSL_DEBUG_LEVEL > 1
115void dump_pset(Reference< XPropertySet > const& rXPropSet);
116#endif
117
118namespace oox::core
119{
120
122{
126public:
128 void SetMaster(bool bMaster);
129 void SetPageType(PageType ePageType);
130 ShapeExport& WriteNonVisualProperties(const Reference< XShape >& xShape) override;
131 ShapeExport& WriteTextShape(const Reference< XShape >& xShape) override;
132 ShapeExport& WriteUnknownShape(const Reference< XShape >& xShape) override;
133 ShapeExport& WritePlaceholderShape(const Reference< XShape >& xShape, PlaceholderType ePlaceholder);
135 ShapeExport& WritePlaceholderReferenceShape(PlaceholderType ePlaceholder, sal_Int32 nReferencedPlaceholderIdx, PageType ePageType, const Reference<XPropertySet>& rXPagePropSet);
136 ShapeExport& WritePageShape(const Reference< XShape >& xShape, PageType ePageType, bool bPresObj);
138 ShapeExport& WritePlaceholderReferenceTextBody(PlaceholderType ePlaceholder, PageType ePageType, const Reference<XPropertySet> xPagePropSet);
139
140 // helper parts
141 bool WritePlaceholder(const Reference< XShape >& xShape, PlaceholderType ePlaceholder, bool bMaster);
142};
143
144
145namespace
146{
147void WriteSndAc(const FSHelperPtr& pFS, const OUString& sSoundRelId, const OUString& sSoundName)
148{
149 pFS->startElementNS(XML_p, XML_sndAc);
150 pFS->startElementNS(XML_p, XML_stSnd);
151 pFS->singleElementNS(XML_p, XML_snd, FSNS(XML_r, XML_embed),
152 sax_fastparser::UseIf(sSoundRelId, !sSoundRelId.isEmpty()), XML_name,
153 sax_fastparser::UseIf(sSoundName, !sSoundName.isEmpty()));
154 pFS->endElement(FSNS(XML_p, XML_stSnd));
155 pFS->endElement(FSNS(XML_p, XML_sndAc));
156}
157
158const char* getPlaceholderTypeName(PlaceholderType ePlaceholder)
159{
160 switch (ePlaceholder)
161 {
162 case SlideImage:
163 return "sldImg";
164 case Notes:
165 return "body";
166 case Header:
167 return "hdr";
168 case Footer:
169 return "ftr";
170 case SlideNumber:
171 return "sldNum";
172 case DateAndTime:
173 return "dt";
174 case Outliner:
175 return "body";
176 case Title:
177 return "title";
178 case Subtitle:
179 return "subTitle";
180 default:
181 SAL_INFO("sd.eppt", "warning: unhandled placeholder type: " << ePlaceholder);
182 return "";
183 }
184}
185}
186}
187
188namespace {
189
190enum PPTXLayout
191{
192 LAYOUT_BLANK,
193 LAYOUT_TITLE_SLIDE,
194 LAYOUT_TITLE_CONTENT,
195 LAYOUT_TITLE_2CONTENT,
196 LAYOUT_TITLE,
197 LAYOUT_CENTERED_TEXT,
198 LAYOUT_TITLE_2CONTENT_CONTENT,
199 LAYOUT_TITLE_CONTENT_2CONTENT,
200 LAYOUT_TITLE_2CONTENT_OVER_CONTENT,
201 LAYOUT_TITLE_CONTENT_OVER_CONTENT,
202 LAYOUT_TITLE_4CONTENT,
203 LAYOUT_TITLE_6CONTENT,
204 LAYOUT_SIZE
205};
206
207struct PPTXLayoutInfo
208{
209 int nType;
210 const char* sName;
211 const char* sType;
212};
213
214}
215
216const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] =
217{
218 { 20, "Blank Slide", "blank" },
219 { 0, "Title Slide", "tx" },
220 { 1, "Title, Content", "obj" },
221 { 3, "Title, 2 Content", "twoObj" },
222 { 19, "Title Only", "titleOnly" },
223 { 32, "Centered Text", "objOnly" }, // not exactly, but close
224 { 15, "Title, 2 Content and Content", "twoObjAndObj" },
225 { 12, "Title Content and 2 Content", "objAndTwoObj" },
226 { 16, "Title, 2 Content over Content", "twoObjOverTx" }, // not exactly, but close
227 { 14, "Title, Content over Content", "objOverTx" }, // not exactly, but close
228 { 18, "Title, 4 Content", "fourObj" },
229 { 34, "Title, 6 Content", "blank" } // not defined => blank
230};
231
232int PowerPointExport::GetPPTXLayoutId(int nOffset)
233{
234 int nId = LAYOUT_BLANK;
235
236 SAL_INFO("sd.eppt", "GetPPTXLayoutId " << nOffset);
237
238 switch (nOffset)
239 {
240 case 0:
241 nId = LAYOUT_TITLE_SLIDE;
242 break;
243 case 1:
244 nId = LAYOUT_TITLE_CONTENT;
245 break;
246 case 3:
247 nId = LAYOUT_TITLE_2CONTENT;
248 break;
249 case 19:
250 nId = LAYOUT_TITLE;
251 break;
252 case 15:
253 nId = LAYOUT_TITLE_2CONTENT_CONTENT;
254 break;
255 case 12:
256 nId = LAYOUT_TITLE_CONTENT_2CONTENT;
257 break;
258 case 16:
259 nId = LAYOUT_TITLE_2CONTENT_OVER_CONTENT;
260 break;
261 case 14:
262 nId = LAYOUT_TITLE_CONTENT_OVER_CONTENT;
263 break;
264 case 18:
265 nId = LAYOUT_TITLE_4CONTENT;
266 break;
267 case 32:
268 nId = LAYOUT_CENTERED_TEXT;
269 break;
270 case 34:
271 nId = LAYOUT_TITLE_6CONTENT;
272 break;
273 case 20:
274 default:
275 nId = LAYOUT_BLANK;
276 break;
277 }
278
279 return nId;
280}
281
283 PowerPointExport* pFB)
284 : ShapeExport(XML_p, std::move(pFS), pShapeMap, pFB)
285 , mrExport(*pFB)
286 , mePageType(UNDEFINED)
287 , mbMaster(false)
288{
289}
290
292{
293 mbMaster = bMaster;
294}
295
297{
298 mePageType = ePageType;
299}
300
302{
303 GetFS()->singleElementNS(XML_p, XML_nvPr);
304
305 return *this;
306}
307
308ShapeExport& PowerPointShapeExport::WriteTextShape(const Reference< XShape >& xShape)
309{
310 OUString sShapeType = xShape->getShapeType();
311
312 SAL_INFO("sd.eppt", "shape(text) : " << sShapeType.toUtf8());
313
314 if (sShapeType == "com.sun.star.drawing.TextShape" || sShapeType == "com.sun.star.drawing.GraphicObjectShape")
315 {
316 ShapeExport::WriteTextShape(xShape);
317 }
318 else if (sShapeType == "com.sun.star.presentation.DateTimeShape")
319 {
321 ShapeExport::WriteTextShape(xShape);
322 }
323 else if (sShapeType == "com.sun.star.presentation.FooterShape")
324 {
325 if (!WritePlaceholder(xShape, Footer, mbMaster))
326 ShapeExport::WriteTextShape(xShape);
327 }
328 else if (sShapeType == "com.sun.star.presentation.HeaderShape")
329 {
330 if (!WritePlaceholder(xShape, Header, mbMaster))
331 ShapeExport::WriteTextShape(xShape);
332 }
333 else if (sShapeType == "com.sun.star.presentation.NotesShape")
334 {
337 else
338 ShapeExport::WriteTextShape(xShape);
339 }
340 else if (sShapeType == "com.sun.star.presentation.OutlinerShape")
341 {
342 if (!WritePlaceholder(xShape, Outliner, mbMaster))
343 ShapeExport::WriteTextShape(xShape);
344 }
345 else if (sShapeType == "com.sun.star.presentation.SlideNumberShape")
346 {
348 ShapeExport::WriteTextShape(xShape);
349 }
350 else if (sShapeType == "com.sun.star.presentation.TitleTextShape")
351 {
352 if (!WritePlaceholder(xShape, Title, mbMaster))
353 ShapeExport::WriteTextShape(xShape);
354 }
355 else
356 SAL_WARN("sd.eppt", "PowerPointShapeExport::WriteTextShape: shape of type '" << sShapeType << "' is ignored");
357
358 return *this;
359}
360
361ShapeExport& PowerPointShapeExport::WriteUnknownShape(const Reference< XShape >& xShape)
362{
363 OUString sShapeType = xShape->getShapeType();
364
365 SAL_INFO("sd.eppt", "shape(unknown): " << sShapeType.toUtf8());
366
367 if (sShapeType == "com.sun.star.presentation.PageShape")
368 {
370 }
371 else if (sShapeType == "com.sun.star.presentation.SubtitleShape")
372 {
373 if(mePageType != MASTER)
374 {
375 if (!WritePlaceholder(xShape, Subtitle, mbMaster))
376 ShapeExport::WriteTextShape(xShape);
377 }
378 }
379 else
380 SAL_WARN("sd.eppt", "unknown shape not handled: " << sShapeType.toUtf8());
381
382 return *this;
383}
384
385PowerPointExport::PowerPointExport(const Reference< XComponentContext >& rContext, const uno::Sequence<uno::Any>& rArguments)
386 : XmlFilterBase(rContext)
387 , mnLayoutFileIdMax(1)
388 , mnSlideIdMax(1 << 8)
389 , mnSlideMasterIdMax(1U << 31)
390 , mnAnimationNodeIdMax(1)
391 , mnDiagramId(1)
392 , mbCreateNotes(false)
393 , mnPlaceholderIndexMax(1)
394{
395 comphelper::SequenceAsHashMap aArgumentsMap(rArguments);
396 mbPptm = aArgumentsMap.getUnpackedValueOrDefault("IsPPTM", false);
397 mbExportTemplate = aArgumentsMap.getUnpackedValueOrDefault("IsTemplate", false);
398}
399
401{
402}
403
405{
406 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(mXModel, uno::UNO_QUERY);
407 uno::Reference<document::XDocumentProperties> xDocProps = xDPS->getDocumentProperties();
408
409 if (xDocProps.is())
410 {
411 bool bSecurityOptOpenReadOnly = false;
412 uno::Reference< lang::XMultiServiceFactory > xFactory(mXModel, uno::UNO_QUERY);
413 uno::Reference< beans::XPropertySet > xSettings(xFactory->createInstance("com.sun.star.document.Settings"), uno::UNO_QUERY);
414 try
415 {
416 xSettings->getPropertyValue("LoadReadonly") >>= bSecurityOptOpenReadOnly;
417 }
418 catch( Exception& )
419 {
420 }
421 exportDocumentProperties(xDocProps, bSecurityOptOpenReadOnly);
422 }
423
425}
426
428{
429 return false;
430}
431
433{
435 auto& rGraphicExportCache = drawingml::GraphicExportCache::get();
436
437 rGraphicExportCache.push();
438
439 maShapeMap.clear();
440
441 mXModel = getModel();
442
443 //write document properties
445
447
448 OUString aMediaType;
449 if (mbPptm)
450 {
452 {
453 aMediaType = "application/vnd.ms-powerpoint.template.macroEnabled.main+xml";
454 }
455 else
456 {
457 aMediaType = "application/vnd.ms-powerpoint.presentation.macroEnabled.main+xml";
458 }
459 }
460 else
461 {
463 {
464 aMediaType = "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml";
465 }
466 else
467 {
468 aMediaType = "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml";
469 }
470 }
471
472 mPresentationFS = openFragmentStreamWithSerializer("ppt/presentation.xml", aMediaType);
473
474 addRelation(mPresentationFS->getOutputStream(),
476 u"theme/theme1.xml");
477
478 mPresentationFS->startElementNS(XML_p, XML_presentation, PNMSS);
479
481
482 std::vector< PropertyValue > aProperties;
483 PropertyValue aProperty;
484 aProperty.Name = "BaseURI";
485 aProperty.Value <<= getFileUrl();
486 aProperties.push_back(aProperty);
487
489
490 mPresentationFS->singleElementNS(XML_p, XML_sldSz,
491 XML_cx, OString::number(PPTtoEMU(maDestPageSize.Width)),
492 XML_cy, OString::number(PPTtoEMU(maDestPageSize.Height)));
493 // for some reason if added before slides list it will not load the slides (alas with error reports) in mso
494 mPresentationFS->singleElementNS(XML_p, XML_notesSz,
495 XML_cx, OString::number(PPTtoEMU(maNotesPageSize.Width)),
496 XML_cy, OString::number(PPTtoEMU(maNotesPageSize.Height)));
497
499
501
502 WriteAuthors();
503
504 WriteVBA();
505
507
508 mPresentationFS->endElementNS(XML_p, XML_presentation);
509 mPresentationFS->endDocument();
510 mPresentationFS.reset();
511 // Free all FSHelperPtr, to flush data before committing storage
512 for (auto& serializer : mpSlidesFSArray)
513 {
514 if (!serializer)
515 continue;
516 serializer->endDocument();
517 }
518 mpSlidesFSArray.clear();
519
521
522 rGraphicExportCache.pop();
523
524 maShapeMap.clear();
525 maAuthors.clear();
526 maRelId.clear();
527
528 return true;
529}
530
532{
533 return new ::oox::ole::VbaProject(getComponentContext(), getModel(), u"Impress");
534}
535
537{
538 Reference<XCustomPresentationSupplier> aXCPSup(mXModel, css::uno::UNO_QUERY);
539 if (!aXCPSup.is() || !aXCPSup->getCustomPresentations()->hasElements())
540 return;
541
542 mPresentationFS->startElementNS(XML_p, XML_custShowLst);
543
544 Reference<XDrawPagesSupplier> xDPS(getModel(), uno::UNO_QUERY_THROW);
545 Reference<XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
546 Reference<XNameContainer> aXNameCont(aXCPSup->getCustomPresentations());
547 const Sequence<OUString> aNameSeq(aXNameCont->getElementNames());
548
549 OUString sRelId;
550 sal_uInt32 nCustomShowIndex = 0;
551 sal_Int32 nSlideCount = xDrawPages->getCount();
552
553 for (OUString const& customShowName : aNameSeq)
554 {
555 mPresentationFS->startElementNS(XML_p, XML_custShow, XML_name, customShowName, XML_id,
556 OUString::number(nCustomShowIndex++));
557
558 mAny = aXNameCont->getByName(customShowName);
559 Reference<XIndexContainer> aXIContainer;
560 if (mAny >>= aXIContainer)
561 {
562 mPresentationFS->startElementNS(XML_p, XML_sldLst);
563
564 sal_Int32 nCustomShowSlideCount = aXIContainer->getCount();
565 for (sal_Int32 i = 0; i < nCustomShowSlideCount; ++i)
566 {
567 Reference<XDrawPage> aXCustomShowDrawPage;
568 aXIContainer->getByIndex(i) >>= aXCustomShowDrawPage;
569 Reference<XNamed> aXName(aXCustomShowDrawPage, UNO_QUERY_THROW);
570 OUString sCustomShowSlideName = aXName->getName();
571
572 for (sal_Int32 j = 0; j < nSlideCount; ++j)
573 {
574 Reference<XDrawPage> xDrawPage;
575 xDrawPages->getByIndex(j) >>= xDrawPage;
576 Reference<XNamed> xNamed(xDrawPage, UNO_QUERY_THROW);
577 OUString sSlideName = xNamed->getName();
578
579 if (sCustomShowSlideName == sSlideName)
580 {
581 sRelId = maRelId[j];
582 break;
583 }
584 }
585 mPresentationFS->singleElementNS(XML_p, XML_sld, FSNS(XML_r, XML_id), sRelId);
586 }
587 mPresentationFS->endElementNS(XML_p, XML_sldLst);
588 }
589 mPresentationFS->endElementNS(XML_p, XML_custShow);
590 }
591 mPresentationFS->endElementNS(XML_p, XML_custShowLst);
592}
593
594void PowerPointExport::ImplWriteBackground(const FSHelperPtr& pFS, const Reference< XPropertySet >& rXPropSet)
595{
596 FillStyle aFillStyle(FillStyle_NONE);
597 if (ImplGetPropertyValue(rXPropSet, "FillStyle"))
598 mAny >>= aFillStyle;
599
600 if (aFillStyle == FillStyle_NONE ||
601 aFillStyle == FillStyle_HATCH)
602 return;
603
604 pFS->startElementNS(XML_p, XML_bg);
605 pFS->startElementNS(XML_p, XML_bgPr);
606
607 PowerPointShapeExport aDML(pFS, &maShapeMap, this);
609 aDML.WriteFill(rXPropSet, maPageSize);
610
611 pFS->endElementNS(XML_p, XML_bgPr);
612 pFS->endElementNS(XML_p, XML_bg);
613}
614
615#define MAIN_GROUP \
616 "<p:nvGrpSpPr>\
617 <p:cNvPr id=\"1\" name=\"\"/>\
618 <p:cNvGrpSpPr/>\
619 <p:nvPr/>\
620 </p:nvGrpSpPr>\
621 <p:grpSpPr>\
622 <a:xfrm>\
623 <a:off x=\"0\" y=\"0\"/>\
624 <a:ext cx=\"0\" cy=\"0\"/>\
625 <a:chOff x=\"0\" y=\"0\"/>\
626 <a:chExt cx=\"0\" cy=\"0\"/>\
627 </a:xfrm>\
628 </p:grpSpPr>"
629
631{
632 const char* pDirection = nullptr;
633
634 switch (nDirection)
635 {
636 case 0:
637 pDirection = "l";
638 break;
639 case 1:
640 pDirection = "u";
641 break;
642 case 2:
643 pDirection = "r";
644 break;
645 case 3:
646 pDirection = "d";
647 break;
648 }
649
650 return pDirection;
651}
652
654{
655 const char* pDirection = nullptr;
656
657 switch (nDirection)
658 {
659 case 4:
660 pDirection = "lu";
661 break;
662 case 5:
663 pDirection = "ru";
664 break;
665 case 6:
666 pDirection = "ld";
667 break;
668 case 7:
669 pDirection = "rd";
670 break;
671 }
672
673 return pDirection;
674}
675
677{
678 const char* pDirection = GetSideDirection(nDirection);
679
680 if (!pDirection)
681 pDirection = GetCornerDirection(nDirection);
682
683 return pDirection;
684}
685
687{
688 FadeEffect eFadeEffect = FadeEffect_NONE;
689 if (ImplGetPropertyValue(mXPagePropSet, "Effect"))
690 mAny >>= eFadeEffect;
691
692 sal_Int16 nTransitionType = 0, nTransitionSubtype = 0;
693 sal_Int8 nPPTTransitionType = 0;
694 sal_uInt8 nDirection = 0;
695
696 OUString sSoundUrl;
697 OUString sSoundRelId;
698 OUString sSoundName;
699
700 if (ImplGetPropertyValue(mXPagePropSet, "TransitionType") && (mAny >>= nTransitionType) &&
701 ImplGetPropertyValue(mXPagePropSet, "TransitionSubtype") && (mAny >>= nTransitionSubtype))
702 {
703 // FADEOVERCOLOR with black -> fade, with white -> flash
704 sal_Int32 nTransitionFadeColor = 0;
705 if( ImplGetPropertyValue(mXPagePropSet, "TransitionFadeColor"))
706 mAny >>= nTransitionFadeColor;
707 nPPTTransitionType = GetTransition(nTransitionType, nTransitionSubtype, eFadeEffect, nTransitionFadeColor, nDirection);
708 }
709
710 if (!nPPTTransitionType && eFadeEffect != FadeEffect_NONE)
711 nPPTTransitionType = GetTransition(eFadeEffect, nDirection);
712
713 if (ImplGetPropertyValue(mXPagePropSet, "Sound") && (mAny >>= sSoundUrl))
714 embedEffectAudio(pFS, sSoundUrl, sSoundRelId, sSoundName);
715
716 bool bOOXmlSpecificTransition = false;
717
718 sal_Int32 nTransition = 0;
719 const char* pDirection = nullptr;
720 const char* pOrientation = nullptr;
721 const char* pThruBlk = nullptr;
722 const char* pSpokes = nullptr;
723
724 char pSpokesTmp[2] = "0";
725
726 // p14
727 sal_Int32 nTransition14 = 0;
728 const char* pDirection14 = nullptr;
729 const char* pInverted = nullptr;
730 const char* pPattern = nullptr; // diamond or hexagon
731
732 //p15
733 const char* pPresetTransition = nullptr;
734
735 if (!nPPTTransitionType)
736 {
737 switch (nTransitionType)
738 {
739 case animations::TransitionType::BARWIPE:
740 {
741 if (nTransitionSubtype == animations::TransitionSubType::FADEOVERCOLOR)
742 {
743 nTransition = XML_cut;
744 pThruBlk = "true";
745 bOOXmlSpecificTransition = true;
746 }
747 break;
748 }
749 case animations::TransitionType::MISCSHAPEWIPE:
750 {
751 switch (nTransitionSubtype)
752 {
753 case animations::TransitionSubType::TOPTOBOTTOM: // Turn around
754 nTransition = XML_fade;
755 nTransition14 = XML_flip;
756 pDirection14 = "l";
757 bOOXmlSpecificTransition = true;
758 break;
759 case animations::TransitionSubType::BOTTOMRIGHT: // Rochade
760 nTransition = XML_fade;
761 nTransition14 = XML_switch;
762 pDirection14 = "r";
763 bOOXmlSpecificTransition = true;
764 break;
766 nTransition = XML_fade;
767 nTransition14 = XML_vortex;
768 bOOXmlSpecificTransition = true;
769 break;
770 case animations::TransitionSubType::HORIZONTAL: // Ripple
771 nTransition = XML_fade;
772 nTransition14 = XML_ripple;
773 bOOXmlSpecificTransition = true;
774 break;
775 case animations::TransitionSubType::LEFTTORIGHT: // Fall
776 nTransition = XML_fade;
777 pPresetTransition = "fallOver";
778 bOOXmlSpecificTransition = true;
779 break;
780 case animations::TransitionSubType::CORNERSIN: // Inside turning cube
781 pInverted = "true";
782 [[fallthrough]];
783 case animations::TransitionSubType::CORNERSOUT: // Outside turning cube
784 nTransition = XML_fade;
785 nTransition14 = XML_prism;
786 bOOXmlSpecificTransition = true;
787 break;
788 case animations::TransitionSubType::DIAMOND: // Glitter
789 nTransition = XML_fade;
790 nTransition14 = XML_glitter;
791 pDirection14 = "l";
792 pPattern = "hexagon";
793 bOOXmlSpecificTransition = true;
794 break;
795 case animations::TransitionSubType::HEART: // Honeycomb
796 nTransition = XML_fade;
797 nTransition14 = XML_honeycomb;
798 bOOXmlSpecificTransition = true;
799 break;
800 }
801 break;
802 }
803 }
804 }
805
806 AnimationSpeed animationSpeed = AnimationSpeed_MEDIUM;
807 const char* speed = nullptr;
808 sal_Int32 advanceTiming = -1;
809 sal_Int32 changeType = 0;
810
811 sal_Int32 nTransitionDuration = -1;
812 bool isTransitionDurationSet = false;
813
814 // try to use TransitionDuration instead of old Speed property
815 if (ImplGetPropertyValue(mXPagePropSet, "TransitionDuration"))
816 {
817 double fTransitionDuration = -1.0;
818 mAny >>= fTransitionDuration;
819 if (fTransitionDuration >= 0)
820 {
821 nTransitionDuration = fTransitionDuration * 1000.0;
822
823 // override values because in MS formats meaning of fast/medium/slow is different
824 if (nTransitionDuration <= 500)
825 {
826 // fast is default
827 speed = nullptr;
828 }
829 else if (nTransitionDuration >= 1000)
830 {
831 speed = "slow";
832 }
833 else
834 {
835 speed = "med";
836 }
837
838 bool isStandardValue = nTransitionDuration == 500
839 || nTransitionDuration == 750
840 || nTransitionDuration == 1000;
841
842 if(!isStandardValue)
843 isTransitionDurationSet = true;
844 }
845 }
846 else if (ImplGetPropertyValue(mXPagePropSet, "Speed"))
847 {
848 mAny >>= animationSpeed;
849
850 switch (animationSpeed)
851 {
852 default:
853 case AnimationSpeed_MEDIUM:
854 speed = "med";
855 break;
856 case AnimationSpeed_SLOW:
857 speed = "slow";
858 break;
859 case AnimationSpeed_FAST:
860 break;
861 }
862 }
863
864 // check if we resolved what transition to export or time is set
865 if (!nPPTTransitionType && !bOOXmlSpecificTransition && !isTransitionDurationSet)
866 return;
867
868 if (ImplGetPropertyValue(mXPagePropSet, "Change"))
869 mAny >>= changeType;
870
871 // 1 means automatic, 2 half automatic - not sure what it means - at least I don't see it in UI
872 if (changeType == 1 && ImplGetPropertyValue(mXPagePropSet, "Duration"))
873 mAny >>= advanceTiming;
874
875 if (!bOOXmlSpecificTransition)
876 {
877 switch (nPPTTransitionType)
878 {
880 nTransition = XML_blinds;
881 pDirection = (nDirection == 0) ? "vert" : "horz";
882 break;
884 nTransition = XML_checker;
885 pDirection = (nDirection == 1) ? "vert" : "horz";
886 break;
888 nTransition = XML_circle;
889 break;
891 nTransition = XML_comb;
892 pDirection = (nDirection == 1) ? "vert" : "horz";
893 break;
895 nTransition = XML_cover;
896 pDirection = Get8Direction(nDirection);
897 break;
899 nTransition = XML_diamond;
900 break;
902 nTransition = XML_dissolve;
903 break;
905 nTransition = XML_fade;
906 pThruBlk = "true";
907 break;
909 nTransition = XML_fade;
910 break;
912 nTransition = XML_newsflash;
913 break;
915 nTransition = XML_plus;
916 break;
918 nTransition = XML_pull;
919 pDirection = Get8Direction(nDirection);
920 break;
922 nTransition = XML_push;
923 pDirection = GetSideDirection(nDirection);
924 break;
926 nTransition = XML_random;
927 break;
929 nTransition = XML_randomBar;
930 pDirection = (nDirection == 1) ? "vert" : "horz";
931 break;
933 nTransition = XML_split;
934 pDirection = (nDirection & 1) ? "in" : "out";
935 pOrientation = (nDirection < 2) ? "horz" : "vert";
936 break;
938 nTransition = XML_strips;
939 pDirection = GetCornerDirection(nDirection);
940 break;
942 nTransition = XML_wedge;
943 break;
945 nTransition = XML_wheel;
946 if (nDirection != 4 && nDirection <= 9)
947 {
948 pSpokesTmp[0] = '0' + nDirection;
949 pSpokes = pSpokesTmp;
950 }
951 break;
953 nTransition = XML_wipe;
954 pDirection = GetSideDirection(nDirection);
955 break;
957 nTransition = XML_zoom;
958 pDirection = (nDirection == 1) ? "in" : "out";
959 break;
961 nTransition14 = XML_flash;
962 nTransition = XML_fade;
963 bOOXmlSpecificTransition = true;
964 break;
965 // coverity[dead_error_line] - following conditions exist to avoid compiler warning
967 default:
968 nTransition = 0;
969 break;
970 }
971 }
972
973 bool isAdvanceTimingSet = advanceTiming != -1;
974 if (nTransition14 || pPresetTransition || isTransitionDurationSet)
975 {
976 const char* pRequiresNS = (nTransition14 || isTransitionDurationSet) ? "p14" : "p15";
977
978 pFS->startElement(FSNS(XML_mc, XML_AlternateContent));
979 pFS->startElement(FSNS(XML_mc, XML_Choice), XML_Requires, pRequiresNS);
980
981 if(isTransitionDurationSet && isAdvanceTimingSet)
982 {
983 pFS->startElementNS(XML_p, XML_transition,
984 XML_spd, speed,
985 XML_advTm, OString::number(advanceTiming * 1000),
986 FSNS(XML_p14, XML_dur), OString::number(nTransitionDuration));
987 }
988 else if(isTransitionDurationSet)
989 {
990 pFS->startElementNS(XML_p, XML_transition,
991 XML_spd, speed,
992 FSNS(XML_p14, XML_dur), OString::number(nTransitionDuration));
993 }
994 else if(isAdvanceTimingSet)
995 {
996 pFS->startElementNS(XML_p, XML_transition,
997 XML_spd, speed,
998 XML_advTm, OString::number(advanceTiming * 1000));
999 }
1000 else
1001 {
1002 pFS->startElementNS(XML_p, XML_transition, XML_spd, speed);
1003 }
1004
1005 if (nTransition14)
1006 {
1007 pFS->singleElementNS(XML_p14, nTransition14,
1008 XML_isInverted, pInverted,
1009 XML_dir, pDirection14,
1010 XML_pattern, pPattern);
1011 }
1012 else if (pPresetTransition)
1013 {
1014 pFS->singleElementNS(XML_p15, XML_prstTrans,
1015 XML_prst, pPresetTransition);
1016 }
1017 else if (isTransitionDurationSet && nTransition)
1018 {
1019 pFS->singleElementNS(XML_p, nTransition,
1020 XML_dir, pDirection,
1021 XML_orient, pOrientation,
1022 XML_spokes, pSpokes,
1023 XML_thruBlk, pThruBlk);
1024 }
1025
1026 if (!sSoundRelId.isEmpty())
1027 WriteSndAc(pFS, sSoundRelId, sSoundName);
1028
1029 pFS->endElement(FSNS(XML_p, XML_transition));
1030
1031 pFS->endElement(FSNS(XML_mc, XML_Choice));
1032 pFS->startElement(FSNS(XML_mc, XML_Fallback));
1033 }
1034
1035 pFS->startElementNS(XML_p, XML_transition,
1036 XML_spd, speed,
1037 XML_advTm, sax_fastparser::UseIf(OString::number(advanceTiming * 1000), isAdvanceTimingSet));
1038
1039 if (nTransition)
1040 {
1041 pFS->singleElementNS(XML_p, nTransition,
1042 XML_dir, pDirection,
1043 XML_orient, pOrientation,
1044 XML_spokes, pSpokes,
1045 XML_thruBlk, pThruBlk);
1046 }
1047
1048 if (!sSoundRelId.isEmpty())
1049 WriteSndAc(pFS, sSoundRelId, sSoundName);
1050
1051 pFS->endElementNS(XML_p, XML_transition);
1052
1053 if (nTransition14 || pPresetTransition || isTransitionDurationSet)
1054 {
1055 pFS->endElement(FSNS(XML_mc, XML_Fallback));
1056 pFS->endElement(FSNS(XML_mc, XML_AlternateContent));
1057 }
1058}
1059
1060static OUString lcl_GetInitials(std::u16string_view sName)
1061{
1062 OUStringBuffer sRet;
1063
1064 if (!sName.empty())
1065 {
1066 sRet.append(sName[0]);
1067 size_t nStart = 0, nOffset;
1068
1069 while ((nOffset = sName.find(' ', nStart)) != std::u16string_view::npos)
1070 {
1071 if (nOffset + 1 < sName.size())
1072 sRet.append(sName[ nOffset + 1 ]);
1073 nStart = nOffset + 1;
1074 }
1075 }
1076
1077 return sRet.makeStringAndClear();
1078}
1079
1081{
1082 if (maAuthors.empty())
1083 return;
1084
1085 FSHelperPtr pFS = openFragmentStreamWithSerializer("ppt/commentAuthors.xml",
1086 "application/vnd.openxmlformats-officedocument.presentationml.commentAuthors+xml");
1087 addRelation(mPresentationFS->getOutputStream(),
1089 u"commentAuthors.xml");
1090
1091 pFS->startElementNS(XML_p, XML_cmAuthorLst,
1092 FSNS(XML_xmlns, XML_p), getNamespaceURL(OOX_NS(ppt)));
1093
1094 for (const AuthorsMap::value_type& i : maAuthors)
1095 {
1096 pFS->singleElementNS(XML_p, XML_cmAuthor,
1097 XML_id, OString::number(i.second.nId),
1098 XML_name, i.first,
1099 XML_initials, lcl_GetInitials(i.first),
1100 XML_lastIdx, OString::number(i.second.nLastIndex),
1101 XML_clrIdx, OString::number(i.second.nId));
1102 }
1103
1104 pFS->endElementNS(XML_p, XML_cmAuthorLst);
1105
1106 pFS->endDocument();
1107}
1108
1109sal_Int32 PowerPointExport::GetAuthorIdAndLastIndex(const OUString& sAuthor, sal_Int32& nLastIndex)
1110{
1111 if (maAuthors.count(sAuthor) <= 0)
1112 {
1113 struct AuthorComments aAuthorComments;
1114
1115 aAuthorComments.nId = maAuthors.size();
1116 aAuthorComments.nLastIndex = 0;
1117
1118 maAuthors[ sAuthor ] = aAuthorComments;
1119 }
1120
1121 nLastIndex = ++maAuthors[ sAuthor ].nLastIndex;
1122
1123 return maAuthors[ sAuthor ].nId;
1124}
1125
1127{
1128 Reference<XPresentationSupplier> xPresentationSupplier(mXModel, uno::UNO_QUERY);
1129 if (!xPresentationSupplier.is())
1130 return;
1131
1132 Reference<beans::XPropertySet> xPresentationProps(xPresentationSupplier->getPresentation(),
1133 uno::UNO_QUERY);
1134 bool bEndlessVal = xPresentationProps->getPropertyValue("IsEndless").get<bool>();
1135 bool bChangeManually = xPresentationProps->getPropertyValue("IsAutomatic").get<bool>();
1136 OUString sFirstPage = xPresentationProps->getPropertyValue("FirstPage").get<OUString>();
1137 OUString sCustomShow = xPresentationProps->getPropertyValue("CustomShow").get<OUString>();
1138
1140 "ppt/presProps.xml",
1141 "application/vnd.openxmlformats-officedocument.presentationml.presProps+xml");
1142
1143 addRelation(mPresentationFS->getOutputStream(),
1145
1146 pFS->startElementNS(XML_p, XML_presentationPr, PPRNMSS);
1147
1148 pFS->startElementNS(XML_p, XML_showPr, XML_loop, sax_fastparser::UseIf("1", bEndlessVal),
1149 XML_useTimings, sax_fastparser::UseIf("0", bChangeManually),
1150 XML_showNarration, "1");
1151
1152 Reference<drawing::XDrawPagesSupplier> xDPS(mXModel, uno::UNO_QUERY_THROW);
1153 Reference<drawing::XDrawPages> xDrawPages(xDPS->getDrawPages(), uno::UNO_SET_THROW);
1154 if (!sFirstPage.isEmpty())
1155 {
1156 sal_Int32 nStartSlide = 1;
1157 sal_Int32 nEndSlide = xDrawPages->getCount();
1158 for (sal_Int32 i = 0; i < nEndSlide; i++)
1159 {
1160 Reference<drawing::XDrawPage> xDrawPage;
1161 xDrawPages->getByIndex(i) >>= xDrawPage;
1162 Reference<container::XNamed> xNamed(xDrawPage, uno::UNO_QUERY_THROW);
1163 if (xNamed->getName() == sFirstPage)
1164 {
1165 nStartSlide = i + 1;
1166 break;
1167 }
1168 }
1169
1170 pFS->singleElementNS(XML_p, XML_sldRg, XML_st, OUString::number(nStartSlide), XML_end,
1171 OUString::number(nEndSlide));
1172 }
1173
1174 if (!sCustomShow.isEmpty())
1175 {
1176 css::uno::Reference<css::presentation::XCustomPresentationSupplier>
1177 XCustPresentationSupplier(mXModel, css::uno::UNO_QUERY_THROW);
1178 css::uno::Reference<css::container::XNameContainer> mxCustShows;
1179 mxCustShows = XCustPresentationSupplier->getCustomPresentations();
1180 const css::uno::Sequence<OUString> aNameSeq(mxCustShows->getElementNames());
1181
1182 sal_Int32 nCustShowIndex = 0;
1183 for (sal_Int32 i = 0; i < aNameSeq.getLength(); i++)
1184 {
1185 if (aNameSeq[i] == sCustomShow)
1186 {
1187 nCustShowIndex = i;
1188 break;
1189 }
1190 }
1191
1192 pFS->singleElementNS(XML_p, XML_custShow, XML_id, OUString::number(nCustShowIndex));
1193 }
1194
1195 pFS->endElementNS(XML_p, XML_showPr);
1196
1197 pFS->endElementNS(XML_p, XML_presentationPr);
1198
1199 pFS->endDocument();
1200}
1201
1202bool PowerPointExport::WriteComments(sal_uInt32 nPageNum)
1203{
1204 Reference< XAnnotationAccess > xAnnotationAccess(mXDrawPage, uno::UNO_QUERY);
1205 if (xAnnotationAccess.is())
1206 {
1207 Reference< XAnnotationEnumeration > xAnnotationEnumeration(xAnnotationAccess->createAnnotationEnumeration());
1208
1209 if (xAnnotationEnumeration->hasMoreElements())
1210 {
1212 "ppt/comments/comment" + OUString::number(nPageNum + 1) + ".xml",
1213 "application/vnd.openxmlformats-officedocument.presentationml.comments+xml");
1214
1215 pFS->startElementNS(XML_p, XML_cmLst,
1216 FSNS(XML_xmlns, XML_p), this->getNamespaceURL(OOX_NS(ppt)));
1217
1218 do
1219 {
1220 Reference< XAnnotation > xAnnotation(xAnnotationEnumeration->nextElement());
1221 util::DateTime aDateTime(xAnnotation->getDateTime());
1222 RealPoint2D aRealPoint2D(xAnnotation->getPosition());
1223 Reference< XText > xText(xAnnotation->getTextRange());
1224 sal_Int32 nLastIndex;
1225 sal_Int32 nId = GetAuthorIdAndLastIndex(xAnnotation->getAuthor(), nLastIndex);
1226 char cDateTime[sizeof("-32768-65535-65535T65535:65535:65535.4294967295")];
1227 // reserve enough space for hypothetical max length
1228
1229 snprintf(cDateTime, sizeof cDateTime, "%02" SAL_PRIdINT32 "-%02" SAL_PRIuUINT32 "-%02" SAL_PRIuUINT32 "T%02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32 ".%09" SAL_PRIuUINT32, sal_Int32(aDateTime.Year), sal_uInt32(aDateTime.Month), sal_uInt32(aDateTime.Day), sal_uInt32(aDateTime.Hours), sal_uInt32(aDateTime.Minutes), sal_uInt32(aDateTime.Seconds), aDateTime.NanoSeconds);
1230
1231 pFS->startElementNS(XML_p, XML_cm,
1232 XML_authorId, OString::number(nId),
1233 XML_dt, cDateTime,
1234 XML_idx, OString::number(nLastIndex));
1235
1236 pFS->singleElementNS(XML_p, XML_pos,
1237 XML_x, OString::number(std::round(convertMm100ToMasterUnit(aRealPoint2D.X * 100))),
1238 XML_y, OString::number(std::round(convertMm100ToMasterUnit(aRealPoint2D.Y * 100))));
1239
1240 pFS->startElementNS(XML_p, XML_text);
1241 pFS->write(xText->getString());
1242 pFS->endElementNS(XML_p, XML_text);
1243
1244 pFS->endElementNS(XML_p, XML_cm);
1245
1246 }
1247 while (xAnnotationEnumeration->hasMoreElements());
1248
1249 pFS->endElementNS(XML_p, XML_cmLst);
1250
1251 pFS->endDocument();
1252
1253 return true;
1254 }
1255 }
1256
1257 return false;
1258}
1259
1261{
1262 if (!mbPptm)
1263 return;
1264
1265 uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(getModel(), uno::UNO_QUERY);
1266 if (!xStorageBasedDocument.is())
1267 return;
1268
1269 uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage();
1270 OUString aMacrosName("_MS_VBA_Macros");
1271 if (!xDocumentStorage.is() || !xDocumentStorage->hasByName(aMacrosName))
1272 return;
1273
1274 const sal_Int32 nOpenMode = embed::ElementModes::READ;
1275 uno::Reference<io::XInputStream> xMacrosStream(xDocumentStorage->openStreamElement(aMacrosName, nOpenMode), uno::UNO_QUERY);
1276 if (!xMacrosStream.is())
1277 return;
1278
1279 uno::Reference<io::XOutputStream> xOutputStream = openFragmentStream("ppt/vbaProject.bin", "application/vnd.ms-office.vbaProject");
1280 comphelper::OStorageHelper::CopyInputToOutput(xMacrosStream, xOutputStream);
1281
1282 // Write the relationship.
1283 addRelation(mPresentationFS->getOutputStream(), oox::getRelationship(Relationship::VBAPROJECT), u"vbaProject.bin");
1284}
1285
1287{
1288 Sequence<PropertyValue> aInfo;
1289
1290 try
1291 {
1292 Reference<lang::XMultiServiceFactory> xFactory(mXModel, UNO_QUERY);
1293 Reference<XPropertySet> xDocSettings(
1294 xFactory->createInstance("com.sun.star.document.Settings"), UNO_QUERY);
1295 xDocSettings->getPropertyValue("ModifyPasswordInfo") >>= aInfo;
1296 }
1297 catch (const Exception&)
1298 {
1299 }
1300
1301 if (aInfo.hasElements())
1302 {
1303 OUString sAlgorithm, sSalt, sHash;
1304 sal_Int32 nCount = 0;
1305 for (auto& prop : aInfo)
1306 {
1307 if (prop.Name == "algorithm-name")
1308 prop.Value >>= sAlgorithm;
1309 else if (prop.Name == "salt")
1310 prop.Value >>= sSalt;
1311 else if (prop.Name == "iteration-count")
1312 prop.Value >>= nCount;
1313 else if (prop.Name == "hash")
1314 prop.Value >>= sHash;
1315 }
1316 if (!sAlgorithm.isEmpty() && !sSalt.isEmpty() && !sHash.isEmpty())
1317 {
1318 sal_Int32 nAlgorithmSid = 0;
1319 if (sAlgorithm == "MD2")
1320 nAlgorithmSid = 1;
1321 else if (sAlgorithm == "MD4")
1322 nAlgorithmSid = 2;
1323 else if (sAlgorithm == "MD5")
1324 nAlgorithmSid = 3;
1325 else if (sAlgorithm == "SHA-1")
1326 nAlgorithmSid = 4;
1327 else if (sAlgorithm == "MAC")
1328 nAlgorithmSid = 5;
1329 else if (sAlgorithm == "RIPEMD")
1330 nAlgorithmSid = 6;
1331 else if (sAlgorithm == "RIPEMD-160")
1332 nAlgorithmSid = 7;
1333 else if (sAlgorithm == "HMAC")
1334 nAlgorithmSid = 9;
1335 else if (sAlgorithm == "SHA-256")
1336 nAlgorithmSid = 12;
1337 else if (sAlgorithm == "SHA-384")
1338 nAlgorithmSid = 13;
1339 else if (sAlgorithm == "SHA-512")
1340 nAlgorithmSid = 14;
1341
1342 if (nAlgorithmSid != 0)
1343 mPresentationFS->singleElementNS(XML_p, XML_modifyVerifier,
1344 XML_cryptProviderType, "rsaAES",
1345 XML_cryptAlgorithmClass, "hash",
1346 XML_cryptAlgorithmType, "typeAny",
1347 XML_cryptAlgorithmSid, OString::number(nAlgorithmSid),
1348 XML_spinCount, OString::number(nCount),
1349 XML_saltData, sSalt,
1350 XML_hashData, sHash);
1351 }
1352 }
1353}
1354
1355void PowerPointExport::ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 /* nMode */,
1356 bool bHasBackground, Reference< XPropertySet > const& aXBackgroundPropSet)
1357{
1358 SAL_INFO("sd.eppt", "write slide: " << nPageNum << "\n----------------");
1359
1360 // slides list
1361 if (nPageNum == 0)
1362 mPresentationFS->startElementNS(XML_p, XML_sldIdLst);
1363
1364 // add explicit relation of presentation to this slide
1365 OUString sRelId = addRelation(mPresentationFS->getOutputStream(),
1367 Concat2View("slides/slide" + OUString::number(nPageNum + 1) +".xml"));
1368
1369 mPresentationFS->singleElementNS(XML_p, XML_sldId,
1370 XML_id, OString::number(GetNewSlideId()),
1371 FSNS(XML_r, XML_id), sRelId);
1372
1373 maRelId.push_back(sRelId);
1374
1375 if (nPageNum == mnPages - 1)
1376 mPresentationFS->endElementNS(XML_p, XML_sldIdLst);
1377
1379 "ppt/slides/slide" + OUString::number(nPageNum + 1) + ".xml",
1380 "application/vnd.openxmlformats-officedocument.presentationml.slide+xml");
1381
1382 if (mpSlidesFSArray.size() < mnPages)
1383 mpSlidesFSArray.resize(mnPages);
1384 mpSlidesFSArray[ nPageNum ] = pFS;
1385
1386 const char* pShow = nullptr;
1387 const char* pShowMasterShape = nullptr;
1388
1389 if (ImplGetPropertyValue(mXPagePropSet, "Visible"))
1390 {
1391 bool bShow(false);
1392 if ((mAny >>= bShow) && !bShow)
1393 pShow = "0";
1394 }
1395
1396 if (ImplGetPropertyValue(mXPagePropSet, "IsBackgroundObjectsVisible"))
1397 {
1398 bool bShowMasterShape(false);
1399 if ((mAny >>= bShowMasterShape) && !bShowMasterShape)
1400 pShowMasterShape = "0";
1401 }
1402
1403 pFS->startElementNS(XML_p, XML_sld, PNMSS, XML_show, pShow, XML_showMasterSp, pShowMasterShape);
1404
1405 pFS->startElementNS(XML_p, XML_cSld);
1406
1407 // background
1408 if (bHasBackground)
1409 {
1410 ImplWriteBackground(pFS, aXBackgroundPropSet);
1411 }
1412
1413 WriteShapeTree(pFS, NORMAL, false);
1414
1415 pFS->endElementNS(XML_p, XML_cSld);
1416
1417 WriteTransition(pFS);
1418 WriteAnimations(pFS, mXDrawPage, *this);
1419
1420 pFS->endElementNS(XML_p, XML_sld);
1421
1422 // add implicit relation to slide layout
1423 addRelation(pFS->getOutputStream(),
1425 Concat2View("../slideLayouts/slideLayout" +
1426 OUString::number(GetLayoutFileId(GetPPTXLayoutId(GetLayoutOffset(mXPagePropSet)), nMasterNum)) +
1427 ".xml"));
1428
1429 if (WriteComments(nPageNum))
1430 // add implicit relation to slide comments
1431 addRelation(pFS->getOutputStream(),
1433 Concat2View("../comments/comment" + OUString::number(nPageNum + 1) + ".xml"));
1434
1435 SAL_INFO("sd.eppt", "----------------");
1436}
1437
1438void PowerPointExport::ImplWriteNotes(sal_uInt32 nPageNum)
1439{
1441 return;
1442
1443 SAL_INFO("sd.eppt", "write Notes " << nPageNum << "\n----------------");
1444
1446 "ppt/notesSlides/notesSlide" +
1447 OUString::number(nPageNum + 1) +
1448 ".xml",
1449 "application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml");
1450
1451 pFS->startElementNS(XML_p, XML_notes, PNMSS);
1452
1453 pFS->startElementNS(XML_p, XML_cSld);
1454
1455 WriteShapeTree(pFS, NOTICE, false);
1456
1457 pFS->endElementNS(XML_p, XML_cSld);
1458
1459 pFS->endElementNS(XML_p, XML_notes);
1460
1461 // add implicit relation to slide
1462 addRelation(pFS->getOutputStream(),
1464 Concat2View("../slides/slide" + OUString::number(nPageNum + 1) + ".xml"));
1465
1466 // add slide implicit relation to notes
1467 if (nPageNum < mpSlidesFSArray.size())
1470 Concat2View("../notesSlides/notesSlide" + OUString::number(nPageNum + 1) + ".xml"));
1471
1472 // add implicit relation to notes master
1473 addRelation(pFS->getOutputStream(),
1475 u"../notesMasters/notesMaster1.xml");
1476
1477 SAL_INFO("sd.eppt", "-----------------");
1478
1479 pFS->endDocument();
1480}
1481
1482void PowerPointExport::AddLayoutIdAndRelation(const FSHelperPtr& pFS, sal_Int32 nLayoutFileId)
1483{
1484 // add implicit relation of slide master to slide layout
1485 OUString sRelId = addRelation(pFS->getOutputStream(),
1487 Concat2View("../slideLayouts/slideLayout" + OUString::number(nLayoutFileId) + ".xml"));
1488
1489 pFS->singleElementNS(XML_p, XML_sldLayoutId,
1490 XML_id, OString::number(GetNewSlideMasterId()),
1491 FSNS(XML_r, XML_id), sRelId);
1492}
1493
1494void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPropertySet > const& aXBackgroundPropSet)
1495{
1496 SAL_INFO("sd.eppt", "write master slide: " << nPageNum << "\n--------------");
1497
1498 // slides list
1499 if (nPageNum == 0)
1500 mPresentationFS->startElementNS(XML_p, XML_sldMasterIdLst);
1501
1502 OUString sRelId = addRelation(mPresentationFS->getOutputStream(),
1504 Concat2View("slideMasters/slideMaster" + OUString::number(nPageNum + 1) + ".xml"));
1505
1506 mPresentationFS->singleElementNS(XML_p, XML_sldMasterId,
1507 XML_id, OString::number(GetNewSlideMasterId()),
1508 FSNS(XML_r, XML_id), sRelId);
1509
1510 if (nPageNum == mnMasterPages - 1)
1511 mPresentationFS->endElementNS(XML_p, XML_sldMasterIdLst);
1512
1513 FSHelperPtr pFS =
1514 openFragmentStreamWithSerializer("ppt/slideMasters/slideMaster" +
1515 OUString::number(nPageNum + 1) + ".xml",
1516 "application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml");
1517
1519 model::Theme* pTheme = nullptr;
1520 if (pMasterPage)
1521 {
1522 pTheme = pMasterPage->getSdrPageProperties().GetTheme().get();
1523 }
1524
1525 // write theme per master
1526 WriteTheme(nPageNum, pTheme);
1527
1528 // add implicit relation to the presentation theme
1529 addRelation(pFS->getOutputStream(),
1531 Concat2View("../theme/theme" + OUString::number(nPageNum + 1) + ".xml"));
1532
1533 pFS->startElementNS(XML_p, XML_sldMaster, PNMSS);
1534
1535 pFS->startElementNS(XML_p, XML_cSld);
1536
1537 if (aXBackgroundPropSet)
1538 ImplWriteBackground(pFS, aXBackgroundPropSet);
1539 WriteShapeTree(pFS, MASTER, true);
1540
1541 pFS->endElementNS(XML_p, XML_cSld);
1542
1543 // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
1544 pFS->singleElementNS(XML_p, XML_clrMap,
1545 XML_bg1, "lt1",
1546 XML_bg2, "lt2",
1547 XML_tx1, "dk1",
1548 XML_tx2, "dk2",
1549 XML_accent1, "accent1",
1550 XML_accent2, "accent2",
1551 XML_accent3, "accent3",
1552 XML_accent4, "accent4",
1553 XML_accent5, "accent5",
1554 XML_accent6, "accent6",
1555 XML_hlink, "hlink",
1556 XML_folHlink, "folHlink");
1557
1558 // use master's id type as they have same range, mso does that as well
1559 pFS->startElementNS(XML_p, XML_sldLayoutIdLst);
1560
1561 for (int i = 0; i < LAYOUT_SIZE; i++)
1562 {
1563 sal_Int32 nLayoutFileId = GetLayoutFileId(i, nPageNum);
1564 if (nLayoutFileId > 0)
1565 {
1566 AddLayoutIdAndRelation(pFS, nLayoutFileId);
1567 }
1568 else
1569 {
1570 ImplWritePPTXLayout(i, nPageNum);
1571 AddLayoutIdAndRelation(pFS, GetLayoutFileId(i, nPageNum));
1572 }
1573 }
1574
1575 pFS->endElementNS(XML_p, XML_sldLayoutIdLst);
1576
1577 pFS->endElementNS(XML_p, XML_sldMaster);
1578
1579 SAL_INFO("sd.eppt", "----------------");
1580
1581 pFS->endDocument();
1582}
1583
1584sal_Int32 PowerPointExport::GetLayoutFileId(sal_Int32 nOffset, sal_uInt32 nMasterNum)
1585{
1586 SAL_INFO("sd.eppt", "GetLayoutFileId offset: " << nOffset << " master: " << nMasterNum);
1587 if (mLayoutInfo[ nOffset ].mnFileIdArray.size() <= nMasterNum)
1588 return 0;
1589
1590 return mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ];
1591}
1592
1593void PowerPointExport::ImplWritePPTXLayout(sal_Int32 nOffset, sal_uInt32 nMasterNum)
1594{
1595 SAL_INFO("sd.eppt", "write layout: " << nOffset);
1596
1597 Reference< drawing::XDrawPagesSupplier > xDPS(getModel(), uno::UNO_QUERY);
1598 Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages();
1599 Reference< drawing::XDrawPage > xSlide = xDrawPages->insertNewByIndex(xDrawPages->getCount());
1600
1601#ifdef DEBUG
1602 if (xSlide.is())
1603 printf("new page created\n");
1604#endif
1605
1606 Reference< beans::XPropertySet > xPropSet(xSlide, uno::UNO_QUERY);
1607 xPropSet->setPropertyValue("Layout", Any(short(aLayoutInfo[ nOffset ].nType)));
1608#if OSL_DEBUG_LEVEL > 1
1609 dump_pset(xPropSet);
1610#endif
1611 mXPagePropSet.set(xSlide, UNO_QUERY);
1612 mXShapes = xSlide;
1613
1614 if (mLayoutInfo[ nOffset ].mnFileIdArray.size() < mnMasterPages)
1615 {
1616 mLayoutInfo[ nOffset ].mnFileIdArray.resize(mnMasterPages);
1617 }
1618
1619 if (mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] != 0)
1620 return;
1621
1622 FSHelperPtr pFS
1623 = openFragmentStreamWithSerializer("ppt/slideLayouts/slideLayout" +
1624 OUString::number(mnLayoutFileIdMax) + ".xml",
1625 "application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml");
1626
1627 // add implicit relation of slide layout to slide master
1628 addRelation(pFS->getOutputStream(),
1630 Concat2View("../slideMasters/slideMaster" + OUString::number(nMasterNum + 1) + ".xml"));
1631
1632 pFS->startElementNS(XML_p, XML_sldLayout,
1633 PNMSS,
1634 XML_type, aLayoutInfo[ nOffset ].sType,
1635 XML_preserve, "1");
1636
1637 pFS->startElementNS(XML_p, XML_cSld,
1638 XML_name, aLayoutInfo[ nOffset ].sName);
1639 //pFS->write( MINIMAL_SPTREE ); // TODO: write actual shape tree
1640 WriteShapeTree(pFS, LAYOUT, true);
1641
1642 pFS->endElementNS(XML_p, XML_cSld);
1643
1644 pFS->endElementNS(XML_p, XML_sldLayout);
1645
1646 mLayoutInfo[ nOffset ].mnFileIdArray[ nMasterNum ] = mnLayoutFileIdMax;
1647
1649
1650 xDrawPages->remove(xSlide);
1651
1652 pFS->endDocument();
1653}
1654
1655void PowerPointExport::WriteShapeTree(const FSHelperPtr& pFS, PageType ePageType, bool bMaster)
1656{
1657 PowerPointShapeExport aDML(pFS, &maShapeMap, this);
1658 aDML.SetMaster(bMaster);
1659 aDML.SetPageType(ePageType);
1661
1662 pFS->startElementNS(XML_p, XML_spTree);
1663 pFS->write(MAIN_GROUP);
1664
1665 ResetGroupTable(mXShapes->getCount());
1666
1667 while (GetNextGroupEntry())
1668 {
1669
1670 sal_uInt32 nGroups = GetGroupsClosed();
1671 for (sal_uInt32 i = 0; i < nGroups; i++)
1672 {
1673 SAL_INFO("sd.eppt", "leave group");
1674 }
1675
1677 {
1678 SAL_INFO("sd.eppt", "mType: " << mType);
1679 const SdrObjGroup* pDiagramCandidate(dynamic_cast<const SdrObjGroup*>(SdrObject::getSdrObjectFromXShape(mXShape)));
1680 const bool bIsDiagram(nullptr != pDiagramCandidate && pDiagramCandidate->isDiagram());
1681
1682 if (bIsDiagram)
1683 WriteDiagram(pFS, aDML, mXShape, mnDiagramId++);
1684 else
1685 aDML.WriteShape(mXShape);
1686 }
1687 }
1688
1689 if ( ePageType == NORMAL || ePageType == LAYOUT )
1690 WritePlaceholderReferenceShapes(aDML, ePageType);
1691 pFS->endElementNS(XML_p, XML_spTree);
1692}
1693
1694ShapeExport& PowerPointShapeExport::WritePageShape(const Reference< XShape >& xShape, PageType ePageType, bool bPresObj)
1695{
1696 if ((ePageType == NOTICE && bPresObj) || ePageType == LAYOUT || ePageType == MASTER)
1697 return WritePlaceholderShape(xShape, SlideImage);
1698
1699 return WriteTextShape(xShape);
1700}
1701
1702bool PowerPointShapeExport::WritePlaceholder(const Reference< XShape >& xShape, PlaceholderType ePlaceholder, bool bMaster)
1703{
1704 SAL_INFO("sd.eppt", "WritePlaceholder " << bMaster << " " << ShapeExport::NonEmptyText(xShape));
1705 if (!xShape)
1706 return false;
1707 try
1708 {
1709 Reference<XPropertySet> xShapeProps(xShape, UNO_QUERY);
1710 if (xShapeProps->getPropertyValue("IsPresentationObject").get<bool>())
1711 {
1712 WritePlaceholderShape(xShape, ePlaceholder);
1713
1714 return true;
1715 }
1716 }
1717 catch (Exception&)
1718 {
1719 return false;
1720 }
1721 return false;
1722}
1723
1724ShapeExport& PowerPointShapeExport::WritePlaceholderShape(const Reference< XShape >& xShape, PlaceholderType ePlaceholder)
1725{
1726 Reference<XPropertySet> xProps(xShape, UNO_QUERY);
1727 bool bUseBackground(false);
1728 if (xProps.is() && xProps->getPropertySetInfo()->hasPropertyByName("FillUseSlideBackground"))
1729 xProps->getPropertyValue("FillUseSlideBackground") >>= bUseBackground;
1730
1731 if (bUseBackground)
1732 mpFS->startElementNS(XML_p, XML_sp, XML_useBgFill, "1");
1733 else
1734 mpFS->startElementNS(XML_p, XML_sp);
1735
1736 // non visual shape properties
1737 mpFS->startElementNS(XML_p, XML_nvSpPr);
1738 const OString aPlaceholderID("PlaceHolder " + OString::number(mnShapeIdMax++));
1739 WriteNonVisualDrawingProperties(xShape, aPlaceholderID.getStr());
1740 mpFS->startElementNS(XML_p, XML_cNvSpPr);
1741 mpFS->singleElementNS(XML_a, XML_spLocks, XML_noGrp, "1");
1742 mpFS->endElementNS(XML_p, XML_cNvSpPr);
1743 mpFS->startElementNS(XML_p, XML_nvPr);
1744
1745 bool bUsePlaceholderIndex
1746 = ePlaceholder == Footer || ePlaceholder == DateAndTime || ePlaceholder == SlideNumber;
1747 const char* pType = getPlaceholderTypeName(ePlaceholder);
1748
1749 SAL_INFO("sd.eppt", "write placeholder " << pType);
1750 if (bUsePlaceholderIndex)
1751 {
1752 mpFS->singleElementNS(
1753 XML_p, XML_ph, XML_type, pType, XML_idx,
1754 OString::number(
1755 static_cast<PowerPointExport*>(GetFB())->CreateNewPlaceholderIndex(xShape)));
1756 }
1757 else
1758 {
1760 && ePlaceholder == Outliner)
1761 mpFS->singleElementNS(XML_p, XML_ph);
1762 else
1763 mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType);
1764 }
1765 mpFS->endElementNS(XML_p, XML_nvPr);
1766 mpFS->endElementNS(XML_p, XML_nvSpPr);
1767
1768 // visual shape properties
1769 mpFS->startElementNS(XML_p, XML_spPr);
1770 WriteShapeTransformation(xShape, XML_a);
1771 WritePresetShape("rect");
1772 if (xProps.is())
1773 {
1774 WriteBlipFill(xProps, "Graphic");
1775 // Do not forget to export the visible properties.
1776 WriteFill( xProps, xShape->getSize());
1777 WriteOutline( xProps );
1778 WriteShapeEffects( xProps );
1779
1780 bool bHas3DEffectinShape = false;
1781 uno::Sequence<beans::PropertyValue> grabBag;
1782 if (xProps->getPropertySetInfo()->hasPropertyByName("InteropGrabBag"))
1783 xProps->getPropertyValue("InteropGrabBag") >>= grabBag;
1784
1785 for (auto const& it : std::as_const(grabBag))
1786 if (it.Name == "3DEffectProperties")
1787 bHas3DEffectinShape = true;
1788
1789 if( bHas3DEffectinShape)
1790 Write3DEffects( xProps, /*bIsText=*/false );
1791 }
1792 mpFS->endElementNS(XML_p, XML_spPr);
1793
1794 WriteTextBox(xShape, XML_p, /*bWritePropertiesAsLstStyles=*/bUsePlaceholderIndex);
1795
1796 mpFS->endElementNS(XML_p, XML_sp);
1797
1798 return *this;
1799}
1800
1802 PlaceholderType ePlaceholder, sal_Int32 nReferencedPlaceholderIdx, PageType ePageType,
1803 const Reference<XPropertySet>& rXPagePropSet)
1804{
1805 mpFS->startElementNS(XML_p, XML_sp);
1806
1807 // non visual shape properties
1808 mpFS->startElementNS(XML_p, XML_nvSpPr);
1809 const OString aPlaceholderID("PlaceHolder " + OString::number(mnShapeIdMax++));
1810 GetFS()->singleElementNS(XML_p, XML_cNvPr, XML_id, OString::number(mnShapeIdMax), XML_name,
1811 aPlaceholderID);
1812
1813 mpFS->startElementNS(XML_p, XML_cNvSpPr);
1814 mpFS->singleElementNS(XML_a, XML_spLocks, XML_noGrp, "1");
1815 mpFS->endElementNS(XML_p, XML_cNvSpPr);
1816 mpFS->startElementNS(XML_p, XML_nvPr);
1817
1818 const char* pType = getPlaceholderTypeName(ePlaceholder);
1819 mpFS->singleElementNS(XML_p, XML_ph, XML_type, pType, XML_idx,
1820 OString::number(nReferencedPlaceholderIdx));
1821 mpFS->endElementNS(XML_p, XML_nvPr);
1822 mpFS->endElementNS(XML_p, XML_nvSpPr);
1823
1824 // visual shape properties
1825 mpFS->startElementNS(XML_p, XML_spPr);
1826 mpFS->endElementNS(XML_p, XML_spPr);
1827
1828 WritePlaceholderReferenceTextBody(ePlaceholder, ePageType, rXPagePropSet);
1829
1830 mpFS->endElementNS(XML_p, XML_sp);
1831
1832 return *this;
1833}
1834
1836 PlaceholderType ePlaceholder, PageType ePageType, const Reference<XPropertySet> xPagePropSet)
1837{
1838 mpFS->startElementNS(XML_p, XML_txBody);
1839 mpFS->singleElementNS(XML_a, XML_bodyPr);
1840 mpFS->startElementNS(XML_a, XML_p);
1841
1842 switch (ePlaceholder)
1843 {
1844 case Header:
1845 break;
1846 case Footer:
1847 {
1848 OUString aFooterText;
1849 if (ePageType == LAYOUT)
1850 {
1851 aFooterText = "Footer";
1852 }
1853 else
1854 {
1855 xPagePropSet->getPropertyValue("FooterText") >>= aFooterText;
1856 }
1857 mpFS->startElementNS(XML_a, XML_r);
1858 mpFS->startElementNS(XML_a, XML_t);
1859 mpFS->writeEscaped(aFooterText);
1860 mpFS->endElementNS(XML_a, XML_t);
1861 mpFS->endElementNS(XML_a, XML_r);
1862 break;
1863 }
1864 case SlideNumber:
1865 {
1866 OUString aSlideNum;
1867 sal_Int32 nSlideNum = 0;
1868 if (ePageType == LAYOUT)
1869 {
1870 aSlideNum = "<#>";
1871 }
1872 else
1873 {
1874 xPagePropSet->getPropertyValue("Number") >>= nSlideNum;
1875 aSlideNum = OUString::number(nSlideNum);
1876 }
1877 OString aUUID(comphelper::xml::generateGUIDString());
1878 mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID, XML_type, "slidenum");
1879 mpFS->startElementNS(XML_a, XML_t);
1880 mpFS->writeEscaped(aSlideNum);
1881 mpFS->endElementNS(XML_a, XML_t);
1882 mpFS->endElementNS(XML_a, XML_fld);
1883 break;
1884 }
1885 case DateAndTime:
1886 {
1887 OUString aDateTimeType = "datetime1";
1888 bool bIsDateTimeFixed = false;
1889 xPagePropSet->getPropertyValue("IsDateTimeFixed") >>= bIsDateTimeFixed;
1890
1891 OUString aDateTimeText = "Date";
1892 const LanguageTag& rLanguageTag = Application::GetSettings().GetLanguageTag();
1893
1894 if(ePageType != LAYOUT && !bIsDateTimeFixed)
1895 {
1896 sal_Int32 nDateTimeFormat = 0;
1897 xPagePropSet->getPropertyValue("DateTimeFormat") >>= nDateTimeFormat;
1898
1899 // 4 LSBs represent the date
1900 SvxDateFormat eDate = static_cast<SvxDateFormat>(nDateTimeFormat & 0x0f);
1901 // the 4 bits after the date bits represent the time
1902 SvxTimeFormat eTime = static_cast<SvxTimeFormat>(nDateTimeFormat >> 4);
1903 aDateTimeType = GetDatetimeTypeFromDateTime(eDate, eTime);
1904
1905 if (aDateTimeType == "datetime")
1906 aDateTimeType = "datetime1";
1907
1908 ::DateTime aDateTime( ::DateTime::SYSTEM );
1909
1910 aDateTimeText = SvxDateTimeField::GetFormatted(
1911 aDateTime, aDateTime, eDate,
1912 eTime, *(SD_MOD()->GetNumberFormatter()),
1913 rLanguageTag.getLanguageType());
1914 }
1915
1916 if(!bIsDateTimeFixed)
1917 {
1918 OString aUUID(comphelper::xml::generateGUIDString());
1919 mpFS->startElementNS(XML_a, XML_fld, XML_id, aUUID, XML_type, aDateTimeType);
1920 }
1921 else
1922 {
1923 xPagePropSet->getPropertyValue("DateTimeText") >>= aDateTimeText;
1924 mpFS->startElementNS(XML_a, XML_r);
1925 }
1926
1927 mpFS->startElementNS(XML_a, XML_rPr, XML_lang, rLanguageTag.getBcp47MS());
1928 mpFS->endElementNS(XML_a, XML_rPr);
1929
1930 mpFS->startElementNS(XML_a, XML_t);
1931 mpFS->writeEscaped(aDateTimeText);
1932 mpFS->endElementNS(XML_a, XML_t);
1933
1934 mpFS->endElementNS(XML_a, bIsDateTimeFixed ? XML_r : XML_fld);
1935 break;
1936 }
1937 default:
1938 SAL_INFO("sd.eppt", "warning: no defined textbody for referenced placeholder type: "
1939 << ePlaceholder);
1940 }
1941 mpFS->endElementNS(XML_a, XML_p);
1942 mpFS->endElementNS(XML_p, XML_txBody);
1943
1944 return *this;
1945}
1946
1948{
1949 for (int nId = PredefinedClrSchemeId::dk2; nId != PredefinedClrSchemeId::Count; nId++)
1950 {
1951 OUString sName(getPredefinedClrNames(static_cast<PredefinedClrSchemeId>(nId)));
1952 sal_Int32 nColor = 0;
1953
1954 switch (nId)
1955 {
1956 case PredefinedClrSchemeId::dk2:
1957 nColor = 0x1F497D;
1958 break;
1959 case PredefinedClrSchemeId::lt2:
1960 nColor = 0xEEECE1;
1961 break;
1962 case PredefinedClrSchemeId::accent1:
1963 nColor = 0x4F81BD;
1964 break;
1965 case PredefinedClrSchemeId::accent2:
1966 nColor = 0xC0504D;
1967 break;
1968 case PredefinedClrSchemeId::accent3:
1969 nColor = 0x9BBB59;
1970 break;
1971 case PredefinedClrSchemeId::accent4:
1972 nColor = 0x8064A2;
1973 break;
1974 case PredefinedClrSchemeId::accent5:
1975 nColor = 0x4BACC6;
1976 break;
1977 case PredefinedClrSchemeId::accent6:
1978 nColor = 0xF79646;
1979 break;
1980 case PredefinedClrSchemeId::hlink:
1981 nColor = 0x0000FF;
1982 break;
1983 case PredefinedClrSchemeId::folHlink:
1984 nColor = 0x800080;
1985 break;
1986 }
1987
1988 OUString sOpenColorScheme = "<a:" + sName + ">";
1989 pFS->write(sOpenColorScheme);
1990
1991 pFS->singleElementNS(XML_a, XML_srgbClr, XML_val, I32SHEX(nColor));
1992
1993 OUString sCloseColorScheme = "</a:" + sName + ">";
1994 pFS->write(sCloseColorScheme);
1995 }
1996}
1997
1998void PowerPointExport::WriteTheme(sal_Int32 nThemeNum, model::Theme* pTheme)
1999{
2000 if (!pTheme)
2001 return;
2002 OUString sThemePath = "ppt/theme/theme" + OUString::number(nThemeNum + 1) + ".xml";
2003
2004 oox::ThemeExport aThemeExport(this, DOCUMENT_PPTX);
2005
2006 aThemeExport.write(sThemePath, *pTheme);
2007}
2008
2010{
2011 mbCreateNotes = false;
2012
2013 for (sal_uInt32 i = 0; i < mnPages; i++)
2014 {
2015 if (!GetPageByIndex(i, NOTICE))
2016 return false;
2017
2019 {
2020 mbCreateNotes = true;
2021 break;
2022 }
2023 }
2024
2025 return true;
2026}
2027
2029{
2030 SAL_INFO("sd.eppt", "write Notes master\n---------------");
2031
2032 mPresentationFS->startElementNS(XML_p, XML_notesMasterIdLst);
2033
2034 OUString sRelId = addRelation(mPresentationFS->getOutputStream(),
2036 u"notesMasters/notesMaster1.xml");
2037
2038 mPresentationFS->singleElementNS(XML_p, XML_notesMasterId,
2039 FSNS(XML_r, XML_id), sRelId);
2040
2041 mPresentationFS->endElementNS(XML_p, XML_notesMasterIdLst);
2042
2043 FSHelperPtr pFS =
2044 openFragmentStreamWithSerializer("ppt/notesMasters/notesMaster1.xml",
2045 "application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml");
2046 // write theme per master
2047
2048 // TODO: Need to implement theme support for note master, so the
2049 // note master has his own theme associated.
2050
2051 // For now just use the default theme
2052 auto const* pDefaultColorSet = svx::ColorSets::get().getColorSet(u"LibreOffice");
2053 if (pDefaultColorSet)
2054 {
2055 auto pTheme = std::make_shared<model::Theme>("Office Theme");
2056 pTheme->setColorSet(std::make_shared<model::ColorSet>(*pDefaultColorSet));
2057
2058 WriteTheme(mnMasterPages, pTheme.get());
2059
2060 // add implicit relation to the presentation theme
2061 addRelation(pFS->getOutputStream(),
2063 Concat2View("../theme/theme" + OUString::number(mnMasterPages + 1) + ".xml"));
2064 }
2065
2066 pFS->startElementNS(XML_p, XML_notesMaster, PNMSS);
2067
2068 pFS->startElementNS(XML_p, XML_cSld);
2069
2070 Reference< XPropertySet > aXBackgroundPropSet;
2071 if (ImplGetPropertyValue(mXPagePropSet, "Background") &&
2072 (mAny >>= aXBackgroundPropSet))
2073 ImplWriteBackground(pFS, aXBackgroundPropSet);
2074
2075 WriteShapeTree(pFS, NOTICE, true);
2076
2077 pFS->endElementNS(XML_p, XML_cSld);
2078
2079 // color map - now it uses colors from hardcoded theme, once we eventually generate theme, this might need update
2080 pFS->singleElementNS(XML_p, XML_clrMap,
2081 XML_bg1, "lt1",
2082 XML_bg2, "lt2",
2083 XML_tx1, "dk1",
2084 XML_tx2, "dk2",
2085 XML_accent1, "accent1",
2086 XML_accent2, "accent2",
2087 XML_accent3, "accent3",
2088 XML_accent4, "accent4",
2089 XML_accent5, "accent5",
2090 XML_accent6, "accent6",
2091 XML_hlink, "hlink",
2092 XML_folHlink, "folHlink");
2093
2094 pFS->endElementNS(XML_p, XML_notesMaster);
2095
2096 SAL_INFO("sd.eppt", "----------------");
2097
2098 pFS->endDocument();
2099}
2100
2101void PowerPointExport::embedEffectAudio(const FSHelperPtr& pFS, const OUString& sUrl, OUString& sRelId, OUString& sName)
2102{
2104
2105 if (!sUrl.endsWithIgnoreAsciiCase(".wav"))
2106 return;
2107
2108 uno::Reference<io::XInputStream> xAudioStream;
2109 try
2110 {
2111 if (sUrl.startsWith("vnd.sun.star.Package:"))
2112 {
2113 uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(getModel(), uno::UNO_QUERY);
2114 if (!xStorageBasedDocument.is())
2115 return;
2116
2117 uno::Reference<embed::XStorage> xDocumentStorage = xStorageBasedDocument->getDocumentStorage();
2118 if (!xDocumentStorage.is())
2119 return;
2120
2121 uno::Reference<io::XStream> xStream = comphelper::OStorageHelper::GetStreamAtPackageURL(xDocumentStorage, sUrl,
2122 css::embed::ElementModes::READ, aProxy);
2123
2124 if (xStream.is())
2125 xAudioStream = xStream->getInputStream();
2126 }
2127 else
2129 }
2130 catch (const Exception&)
2131 {
2132 TOOLS_WARN_EXCEPTION("sd", "PowerPointExport::embedEffectAudio");
2133 }
2134
2135 if (!xAudioStream.is())
2136 return;
2137
2138 int nLastSlash = sUrl.lastIndexOf('/');
2139 sName = sUrl.copy(nLastSlash >= 0 ? nLastSlash + 1 : 0);
2140
2141 OUString sPath = "../media/" + sName;
2142 sRelId = addRelation(pFS->getOutputStream(),
2144
2145 uno::Reference<io::XOutputStream> xOutputStream = openFragmentStream(sPath.replaceAt(0, 2, u"/ppt"),
2146 "audio/x-wav");
2147
2148 comphelper::OStorageHelper::CopyInputToOutput(xAudioStream, xOutputStream);
2149}
2150
2151sal_Int32 PowerPointExport::GetShapeID(const Reference<XShape>& rXShape)
2152{
2153 return ShapeExport::GetShapeID(rXShape, &maShapeMap);
2154}
2155
2157{
2158 return mnAnimationNodeIdMax++;
2159}
2160
2162{
2163 if (mbCreateNotes)
2165
2166 return true;
2167}
2168
2170{
2171 return "com.sun.star.comp.Impress.oox.PowerPointExport";
2172}
2173
2174void PowerPointExport::WriteDiagram(const FSHelperPtr& pFS, PowerPointShapeExport& rDML, const css::uno::Reference<css::drawing::XShape>& rXShape, int nDiagramId)
2175{
2176 SAL_INFO("sd.eppt", "writing Diagram " + OUString::number(nDiagramId));
2177 pFS->startElementNS(XML_p, XML_graphicFrame);
2178 rDML.WriteDiagram(rXShape, nDiagramId);
2179 pFS->endElementNS(XML_p, XML_graphicFrame);
2180}
2181
2183{
2184 bool bCheckProps = ePageType == NORMAL;
2185 Reference<XShape> xShape;
2186 Any aAny;
2187 OUString aText;
2188 if (ePageType == LAYOUT
2189 || (bCheckProps && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsFooterVisible", true)
2190 && aAny == true && GetPropertyValue(aAny, mXPagePropSet, "FooterText", true)
2191 && (aAny >>= aText) && !aText.isEmpty()))
2192 {
2193 if ((xShape = GetReferencedPlaceholderXShape(Footer, ePageType)))
2195 maPlaceholderShapeToIndexMap.find(xShape)->second,
2196 ePageType, mXPagePropSet);
2197 }
2198
2199 if (ePageType == LAYOUT
2200 || (bCheckProps
2201 && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsPageNumberVisible", true)
2202 && aAny == true))
2203 {
2204 if ((xShape = GetReferencedPlaceholderXShape(SlideNumber, ePageType)))
2206 maPlaceholderShapeToIndexMap.find(xShape)->second,
2207 ePageType, mXPagePropSet);
2208 }
2209
2210 if (ePageType == LAYOUT
2211 || (bCheckProps
2212 && PropValue::GetPropertyValue(aAny, mXPagePropSet, "IsDateTimeVisible", true)
2213 && aAny == true
2214 && ((GetPropertyValue(aAny, mXPagePropSet, "DateTimeText", true) && (aAny >>= aText)
2215 && !aText.isEmpty())
2216 || mXPagePropSet->getPropertyValue("IsDateTimeFixed") == false)))
2217 {
2218 if ((xShape = GetReferencedPlaceholderXShape(DateAndTime, ePageType)))
2220 maPlaceholderShapeToIndexMap.find(xShape)->second,
2221 ePageType, mXPagePropSet);
2222 }
2223}
2224
2225sal_Int32 PowerPointExport::CreateNewPlaceholderIndex(const css::uno::Reference<XShape> &rXShape)
2226{
2228 return mnPlaceholderIndexMax++;
2229}
2230
2232 PageType ePageType) const
2233{
2234 PresObjKind ePresObjKind = PresObjKind::NONE;
2235 switch (eType)
2236 {
2237 case oox::core::None:
2238 break;
2240 break;
2241 case oox::core::Notes:
2242 break;
2243 case oox::core::Header:
2244 ePresObjKind = PresObjKind::Header;
2245 break;
2246 case oox::core::Footer:
2247 ePresObjKind = PresObjKind::Footer;
2248 break;
2250 ePresObjKind = PresObjKind::SlideNumber;
2251 break;
2253 ePresObjKind = PresObjKind::DateTime;
2254 break;
2256 break;
2257 case oox::core::Title:
2258 ePresObjKind = PresObjKind::Title;
2259 break;
2261 break;
2262 }
2263 if (ePresObjKind != PresObjKind::NONE)
2264 {
2265 SdPage* pMasterPage;
2266 if (ePageType == LAYOUT)
2267 {
2268 // since Layout pages do not have drawpages themselves - mXDrawPage is still the master they reference to..
2270 }
2271 else
2272 {
2273 pMasterPage
2275 }
2276 if (SdrObject* pMasterFooter = pMasterPage->GetPresObj(ePresObjKind))
2277 return GetXShapeForSdrObject(pMasterFooter);
2278 }
2279 return nullptr;
2280}
2281
2282// UNO component
2283extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
2284css_comp_Impress_oox_PowerPointExport(uno::XComponentContext* rxCtxt,
2285 uno::Sequence<css::uno::Any> const& rArguments)
2286{
2287 return cppu::acquire(new PowerPointExport(rxCtxt, rArguments));
2288}
2289
2290#if OSL_DEBUG_LEVEL > 1
2291void dump_pset(Reference< XPropertySet > const& rXPropSet)
2292{
2293 Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo();
2294 Sequence< beans::Property > props = info->getProperties();
2295
2296 for (int i=0; i < props.getLength(); i++)
2297 {
2298 OString name = OUStringToOString(props [i].Name, RTL_TEXTENCODING_UTF8);
2299
2300 Any value = rXPropSet->getPropertyValue(props [i].Name);
2301
2302 OUString strValue;
2303 sal_Int32 intValue;
2304 bool boolValue;
2305 RectanglePoint pointValue;
2306
2307 if (value >>= strValue)
2308 SAL_INFO("sd.eppt", name << " = \"" << strValue << "\"");
2309 else if (value >>= intValue)
2310 SAL_INFO("sd.eppt", name << " = " << intValue << "(hex : " << std::hex << intValue << ")");
2311 else if (value >>= boolValue)
2312 SAL_INFO("sd.eppt", name << " = " << boolValue << " (bool)");
2313 else if (value >>= pointValue)
2314 SAL_INFO("sd.eppt", name << " = " << static_cast<int>(pointValue) << " (RectanglePoint)");
2315 else
2316 SAL_INFO("sd.eppt", "??? <unhandled type>");
2317 }
2318}
2319#endif
2320
2321/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OptionalString sType
PropertiesInfo aProperties
constexpr auto convertMm100ToMasterUnit(N n)
Reference< XInputStream > xStream
const LanguageTag & GetLanguageTag() const
static const AllSettings & GetSettings()
sal_uInt32 GetGroupsClosed()
sal_uInt32 GetCurrentGroupIndex() const
Definition: grouptable.hxx:54
bool GetNextGroupEntry()
void ResetGroupTable(sal_uInt32 nCount)
LanguageType getLanguageType(bool bResolveSystem=true) const
OUString getBcp47MS() const
css::uno::Reference< css::drawing::XShapes > mXShapes
Definition: epptbase.hxx:333
bool mbIsBackgroundDark
Definition: epptbase.hxx:341
bool GetPageByIndex(sal_uInt32 nIndex, PageType)
css::awt::Size maPageSize
Definition: epptbase.hxx:351
bool GetPresObj() const
Definition: epptbase.hxx:396
sal_uInt32 mnMasterPages
Definition: epptbase.hxx:345
css::uno::Reference< css::beans::XPropertySet > mXPagePropSet
Definition: epptbase.hxx:331
css::uno::Reference< css::task::XStatusIndicator > mXStatusIndicator
Definition: epptbase.hxx:323
static sal_Int32 GetLayoutOffset(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
void exportPPT(const std::vector< css::beans::PropertyValue > &)
OString mType
Definition: epptbase.hxx:338
static sal_Int8 GetTransition(sal_Int16 nTransitionType, sal_Int16 nTransitionSubtype, css::presentation::FadeEffect eEffect, sal_Int32 nTransitionFadeColor, sal_uInt8 &nDirection)
bool ContainsOtherShapeThanPlaceholders()
sal_uInt32 mnPages
number of Slides ( w/o master pages & notes & handout )
Definition: epptbase.hxx:344
css::uno::Reference< css::frame::XModel > mXModel
Definition: epptbase.hxx:322
css::uno::Reference< css::drawing::XDrawPage > mXDrawPage
Definition: epptbase.hxx:330
css::awt::Size maNotesPageSize
Definition: epptbase.hxx:352
css::awt::Size maDestPageSize
Definition: epptbase.hxx:350
bool GetShapeByIndex(sal_uInt32 nIndex, bool bGroup)
css::uno::Reference< css::drawing::XShape > mXShape
Definition: epptbase.hxx:334
css::uno::Any mAny
Definition: epptbase.hxx:98
static bool GetPropertyValue(css::uno::Any &rAny, const css::uno::Reference< css::beans::XPropertySet > &, const OUString &rPropertyName, bool bTestPropertyAvailability=false)
Definition: epptso.cxx:532
bool ImplGetPropertyValue(const OUString &rString)
Definition: epptso.cxx:587
SdrObject * GetPresObj(PresObjKind eObjKind, int nIndex=1, bool bFuzzySearch=false)
returns the nIndex'th object from the given PresObjKind, index starts with 1
Definition: sdpage.cxx:203
static SdPage * getImplementation(const css::uno::Reference< css::drawing::XDrawPage > &xPage)
returns the SdPage implementation for the given XDrawPage or 0 if not available
Definition: sdpage.cxx:2682
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
bool isDiagram() const
std::shared_ptr< model::Theme > const & GetTheme() const
SdrPage & TRG_GetMasterPage() const
SdrPageProperties & getSdrPageProperties()
static OUString GetFormatted(Date const &rDate, tools::Time const &rTime, SvxDateFormat eDateFormat, SvxTimeFormat eTimeFormat, SvNumberFormatter &rFormatter, LanguageType eLanguage)
static void CopyInputToOutput(const css::uno::Reference< css::io::XInputStream > &xInput, const css::uno::Reference< css::io::XOutputStream > &xOutput)
static css::uno::Reference< css::io::XStream > GetStreamAtPackageURL(const css::uno::Reference< css::embed::XStorage > &xStorage, const OUString &rURL, sal_uInt32 const nOpenMode, LifecycleProxy const &rNastiness)
static css::uno::Reference< css::io::XInputStream > GetInputStreamFromURL(const OUString &aURL, const css::uno::Reference< css::uno::XComponentContext > &context)
TValueType getUnpackedValueOrDefault(const OUString &sKey, const TValueType &aDefault) const
void write(OUString const &rPath, model::Theme const &rTheme)
const OUString & getFileUrl() const
const css::uno::Reference< css::frame::XModel > & getModel() const
void commitStorage() const
const css::uno::Reference< css::task::XStatusIndicator > & getStatusIndicator() const
const css::uno::Reference< css::uno::XComponentContext > & getComponentContext() const
virtual bool importDocument() noexcept override
static int GetPPTXLayoutId(int nOffset)
virtual ::oox::ole::VbaProject * implCreateVbaProject() const override
virtual bool ImplCreateDocument() override
sal_Int32 GetAuthorIdAndLastIndex(const OUString &sAuthor, sal_Int32 &nLastIndex)
LayoutInfo mLayoutInfo[EPP_LAYOUT_SIZE]
Definition: epptooxml.hxx:142
::sax_fastparser::FSHelperPtr mPresentationFS
Definition: epptooxml.hxx:140
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > maPlaceholderShapeToIndexMap
Map of placeholder indexes for Master placeholders.
Definition: epptooxml.hxx:160
virtual void ImplWriteNotes(sal_uInt32 nPageNum) override
static const char * Get8Direction(sal_uInt8 nDirection)
sal_Int32 GetShapeID(const css::uno::Reference< css::drawing::XShape > &rXShape)
void WriteShapeTree(const ::sax_fastparser::FSHelperPtr &pFS, PageType ePageType, bool bMaster)
virtual bool ImplCreateMainNotes() override
static const char * GetSideDirection(sal_uInt8 nDirection)
void embedEffectAudio(const FSHelperPtr &pFS, const OUString &sUrl, OUString &sRelId, OUString &sName)
virtual void ImplWriteSlide(sal_uInt32 nPageNum, sal_uInt32 nMasterNum, sal_uInt16 nMode, bool bHasBackground, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
sal_Int32 GetLayoutFileId(sal_Int32 nOffset, sal_uInt32 nMasterNum)
static void WriteDiagram(const FSHelperPtr &pFS, PowerPointShapeExport &rDML, const css::uno::Reference< css::drawing::XShape > &rXShape, int nDiagramId)
void WritePlaceholderReferenceShapes(PowerPointShapeExport &rDML, PageType ePageType)
bool mbPptm
Should we export as .pptm, ie. do we contain macros?
Definition: epptooxml.hxx:135
PowerPointExport(const css::uno::Reference< css::uno::XComponentContext > &rContext, const css::uno::Sequence< css::uno::Any > &rArguments)
std::vector< ::sax_fastparser::FSHelperPtr > mpSlidesFSArray
Definition: epptooxml.hxx:143
::oox::drawingml::ShapeExport::ShapeHashMap maShapeMap
Definition: epptooxml.hxx:156
bool WriteComments(sal_uInt32 nPageNum)
sal_Int32 mnPlaceholderIndexMax
Last used placeholder index.
Definition: epptooxml.hxx:158
sal_uInt32 GetNewSlideMasterId()
Definition: epptooxml.hxx:111
virtual void ImplWriteSlideMaster(sal_uInt32 nPageNum, css::uno::Reference< css::beans::XPropertySet > const &aXBackgroundPropSet) override
static void WriteDefaultColorSchemes(const FSHelperPtr &pFS)
void WriteTransition(const ::sax_fastparser::FSHelperPtr &pFS)
css::uno::Reference< css::drawing::XShape > GetReferencedPlaceholderXShape(const PlaceholderType eType, PageType ePageType) const
void ImplWriteBackground(const ::sax_fastparser::FSHelperPtr &pFS, const css::uno::Reference< css::beans::XPropertySet > &aXBackgroundPropSet)
virtual bool exportDocument() override
void AddLayoutIdAndRelation(const ::sax_fastparser::FSHelperPtr &pFS, sal_Int32 nLayoutFileId)
virtual OUString SAL_CALL getImplementationName() override
void ImplWritePPTXLayout(sal_Int32 nOffset, sal_uInt32 nMasterNum)
void WriteVBA()
If this is PPTM, output the VBA stream.
std::vector< OUString > maRelId
Definition: epptooxml.hxx:152
static const char * GetCornerDirection(sal_uInt8 nDirection)
sal_Int32 CreateNewPlaceholderIndex(const css::uno::Reference< css::drawing::XShape > &rXShape)
Create a new placeholder index for a master placeholder shape.
void WriteTheme(sal_Int32 nThemeNum, model::Theme *pTheme)
virtual ~PowerPointExport() override
ShapeExport & WriteNonVisualProperties(const Reference< XShape > &xShape) override
ShapeExport & WriteUnknownShape(const Reference< XShape > &xShape) override
ShapeExport & WriteTextShape(const Reference< XShape > &xShape) override
ShapeExport & WritePlaceholderShape(const Reference< XShape > &xShape, PlaceholderType ePlaceholder)
bool WritePlaceholder(const Reference< XShape > &xShape, PlaceholderType ePlaceholder, bool bMaster)
ShapeExport & WritePlaceholderReferenceShape(PlaceholderType ePlaceholder, sal_Int32 nReferencedPlaceholderIdx, PageType ePageType, const Reference< XPropertySet > &rXPagePropSet)
Writes a placeholder shape that references the placeholder on the master slide.
ShapeExport & WritePageShape(const Reference< XShape > &xShape, PageType ePageType, bool bPresObj)
PowerPointShapeExport(FSHelperPtr pFS, ShapeHashMap *pShapeMap, PowerPointExport *pFB)
void SetPageType(PageType ePageType)
ShapeExport & WritePlaceholderReferenceTextBody(PlaceholderType ePlaceholder, PageType ePageType, const Reference< XPropertySet > xPagePropSet)
Writes textbody of a placeholder that references the placeholder on the master slide.
::sax_fastparser::FSHelperPtr openFragmentStreamWithSerializer(const OUString &rStreamName, const OUString &rMediaType)
OUString addRelation(const OUString &rType, std::u16string_view rTarget)
css::uno::Reference< css::io::XOutputStream > openFragmentStream(const OUString &rStreamName, const OUString &rMediaType)
OUString getNamespaceURL(sal_Int32 nNSID) const
void exportDocumentProperties(const css::uno::Reference< css::document::XDocumentProperties > &xProperties, bool bSecurityOptOpenReadOnly)
void WriteDiagram(const css::uno::Reference< css::drawing::XShape > &rXShape, int nDiagramId)
void WriteShapeEffects(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet)
static void ResetMlCounters()
::sax_fastparser::FSHelperPtr mpFS
void Write3DEffects(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, bool bIsText)
void WriteBlipFill(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, const OUString &sURLPropName, const css::awt::Size &rSize={})
void WriteFill(const css::uno::Reference< css::beans::XPropertySet > &xPropSet, const css::awt::Size &rSize={})
const ::sax_fastparser::FSHelperPtr & GetFS() const
::oox::core::XmlFilterBase * GetFB()
void WriteShapeTransformation(const css::uno::Reference< css::drawing::XShape > &rXShape, sal_Int32 nXmlNamespace, bool bFlipH=false, bool bFlipV=false, bool bSuppressRotation=false, bool bSuppressFlipping=false, bool bFlippedBeforeRotation=false)
void WritePresetShape(const OString &pShape, std::vector< std::pair< sal_Int32, sal_Int32 > > &rAvList)
void WriteOutline(const css::uno::Reference< css::beans::XPropertySet > &rXPropSet, css::uno::Reference< css::frame::XModel > const &xModel=nullptr)
static OUString GetDatetimeTypeFromDateTime(SvxDateFormat eDate, SvxTimeFormat eTime)
void SetBackgroundDark(bool bIsDark)
static GraphicExportCache & get()
std::unordered_map< css::uno::Reference< css::drawing::XShape >, sal_Int32 > ShapeHashMap
ShapeExport & WriteNonVisualDrawingProperties(const css::uno::Reference< css::drawing::XShape > &xShape, const char *sName)
ShapeExport & WriteShape(const css::uno::Reference< css::drawing::XShape > &xShape)
ShapeExport & WriteTextBox(const css::uno::Reference< css::uno::XInterface > &xIface, sal_Int32 nXmlNamespace, bool bWritePropertiesAsLstStyles=false)
static ColorSets & get()
const model::ColorSet & getColorSet(sal_uInt32 nIndex) const
Any value
PageType
int nCount
#define TOOLS_WARN_EXCEPTION(area, stream)
float u
@ NORMAL
Definition: epptbase.hxx:92
@ MASTER
Definition: epptbase.hxx:92
@ NOTICE
Definition: epptbase.hxx:92
@ LAYOUT
Definition: epptbase.hxx:92
UNDEFINED
Reference< XSingleServiceFactory > xFactory
SvxTimeFormat
SvxDateFormat
DocumentType eType
OUString sName
constexpr sal_Int32 FSNS(sal_Int32 namespc, sal_Int32 element)
char const sHash[]
const char * name
#define SAL_WARN(area, stream)
#define SAL_INFO(area, stream)
@ Exception
enum SAL_DLLPUBLIC_RTTI FillStyle
OString generateGUIDString()
int i
void WriteAnimations(const FSHelperPtr &pFS, const Reference< XDrawPage > &rXDrawPage, PowerPointExport &rExport)
DOCUMENT_PPTX
std::u16string_view getPredefinedClrNames(PredefinedClrSchemeId eID)
PredefinedClrSchemeId
OUString getRelationship(Relationship eRelationship)
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
dictionary props
const char * UseIf(const char *s, bool bUse)
std::shared_ptr< FastSerializerHelper > FSHelperPtr
bool getOutputStream(ProgramOptions const &options, OString const &extension, std::ostream **ppOutputStream, OString &targetSourceFileName, OString &tmpSourceFileName)
XML_type
sal_Int16 nId
#define PPT_TRANSITION_TYPE_PLUS
#define PPT_TRANSITION_TYPE_CIRCLE
#define PPT_TRANSITION_TYPE_RANDOM
#define PPT_TRANSITION_TYPE_PULL
#define PPT_TRANSITION_TYPE_WIPE
#define PPT_TRANSITION_TYPE_PUSH
#define PPT_TRANSITION_TYPE_ZOOM
#define PPT_TRANSITION_TYPE_SPLIT
#define PPT_TRANSITION_TYPE_DIAMOND
#define PPT_TRANSITION_TYPE_COVER
#define PPT_TRANSITION_TYPE_BLINDS
#define PPT_TRANSITION_TYPE_NEWSFLASH
#define PPT_TRANSITION_TYPE_SMOOTHFADE
#define PPT_TRANSITION_TYPE_DISSOLVE
#define PPT_TRANSITION_TYPE_WHEEL
#define PPT_TRANSITION_TYPE_WEDGE
#define PPT_TRANSITION_TYPE_COMB
#define PPT_TRANSITION_TYPE_FLASH
#define PPT_TRANSITION_TYPE_RANDOM_BARS
#define PPT_TRANSITION_TYPE_STRIPS
#define PPT_TRANSITION_TYPE_FADE
#define PPT_TRANSITION_TYPE_NONE
#define PPT_TRANSITION_TYPE_CHECKER
SAL_DLLPUBLIC_EXPORT uno::XInterface * css_comp_Impress_oox_PowerPointExport(uno::XComponentContext *rxCtxt, uno::Sequence< css::uno::Any > const &rArguments)
const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE]
static OUString lcl_GetInitials(std::u16string_view sName)
#define PPRNMSS
#define PNMSS
#define MAIN_GROUP
void dump_pset(Reference< XPropertySet > const &rXPropSet)
PresObjKind
Definition: pres.hxx:22
QPRO_FUNC_TYPE nType
#define SD_MOD()
Definition: sdmod.hxx:184
const int VERTICAL
Definition: sdpage.cxx:1208
std::vector< sal_Int32 > mnFileIdArray
Definition: epptooxml.hxx:38
OUString Name
unsigned char sal_uInt8
signed char sal_Int8
SVXCORE_DLLPUBLIC css::uno::Reference< css::drawing::XShape > GetXShapeForSdrObject(SdrObject *pObj) noexcept
@ Count
Definition: unomodel.hxx:389
OString I32SHEX(sal_Int32 x)