sw/qa/extras/ooxmlexport/data/fdo83044.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 9 +++++++++ sw/source/filter/ww8/docxattributeoutput.cxx | 14 ++++++++------ 3 files changed, 17 insertions(+), 6 deletions(-)
New commits: commit 96dc17221c286dd02772f1dd54b4ffc3c3091b9a Author: Rohit Deshmukh <rohit.deshm...@synerzip.com> Date: Wed Aug 27 12:43:29 2014 +0530 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/11146 Reviewed-by: Miklos Vajna <vmik...@collabora.co.uk> Tested-by: Miklos Vajna <vmik...@collabora.co.uk> diff --git a/sw/qa/extras/ooxmlexport/data/fdo83044.docx b/sw/qa/extras/ooxmlexport/data/fdo83044.docx new file mode 100644 index 0000000..01d32bf Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo83044.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index f843c24..3cda4ce 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -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: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 3e78a1a..b4587e8 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -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 ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits