diff options
author | Armin Le Grand <alg@apache.org> | 2012-12-11 13:43:12 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-05 16:53:51 +0100 |
commit | efce445d0eb5709b86499e8f79f933d918cb3dd6 (patch) | |
tree | 2c47b81ea89e4b647acc6c1989aebd94d3a7086c | |
parent | f3d27c66e14745632f83ca4d1b80473e70b85c96 (diff) |
Resolves: #i55394# solve mirror problem for CustomShapes
Patch by: Regina
Review by: alg
(cherry picked from commit 79fe1227e77fa66cbfd9c4d1ca106b596966bd18)
Conflicts:
svx/source/svdraw/svdoashp.cxx
Change-Id: I0e8c15b3dd3b6b930dffa862c349270c27966704
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 106 |
1 files changed, 48 insertions, 58 deletions
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index babab98398e0..91e46be4c7c6 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1644,62 +1644,48 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, long nWink, double sn, dou void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 ) { + // TTTT: Fix for old mirroring, can be removed again in aw080 // storing horizontal and vertical flipping without modifying the rotate angle - sal_Bool bHorz = sal_False; - sal_Bool bVert = sal_False; - if ( rRef1.X() == rRef2.X() ) - bHorz = sal_True; - if ( rRef1.Y() == rRef2.Y() ) - bVert = sal_True; - if ( !bHorz && !bVert ) - bHorz = bVert = sal_True; + // decompose other flipping to rotation and MirrorX. + long ndx = rRef2.X()-rRef1.X(); + long ndy = rRef2.Y()-rRef1.Y(); - if ( bHorz || bVert ) + if(!ndx) // MirroredX { - SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); - - // "MirroredX" // - if ( bHorz ) + SetMirroredX(!IsMirroredX()); + SdrTextObj::NbcMirror( rRef1, rRef2 ); + } + else + { + if(!ndy) // MirroredY { - const OUString sMirroredX( "MirroredX" ); - com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredX ); - if ( pAny ) - { - sal_Bool bFlip = sal_Bool(); - if ( *pAny >>= bFlip ) - { - if ( bFlip ) - bHorz = sal_False; - } - } - PropertyValue aPropVal; - aPropVal.Name = sMirroredX; - aPropVal.Value <<= bHorz; - aGeometryItem.SetPropertyValue( aPropVal ); + SetMirroredY(!IsMirroredY()); + SdrTextObj::NbcMirror( rRef1, rRef2 ); } - - // "MirroredY" // - if ( bVert ) + else // neither horizontal nor vertical { - const OUString sMirroredY( "MirroredY" ); - com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY ); - if ( pAny ) + SetMirroredX(!IsMirroredX()); + + // call parent + SdrTextObj::NbcMirror( rRef1, rRef2 ); + + // update fObjectRotation + long nTextObjRotation = aGeo.nDrehWink; + double fWink = nTextObjRotation; + + fWink /= 100.0; + + bool bSingleFlip = (IsMirroredX()!= IsMirroredY()); + + fObjectRotation = fmod( bSingleFlip ? -fWink : fWink, 360.0 ); + + if ( fObjectRotation < 0 ) { - sal_Bool bFlip = sal_Bool(); - if ( *pAny >>= bFlip ) - { - if ( bFlip ) - bVert = sal_False; - } + fObjectRotation = 360.0 + fObjectRotation; } - PropertyValue aPropVal; - aPropVal.Name = sMirroredY; - aPropVal.Value <<= bVert; - aGeometryItem.SetPropertyValue( aPropVal ); - } - SetMergedItem( aGeometryItem ); + } } - SdrTextObj::NbcMirror( rRef1, rRef2 ); + InvalidateRenderGeometry(); } @@ -1710,20 +1696,24 @@ void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, bool bV } void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, bool bVShear ) { - long nDrehWink = aGeo.nDrehWink; - if ( nDrehWink ) - { - aGeo.nDrehWink = -nDrehWink; - aGeo.RecalcSinCos(); - NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos ); - } + // TTTT: Fix for old mirroring, can be removed again in aw080 SdrTextObj::NbcShear(rRef,nWink,tn,bVShear); - if ( nDrehWink ) + + // updating fObjectRotation + long nTextObjRotation = aGeo.nDrehWink; + double fWink = nTextObjRotation; + + fWink /= 100.0; + + bool bSingleFlip = (IsMirroredX()!= IsMirroredY()); + + fObjectRotation = fmod( bSingleFlip ? -fWink : fWink, 360.0 ); + + if ( fObjectRotation < 0 ) { - aGeo.nDrehWink = nDrehWink; - aGeo.RecalcSinCos(); - Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos ); + fObjectRotation = 360.0 + fObjectRotation; } + InvalidateRenderGeometry(); } |