sd/qa/unit/data/pptx/multiplelayoutfooter.pptx |binary
 sd/qa/unit/export-tests-ooxml4.cxx             |   24 ++++++++++++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx       |    9 ---------
 3 files changed, 24 insertions(+), 9 deletions(-)

New commits:
commit 209b7a08235f081a43248b3e3861c810ed111854
Author:     Jaume Pujantell <[email protected]>
AuthorDate: Wed Nov 19 09:15:38 2025 +0100
Commit:     Xisco Fauli <[email protected]>
CommitDate: Wed Dec 10 13:53:39 2025 +0100

    sd: pptx: fix footer moving places for MSO
    
    In a pptx file with a slide master that has multiple slide layouts, the
    footer would loose properties when saved in LO and opened in MSO.
    This is due to the master de-duplicating logic that in trying to emulate
    pptx's natural way of dealing with master and layout slide it treats
    multiple Impress masters as equivalent. This is needed for most export
    functions, but when exporting an element from an Impress slide that
    references an Impress master (like a footer), we need to differentiate
    exactly which one of the equivalent masters it comes from to make the
    indices match.
    
    Change-Id: I815c3db54256d934b69108c7268f6d7642c33cbb
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194190
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    (cherry picked from commit 0f21756af8e74b0dd3f25fe4234feb067430838b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195225
    Tested-by: Jenkins
    Reviewed-by: Jaume Pujantell <[email protected]>
    (cherry picked from commit f2736a8407ed006741a0d1f55b525e39783b29f1)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195359
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sd/qa/unit/data/pptx/multiplelayoutfooter.pptx 
b/sd/qa/unit/data/pptx/multiplelayoutfooter.pptx
new file mode 100644
index 000000000000..9536e13a6e07
Binary files /dev/null and b/sd/qa/unit/data/pptx/multiplelayoutfooter.pptx 
differ
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 7b7a93d421e6..1d02590c0f4c 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1801,6 +1801,30 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testtdf169825_layout_type)
     assertXPath(pXmlDocLayout, "/p:sldLayout", "type", u"blank");
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testFooterIdxConsistency)
+{
+    createSdImpressDoc("pptx/multiplelayoutfooter.pptx");
+    save(TestFilter::PPTX);
+
+    // slide1 points to slideLayout2
+    xmlDocUniquePtr pRelsDoc = 
parseExport(u"ppt/slides/_rels/slide1.xml.rels"_ustr);
+    assertXPath(pRelsDoc,
+                "/rels:Relationships/rels:Relationship[@Type='http://";
+                "schemas.openxmlformats.org/officeDocument/2006/"
+                "relationships/slideLayout']",
+                "Target", u"../slideLayouts/slideLayout2.xml");
+
+    // And they agree on the idx of the footer:
+    xmlDocUniquePtr pSlide = parseExport(u"ppt/slides/slide1.xml"_ustr);
+    OUString aFtrIdx = getXPath(pSlide, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx");
+    xmlDocUniquePtr pLayout = 
parseExport(u"ppt/slideLayouts/slideLayout2.xml"_ustr);
+    assertXPath(pLayout, "//p:sp/p:nvSpPr/p:nvPr/p:ph", "idx", aFtrIdx);
+    // Without the fix it fails with:
+    // - Expected: 1
+    // - Actual  : 2
+    // - In <>, attribute 'idx' of '//p:sp/p:nvSpPr/p:nvPr/p:ph' incorrect 
value.
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 0a51893951b4..558a142e5d62 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -2994,15 +2994,6 @@ Reference<XShape> 
PowerPointExport::GetReferencedPlaceholderXShape(const Placeho
         {
             pPage = 
&SdPage::getImplementation(mXDrawPage)->TRG_GetMasterPage();
         }
-        for (sal_uInt32 i = 0; i < mnMasterPages; i++)
-        {
-            if (maMastersLayouts[i].first == pPage)
-            {
-                if (maEquivalentMasters[i] < mnMasterPages)
-                    pPage = maMastersLayouts[maEquivalentMasters[i]].first;
-                break;
-            }
-        }
         SdPage* pMasterPage = dynamic_cast<SdPage*>(pPage);
         if (SdrObject* pMasterFooter
             = (pMasterPage ? pMasterPage->GetPresObj(ePresObjKind) : nullptr))

Reply via email to