diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-05-29 11:17:44 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2013-05-29 15:56:51 +0200 |
commit | b2c16f6c1b8bd3c96e0549eb3036c820094a795f (patch) | |
tree | 0bf8c01cdee9c7e74b9d4a3a93405cce25dab7d8 /oox | |
parent | 290695c785ef831abb6e78cd3675bc071f05f643 (diff) |
bnc#817956 fix VML import of rotation
In VML, positive rotation angles are clockwise, we have them as
counter-clockwise. This wasn't noticed earlier, as the n751117.docx
testcase also had flip:x. (For example, rotation with angle 90 + flip:x
is presented as 270 by the UI.)
Fix this, and also mirror the angle when flip:x is present.
Change-Id: I591ec3369a5bdca53f9684006a459d11e37fbc33
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/vml/vmlshape.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx index 8e5e2a9524f6..b4b3e9e8b3bc 100644 --- a/oox/source/vml/vmlshape.cxx +++ b/oox/source/vml/vmlshape.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/text/TextContentAnchorType.hpp> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> +#include <svx/svdtrans.hxx> #include "oox/drawingml/shapepropertymap.hxx" #include "oox/helper/graphichelper.hxx" #include "oox/helper/propertyset.hxx" @@ -476,12 +477,17 @@ void lcl_SetAnchorType(PropertySet& rPropSet, const ShapeTypeModel& rTypeModel) Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes >& rxShapes, const awt::Rectangle& rShapeRect ) const { awt::Rectangle aShapeRect(rShapeRect); + boost::optional<sal_Int32> oRotation; + if (!maTypeModel.maRotation.isEmpty()) + oRotation.reset(maTypeModel.maRotation.toInt32()); if (!maTypeModel.maFlip.isEmpty()) { if (maTypeModel.maFlip.equalsAscii("x")) { aShapeRect.X += aShapeRect.Width; aShapeRect.Width *= -1; + if (oRotation) + oRotation.reset(360 - *oRotation); } else if (maTypeModel.maFlip.equalsAscii("y")) { @@ -548,9 +554,11 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes } PropertySet aPropertySet(xShape); - if (xShape.is() && !maTypeModel.maRotation.isEmpty()) + if (xShape.is() && oRotation) { - aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(maTypeModel.maRotation.toInt32() * 100)); + // See DffPropertyReader::Fix16ToAngle(): in VML, positive rotation angles are clockwise, we have them as counter-clockwise. + // Additionally, VML type is 0..360, our is 0.36000. + aPropertySet.setAnyProperty(PROP_RotateAngle, makeAny(sal_Int32(NormAngle360((*oRotation) * -100)))); // If rotation is used, simple setPosition() is not enough. aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) ); aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) ); |