summaryrefslogtreecommitdiff
path: root/sd/source
diff options
context:
space:
mode:
authorSarper Akdemir <sarper.akdemir.extern@allotropia.de>2024-03-06 13:48:14 +0300
committerSarper Akdemir <sarper.akdemir.extern@allotropia.de>2024-03-07 15:07:27 +0100
commit6c25216e461b624f556a1b2830ab0911d5df7daf (patch)
tree99ab7fcd0c79ab6fd68784ce0dbf2f41337fb246 /sd/source
parent7979508e4328ceb9d6a2dff6a2a080ea64247c7e (diff)
tdf#159931: pptx export: export each used slide layout for a master
attempts to fix the slideLayout reference related regression from Idb6b88ebe87a83818d8eb27a1fa087652a002c0c. To correctly export the all used slideLayout instances for a given master, iterate through sdr::PageUsers of that master and figure out all used layouts. Change-Id: I0f58befac1ba4d5ec01aeedbb5f611c83683dcf8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164468 Tested-by: Jenkins Reviewed-by: Balazs Varga <balazs.varga.extern@allotropia.de> Reviewed-by: Sarper Akdemir <sarper.akdemir.extern@allotropia.de>
Diffstat (limited to 'sd/source')
-rw-r--r--sd/source/filter/eppt/pptx-epptooxml.cxx38
1 files changed, 32 insertions, 6 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx
index c431d9868cb3..2cfd29be0fcc 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -63,6 +63,7 @@
#include "../ppt/pptanimations.hxx"
#include <i18nlangtag/languagetag.hxx>
+#include <svx/sdrmasterpagedescriptor.hxx>
#include <svx/svdpage.hxx>
#include <svx/unoapi.hxx>
#include <svx/svdogrp.hxx>
@@ -1515,23 +1516,48 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 nPageNum, Reference< XPro
// use master's id type as they have same range, mso does that as well
pFS->startElementNS(XML_p, XML_sldLayoutIdLst);
- sal_Int32 nLayout = 0;
- OUString aSlideName;
- css::uno::Reference< css::beans::XPropertySet >xPagePropSet;
+ auto getLayoutsUsedForMaster = [](SdrPage* pMaster) -> std::unordered_set<sal_Int32>
+ {
+ if (!pMaster)
+ return {};
+
+ std::unordered_set<sal_Int32> aUsedLayouts{};
+ for (const auto* pPageUser : pMaster->GetPageUsers())
+ {
+ const auto* pMasterPageDescriptor
+ = dynamic_cast<const sdr::MasterPageDescriptor*>(pPageUser);
+
+ if (!pMasterPageDescriptor)
+ continue;
+
+ AutoLayout eLayout
+ = static_cast<SdPage&>(pMasterPageDescriptor->GetOwnerPage()).GetAutoLayout();
+ aUsedLayouts.insert(eLayout);
+ }
+ return aUsedLayouts;
+ };
+
+ std::unordered_set<sal_Int32> aLayouts = getLayoutsUsedForMaster(pMasterPage);
+
+ css::uno::Reference< css::beans::XPropertySet > xPagePropSet;
xPagePropSet.set(mXDrawPage, UNO_QUERY);
if (xPagePropSet.is())
{
uno::Any aAny;
if (GetPropertyValue(aAny, xPagePropSet, "SlideLayout"))
- aAny >>= nLayout;
+ aLayouts.insert(aAny.get<sal_Int32>());
}
+ OUString aSlideName;
Reference< XNamed > xNamed(mXDrawPage, UNO_QUERY);
if (xNamed.is())
aSlideName = xNamed->getName();
- ImplWritePPTXLayout(nLayout, nPageNum, aSlideName);
- AddLayoutIdAndRelation(pFS, GetLayoutFileId(nLayout, nPageNum));
+ for (auto nLayout : aLayouts)
+ {
+ ImplWritePPTXLayout(nLayout, nPageNum, aSlideName);
+ AddLayoutIdAndRelation(pFS, GetLayoutFileId(nLayout, nPageNum));
+ }
pFS->endElementNS(XML_p, XML_sldLayoutIdLst);