[Libreoffice-commits] core.git: sw/qa sw/source
PriyankaGaikwad
priyanka.gaikwad at synerzip.com
Fri Aug 8 00:57:57 PDT 2014
sw/qa/extras/ooxmlexport/data/fdo81946.docx |binary
sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 9 +++++++++
sw/source/filter/ww8/docxattributeoutput.cxx | 6 ++++++
3 files changed, 15 insertions(+)
New commits:
commit 3293bfff71748af714b7dfde50476d4db86510d2
Author: PriyankaGaikwad <priyanka.gaikwad at synerzip.com>
Date: Thu Aug 7 14:50:36 2014 +0530
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
diff --git a/sw/qa/extras/ooxmlexport/data/fdo81946.docx b/sw/qa/extras/ooxmlexport/data/fdo81946.docx
new file mode 100644
index 0000000..b179f58
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo81946.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx
index 9867cce..4c44216 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 5888d32..a8bcc89 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,
More information about the Libreoffice-commits
mailing list