include/oox/export/shapes.hxx                        |    1 
 oox/source/export/shapes.cxx                         |   15 +++++++----
 sd/qa/unit/data/pptx/connector-shape-animations.pptx |binary
 sd/qa/unit/export-tests-ooxml4.cxx                   |   25 +++++++++++++++++++
 4 files changed, 36 insertions(+), 5 deletions(-)

New commits:
commit 0d1046718152ab4aef2c1188702514c1238d57b5
Author:     Karthik Godha <[email protected]>
AuthorDate: Mon Feb 23 11:31:39 2026 +0530
Commit:     Michael Stahl <[email protected]>
CommitDate: Fri Feb 27 13:17:45 2026 +0100

    PPTX: Use correct shape-id for connector shapes
    
    This is a regression from be36f4c40bb7b0c1b8ceb974c932a687f5c488be
    
    bug-document: forum-mso-de-136509.pptx
    Change-Id: If1f4280459245c1cb30cbe5559d22d22d91c558c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200003
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Michael Stahl <[email protected]>

diff --git a/include/oox/export/shapes.hxx b/include/oox/export/shapes.hxx
index 87d5f707dbdd..19bb44118f1a 100644
--- a/include/oox/export/shapes.hxx
+++ b/include/oox/export/shapes.hxx
@@ -200,6 +200,7 @@ public:
 
     sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape 
>& rShape );
     sal_Int32 GetNewShapeID( const css::uno::Reference< css::drawing::XShape 
>& rShape, ::oox::core::XmlFilterBase* pFB );
+    sal_Int32 GetTmpShapeID();
     sal_Int32 GetShapeID( const css::uno::Reference< css::drawing::XShape >& 
rShape );
     static sal_Int32 GetShapeID( const css::uno::Reference< 
css::drawing::XShape >& rShape, ShapeHashMap* pShapeMap );
 };
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 6d4221c9ade3..edec05b9315d 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1456,11 +1456,12 @@ void ShapeExport::WriteGraphicObjectShapePart( const 
Reference< XShape >& xShape
     if (GetProperty(xShapeProps, u"OnClick"_ustr))
         mAny >>= eClickAction;
 
-    pFS->startElementNS( mnXmlNamespace, XML_cNvPr,
-                         XML_id,     OString::number(GetNewShapeID(xShape)),
-                         XML_name,   GetShapeName(xShape),
-                         XML_descr,  sax_fastparser::UseIf(sDescr, 
!sDescr.isEmpty()),
-                         XML_hidden, sax_fastparser::UseIf("1", !bVisible));
+    sal_Int32 nShapeId = GetShapeID(xShape) == -1 ? GetNewShapeID(xShape) : 
GetTmpShapeID();
+
+    pFS->startElementNS(mnXmlNamespace, XML_cNvPr, XML_id, 
OString::number(nShapeId), XML_name,
+                        GetShapeName(xShape), XML_descr,
+                        sax_fastparser::UseIf(sDescr, !sDescr.isEmpty()), 
XML_hidden,
+                        sax_fastparser::UseIf("1", !bVisible));
 
     if (eClickAction != presentation::ClickAction_NONE)
     {
@@ -3072,10 +3073,14 @@ sal_Int32 ShapeExport::GetNewShapeID( const Reference< 
XShape >& rXShape, XmlFil
     auto it = mpShapeMap->find(rXShape);
     if (it == mpShapeMap->end())
         (*mpShapeMap)[rXShape] = nID;
+    else
+        nID = it->second;
 
     return nID;
 }
 
+sal_Int32 ShapeExport::GetTmpShapeID() { return GetFB()->GetUniqueId(); }
+
 sal_Int32 ShapeExport::GetShapeID( const Reference< XShape >& rXShape )
 {
     return GetShapeID( rXShape, mpShapeMap );
diff --git a/sd/qa/unit/data/pptx/connector-shape-animations.pptx 
b/sd/qa/unit/data/pptx/connector-shape-animations.pptx
new file mode 100644
index 000000000000..2fc2cee6af20
Binary files /dev/null and 
b/sd/qa/unit/data/pptx/connector-shape-animations.pptx differ
diff --git a/sd/qa/unit/export-tests-ooxml4.cxx 
b/sd/qa/unit/export-tests-ooxml4.cxx
index 38b4297ff3ad..3189477ef121 100644
--- a/sd/qa/unit/export-tests-ooxml4.cxx
+++ b/sd/qa/unit/export-tests-ooxml4.cxx
@@ -1886,6 +1886,31 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, 
testTdf114443_PPSX)
                 
u"application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml");
 }
 
+CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest4, testConnectorShapeAnimationTarget)
+{
+    createSdImpressDoc("pptx/connector-shape-animations.pptx");
+    save(u"Impress Office Open XML"_ustr);
+
+    xmlDocUniquePtr pXmlDoc = parseExport(u"ppt/slides/slide1.xml"_ustr);
+
+    const OUString sConnectorId = getXPath(
+        pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn", "id");
+
+    const OUString sShapeId = getXPath(
+        pXmlDoc, 
"/p:sld/p:cSld/p:spTree/p:graphicFrame/p:nvGraphicFramePr/p:cNvPr", "id");
+
+    // Check connector and shape both have the same ID
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Connector and the shape doesn't have the 
same ID", sConnectorId,
+                                 sShapeId);
+
+    // Check animation spid matches ShapeId
+    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[2]/p:cTn/p:childTnLst/p:set/"
+                "p:cBhvr/p:tgtEl/p:spTgt",
+                "spid", sShapeId);
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Reply via email to