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

Korrawit Pruegsanusak detective.conan.1412 at gmail.com
Sat Dec 7 23:35:36 PST 2013


 drawinglayer/source/dumper/XShapeDumper.cxx |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit a78f683b1e53d1328af11abdcd362e93db837701
Author: Korrawit Pruegsanusak <detective.conan.1412 at gmail.com>
Date:   Sun Dec 8 14:26:25 2013 +0700

    fdo#72260: guard against duplicate "name" attribute
    
    Change-Id: I1ee4b82e04318a50db8bb54bd5c7e00c79177d37
    Reviewed-on: https://gerrit.libreoffice.org/6984
    Reviewed-by: Markus Mohrhard <markus.mohrhard at googlemail.com>
    Tested-by: Markus Mohrhard <markus.mohrhard at googlemail.com>

diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 089640b..accb18a 100644
--- a/drawinglayer/source/dumper/XShapeDumper.cxx
+++ b/drawinglayer/source/dumper/XShapeDumper.cxx
@@ -172,6 +172,8 @@ int closeCallback(void* )
     return 0;
 }
 
+bool m_bNameDumped;
+
 // ----------------------------------------
 // ---------- FillProperties.idl ----------
 // ----------------------------------------
@@ -1007,8 +1009,11 @@ void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWrite
 
 void dumpNameAsAttribute(OUString sName, xmlTextWriterPtr xmlWriter)
 {
-    if(!sName.isEmpty())
+    if(!sName.isEmpty() && !m_bNameDumped)
+    {
         xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
+        m_bNameDumped = true;
+    }
 }
 
 void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter)
@@ -1806,6 +1811,7 @@ void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWr
     uno::Reference< beans::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
     uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
     OUString aName;
+    m_bNameDumped = false;
 
     dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
     dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
@@ -1823,7 +1829,10 @@ void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWr
         if (aAny >>= aName)
         {
             if (!aName.isEmpty())
+            {
                 xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
+                m_bNameDumped = true;
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list