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

Armin Le Grand alg at apache.org
Tue Nov 5 16:04:47 CET 2013


 xmloff/source/draw/shapeexport.cxx |   68 ++++++++++++++++---------------------
 1 file changed, 30 insertions(+), 38 deletions(-)

New commits:
commit 0794e9ec93be4cfa11daefdb2e428952ea7669a5
Author: Armin Le Grand <alg at apache.org>
Date:   Wed Oct 30 12:52:12 2013 +0000

    corrected export of polygons with text
    
    (cherry picked from commit c0f65b29f8028ab750c8caac033645c3da3cf2f5)
    
    Conflicts:
    	xmloff/source/draw/shapeexport2.cxx
    
    Change-Id: Ic8da384d094ce735ecba51b282de7a697558e51f

diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index e341f71..ec3ec75c 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2097,26 +2097,27 @@ void XMLShapeExport::ImpExportEllipseShape(
 
         sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
 
+        // prepare name (with most used)
+        enum ::xmloff::token::XMLTokenEnum eName(XML_CIRCLE);
+
         if(bCircle)
         {
-            // write circle
-            SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True);
-
-            ImpExportDescription( xShape ); // #i68101#
-            ImpExportEvents( xShape );
-            ImpExportGluePoints( xShape );
-            ImpExportText( xShape );
+            // name already set
         }
         else
         {
-            // write ellipse
-            SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True);
-
-            ImpExportDescription( xShape ); // #i68101#
-            ImpExportEvents( xShape );
-            ImpExportGluePoints( xShape );
-            ImpExportText( xShape );
+            // set name
+            eName = XML_ELLIPSE;
         }
+
+        // write ellipse or circle
+        SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, eName, bCreateNewline, sal_True);
+
+        ImpExportDescription( xShape ); // #i68101#
+        ImpExportEvents( xShape );
+        ImpExportGluePoints( xShape );
+        ImpExportText( xShape );
+
     }
 }
 
@@ -2152,6 +2153,9 @@ void XMLShapeExport::ImpExportPolygonShape(
 
         sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210#
 
+        // prepare name (with most used)
+        enum ::xmloff::token::XMLTokenEnum eName(XML_PATH);
+
         if(bBezier)
         {
             // get PolygonBezier
@@ -2171,15 +2175,6 @@ void XMLShapeExport::ImpExportPolygonShape(
 
                 // write point array
                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
-
-                // write object now
-                SvXMLElementExport aOBJ(
-                    mrExport,
-                    XML_NAMESPACE_DRAW,
-                    XML_PATH,
-                    bCreateNewline,
-                    sal_True);
-
             }
         }
         else
@@ -2198,13 +2193,8 @@ void XMLShapeExport::ImpExportPolygonShape(
                 // write point array
                 mrExport.AddAttribute(XML_NAMESPACE_DRAW, XML_POINTS, aPointString);
 
-                // write object now
-                SvXMLElementExport aOBJ(
-                    mrExport,
-                    XML_NAMESPACE_DRAW,
-                    aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE,
-                    bCreateNewline,
-                    sal_True);
+                // set name
+                eName = aPolygon.isClosed() ? XML_POLYGON : XML_POLYLINE;
             }
             else
             {
@@ -2218,17 +2208,19 @@ void XMLShapeExport::ImpExportPolygonShape(
 
                 // write point array
                 mrExport.AddAttribute(XML_NAMESPACE_SVG, XML_D, aPolygonString);
-
-                // write object now
-                SvXMLElementExport aOBJ(
-                    mrExport,
-                    XML_NAMESPACE_DRAW,
-                    XML_PATH,
-                    bCreateNewline,
-                    sal_True);
             }
         }
 
+        // write object, but after attributes are added since the destructor will
+        // consume all of these added attributes. Also before text is added; this may
+        // open another SvXMLElementExport scope which needs to be inside this one
+        SvXMLElementExport aOBJ(
+            mrExport,
+            XML_NAMESPACE_DRAW,
+            eName,
+            bCreateNewline,
+            sal_True);
+
         ImpExportDescription( xShape ); // #i68101#
         ImpExportEvents( xShape );
         ImpExportGluePoints( xShape );


More information about the Libreoffice-commits mailing list