summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2020-12-13 14:08:38 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2020-12-17 13:37:18 +0100
commit277b22981baae33ab7969538f00a5bb85e1be474 (patch)
tree4ec7b173dc80f7683c0a77fa4e9cf33463e6c92e /oox
parent0e30d1fcdd81c65bcf26723ba04d9dbd2bb08f30 (diff)
tdf#138889 OOXML chart: fix import of rotated shapes
in charts, resulted e.g. distorted arrows. Change-Id: I2d25aeeef8aed9fccacf3cc9f735123e8d891de5 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107670 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit fbe77e5d61ca63a688c12be721e760935d78e780) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/107801 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/chart/chartdrawingfragment.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/oox/source/drawingml/chart/chartdrawingfragment.cxx b/oox/source/drawingml/chart/chartdrawingfragment.cxx
index 85eeb2986bcc..c41e2db49821 100644
--- a/oox/source/drawingml/chart/chartdrawingfragment.cxx
+++ b/oox/source/drawingml/chart/chartdrawingfragment.cxx
@@ -209,6 +209,15 @@ void ChartDrawingFragment::onEndElement()
EmuRectangle aShapeRectEmu = mxAnchor->calcAnchorRectEmu( maChartRectEmu );
if( (aShapeRectEmu.X >= 0) && (aShapeRectEmu.Y >= 0) && (aShapeRectEmu.Width >= 0) && (aShapeRectEmu.Height >= 0) )
{
+ const sal_Int32 aRotation = mxShape->getRotation();
+ if( (aRotation >= 45 * PER_DEGREE && aRotation < 135 * PER_DEGREE) || (aRotation >= 225 * PER_DEGREE && aRotation < 315 * PER_DEGREE) )
+ {
+ sal_Int64 nHalfWidth = aShapeRectEmu.Width / 2;
+ sal_Int64 nHalfHeight = aShapeRectEmu.Height / 2;
+ aShapeRectEmu.X = aShapeRectEmu.X + nHalfWidth - nHalfHeight;
+ aShapeRectEmu.Y = aShapeRectEmu.Y + nHalfHeight - nHalfWidth;
+ std::swap(aShapeRectEmu.Width, aShapeRectEmu.Height);
+ }
// TODO: DrawingML implementation expects 32-bit coordinates for EMU rectangles (change that to EmuRectangle)
awt::Rectangle aShapeRectEmu32(
getLimitedValue< sal_Int32, sal_Int64 >( aShapeRectEmu.X, 0, SAL_MAX_INT32 ),