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 e51d9cec479cbf101413c591439e343088f990ef
Author:     Karthik <[email protected]>
AuthorDate: Tue Oct 28 22:14:58 2025 +0530
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Nov 11 13:34:23 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
    Signed-off-by: Xisco Fauli <[email protected]>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/193791

diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index ba5384d233f8..4ba318720479 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -3013,7 +3013,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 db6933a04cf6..d5f5d4404b41 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1405,6 +1405,30 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testTdf165261HorzAnchor)
     
CPPUNIT_ASSERT_EQUAL(drawing::TextHorizontalAdjust::TextHorizontalAdjust_CENTER,
 eHori);
 }
 
+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