Kaydet (Commit) a78f683b authored tarafından Korrawit Pruegsanusak's avatar Korrawit Pruegsanusak Kaydeden (comit) Markus Mohrhard

fdo#72260: guard against duplicate "name" attribute

Change-Id: I1ee4b82e04318a50db8bb54bd5c7e00c79177d37
Reviewed-on: https://gerrit.libreoffice.org/6984Reviewed-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: 's avatarMarkus Mohrhard <markus.mohrhard@googlemail.com>
üst 3f7cbf4e
...@@ -172,6 +172,8 @@ int closeCallback(void* ) ...@@ -172,6 +172,8 @@ int closeCallback(void* )
return 0; return 0;
} }
bool m_bNameDumped;
// ---------------------------------------- // ----------------------------------------
// ---------- FillProperties.idl ---------- // ---------- FillProperties.idl ----------
// ---------------------------------------- // ----------------------------------------
...@@ -1007,8 +1009,11 @@ void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWrite ...@@ -1007,8 +1009,11 @@ void dumpMoveProtectAsAttribute(sal_Bool bMoveProtect, xmlTextWriterPtr xmlWrite
void dumpNameAsAttribute(OUString sName, xmlTextWriterPtr xmlWriter) 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()); xmlTextWriterWriteFormatAttribute(xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(sName, RTL_TEXTENCODING_UTF8).getStr());
m_bNameDumped = true;
}
} }
void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter) void dumpSizeProtectAsAttribute(sal_Bool bSizeProtect, xmlTextWriterPtr xmlWriter)
...@@ -1806,6 +1811,7 @@ void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWr ...@@ -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::XPropertySet > xPropSet(xShape, uno::UNO_QUERY_THROW);
uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo(); uno::Reference<beans::XPropertySetInfo> xPropSetInfo = xPropSet->getPropertySetInfo();
OUString aName; OUString aName;
m_bNameDumped = false;
dumpPositionAsAttribute(xShape->getPosition(), xmlWriter); dumpPositionAsAttribute(xShape->getPosition(), xmlWriter);
dumpSizeAsAttribute(xShape->getSize(), xmlWriter); dumpSizeAsAttribute(xShape->getSize(), xmlWriter);
...@@ -1823,7 +1829,10 @@ void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWr ...@@ -1823,7 +1829,10 @@ void dumpXShape(uno::Reference< drawing::XShape > xShape, xmlTextWriterPtr xmlWr
if (aAny >>= aName) if (aAny >>= aName)
{ {
if (!aName.isEmpty()) if (!aName.isEmpty())
{
xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr()); xmlTextWriterWriteFormatAttribute( xmlWriter, BAD_CAST("name"), "%s", OUStringToOString(aName, RTL_TEXTENCODING_UTF8).getStr());
m_bNameDumped = true;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment