openoffice-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1412119 - in /incubator/ooo/trunk/main: svx/source/svdraw/svdoashp.cxx xmloff/source/draw/ximpshap.cxx xmloff/source/draw/ximpshap.hxx
Date Wed, 21 Nov 2012 14:23:02 GMT
Author: alg
Date: Wed Nov 21 14:23:01 2012
New Revision: 1412119

URL: http://svn.apache.org/viewvc?rev=1412119&view=rev
Log:
For backward compatibility do take mirrorings in setTransformation into account. Also found
an error in SdrObjCustomShape::TRGetBaseGeometry when MirrorY was used

Modified:
    incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx
    incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx
    incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx

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=1412119&r1=1412118&r2=1412119&view=diff
==============================================================================
--- incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx (original)
+++ incubator/ooo/trunk/main/svx/source/svdraw/svdoashp.cxx Wed Nov 21 14:23:01 2012
@@ -3437,11 +3437,11 @@ sal_Bool SdrObjCustomShape::TRGetBaseGeo
 			}
 			// Polygon wenden und etwas schieben
 			Polygon aPol0(aPol);
-			aPol[0]=aPol0[1];
-			aPol[1]=aPol0[0];
-			aPol[2]=aPol0[3];
-			aPol[3]=aPol0[2];
-			aPol[4]=aPol0[1];
+			aPol[0]=aPol0[3]; // This was WRONG for vertical (!)
+			aPol[1]=aPol0[2];
+			aPol[2]=aPol0[1];
+			aPol[3]=aPol0[0];
+			aPol[4]=aPol0[3];
 			Poly2Rect(aPol,aRectangle,aNewGeo);
 		}
 	}

Modified: incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx?rev=1412119&r1=1412118&r2=1412119&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.cxx Wed Nov 21 14:23:01 2012
@@ -19,13 +19,9 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_xmloff.hxx"
 
-
-
 #include <tools/debug.hxx>
 #include <com/sun/star/document/XEventsSupplier.hpp>
 #include <com/sun/star/container/XNameReplace.hpp>
@@ -40,7 +36,6 @@
 #include <com/sun/star/drawing/EscapeDirection.hpp>
 #include <com/sun/star/media/ZoomLevel.hpp>
 #include <com/sun/star/awt/Rectangle.hpp>
-
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
 #include <comphelper/extract.hxx>
@@ -74,7 +69,6 @@
 #include "XMLImageMapContext.hxx"
 #include "sdpropls.hxx"
 #include "eventimp.hxx"
-
 #include "descriptionimp.hxx"
 #include "ximpcustomshape.hxx"
 #include "XMLEmbeddedObjectImportContext.hxx"
@@ -83,10 +77,8 @@
 #include <tools/string.hxx>
 #include <com/sun/star/drawing/XEnhancedCustomShapeDefaulter.hpp>
 #include <com/sun/star/container/XChild.hpp>
-
-// --> OD 2006-02-22 #b6382898#
 #include <com/sun/star/text/XTextDocument.hpp>
-// <--
+#include <basegfx/vector/b2dvector.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -164,6 +156,7 @@ SdXMLShapeContext::SdXMLShapeContext(
 ,	mnZOrder(-1)
 ,	maSize(1, 1)
 ,	maPosition(0, 0)
+,   maUsedTransformation()
 ,	mbVisible(true)
 ,	mbPrintable(true)
 {
@@ -541,7 +534,7 @@ void SdXMLShapeContext::SetTransformatio
 		uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY);
 		if(xPropSet.is())
 		{
-			::basegfx::B2DHomMatrix aTransformation;
+			maUsedTransformation.identity();
 
 			if(maSize.Width != 1 || maSize.Height != 1)
 			{
@@ -552,13 +545,13 @@ void SdXMLShapeContext::SetTransformatio
 					maSize.Height = 1;
 
 				// set global size. This should always be used.
-				aTransformation.scale(maSize.Width, maSize.Height);
+				maUsedTransformation.scale(maSize.Width, maSize.Height);
 			}
 
 			if(maPosition.X != 0 || maPosition.Y != 0)
 			{
 				// if global position is used, add it to transformation
-				aTransformation.translate(maPosition.X, maPosition.Y);
+				maUsedTransformation.translate(maPosition.X, maPosition.Y);
 			}
 
 			if(mnTransform.NeedsAction())
@@ -572,24 +565,24 @@ void SdXMLShapeContext::SetTransformatio
 				mnTransform.GetFullTransform(aMat);
 
 				// now add to transformation
-				aTransformation *= aMat;
+				maUsedTransformation *= aMat;
 			}
 
 			// now set transformation for this object
 			uno::Any aAny;
 			drawing::HomogenMatrix3 aMatrix;
 
