Kaydet (Commit) 96dc1722 authored tarafından Rohit Deshmukh's avatar Rohit Deshmukh Kaydeden (comit) Miklos Vajna

fdo#83044:Fix for corruption of file with SDT content.

Issue:
  w:text has a wrong child w:docPartGallery and w:docPartUnique.

Change-Id: If1dd6ff15cbba2868c93795051a5328a074721d0
Reviewed-on: https://gerrit.libreoffice.org/11146Reviewed-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
Tested-by: 's avatarMiklos Vajna <vmiklos@collabora.co.uk>
üst 6045c38f
......@@ -201,6 +201,15 @@ DECLARE_OOXMLEXPORT_TEST(testFirstHeaderFooter, "first-header-footer.docx")
CPPUNIT_ASSERT_EQUAL(OUString("Even page footer 2"), parseDump("/root/page[6]/footer/txt/text()"));
}
DECLARE_OOXMLEXPORT_TEST(testFDO83044, "fdo83044.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1);
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -632,12 +632,14 @@ void DocxAttributeOutput::WriteSdtBlock( sal_Int32& nSdtPrToken,
pSdtPrTokenAttributes = 0;
}
uno::Sequence<xml::FastAttribute> aChildren = pSdtPrTokenChildren->getFastAttributes();
for( sal_Int32 i=0; i < aChildren.getLength(); ++i )
m_pSerializer->singleElement( aChildren[i].Token,
FSNS(XML_w, XML_val),
rtl::OUStringToOString( aChildren[i].Value, RTL_TEXTENCODING_UTF8 ).getStr(),
FSEND );
if (nSdtPrToken == FSNS( XML_w, XML_date ) || nSdtPrToken == FSNS( XML_w, XML_docPartObj ) || nSdtPrToken == FSNS( XML_w, XML_docPartList ) || nSdtPrToken == FSNS( XML_w14, XML_checkbox )) {
uno::Sequence<xml::FastAttribute> aChildren = pSdtPrTokenChildren->getFastAttributes();
for( sal_Int32 i=0; i < aChildren.getLength(); ++i )
m_pSerializer->singleElement( aChildren[i].Token,
FSNS(XML_w, XML_val),
rtl::OUStringToOString( aChildren[i].Value, RTL_TEXTENCODING_UTF8 ).getStr(),
FSEND );
}
m_pSerializer->endElement( nSdtPrToken );
}
......
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