[Libreoffice-commits] .: Branch 'libreoffice-3-5-2' - 2 commits - basegfx/inc basegfx/source xmloff/inc xmloff/source

Petr Mladek pmladek at kemper.freedesktop.org
Mon Mar 26 07:46:38 PDT 2012


 basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx |    7 ++++-
 basegfx/source/polygon/b2dsvgpolypolygon.cxx        |    4 +--
 xmloff/inc/xexptran.hxx                             |    3 +-
 xmloff/source/draw/xexptran.cxx                     |   25 ++++++++++++++++++--
 xmloff/source/draw/ximp3dobject.cxx                 |    3 --
 xmloff/source/draw/ximpshap.cxx                     |    6 +---
 xmloff/source/style/MarkerStyle.cxx                 |    3 --
 xmloff/source/text/XMLTextFrameContext.cxx          |    3 --
 8 files changed, 38 insertions(+), 16 deletions(-)

New commits:
commit befb1c7e26b79ae97d802659f3386882d4044251
Author: Fridrich Å trba <fridrich.strba at bluewin.ch>
Date:   Mon Mar 26 12:55:44 2012 +0200

    Compatibility option for incorrect relative moves after closePath (fdo#47406)
    
    Signed-off-by: Thorsten Behrens <tbehrens at suse.com>
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
index 37d2cb5..5a59c3a 100644
--- a/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
+++ b/basegfx/inc/basegfx/polygon/b2dpolypolygontools.hxx
@@ -131,10 +131,15 @@ namespace basegfx
             @param rSvgDAttribute
             A valid SVG-D attribute string
 
+            @param rWrongPositionAfterZ
+            Indicates wheter the generator interprets wrongly
+            the position in the path after Z or z elements
+            https://bugs.freedesktop.org/show_bug.cgi?id=47406
+
             @return true, if the string was successfully parsed
          */
         BASEGFX_DLLPUBLIC bool importFromSvgD( B2DPolyPolygon&        o_rPolyPoly,
-                             const ::rtl::OUString& rSvgDAttribute );
+                             const ::rtl::OUString& rSvgDAttribute, bool bWrongPositionAfterZ = false );
 
         /** Read poly-polygon from SVG.
 
diff --git a/basegfx/source/polygon/b2dsvgpolypolygon.cxx b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
index 863adf5..2928364 100644
--- a/basegfx/source/polygon/b2dsvgpolypolygon.cxx
+++ b/basegfx/source/polygon/b2dsvgpolypolygon.cxx
@@ -210,7 +210,7 @@ namespace basegfx
             }
         }
 
-        bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString&  rSvgDStatement)
+        bool importFromSvgD(B2DPolyPolygon& o_rPolyPolygon, const ::rtl::OUString&  rSvgDStatement, bool bWrongPositionAfterZ)
         {
             o_rPolyPolygon.clear();
             const sal_Int32 nLen(rSvgDStatement.getLength());
@@ -241,7 +241,7 @@ namespace basegfx
                         bIsClosed = true;
 
                         // update current point - we're back at the start
-                        if( aCurrPoly.count() )
+                        if( aCurrPoly.count() && !bWrongPositionAfterZ)
                         {
                             const B2DPoint aFirst( aCurrPoly.getB2DPoint(0) );
                             nLastX = aFirst.getX();
diff --git a/xmloff/inc/xexptran.hxx b/xmloff/inc/xexptran.hxx
index 814ad2a..86883cf 100644
--- a/xmloff/inc/xexptran.hxx
+++ b/xmloff/inc/xexptran.hxx
@@ -36,6 +36,7 @@
 #include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/drawing/HomogenMatrix.hpp>
 #include <tools/mapunit.hxx>
+#include <xmloff/xmlimp.hxx>
 
 #include <vector>
 
@@ -171,7 +172,7 @@ public:
         const SdXMLImExViewBox& rViewBox,
         const com::sun::star::awt::Point& rObjectPos,
         const com::sun::star::awt::Size& rObjectSize,
-        const SvXMLUnitConverter& rConv);
+        const SvXMLImport& rImport);
 
     void AddPolygon(
         com::sun::star::drawing::PointSequence* pPoints,
diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index a2c46fe..e49d971 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -2122,7 +2122,7 @@ SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
     const SdXMLImExViewBox& rViewBox,
     const awt::Point& rObjectPos,
     const awt::Size& rObjectSize,
-    const SvXMLUnitConverter& /*rConv*/)
+    const SvXMLImport& rImport)
 :   msString( rNew ),
     mrViewBox( rViewBox ),
     mbIsClosed( false ),
