summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2021-08-13 16:44:15 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-08-16 15:53:02 +0200
commit581b2cf7960c48e6199bd35be839424113abe533 (patch)
tree5f5d0f4cf0be4d134804cea9738460e92a61e11c /oox
parent76f89b0097c02fa68c36cfc9a31de3b2e9166abc (diff)
Drop tools::Rectangle::getX/getY, which are just duplicates of Left/Top
The change allowed to simplify many places where previously this API was used, to avoid inefficient calculations (e.g., moving rectangle keeping its size, and then immediately changing the size). Change-Id: Ica2dc594d91cae83e2c2740c1f4fb23f44998916 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120461 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/export/drawingml.cxx7
-rw-r--r--oox/source/export/shapes.cxx4
2 files changed, 6 insertions, 5 deletions
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 54a7f2f6eab1..196f6a8ae125 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -5319,9 +5319,10 @@ void DrawingML::WriteFromTo(const uno::Reference<css::drawing::XShape>& rXShape,
// aTopLeft needs correction for rotated customshapes
if (pObj->GetObjIdentifier() == OBJ_CUSTOMSHAPE)
{
- const tools::Rectangle& aSnapRect(pObj->GetSnapRect()); // bounding box of the rotated shape
- aTopLeft.X = aSnapRect.getX() + (aSnapRect.GetWidth() / 2) - nHalfWidth;
- aTopLeft.Y = aSnapRect.getY() + (aSnapRect.GetHeight() / 2) - nHalfHeight;
+ // Center of bounding box of the rotated shape
+ const auto aSnapRectCenter(pObj->GetSnapRect().Center());
+ aTopLeft.X = aSnapRectCenter.X() - nHalfWidth;
+ aTopLeft.Y = aSnapRectCenter.Y() - nHalfHeight;
}
// MSO changes the anchor positions at these angles and that does an extra 90 degrees
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 9b6bb4f8ed4f..c53cc494b594 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -1347,13 +1347,13 @@ ShapeExport& ShapeExport::WriteConnectorShape( const Reference< XShape >& xShape
tools::Rectangle aRect( Point( aStartPoint.X, aStartPoint.Y ), Point( aEndPoint.X, aEndPoint.Y ) );
if( aRect.getWidth() < 0 ) {
bFlipH = true;
- aRect.setX( aEndPoint.X );
+ aRect.SetLeft(aEndPoint.X);
aRect.setWidth( aStartPoint.X - aEndPoint.X );
}
if( aRect.getHeight() < 0 ) {
bFlipV = true;
- aRect.setY( aEndPoint.Y );
+ aRect.SetTop(aEndPoint.Y);
aRect.setHeight( aStartPoint.Y - aEndPoint.Y );
}