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 68a549512bfd4f69ce4ef5fb8e52913ae530aa64
Author:     Justin Luth <[email protected]>
AuthorDate: Fri Mar 28 14:16:46 2025 -0400
Commit:     Aron Budea <[email protected]>
CommitDate: Wed May 14 16:42:28 2025 +0200

    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 <[email protected]>
    (cherry picked from commit 210c89a34bda429fe7e0b8f0e63ce5bb5add9d8b)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183483
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>
    (cherry picked from commit d58ec10d7bf3a367f23f4f064fb9d425985c8fe4)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185318
    Tested-by: Aron Budea <[email protected]>
    Reviewed-by: Aron Budea <[email protected]>

diff --git a/sd/qa/unit/export-tests-ooxml1.cxx 
b/sd/qa/unit/export-tests-ooxml1.cxx
index 9f87fd5d92c4..2868f5b542e0 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("ppt/slides/slide1.xml");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn"_ostr,
-                "id"_ostr, "8");
+                "id"_ostr, "10");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn"_ostr,
                 "idx"_ostr, "0");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn"_ostr,
-                "id"_ostr, "9");
+                "id"_ostr, "11");
     assertXPath(pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn"_ostr,
                 "idx"_ostr, "2");
 }
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx 
b/sd/qa/unit/export-tests-ooxml2.cxx
index 7a1df1662769..4ff7ca14e71e 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1343,7 +1343,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"_ostr,
-                "spid"_ostr, "59");
+                "spid"_ostr, "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 1e4b10dde411..645c1382046a 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