openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1411685 - in /incubator/ooo/trunk/main/svx: inc/svx/svdoashp.hxx source/svdraw/svdoashp.cxx source/unodraw/unoshap2.cxx
Date Tue, 20 Nov 2012 14:38:16 GMT
Author: alg
Date: Tue Nov 20 14:38:15 2012
New Revision: 1411685

URL: http://svn.apache.org/viewvc?rev=1411685&view=rev
Log:
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

Modified:
    incubator/ooo/trunk/main/svx/inc/svx/svdoashp.hxx
    incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx
    incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx

Modified: incubator/ooo/trunk/main/svx/inc/svx/svdoashp.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/inc/svx/svdoashp.hxx?rev=1411685&r1=1411684&r2=1411685&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/inc/svx/svdoashp.hxx (original)
+++ incubator/ooo/trunk/main/svx/inc/svx/svdoashp.hxx Tue Nov 20 14:38:15 2012
@@ -135,6 +135,8 @@ protected:
 	String		aName;
 
 public:
+    bool bPurposeFlipX;
+    bool bPurposeFlipY;
 
 	sal_Bool UseNoFillStyle() const;
 

Modified: incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx?rev=1411685&r1=1411684&r2=1411685&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx Tue Nov 20 14:38:15 2012
@@ -3273,12 +3273,41 @@ void SdrObjCustomShape::TRSetBaseGeometr
 
 	// #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;

Modified: incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx?rev=1411685&r1=1411684&r2=1411685&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/unodraw/unoshap2.cxx Tue Nov 20 14:38:15 2012
@@ -2098,6 +2098,7 @@ void SAL_CALL SvxCustomShape::setPropert
 	{
 		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::setPropert
 			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::setPropert
 			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 )



Mime
View raw message