Author: alg
Date: Mon Apr  8 12:46:32 2013
New Revision: 1465615

URL: http://svn.apache.org/r1465615
Log:
i121965 Take draw:transform into account for draw:connector shapes

Modified:
    openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx

Modified: openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx
URL: 
http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx?rev=1465615&r1=1465614&r2=1465615&view=diff
==============================================================================
--- openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx (original)
+++ openoffice/trunk/main/xmloff/source/draw/ximpshap.cxx Mon Apr  8 12:46:32 
2013
@@ -79,6 +79,7 @@
 #include <com/sun/star/container/XChild.hpp>
 #include <com/sun/star/text/XTextDocument.hpp>
 #include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/point/b2dpoint.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
@@ -1805,6 +1806,11 @@ void SdXMLConnectorShapeContext::process
                        SvXMLUnitConverter::convertEnum( mnType, rValue, 
aXML_ConnectionKind_EnumMap );
                        return;
                }
+        // #121965# draw:transform may be used in ODF1.2, e.g. exports from MS 
seem to use these
+               else if( IsXMLToken( rLocalName, XML_TRANSFORM ) )
+               {
+                       mnTransform.SetString(rValue, 
GetImport().GetMM100UnitConverter());
+               }
        }
        case XML_NAMESPACE_SVG:
        {
@@ -1892,7 +1898,30 @@ void SdXMLConnectorShapeContext::StartEl
                AddShape("com.sun.star.drawing.ConnectorShape");
                if(mxShape.is())
                {
-                       // add connection ids
+            // #121965# if draw:transform is used, apply directly to the start
+            // and end positions before using these
+            if(mnTransform.NeedsAction())
+            {
+                // transformation is used, apply to object.
+                ::basegfx::B2DHomMatrix aMat;
+                mnTransform.GetFullTransform(aMat);
+
+                if(!aMat.isIdentity())
+                {
+                    basegfx::B2DPoint aStart(maStart.X, maStart.Y);
+                    basegfx::B2DPoint aEnd(maEnd.X, maEnd.Y);
+
+                    aStart = aMat * aStart;
+                    aEnd = aMat * aEnd;
+
+                    maStart.X = basegfx::fround(aStart.getX());
+                    maStart.Y = basegfx::fround(aStart.getY());
+                    maEnd.X = basegfx::fround(aEnd.getX());
+                    maEnd.Y = basegfx::fround(aEnd.getY());
+                }
+            }
+
+            // add connection ids
                        if( maStartShapeId.getLength() )
                                
GetImport().GetShapeImport()->addShapeConnection( mxShape, sal_True, 
maStartShapeId, mnStartGlueId );
                        if( maEndShapeId.getLength() )


Reply via email to