diff options
author | Regényi Balázs <regenyi.balazs@nisz.hu> | 2020-09-30 15:19:36 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-10-06 11:22:17 +0200 |
commit | 3b6de95a0d59cf5942af5ecf4a402c224b76f8a3 (patch) | |
tree | a0ab243874672c6ca9ed0e474c5a543f43015389 /oox/source/vml/vmlshape.cxx | |
parent | ff5ca4e5fc6a9fb24b0eb6eb629210b024473f67 (diff) |
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>
Diffstat (limited to 'oox/source/vml/vmlshape.cxx')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 6cd5aff9110d..d70a9563e106 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -1129,6 +1129,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()) { @@ -1151,17 +1166,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; } |