sd/qa/unit/export-tests-ooxml1.cxx       |    4 ++--
 sd/qa/unit/export-tests-ooxml2.cxx       |    2 +-
 sd/source/filter/eppt/pptx-epptooxml.cxx |    4 ++++
 3 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 210c89a34bda429fe7e0b8f0e63ce5bb5add9d8b
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Fri Mar 28 14:16:46 2025 -0400
Commit:     Justin Luth <justin.l...@collabora.com>
CommitDate: Sat Mar 29 14:31:04 2025 +0100

    related tdf#165521 oox: ShapeExport::GetNewShapeID of at least 2
    
    This patch fixes an existing bug that was exposed in 7.6.5
    by commit bff76421e234df7246a7f49c71a11432f86e09d1.
    
    Microsoft Powerpoint was complaining that my unit test
    tdf165521_fixedCellHeight.pptx
    needed to be repaired after round-tripping it in LO.
    
    While notesMaster1.xml didn't mind two shapes having the same id=2,
    it complained if the first one was set to id=0 or id=1.
    
    However, we can see the same situation in other files
    (like slidesMaster1.xml) where there is no complaint,
    like in tdf106867.pptx.
    
    So I don't know what really is going on,
    but it makes sense to not have overlapping unique IDs,
    and thus this patch "just works",
    which is enough to make me happy.
    
    Change-Id: I6e7303997bd404e269e71fe156b1390c57ddb349
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183464
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 46a26a2134d5..32aa1ac088a2 100644
--- a/sd/qa/unit/export-tests-ooxml1.cxx
+++ b/sd/qa/unit/export-tests-ooxml1.cxx
@@ -111,11 +111,11 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest1, testTdf149128)
 
     xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id",
-                u"8");
+                u"10");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "idx",
                 u"0");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "id",
-                u"9");
+                u"11");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx",
                 u"2");
 }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index d84abbd28e79..8ac9d5aaa94e 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1316,7 +1316,7 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf106867)
                 
"/p:sld/p:timing/p:tnLst/p:par/p:cTn/p:childTnLst/p:seq/p:cTn/p:childTnLst/p:par/"
                 
"p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:par/p:cTn/p:childTnLst/p:cmd/"
                 "p:cBhvr/p:tgtEl/p:spTgt",
-                "spid", u"59");
+                "spid", u"61");
 }
 
 CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTdf112280)
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 98b5a1a06222..dca5258a832b 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1935,6 +1935,10 @@ void PowerPointExport::WriteShapeTree(const FSHelperPtr& 
pFS, PageType ePageType
     pFS->startElementNS(XML_p, XML_spTree);
     pFS->write(MAIN_GROUP);
 
+    // MS Office complains if a shape ID is duplicated, and MAIN_GROUP 
specified p:cNvPr id="1"
+    if (GetMaxDocId() < 2)
+        SetMaxDocId(2); // this will be the next GetUniqueId()
+
     ResetGroupTable(mXShapes->getCount());
 
     while (GetNextGroupEntry())

Reply via email to