summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2012-11-20 13:38:15 +0000
committerArmin Le Grand <alg@apache.org>2012-11-20 13:38:15 +0000
commit4ae2ee84957b49f9b691341b8d9e93f920903d3c (patch)
tree553d904e86a9fae13b78f01cc765ee126afc9391
parent3e1227e38c424776cd28f9aba625b2ac61221e92 (diff)
When TRSetBaseGeometry at SdrObjCustomShape gives negative scales (mirrorings) use these to actually apply mirroring as intended to the shapes. This is always valid and a preparation for aw080 where the mirroring will be part of the objects transformstion
Notes
Notes: ignore: reverted
-rw-r--r--svx/inc/svx/svdoashp.hxx2
-rw-r--r--svx/source/svdraw/svdoashp.cxx31
-rw-r--r--svx/source/unodraw/unoshap2.cxx7
3 files changed, 37 insertions, 3 deletions
diff --git a/svx/inc/svx/svdoashp.hxx b/svx/inc/svx/svdoashp.hxx
index 1d8649c54dea..06efa70552c1 100644
--- a/svx/inc/svx/svdoashp.hxx
+++ b/svx/inc/svx/svdoashp.hxx
@@ -135,6 +135,8 @@ protected:
String aName;
public:
+ bool bPurposeFlipX;
+ bool bPurposeFlipY;
sal_Bool UseNoFillStyle() const;
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 00adc62c044b..6c42c3c91de4 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -3273,12 +3273,41 @@ void SdrObjCustomShape::TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix,
// #i75086# Old DrawingLayer (GeoStat and geometry) does not support holding negative scalings
// in X and Y which equal a 180 degree rotation. Recognize it and react accordingly
- if(basegfx::fTools::less(aScale.getX(), 0.0) && basegfx::fTools::less(aScale.getY(), 0.0))
+ const bool bMirrorX(basegfx::fTools::less(aScale.getX(), 0.0));
+ const bool bMirrorY(basegfx::fTools::less(aScale.getY(), 0.0));
+
+ if(bMirrorX && bMirrorY)
{
aScale.setX(fabs(aScale.getX()));
aScale.setY(fabs(aScale.getY()));
fRotate = fmod(fRotate + F_PI, F_2PI);
}
+ else if(bMirrorX || bMirrorY)
+ {
+ basegfx::B2DHomMatrix aNew;
+
+ // create pre-multiplied matrix without mirroring
+ aNew.translate(-0.5, -0.5);
+ aNew.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0);
+ aNew.translate(0.5, 0.5);
+ aNew = rMatrix * aNew;
+
+ // decompose to get corrected, mirror-free values
+ aNew.decompose(aScale, aTranslate, fRotate, fShearX);
+
+ // apply mirroring to CustomShapeGeometry
+ if((bool)IsMirroredX() != bMirrorX)
+ {
+ SetMirroredX(bMirrorX);
+ bPurposeFlipX = !bPurposeFlipX;
+ }
+
+ if((bool)IsMirroredY() != bMirrorY)
+ {
+ SetMirroredY(bMirrorY);
+ bPurposeFlipY = !bPurposeFlipY;
+ }
+ }
// reset object shear and rotations
aGeo.nDrehWink = 0;
diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx
index 36144e6cc0d5..17882c17608d 100644
--- a/svx/source/unodraw/unoshap2.cxx
+++ b/svx/source/unodraw/unoshap2.cxx
@@ -2098,6 +2098,7 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
{
bMirroredX = ( ((SdrObjCustomShape*)pObject)->IsMirroredX() );
bMirroredY = ( ((SdrObjCustomShape*)pObject)->IsMirroredY() );
+ ((SdrObjCustomShape*)pObject)->bPurposeFlipX = ((SdrObjCustomShape*)pObject)->bPurposeFlipY = false;
}
SvxShape::setPropertyValue( aPropertyName, aValue );
@@ -2126,7 +2127,8 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
pObject->NbcMirror( aTop, aBottom );
// NbcMirroring is flipping the current mirror state,
// so we have to set the correct state again
- ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
+ if(((SdrObjCustomShape*)pObject)->bPurposeFlipX)
+ ((SdrObjCustomShape*)pObject)->SetMirroredX( bMirroredX ? sal_False : sal_True );
}
if ( bNeedsMirrorY )
{
@@ -2135,7 +2137,8 @@ void SAL_CALL SvxCustomShape::setPropertyValue( const OUString& aPropertyName, c
pObject->NbcMirror( aLeft, aRight );
// NbcMirroring is flipping the current mirror state,
// so we have to set the correct state again
- ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
+ if(((SdrObjCustomShape*)pObject)->bPurposeFlipY)
+ ((SdrObjCustomShape*)pObject)->SetMirroredY( bMirroredY ? sal_False : sal_True );
}
if( pListCopy )