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 be36f4c40bb7b0c1b8ceb974c932a687f5c488be
Author:     Karthik <[email protected]>
AuthorDate: Tue Oct 28 22:14:58 2025 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Mon Nov 3 12:56:18 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]>

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 ce587ebf507f..93eb86f859fc 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1520,6 +1520,30 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testTextStylesXML)
                 u"6000");
 }
 
+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