summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKorrawit Pruegsanusak <detective.conan.1412@gmail.com>2013-12-08 14:26:25 +0700
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2013-12-08 07:35:11 +0000
commita78f683b1e53d1328af11abdcd362e93db837701 (patch)
treeae58d3f1a1cecf391ee4d4e0bc230e7c90787c2d
parent3f7cbf4e338d7fa036b07f50c569d07be0cab8fe (diff)
fdo#72260: guard against duplicate "name" attribute
Change-Id: I1ee4b82e04318a50db8bb54bd5c7e00c79177d37 Reviewed-on: https://gerrit.libreoffice.org/6984 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r--drawinglayer/source/dumper/XShapeDumper.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/drawinglayer/source/dumper/XShapeDumper.cxx b/drawinglayer/source/dumper/XShapeDumper.cxx
index 089640bae35d..accb18a84e74 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;
+ }
}
}