Author: alg Date: Wed Oct 30 12:52:12 2013 New Revision: 1537067 URL: http://svn.apache.org/r1537067 Log: i122433 corrected export of polygons with text
Modified: openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx Modified: openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx URL: http://svn.apache.org/viewvc/openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx?rev=1537067&r1=1537066&r2=1537067&view=diff ============================================================================== --- openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx (original) +++ openoffice/trunk/main/xmloff/source/draw/shapeexport2.cxx Wed Oct 30 12:52:12 2013 @@ -954,27 +954,27 @@ void XMLShapeExport::ImpExportEllipseSha sal_Bool bCreateNewline( (nFeatures & SEF_EXPORT_NO_WS) == 0 ); // #86116#/#92210# - if(bCircle) - { - // write circle - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_CIRCLE, bCreateNewline, sal_True); + // prepare name (with most used) + enum ::xmloff::token::XMLTokenEnum eName(XML_CIRCLE); - ImpExportDescription( xShape ); // #i68101# - ImpExportEvents( xShape ); - ImpExportGluePoints( xShape ); - ImpExportText( xShape ); - } - else - { - // write ellipse - SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, XML_ELLIPSE, bCreateNewline, sal_True); + if(bCircle) + { + // name already set + } + else + { + // set name + eName = XML_ELLIPSE; + } - ImpExportDescription( xShape ); // #i68101# - ImpExportEvents( xShape ); - ImpExportGluePoints( xShape ); - ImpExportText( xShape ); - } - } + // write ellipse or circle + SvXMLElementExport aOBJ(mrExport, XML_NAMESPACE_DRAW, eName, bCreateNewline, sal_True); + + ImpExportDescription( xShape ); // #i68101# + ImpExportEvents( xShape ); + ImpExportGluePoints( xShape ); + ImpExportText( xShape ); + } } ////////////////////////////////////////////////////////////////////////////// @@ -1013,6 +1013,9 @@ void XMLShapeExport::ImpExportPolygonSha 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 @@ -1032,14 +1035,6 @@ void XMLShapeExport::ImpExportPolygonSha // 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 @@ -1058,13 +1053,8 @@ void XMLShapeExport::ImpExportPolygonSha // 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 { @@ -1078,17 +1068,19 @@ void XMLShapeExport::ImpExportPolygonSha // 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 );