include/filter/msfilter/escherex.hxx | 2 +- oox/source/export/shapes.cxx | 28 ++++++++++++++++++---------- sd/qa/unit/data/odp/tdf164775.odp |binary sd/qa/unit/export-tests-ooxml3.cxx | 12 ++++++++++++ 4 files changed, 31 insertions(+), 11 deletions(-)
New commits: commit 589e523dd967e39f4715cfe120e12fba11cf9c90 Author: Tibor Nagy <tibor.nagy.ext...@allotropia.de> AuthorDate: Fri Feb 7 02:27:57 2025 +0100 Commit: Nagy Tibor <tibor.nagy.ext...@allotropia.de> CommitDate: Sun Feb 9 17:27:49 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). Change-Id: I8eda059e72f595edc62fd5bc7f3e6466988af5bb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181226 Tested-by: Jenkins Reviewed-by: Nagy Tibor <tibor.nagy.ext...@allotropia.de> diff --git a/include/filter/msfilter/escherex.hxx b/include/filter/msfilter/escherex.hxx index 91606bca13a2..d6c1b620f077 100644 --- a/include/filter/msfilter/escherex.hxx +++ b/include/filter/msfilter/escherex.hxx @@ -452,7 +452,7 @@ namespace com::sun::star { } } -struct UNLESS_MERGELIBS(MSFILTER_DLLPUBLIC) EscherConnectorListEntry +struct MSFILTER_DLLPUBLIC EscherConnectorListEntry { css::uno::Reference< css::drawing::XShape > mXConnector; css::awt::Point maPointA; diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx index 0bb8d1ebeecc..40bed3208567 100644 --- a/oox/source/export/shapes.cxx +++ b/oox/source/export/shapes.cxx @@ -1893,16 +1893,6 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape if (GetProperty(rXPropSet, u"EdgeEndConnection"_ustr)) mAny >>= rXShapeB; - if (GetProperty(rXPropSet, u"StartGluePointIndex"_ustr)) - mAny >>= nStartGlueId; - if (nStartGlueId != -1) - nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId); - - if (GetProperty(rXPropSet, u"EndGluePointIndex"_ustr)) - 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()) { @@ -1914,6 +1904,24 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape } EscherConnectorListEntry aConnectorEntry( xShape, aStartPoint, rXShapeA, aEndPoint, rXShapeB ); + if (GetProperty(rXPropSet, u"StartGluePointIndex"_ustr)) + { + mAny >>= nStartGlueId; + nStartGlueId = (nStartGlueId != -1) ? lcl_GetGluePointId(rXShapeA, nStartGlueId) + : (aConnectorEntry.mXConnectToA.is() + ? aConnectorEntry.GetConnectorRule(true) + : -1); + } + + if (GetProperty(rXPropSet, u"EndGluePointIndex"_ustr)) + { + 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 c3ea2f874633..9e0b36b9096d 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", "idx", + u"3"); + assertXPath(pXmlDoc1, "/p:sld/p:cSld/p:spTree/p:cxnSp/p:nvCxnSpPr/p:cNvCxnSpPr/a:endCxn", "idx", + u"1"); +} + CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest3, testTdf153105) { createSdImpressDoc("odp/tdf153105.odp");