oox/source/export/shapes.cxx | 28 ++++++++++++++++++---------- sd/qa/unit/data/odp/tdf164775.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 12 ++++++++++++ 3 files changed, 30 insertions(+), 10 deletions(-)
New commits: commit 1195a577ff7c5553a7043ca642242a8885f47c08 Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> AuthorDate: Fri Feb 7 02:27:57 2025 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Tue Mar 11 10:35:08 2025 +0100 tdf#164775 PPTX export: fix connector shape regression A connector shape can be connected to a shape, if the end of connector shape is released inside the target shape, it will automatically attach to the best possible connection point. It takes into account the shape type, geometric properties, and user-defined glue points. In this case, if we export the ODP file to PPTX, we need to use the GetConnectorRule() method to get the correct connection index(idx). this regression is caused by commit 4d153517183193f468dee9148c94fe9d874bacb3 (tdf#149697 PPTX export: fix changing place of connection points). Conflicts: oox/source/export/shapes.cxx Change-Id: I8eda059e72f595edc62fd5bc7f3e6466988af5bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181226 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de> (cherry picked from commit 589e523dd967e39f4715cfe120e12fba11cf9c90) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181342 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 18a5c7dd18937f315665dc55455965f0272d8f0c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182415 Reviewed-by: Andras Timar <andras.ti...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index dd549fbde179..8a9589b8e7f5 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1808,16 +1808,6 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape if (GetProperty(rXPropSet, "EdgeEndConnection")) mAny >>= rXShapeB; - if (GetProperty(rXPropSet, "StartGluePointIndex")) - mAny >>= nStartGlueId; - if (nStartGlueId != -1) - nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId); - - if (GetProperty(rXPropSet, "EndGluePointIndex")) - mAny >>= nEndGlueId; - if (nEndGlueId != -1) - nEndGlueId = lcl_GetGluePointId(rXShapeB, nEndGlueId); - // Position is relative to group in Word, but relative to anchor of group in API. if (GetDocumentType() == DOCUMENT_DOCX && !mbUserShapes && m_xParent.is()) { @@ -1829,6 +1819,24 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape } EscherConnectorListEntry aConnectorEntry( xShape, aStartPoint, rXShapeA, aEndPoint, rXShapeB ); + if (GetProperty(rXPropSet, "StartGluePointIndex")) + { + mAny >>= nStartGlueId; + nStartGlueId = (nStartGlueId != -1) ? lcl_GetGluePointId(rXShapeA, nStartGlueId) + : (aConnectorEntry.mXConnectToA.is() + ? aConnectorEntry.GetConnectorRule(true) + : -1); + } + + if (GetProperty(rXPropSet, "EndGluePointIndex")) + { + mAny >>= nEndGlueId; + nEndGlueId = (nEndGlueId != -1) ? lcl_GetGluePointId(rXShapeB, nEndGlueId) + : (aConnectorEntry.mXConnectToB.is() + ? aConnectorEntry.GetConnectorRule(false) + : -1); + } + if (eConnectorType != ConnectorType_LINE) { tools::PolyPolygon aPolyPolygon = EscherPropertyContainer::GetPolyPolygon(xShape); diff --git a/sd/qa/unit/data/odp/tdf164775.odp b/sd/qa/unit/data/odp/tdf164775.odp new file mode 100644 index 000000000000..69b163333e3e Binary files /dev/null and b/sd/qa/unit/data/odp/tdf164775.odp differ diff --git a/sd/qa/unit/export-tests-ooxml3.cxx b/sd/qa/unit/export-tests-ooxml3.cxx index 447f014dbf5e..7b63e89b493d 100644 --- a/sd/qa/unit/export-tests-ooxml3.cxx +++ b/sd/qa/unit/export-tests-ooxml3.cxx @@ -27,6 +27,18 @@ public: int testTdf115005_FallBack_Images(bool bAddReplacementImages); }; +CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf164775_ConnectorShape) +{ + createSdImpressDoc("odp/tdf164775.odp"); + save(u"Impress Office Open XML"_ustr); + + xmlDocUniquePtr pXmlDoc1 = parseExport(u"ppt/slides/slide1.xml"_ustr); + assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:stCxn"_ostr, + "idx"_ostr, u"3"_ustr); + assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn"_ostr, + "idx"_ostr, u"1"_ustr); +} + CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf153105) { createSdImpressDoc("odp/tdf153105.odp");