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>
This commit is contained in:
Korrawit Pruegsanusak 2013-12-08 14:26:25 +07:00 committed by Markus Mohrhard
parent 3f7cbf4e33
commit a78f683b1e

View file

@ -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;
}
}
}