summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2022-11-29 15:43:58 +0100
committerLászló Németh <nemeth@numbertext.org>2022-12-05 11:20:11 +0000
commit400e44cebd993f4b9b3d878fb9264f99e005c9fb (patch)
tree7e5511d47a56dc7d3a9f288f475e14adf71f1021
parent12732eb7c34baa3f846ec6d0c10f8987051ace34 (diff)
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 <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--oox/source/ppt/slidepersist.cxx34
-rw-r--r--sd/qa/unit/data/pptx/connectors.pptxbin24186 -> 24318 bytes
-rw-r--r--sd/qa/unit/import-tests.cxx4
3 files changed, 28 insertions, 10 deletions
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index 3b9a93ded03c..9d2ad58b5be2 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -371,10 +371,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")
@@ -385,20 +399,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
--- a/sd/qa/unit/data/pptx/connectors.pptx
+++ b/sd/qa/unit/data/pptx/connectors.pptx
Binary files differ
diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index 3f3aafcbe0e8..eb125a46834f 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -342,8 +342,8 @@ void SdImportTest::testConnectors()
{
createSdImpressDoc("pptx/connectors.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++)