oox/source/export/shapes.cxx        |    4 +++-
 sd/qa/unit/data/pptx/tdf169088.pptx |binary
 sd/qa/unit/export-tests-ooxml4.cxx  |   24 ++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 24a12d1ed0126550512b87baf04c949491452058
Author:     Karthik <[email protected]>
AuthorDate: Tue Oct 28 22:14:58 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Dec 15 15:49:43 2025 +0100

    tdf#169088 Fix PPTX export of OLE animations
    
    Presentations with OLE animations when saved as PPTX can't be opened
    in PowerPoint.
    
    When exporting OLE animations, the target of the animation is set to
    the `pic` inside the OLE instead of OLE.
    
    Change-Id: Ic3e870fff2e896404960f475c67f44df0aef1860
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193110
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>
    (cherry picked from commit be36f4c40bb7b0c1b8ceb974c932a687f5c488be)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193736
    Reviewed-by: Noel Grandin <[email protected]>
    Tested-by: Jenkins
    (cherry picked from commit 2feb36d92e270240019ff5681466fc4ac97a5405)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195633
    Tested-by: Michael Stahl <[email protected]>

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index a043a3c09353..4b055f45f6f4 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -3021,7 +3021,9 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< 
XShape >& rXShape, XmlFil
 
     sal_Int32 nID = pFB->GetUniqueId();
 
-    (*mpShapeMap)[ rXShape ] = nID;
+    auto it = mpShapeMap->find(rXShape);
+    if (it == mpShapeMap->end())
+        (*mpShapeMap)[rXShape] = nID;
 
     return nID;
 }
diff --git a/sd/qa/unit/data/pptx/tdf169088.pptx 
b/sd/qa/unit/data/pptx/tdf169088.pptx
new file mode 100644
index 000000000000..6b290d6f43bb
Binary files /dev/null and b/sd/qa/unit/data/pptx/tdf169088.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 335a8b527cc4..002b54eb3d1c 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1544,6 +1544,30 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testFooterIdxConsistency)
     // - In <>, attribute 'idx' of '//p:sp/p:nvSpPr/p:nvPr/p:ph' incorrect 
value.
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testOLEObjectAnimationTarget)
+{
+    createSdImpressDoc("pptx/tdf169088.pptx");
+    save(u"Impress Office Open XML"_ustr);
+
+    xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
+
+    const OUString sOleId = getXPath(
+        pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
+
+    // Check animation target spid matches OLE object id
+    assertXPath(pXmlDoc,
+                
"/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:set/"
+                "p:cBhvr/p:tgtEl/p:spTgt",
+                "spid", sOleId);
+
+    assertXPath(pXmlDoc,
+                
"/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:animEffect/"
+                "p:cBhvr/p:tgtEl/p:spTgt",
+                "spid", sOleId);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to