openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1420199 - /openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx
Date Tue, 11 Dec 2012 14:43:13 GMT
Author: alg
Date: Tue Dec 11 14:43:12 2012
New Revision: 1420199

URL: http://svn.apache.org/viewvc?rev=1420199&view=rev
Log:
#55394# Applied patch from Regina to solve mirror problem for CustomShapes
Patch by: Regina
Review by: alg

Modified:
    openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx

Modified: openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx?rev=1420199&r1=1420198&r2=1420199&view=diff
==============================================================================
--- openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx (original)
+++ openoffice/trunk/main/svx/source/svdraw/svdoashp.cxx Tue Dec 11 14:43:12 2012
@@ -1921,68 +1921,49 @@ void SdrObjCustomShape::NbcRotate( const
 
 void SdrObjCustomShape::NbcMirror( const Point& rRef1, const Point& rRef2 )
 {
-	// storing horizontal and vertical flipping without modifying the rotate angle
+    // TTTT: Fix for old mirroring, can be removed again in aw080
+    // storing horizontal and vertical flipping without modifying the rotate angle
+    // decompose other flipping to rotation and MirrorX.
+    long ndx = rRef2.X()-rRef1.X();
+    long ndy = rRef2.Y()-rRef1.Y();
 
-	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;
-
-	if ( bHorz || bVert )
-	{
-		SdrCustomShapeGeometryItem aGeometryItem( (SdrCustomShapeGeometryItem&)GetMergedItem(
SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
-
-		/////////////////
-		// "MirroredX" //
-		/////////////////
-		if ( bHorz )
-		{
-			const rtl::OUString	sMirroredX( RTL_CONSTASCII_USTRINGPARAM ( "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 );
-		}
-
-		/////////////////
-		// "MirroredY" //
-		/////////////////
-		if ( bVert )
-		{
-			const rtl::OUString	sMirroredY( RTL_CONSTASCII_USTRINGPARAM ( "MirroredY" ) );
-			com::sun::star::uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sMirroredY );
-			if ( pAny )
-			{
-				sal_Bool bFlip = sal_Bool();
-				if ( *pAny >>= bFlip )
-				{
-					if ( bFlip )
-						bVert = sal_False;
-				}
-			}
-			PropertyValue aPropVal;
-			aPropVal.Name = sMirroredY;
-			aPropVal.Value <<= bVert;
-			aGeometryItem.SetPropertyValue( aPropVal );
-		}
-		SetMergedItem( aGeometryItem );
-	}
-	SdrTextObj::NbcMirror( rRef1, rRef2 );
-	InvalidateRenderGeometry();
+    if(!ndx) // MirroredX
+    {
+         SetMirroredX(!IsMirroredX());
+         SdrTextObj::NbcMirror( rRef1, rRef2 );
+    }
+    else
+    {
+        if(!ndy)  // MirroredY
+        {
+            SetMirroredY(!IsMirroredY());
+            SdrTextObj::NbcMirror( rRef1, rRef2 );
+        }
+        else // neither horizontal nor vertical
+        {
+            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 )
+            {
+                fObjectRotation = 360.0 + fObjectRotation;
+            }
+         }
+    }
+
+    InvalidateRenderGeometry();
 }
 
 void SdrObjCustomShape::Shear( const Point& rRef, long nWink, double tn, FASTBOOL bVShear
)
@@ -1992,21 +1973,25 @@ void SdrObjCustomShape::Shear( const Poi
 }
 void SdrObjCustomShape::NbcShear( const Point& rRef, long nWink, double tn, FASTBOOL
bVShear )
 {
-	long nDrehWink = aGeo.nDrehWink;
-	if ( nDrehWink )
-	{
-		aGeo.nDrehWink = -nDrehWink;
-		aGeo.RecalcSinCos();
-		NbcRotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
-	}
-	SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
-	if ( nDrehWink )
-	{
-		aGeo.nDrehWink = nDrehWink;
-		aGeo.RecalcSinCos();
-		Rotate( rRef, aGeo.nDrehWink, aGeo.nSin, aGeo.nCos );
-	}
-	InvalidateRenderGeometry();
+    // TTTT: Fix for old mirroring, can be removed again in aw080
+     SdrTextObj::NbcShear(rRef,nWink,tn,bVShear);
+
+    // 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 )
+    {
+        fObjectRotation = 360.0 + fObjectRotation;
+    }
+
+    InvalidateRenderGeometry();
 }
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////



Mime
View raw message