oox/source/ppt/slidepersist.cxx | 34 ++++++++++++++++++++++++++-------- sd/qa/unit/data/pptx/connectors.pptx |binary sd/qa/unit/import-tests.cxx | 4 ++-- 3 files changed, 28 insertions(+), 10 deletions(-)
New commits: commit df6ff2392701b04bbafddb1119e1ac43cac71fae Author: Tibor Nagy <nagy.tib...@nisz.hu> AuthorDate: Tue Nov 29 15:43:58 2022 +0100 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Mon Dec 5 21:18:26 2022 +0000 tdf#152211 PPTX import: fix connector position based on line width Thick shape line changed the connector, e.g. direction of its arrow head. Follow-up to commit d8c89fb920af747ec51ce966b5d7b65e9340afbd "tdf#151891 PPTX import: fix regression of connector position" Regression from commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8 "tdf#89449 PPTX import: fix line connectors". Change-Id: I99d22409ec65e10609b1e371cc4d301fd73c7c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143467 Tested-by: László Németh <nem...@numbertext.org> Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 400e44cebd993f4b9b3d878fb9264f99e005c9fb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/143589 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx index d4f56aba5a7e..4536e7c75be1 100644 --- a/oox/source/ppt/slidepersist.cxx +++ b/oox/source/ppt/slidepersist.cxx @@ -372,10 +372,24 @@ static void lcl_SetEdgeLineValue(uno::Reference<drawing::XShape>& rXConnector, SdrObject* pStartObj = xStartSp.is() ? SdrObject::getSdrObjectFromXShape(xStartSp) : nullptr; SdrObject* pEndObj = xEndSp.is() ? SdrObject::getSdrObjectFromXShape(xEndSp) : nullptr; + sal_Int32 nStartSpLineW = 0; if (pStartObj) + { aStartRect = pStartObj->GetSnapRect(); + uno::Reference<beans::XPropertySet> xPropxStartSp(xStartSp, uno::UNO_QUERY); + xPropxStartSp->getPropertyValue("LineWidth") >>= nStartSpLineW; + if (nStartSpLineW) + nStartSpLineW = nStartSpLineW / 2; + } + sal_Int32 nEndSpLineW = 0; if (pEndObj) + { aEndRect = pEndObj->GetSnapRect(); + uno::Reference<beans::XPropertySet> xPropxEndSp(xEndSp, uno::UNO_QUERY); + xPropxEndSp->getPropertyValue("LineWidth") >>= nEndSpLineW; + if (nEndSpLineW) + nEndSpLineW = nEndSpLineW / 2; + } const OUString sConnectorName = rShapePtr->getConnectorName(); if (sConnectorName == "bentConnector2") @@ -386,20 +400,24 @@ static void lcl_SetEdgeLineValue(uno::Reference<drawing::XShape>& rXConnector, if (aConnSize.Height < aConnSize.Width) { if (xStartSp.is()) - nEdge -= (aStartPt.Y > aEndPt.Y) ? (aStartRect.Top() - aEndPt.Y) - : (aStartRect.Bottom() - aEndPt.Y); + nEdge = (aStartPt.Y > aEndPt.Y) + ? (nStartSpLineW - (aStartRect.Top() - aEndPt.Y)) + : ((aEndPt.Y - aStartRect.Bottom()) - nStartSpLineW); else - nEdge -= (aStartPt.Y > aEndPt.Y) ? (aEndRect.Bottom() - aStartPt.Y) - : (aEndRect.Top() - aStartPt.Y); + nEdge = (aStartPt.Y > aEndPt.Y) + ? ((aStartPt.Y - aEndRect.Bottom()) - nEndSpLineW) + : (nEndSpLineW - (aEndRect.Top() - aStartPt.Y)); } else { if (xStartSp.is()) - nEdge -= (aStartPt.X > aEndPt.X) ? (aStartRect.Left() - aEndPt.X) - : (aStartRect.Right() - aEndPt.X); + nEdge = (aStartPt.X > aEndPt.X) + ? (nStartSpLineW - (aStartRect.Left() - aEndPt.X)) + : ((aEndPt.X - aStartRect.Right()) - nStartSpLineW); else - nEdge -= (aStartPt.X > aEndPt.X) ? (aEndRect.Right() - aStartPt.X) - : (aEndRect.Left() - aStartPt.X); + nEdge = (aStartPt.X > aEndPt.X) + ? ((aStartPt.X - aEndRect.Right()) - nEndSpLineW) + : (nEndSpLineW - (aEndRect.Left() - aStartPt.X)); } } else diff --git a/sd/qa/unit/data/pptx/connectors.pptx b/sd/qa/unit/data/pptx/connectors.pptx index ba959068663c..2f65acba13b8 100644 Binary files a/sd/qa/unit/data/pptx/connectors.pptx and b/sd/qa/unit/data/pptx/connectors.pptx differ diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index 17b0f894c75f..66653f751867 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -311,8 +311,8 @@ void SdImportTest::testConnectors() ::sd::DrawDocShellRef xDocShRef = loadURL(m_directories.getURLFromSrc(u"/sd/qa/unit/data/pptx/connectors.pptx"), PPTX); - sal_Int32 aEdgeValue[] = { -1167, -1167, -1591, 1476, 1356, -1357, 1604, -1540, - 607, 1296, -1638, -1060, -522, 1578, -1291, 333 }; + sal_Int32 aEdgeValue[] = { -1123, -1123, -1547, 1432, 1356, -1357, 1604, -1540, + 599, 1288, -1629, -1052, -513, 1569, -1283, 333 }; sal_Int32 nCount = 0; for (size_t i = 0; i < 18; i++)