summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorTibor Nagy <nagy.tibor2@nisz.hu>2023-03-29 09:00:47 +0200
committerLászló Németh <nemeth@numbertext.org>2023-04-11 19:32:45 +0200
commitb7c542b5085374f1d031183cb86ceeefcf24964d (patch)
tree3d097e57fc91d25df586082fb080a46600387d18 /oox
parentb77775de1ab530912153a9fcc571efb300c2888e (diff)
tdf#154363 sd: fix line connectors regression of mirrored shapes
caused by commit cbf66ec3e60d07efb7c3cceed9b4f0fb4f0510c8 (tdf#89449 PPTX import: fix line connectors). Note: partial revert of commit 9ab16e2738b4b9bd324c9aded8acb2ecba0fd2b0 "oox: fix crash in lcl_GetGluePointId by removing unused code". Change-Id: Icc45c93c4fa3a22c0f34866ccb64ea6b9037d936 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149676 Reviewed-by: László Németh <nemeth@numbertext.org> Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/shapes.cxx37
-rw-r--r--oox/source/ppt/slidepersist.cxx15
2 files changed, 39 insertions, 13 deletions
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 372b4376fe22..eab82a86336d 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1640,17 +1640,38 @@ static void lcl_GetConnectorAdjustValue(const Reference<XShape>& xShape, tools::
}
}
-static sal_Int32 lcl_GetGluePointId(sal_Int32 nGluePointId)
+static sal_Int32 lcl_GetGluePointId(const Reference<XShape>& xShape, sal_Int32 nGluePointId)
{
if (nGluePointId > 3)
return nGluePointId - 4;
else
{
- // change id of the bounding box (1 <-> 3)
- if (nGluePointId == 1)
- return 3; // Right
- else if (nGluePointId == 3)
- return 1; // Left
+ bool bFlipH = false;
+ bool bFlipV = false;
+ Reference<XPropertySet> xShapeProps(xShape, UNO_QUERY);
+ if (xShapeProps->getPropertySetInfo()->hasPropertyByName("CustomShapeGeometry"))
+ {
+ Sequence<PropertyValue> aGeometrySeq;
+ xShapeProps->getPropertyValue("CustomShapeGeometry") >>= aGeometrySeq;
+ for (int i = 0; i < aGeometrySeq.getLength(); i++)
+ {
+ const PropertyValue& rProp = aGeometrySeq[i];
+ if (rProp.Name == "MirroredX")
+ rProp.Value >>= bFlipH;
+
+ if (rProp.Name == "MirroredY")
+ rProp.Value >>= bFlipV;
+ }
+ }
+
+ if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+ {
+ // change id of the bounding box (1 <-> 3)
+ if (nGluePointId == 1)
+ nGluePointId = 3; // Right
+ else if (nGluePointId == 3)
+ nGluePointId = 1; // Left
+ }
}
return nGluePointId;
@@ -1708,12 +1729,12 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape
if (GetProperty(rXPropSet, "StartGluePointIndex"))
mAny >>= nStartGlueId;
if (nStartGlueId != -1)
- nStartGlueId = lcl_GetGluePointId(nStartGlueId);
+ nStartGlueId = lcl_GetGluePointId(rXShapeA, nStartGlueId);
if (GetProperty(rXPropSet, "EndGluePointIndex"))
mAny >>= nEndGlueId;
if (nEndGlueId != -1)
- nEndGlueId = lcl_GetGluePointId(nEndGlueId);
+ 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())
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index bb673b52442e..0f7479e8ede9 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -659,11 +659,16 @@ void SlidePersist::createConnectorShapeConnection()
nGlueId += 4;
else
{
- // change id of the left and right glue points of the bounding box (1 <-> 3)
- if (nGlueId == 1)
- nGlueId = 3; // Right
- else if (nGlueId == 3)
- nGlueId = 1; // Left
+ bool bFlipH = pShape->second->getFlipH();
+ bool bFlipV = pShape->second->getFlipV();
+ if ((!bFlipH && !bFlipV) || (bFlipH && bFlipV))
+ {
+ // change id of the left and right glue points of the bounding box (1 <-> 3)
+ if (nGlueId == 1)
+ nGlueId = 3; // Right
+ else if (nGlueId == 3)
+ nGlueId = 1; // Left
+ }
}
bool bStart = aConnectorShapeProperties[j].mbStartShape;