diff options
author | PriyankaGaikwad <priyanka.gaikwad@synerzip.com> | 2014-05-12 17:54:30 +0530 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2014-05-14 10:59:33 +0000 |
commit | 8db493240a2caced1ab72a9e0fc87d39a6d3f12d (patch) | |
tree | decff4d421fea0e9077a5a658d46d3af37ab0d40 | |
parent | 584b415924bba22db23a4258062e54973de0ed7c (diff) |
fdo#78599: Fixed for file corruption which contains fields and hyperlink
Field inside a hyperlink closed after the ending tag of hyperlink, which corrupted the RT file.
Change-Id: Ib89ead8d2f8a9eb6c8473ffd14853495ee1b2f62
Reviewed-on: https://gerrit.libreoffice.org/9330
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo78599.docx | bin | 0 -> 38560 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 10 |
3 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78599.docx b/sw/qa/extras/ooxmlexport/data/fdo78599.docx Binary files differnew file mode 100644 index 000000000000..3c81780da12b --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo78599.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 87097d944e79..df265ff31bce 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3328,6 +3328,16 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78384,"fdo78384.docx") return; assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings"); } + +DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx") +{ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + //docx file after RT is getting corrupted. + assertXPath ( pXmlDoc, "/w:document/w:body/w:p[1]/w:hyperlink/w:r[6]/w:fldChar", "fldCharType", "end" ); +} + #endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 4598bb7fbcca..74c47c648490 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -746,6 +746,7 @@ void DocxAttributeOutput::EndRun() EndField_Impl( m_Fields.back( ) ); if (m_Fields.back().pField) delete m_Fields.back().pField; + m_Fields.pop_back(); } m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; @@ -871,6 +872,15 @@ void DocxAttributeOutput::EndRun() m_endPageRef = false; m_hyperLinkAnchor = ""; } + for ( int i = 0; i < m_nFieldsInHyperlink; i++ ) + { + // If fields begin after hyperlink start then + // it should end before hyperlink close + EndField_Impl( m_Fields.back( ) ); + if (m_Fields.back().pField) + delete m_Fields.back().pField; + m_Fields.pop_back(); + } m_pSerializer->endElementNS( XML_w, XML_hyperlink ); m_startedHyperlink = false; |