diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2014-08-07 14:50:36 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-08-08 09:55:15 +0200 |
commit | 3293bfff71748af714b7dfde50476d4db86510d2 (patch) | |
tree | 7133d73a841fb7b7bde445fee0fd8ef54be86c72 | |
parent | 616b3ad50404f35d84708b3feeb8c66f2f23f1b1 (diff) |
fdo#81946 Corrupt : DOCX file getting corrupt after RT
Decription :
DOCX file getting corrupt after RT due to the AlternateContent inside sdtContent block
XML Difference :
In header.xml
Original File
<w:sdt>
<w:sdtContent>
...
</w:sdtContent>
</w:sdt>
Roundtrip File
<w:sdt>
<w:sdtContent>
<mc:AlternateContent>
......Text Box.....
</mc:AlternateContent>
</w:sdtContent>
</w:sdt>
Reviewed on:
https://gerrit.libreoffice.org/10805
Change-Id: I32d22f57a52060dd6f0ee784ee0002968d06ac3a
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo81946.docx | bin | 0 -> 34561 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 9 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 6 |
3 files changed, 15 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81946.docx b/sw/qa/extras/ooxmlexport/data/fdo81946.docx Binary files differnew file mode 100644 index 000000000000..b179f58bf81d --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo81946.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 9867cceed1a1..4c44216a17a7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -591,6 +591,15 @@ DECLARE_OOXMLEXPORT_TEST(testFdo81945, "fdo81945.docx") assertXPath(pXmlDoc, "//w:sdt//w:sdt", 0); } +DECLARE_OOXMLEXPORT_TEST(testfdo81946, "fdo81946.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/header1.xml"); + if (!pXmlDoc) + return; + // make sure AlternateContent should not present in sdt + assertXPath(pXmlDoc, "/w:hdr[1]/w:p[1]/w:sdt[1]/w:sdtContent[1]/w:r[2]/mc:AlternateContent[1]",0); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5888d32dc681..a8bcc8903c5a 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -450,6 +450,12 @@ void DocxAttributeOutput::EndParagraph( ww8::WW8TableNodeInfoInner::Pointer_t pT if (!TextBoxIsFramePr(rFrmFmt) || m_bWritingHeaderFooter) { + if (m_bStartedCharSdt) + { + // Run-level SDT still open? Close it befor AlternateContent. + EndSdtBlock(); + m_bStartedCharSdt = false; + } m_pSerializer->startElementNS( XML_w, XML_r, FSEND ); m_pSerializer->startElementNS(XML_mc, XML_AlternateContent, FSEND); m_pSerializer->startElementNS(XML_mc, XML_Choice, |