summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorSourav <sourav.mahajan@synerzip.com>2014-03-15 12:48:18 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-03-17 17:22:55 +0100
commitd44abe1724ee5470c88f5fba5c0217fb37e2205c (patch)
tree04b07c110bc1f57106b67b6d42fb8b7c0ac0a499 /sw
parentac5078a46632ef7efbdce9340c0b023d7f455d14 (diff)
fdo#76108 : The RT file is getting corrupted.
Description:The RT file is getting corrupted. The <w:fldChar w:fldCharType="end" /> tag is there inside the hyperlink tag where as the <w:fldChar w:fldCharType="begin"> is starting before the hyperlink tag.This is causing the issue. The rootcause found is in DocxAttributeOutput::EndRun(). A check is introduced before the code that writes the <w:fldChar w:fldCharType="end" /> after the hyperlink to check if the m_startedHyperlink is false. I have added test case to verify that now the RT file is opening I also verified this change on a set of 440 real world documents (containing many combinations of MS Office features) to make sure there is no regression because of this change. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/8603 Change-Id: Ibc3ca8edcfb68d52a9394580bac1ce878eda9405
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/test76108.docxbin0 -> 14419 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx15
3 files changed, 15 insertions, 7 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/test76108.docx b/sw/qa/extras/ooxmlexport/data/test76108.docx
new file mode 100644
index 000000000000..3476dc58cfb1
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/test76108.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index aea7db318dbc..ed5eb9654c2c 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -2854,6 +2854,13 @@ DECLARE_OOXMLEXPORT_TEST(testContentTypeXLSM, "fdo76098.docx")
}
+DECLARE_OOXMLEXPORT_TEST(test76108, "test76108.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc) return;
+ //docx file after RT is getting corrupted.
+ assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
+}
#endif
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index eab3f9034db8..42ca6bdbf7f5 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -827,13 +827,14 @@ void DocxAttributeOutput::EndRun()
m_closeHyperlinkInThisRun = false;
}
- while ( m_Fields.begin() != m_Fields.end() )
- {
- EndField_Impl( m_Fields.front( ) );
- if (m_Fields.front().pField)
- delete m_Fields.front().pField;
- m_Fields.erase( m_Fields.begin( ) );
- }
+ if(!m_startedHyperlink)
+ while ( m_Fields.begin() != m_Fields.end() )
+ {
+ EndField_Impl( m_Fields.front( ) );
+ if (m_Fields.front().pField)
+ delete m_Fields.front().pField;
+ m_Fields.erase( m_Fields.begin( ) );
+ }
}
void DocxAttributeOutput::DoWriteBookmarks()