@@ -2131,9 +2131,20 @@ SdXMLImExSvgDElement::SdXMLImExSvgDElement(const OUString& rNew,
     mnLastY( 0L ),
     maPoly()
 {
+    bool bWrongPositionAfterZ( false );
+	sal_Int32 nUPD( 0 );
+	sal_Int32 nBuildId( 0 );
+	if ( rImport.getBuildIds( nUPD, nBuildId ) &&
+       ( ( nUPD == 641 ) || ( nUPD == 645 ) || ( nUPD == 680 ) || ( nUPD == 300 ) ||
+         ( nUPD == 310 ) || ( nUPD == 320 ) || ( nUPD == 330 ) || ( nUPD == 340 ) ||
+         ( nUPD == 350 && nBuildId < 202 ) ) )
+    {
+        bWrongPositionAfterZ = true;
+    }
+
     // convert string to polygon
     basegfx::B2DPolyPolygon aPoly;
-    basegfx::tools::importFromSvgD(aPoly,msString);
+    basegfx::tools::importFromSvgD(aPoly,msString,bWrongPositionAfterZ);
 
     mbIsCurve = aPoly.areControlPointsUsed();
     mbIsClosed = aPoly.isClosed();
diff --git a/xmloff/source/draw/ximp3dobject.cxx b/xmloff/source/draw/ximp3dobject.cxx
index 3051578..efeb89e 100644
--- a/xmloff/source/draw/ximp3dobject.cxx
+++ b/xmloff/source/draw/ximp3dobject.cxx
@@ -399,8 +399,7 @@ void SdXML3DPolygonBasedShapeContext::StartElement(const uno::Reference< xml::sa
             SdXMLImExViewBox aViewBox(maViewBox, GetImport().GetMM100UnitConverter());
             awt::Point aMinPoint(aViewBox.GetX(), aViewBox.GetY());
             awt::Size aMaxSize(aViewBox.GetWidth(), aViewBox.GetHeight());
-            SdXMLImExSvgDElement aPoints(maPoints, aViewBox,
-                aMinPoint, aMaxSize, GetImport().GetMM100UnitConverter());
+            SdXMLImExSvgDElement aPoints(maPoints, aViewBox, aMinPoint, aMaxSize, GetImport());
 
             // convert to double sequences
             drawing::PointSequenceSequence& xPoSeSe =
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index 24824d9..68192ec 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1421,8 +1421,7 @@ void SdXMLPathShapeContext::StartElement(const uno::Reference< xml::sax::XAttrib
         {
             aSize = maSize;
         }
-        SdXMLImExSvgDElement aPoints(maD, aViewBox,
-            aPosition, aSize, GetImport().GetMM100UnitConverter());
+        SdXMLImExSvgDElement aPoints(maD, aViewBox, aPosition, aSize, GetImport());
 
         const char* pService;
         // now create shape
@@ -1861,8 +1860,7 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r
             awt::Point aPoint( 0, 0 );
             awt::Size aSize( 1, 1 );
 
-            SdXMLImExSvgDElement aPoints( rValue, aViewBox,
-                aPoint, aSize, GetImport().GetMM100UnitConverter() );
+            SdXMLImExSvgDElement aPoints( rValue, aViewBox, aPoint, aSize, GetImport() );
 
             if ( aPoints.IsCurve() )
             {
diff --git a/xmloff/source/style/MarkerStyle.cxx b/xmloff/source/style/MarkerStyle.cxx
index ff806f7..0694e3e 100644
--- a/xmloff/source/style/MarkerStyle.cxx
+++ b/xmloff/source/style/MarkerStyle.cxx
@@ -107,8 +107,7 @@ sal_Bool XMLMarkerStyleImport::importXML(
     if( bHasViewBox && bHasPathData )
     {
         SdXMLImExSvgDElement aPoints(strPathData, *pViewBox, awt::Point( 0, 0 ),
-            awt::Size( pViewBox->GetWidth(), pViewBox->GetHeight() ),
-            rUnitConverter );
+            awt::Size( pViewBox->GetWidth(), pViewBox->GetHeight() ), rImport );
 
         if(aPoints.IsCurve())
         {
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index f12f66b..ebcf38d 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -313,8 +313,7 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl(
         Any aAny;
         if( bPath )
         {
-            SdXMLImExSvgDElement aPoints( sD, aViewBox, aPoint, aSize,
-                                          GetImport().GetMM100UnitConverter() );
+            SdXMLImExSvgDElement aPoints( sD, aViewBox, aPoint, aSize, GetImport() );
             aAny <<= aPoints.GetPointSequenceSequence();
         }
         else
commit 60a291d006890bc539d5cd19d03a930628d7d756
Author: Thorsten Behrens <tbehrens at suse.com>
Date:   Fri Mar 23 17:46:43 2012 +0100

    Fix fdo#47406 incorrect relative moves after closePath
    
    I missed the fact that odf export still uses the old exporter in
    xmloff/source/draw/xexptran.cxx, which was not fixed wrt. the update
    of current position in basegfx/source/polygon/b2dsvgpolypolygon.cxx
    
    Conflicts:
    
    	xmloff/source/draw/xexptran.cxx
    
    Signed-off-by: Fridrich Å trba <fridrich.strba at bluewin.ch>
    Signed-off-by: Michael Meeks <michael.meeks at suse.com>
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx
index 98fb45a..a2c46fe 100644
--- a/xmloff/source/draw/xexptran.cxx
+++ b/xmloff/source/draw/xexptran.cxx
@@ -1607,6 +1607,7 @@ void SdXMLImExSvgDElement::AddPolygon(
 
         // bezier poly, handle curves
         bool  bDidWriteStart(false);
+        sal_Int32 nStartX(0), nStartY(0);
 
         for(sal_Int32 a(0L); a < nCnt; a++)
         {
@@ -2081,6 +2082,8 @@ void SdXMLImExSvgDElement::AddPolygon(
 
                         // remember start written
                         bDidWriteStart = true;
+                        nStartX = nX;
+                        nStartY = nY;
                     }
 
                     // remember new last position
@@ -2101,6 +2104,13 @@ void SdXMLImExSvgDElement::AddPolygon(
                 aNewString += String(sal_Unicode('z'));
             else
                 aNewString += String(sal_Unicode('Z'));
+
+            // update current point - we're back at the start
+            if( bDidWriteStart )
+            {
+                mnLastX = nStartX;
+                mnLastY = nStartY;
+            }
         }
 
         // append new string


More information about the Libreoffice-commits mailing list