summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorSzabolcs Toth <toth.szabolcs@nisz.hu>2021-05-19 08:42:29 +0200
committerLászló Németh <nemeth@numbertext.org>2021-05-25 13:41:29 +0200
commitb2190523e0b226bcae19cc8c3ce8a83855c7f009 (patch)
tree784b0e90daf8882ce93f13d1d0395d743ba5eaa1 /oox
parent4c1bab94d7c113f2fcb5458809fe8ec0683be951 (diff)
tdf#141644 OOXML shape import: fix upright text rotate angle
Text rotate angle was not imported correctly with "upright" setting, e.g. resulting horizontal text in shapes of XLSX documents instead of vertical. Change-Id: I2ad9ba3465278220e64123c4400acff4125310d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115777 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/drawingml/shape.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index ed26e2313941..b0e2ddef30e7 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -1507,6 +1507,9 @@ Reference< XShape > const & Shape::createAndInsert(
sal_Int32 nTextRotateAngle = static_cast< sal_Int32 >( getTextBody()->getTextProperties().moRotation.get( 0 ) );
nTextRotateAngle -= mnDiagramRotation;
+ /* OOX measures text rotation clockwise in 1/60000th degrees,
+ relative to the containing shape. setTextRotateAngle wants degrees anticlockwise. */
+ nTextRotateAngle = -1 * nTextRotateAngle / 60000;
if (getTextBody()->getTextProperties().moUpright)
{
@@ -1515,18 +1518,15 @@ Reference< XShape > const & Shape::createAndInsert(
// shape containing it is rotated.
// Hence, we rotate the text into the opposite direction of
// the rotation of the shape, by as much as the shape was rotated.
- mpCustomShapePropertiesPtr->setTextRotateAngle(mnRotation / 60000);
+ mpCustomShapePropertiesPtr->setTextRotateAngle((mnRotation / 60000) + nTextRotateAngle);
// Also put the initial angles away in a GrabBag.
putPropertyToGrabBag("Upright", Any(true));
putPropertyToGrabBag("nShapeRotationAtImport", Any(mnRotation / 60000));
- putPropertyToGrabBag("nTextRotationAtImport", Any(mnRotation / 60000));
+ putPropertyToGrabBag("nTextRotationAtImport", Any(nTextRotateAngle));
}
else
{
- /* OOX measures text rotation clockwise in 1/60000th degrees,
- relative to the containing shape. setTextRotateAngle wants
- degrees anticlockwise. */
- mpCustomShapePropertiesPtr->setTextRotateAngle(-1 * nTextRotateAngle / 60000);
+ mpCustomShapePropertiesPtr->setTextRotateAngle(nTextRotateAngle);
}
auto sHorzOverflow = getTextBody()->getTextProperties().msHorzOverflow;