summaryrefslogtreecommitdiff
path: root/oox/source/vml
diff options
context:
space:
mode:
authorRi GangHu <sweetdream201@163.com>2013-08-04 14:39:18 +0300
committerMiklos Vajna <vmiklos@suse.cz>2013-08-22 17:06:10 +0200
commitd3ffe3ed3fa1b80c7e54439673029e105940db80 (patch)
treeb327a7ea5397c47be50109d15d7efd917d37d2ec /oox/source/vml
parent84184f957d004e1f7b7a361935d34b1fc2af51d6 (diff)
fdo#67737 : fix for flip not being imported & rendered correctly
Signed-off-by: Adam Co <rattles2013@gmail.com> Reviewed-on: https://gerrit.libreoffice.org/5272 Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Change-Id: I5c8440edad0381e33b64f64bb54aa8f1bc304007
Diffstat (limited to 'oox/source/vml')
-rw-r--r--oox/source/vml/vmlshape.cxx44
1 files changed, 33 insertions, 11 deletions
diff --git a/oox/source/vml/vmlshape.cxx b/oox/source/vml/vmlshape.cxx
index 40281cf545df..e5eb0175996b 100644
--- a/oox/source/vml/vmlshape.cxx
+++ b/oox/source/vml/vmlshape.cxx
@@ -501,21 +501,18 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
{
awt::Rectangle aShapeRect(rShapeRect);
boost::optional<sal_Int32> oRotation;
+ bool bFlipX = false, bFlipY = false;
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);
+ bFlipX = true;
}
else if (maTypeModel.maFlip.equalsAscii("y"))
{
- aShapeRect.Y += aShapeRect.Height;
- aShapeRect.Height *= -1;
+ bFlipY = true;
}
}
@@ -604,12 +601,37 @@ Reference< XShape > SimpleShape::implConvertAndInsert( const Reference< XShapes
}
PropertySet aPropertySet(xShape);
- if (xShape.is() && oRotation)
+ if (xShape.is())
{
- lcl_SetRotation(aPropertySet, *oRotation);
- // If rotation is used, simple setPosition() is not enough.
- aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) );
- aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) );
+ if (oRotation)
+ {
+ lcl_SetRotation(aPropertySet, *oRotation);
+ // If rotation is used, simple setPosition() is not enough.
+ aPropertySet.setAnyProperty(PROP_HoriOrientPosition, makeAny( aShapeRect.X ) );
+ aPropertySet.setAnyProperty(PROP_VertOrientPosition, makeAny( aShapeRect.Y ) );
+ }
+
+ // When flip has 'x' or 'y', the associated ShapeRect will be changed but direction change doesn't occur.
+ // It might occur internally in SdrObject of "sw" module, not here.
+ // The associated properties "PROP_MirroredX" and "PROP_MirroredY" have to be set here so that direction change will occur internally.
+ if (bFlipX || bFlipY)
+ {
+ com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue > aPropSequence (2);
+ int nPropertyIndex = 0;
+ if (bFlipX)
+ {
+ aPropSequence [nPropertyIndex].Name = "MirroredX";
+ aPropSequence [nPropertyIndex].Value = makeAny (bFlipX);
+ nPropertyIndex++;
+ }
+ if (bFlipY)
+ {
+ aPropSequence [nPropertyIndex].Name = "MirroredY";
+ aPropSequence [nPropertyIndex].Value = makeAny (bFlipY);
+ nPropertyIndex++;
+ }
+ aPropertySet.setAnyProperty(PROP_CustomShapeGeometry, makeAny( aPropSequence ) );
+ }
}
lcl_SetAnchorType(aPropertySet, maTypeModel);