summaryrefslogtreecommitdiffstats
path: root/oox
diff options
context:
space:
mode:
authorRegényi Balázs <regenyi.balazs@nisz.hu>2020-09-30 15:19:36 +0200
committerMichael Stahl <michael.stahl@cib.de>2020-10-07 10:14:26 +0200
commit767ec919f09e5ed69149ed27bd46a6bb67556863 (patch)
tree331434b50d1bdc3416d13ee172ec8877e1c38eef /oox
parenttdf#137165 chart2: fix label position in Position and Size (diff)
downloadcore-767ec919f09e5ed69149ed27bd46a6bb67556863.tar.gz
core-767ec919f09e5ed69149ed27bd46a6bb67556863.zip
tdf#105875 DOCX VML shape import: fix missing rotation
Also to avoid bad resizing of the rotated shape, remove obsolete(?) code part from commit 0423a6741fc08a35b123556f9b10219d090ee42a (Import bezier curves from .docx.). Co-authored-by: Szabolcs Toth Change-Id: I77266ba65e558cf9e6dd0e1c37fad85abd038819 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103693 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org> (cherry picked from commit 3b6de95a0d59cf5942af5ecf4a402c224b76f8a3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103976 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.stahl@cib.de>
Diffstat (limited to 'oox')
-rw-r--r--oox/source/vml/vmlshape.cxx26
1 files changed, 15 insertions, 11 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index d52e8e97fe1d..a7a0c46d6204 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -1108,6 +1108,21 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
aPropSet.setProperty( PROP_PolyPolygonBezier, aBezierCoords );
}
+ // 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));
+ }
+ }
+
// Handle horizontal and vertical flip.
if (!maTypeModel.maFlip.isEmpty())
{
@@ -1130,17 +1145,6 @@ Reference< XShape > BezierShape::implConvertAndInsert( const Reference< XShapes
}
}
- // Hacky way of ensuring the shape is correctly sized/positioned
- try
- {
- // E.g. SwXFrame::setPosition() unconditionally throws
- xShape->setSize( awt::Size( rShapeRect.Width, rShapeRect.Height ) );
- xShape->setPosition( awt::Point( rShapeRect.X, rShapeRect.Y ) );
- }
- catch (const ::css::uno::Exception&)
- {
- // TODO: try some other way to ensure size/position
- }
return xShape;
}