[Libreoffice-commits] core.git: svx/source

Armin Le Grand alg at apache.org
Wed Jun 5 09:02:36 PDT 2013


 svx/source/svdraw/svdoashp.cxx |  106 ++++++++++++++++++-----------------------
 1 file changed, 48 insertions(+), 58 deletions(-)

New commits:
commit efce445d0eb5709b86499e8f79f933d918cb3dd6
Author: Armin Le Grand <alg at apache.org>
Date:   Tue Dec 11 13:43:12 2012 +0000

    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

diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index babab98..91e46be 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();
 }
 


More information about the Libreoffice-commits mailing list