summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorRegényi Balázs <regenyi.balazs@nisz.hu>2020-10-26 11:52:29 +0100
committerLászló Németh <nemeth@numbertext.org>2020-10-29 15:18:22 +0100
commit7774d01891df6787058677dee4bc449cd5841c59 (patch)
tree980f65db0ee00d35fb6eb07647852829766c25c5 /oox
parent66d1964718013901c2aa93c512e1adc0b91ddec9 (diff)
tdf#137765 DOCX VML shape import: fix rotation handling
Change-Id: I78c89d4f795a67ff44ae9cef9daf44bf9f1d5c8a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104807 Tested-by: Jenkins 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/vml/vmlshape.cxx34
1 files changed, 21 insertions, 13 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 43b54a658db6..a83cb6b2c76c 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -679,7 +679,8 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
awt::Rectangle aShapeRect(rShapeRect);
std::optional<sal_Int32> oRotation;
bool bFlipX = false, bFlipY = false;
- if (!maTypeModel.maRotation.isEmpty())
+ // tdf#137765: skip this rotation for line shapes
+ if (!maTypeModel.maRotation.isEmpty() && maService != "com.sun.star.drawing.LineShape")
oRotation = ConversionHelper::decodeRotation(maTypeModel.maRotation);
if (!maTypeModel.maFlip.isEmpty())
{
@@ -1035,6 +1036,22 @@ namespace
}
}
}
+
+ void handleRotation(const ShapeTypeModel& rTypeModel, Reference<XShape>& rxShape)
+ {
+ if (!rTypeModel.maRotation.isEmpty())
+ {
+ if (SdrObject* pShape = GetSdrObjectFromXShape(rxShape))
+ {
+ // -1 is required because the direction of MSO rotation is the opposite of ours
+ // 100 is required because in this part of the code the angle is in a hundredth of
+ // degrees.
+ auto nAngle = -1 * 100.0 * rTypeModel.maRotation.toDouble();
+ double nHRad = nAngle * F_PI18000;
+ pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, sin(nHRad), cos(nHRad));
+ }
+ }
+ }
}
LineShape::LineShape(Drawing& rDrawing)
@@ -1045,6 +1062,8 @@ LineShape::LineShape(Drawing& rDrawing)
Reference<XShape> LineShape::implConvertAndInsert(const Reference<XShapes>& rxShapes, const awt::Rectangle& rShapeRect) const
{
Reference<XShape> xShape = SimpleShape::implConvertAndInsert(rxShapes, rShapeRect);
+ // tdf#137765
+ handleRotation(maTypeModel, xShape);
// tdf#97517 tdf#137678
// The MirroredX and MirroredY properties (in the CustomShapeGeometry property) are not
// supported for the LineShape by UNO, so we have to make the mirroring here.
@@ -1174,18 +1193,7 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
// tdf#105875 handle rotation
// Note: must rotate before flip!
- if (!maTypeModel.maRotation.isEmpty())
- {
- if (SdrObject* pShape = GetSdrObjectFromXShape(xShape))
- {
- // -1 is required because the direction of MSO rotation is the opposite of ours
- // 100 is required because in this part of the code the angle is in a hundredth of
- // degrees.
- auto nAngle = -1 * 100.0 * maTypeModel.maRotation.toDouble();
- double nHRad = nAngle * F_PI18000;
- pShape->NbcRotate(pShape->GetSnapRect().Center(), nAngle, sin(nHRad), cos(nHRad));
- }
- }
+ handleRotation(maTypeModel, xShape);
// Handle horizontal and vertical flip.
handleMirroring(maTypeModel, xShape);