-			aMatrix.Line1.Column1 = aTransformation.get(0, 0);
-			aMatrix.Line1.Column2 = aTransformation.get(0, 1);
-			aMatrix.Line1.Column3 = aTransformation.get(0, 2);
-
-			aMatrix.Line2.Column1 = aTransformation.get(1, 0);
-			aMatrix.Line2.Column2 = aTransformation.get(1, 1);
-			aMatrix.Line2.Column3 = aTransformation.get(1, 2);
-
-			aMatrix.Line3.Column1 = aTransformation.get(2, 0);
-			aMatrix.Line3.Column2 = aTransformation.get(2, 1);
-			aMatrix.Line3.Column3 = aTransformation.get(2, 2);
+			aMatrix.Line1.Column1 = maUsedTransformation.get(0, 0);
+			aMatrix.Line1.Column2 = maUsedTransformation.get(0, 1);
+			aMatrix.Line1.Column3 = maUsedTransformation.get(0, 2);
+
+			aMatrix.Line2.Column1 = maUsedTransformation.get(1, 0);
+			aMatrix.Line2.Column2 = maUsedTransformation.get(1, 1);
+			aMatrix.Line2.Column3 = maUsedTransformation.get(1, 2);
+
+			aMatrix.Line3.Column1 = maUsedTransformation.get(2, 0);
+			aMatrix.Line3.Column2 = maUsedTransformation.get(2, 1);
+			aMatrix.Line3.Column3 = maUsedTransformation.get(2, 2);
 
 			aAny <<= aMatrix;
 
@@ -3683,6 +3676,48 @@ void SdXMLCustomShapeContext::StartEleme
 
 void SdXMLCustomShapeContext::EndElement()
 {
+    // for backward compatibility, the above SetTransformation() may alraedy have
+    // applied a call to SetMirroredX/SetMirroredY. This is not yet added to the
+    // beans::PropertyValues in maCustomShapeGeometry. When applying these now, this 
+    // would be lost again.
+    // TTTT: Remove again after aw080
+    if(!maUsedTransformation.isIdentity())
+    {
+        basegfx::B2DVector aScale, aTranslate;
+        double fRotate, fShearX;
+
+        maUsedTransformation.decompose(aScale, aTranslate, fRotate, fShearX);
+
+        bool bFlippedX(aScale.getX() < 0.0);
+        bool bFlippedY(aScale.getY() < 0.0);
+
+        if(bFlippedX && bFlippedY)
+        {
+            // when both are used it is the same as 180 degree rotation; reset
+            bFlippedX = bFlippedY = false;
+        }
+
+        if(bFlippedX || bFlippedY)
+        {
+            beans::PropertyValue aNewPoroperty;
+
+            if(bFlippedX)
+            {
+                aNewPoroperty.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MirroredX"));
+            }
+            else
+            {
+                aNewPoroperty.Name = rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MirroredY"));
+            }
+
+            aNewPoroperty.Handle = -1;
+            aNewPoroperty.Value <<= sal_True;
+            aNewPoroperty.State = beans::PropertyState_DIRECT_VALUE;
+
+            maCustomShapeGeometry.push_back(aNewPoroperty);
+        }
+    }
+
 	if ( !maCustomShapeGeometry.empty() )
 	{
 		const rtl::OUString	sCustomShapeGeometry	( RTL_CONSTASCII_USTRINGPARAM( "CustomShapeGeometry"
) );

Modified: incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx?rev=1412119&r1=1412118&r2=1412119&view=diff
==============================================================================
--- incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx (original)
+++ incubator/ooo/trunk/main/xmloff/source/draw/ximpshap.hxx Wed Nov 21 14:23:01 2012
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef _XIMPSHAPE_HXX
 #define _XIMPSHAPE_HXX
 
@@ -35,10 +33,10 @@
 #include <com/sun/star/awt/Point.hpp>
 #include <tools/rtti.hxx>
 #include "xexptran.hxx"
-
 #include <vector>
 #include <xmloff/shapeimport.hxx>
 #include <xmloff/xmlmultiimagehelper.hxx>
+#include <basegfx/matrix/b2dhommatrix.hxx>
 
 //////////////////////////////////////////////////////////////////////////////
 // common shape context
@@ -79,6 +77,7 @@ protected:
 	SdXMLImExTransform2D		mnTransform;
 	com::sun::star::awt::Size	maSize;
 	com::sun::star::awt::Point	maPosition;
+    basegfx::B2DHomMatrix       maUsedTransformation;
 
 	bool						mbVisible;
 	bool						mbPrintable;



Mime
View raw message