summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsushil_shinde <sushil.shinde@synerzip.com>2014-05-15 19:22:12 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-20 03:16:26 -0500
commitd2a19aad658cc0e8939c16b5137c15727c3cdff9 (patch)
treebe195859dd1253470b0ad983d778dda59e490f0f
parentc3ed5f6d3348fa2b6551d0d942632d951555a01d (diff)
fdo#78654 LO was exporting corrupt docx file.
If docx file contains multiple hyperlinks in one paragraph and one of the hyperlink contains "PAGEREF" field. End tag for "PAGEREF" field was not exported hence it was causing corruption in exported file. Fixed export part of field end tags in case of "PAGEREF". Added unit test. Change-Id: I18a3625213bf7269e3f441859a27acc38cf6ff45 Reviewed-on: https://gerrit.libreoffice.org/9364 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
-rw-r--r--sw/qa/extras/ooxmlexport/data/fdo78654.docxbin0 -> 40927 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx11
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx2
3 files changed, 13 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo78654.docx b/sw/qa/extras/ooxmlexport/data/fdo78654.docx
new file mode 100644
index 000000000000..81d7bd0c42d7
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/fdo78654.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 67ccaaea4db6..7f3a5b71f98b 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3370,6 +3370,17 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78384,"fdo78384.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings");
}
+DECLARE_OOXMLEXPORT_TEST(testFDO78654 , "fdo78654.docx")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ if (!pXmlDoc)
+ return;
+ // In case of two "Hyperlink" tags in one paragraph and one of them
+ // contains "PAGEREF" field then field end tag was missing from hyperlink.
+ assertXPath ( pXmlDoc, "/w:document/w:body/w:p[2]/w:hyperlink[3]/w:r[5]/w:fldChar", "fldCharType", "end" );
+}
+
+
DECLARE_OOXMLEXPORT_TEST(testfdo78599,"fdo78599.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4c6c7d0b058c..19807f40565c 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -823,6 +823,8 @@ void DocxAttributeOutput::EndRun()
FSNS( XML_w, XML_fldCharType ), "separate",
FSEND );
m_pSerializer->endElementNS( XML_w, XML_r );
+ // At start of every "PAGEREF" field m_endPageRef value should be true.
+ m_endPageRef = true;
}
m_pSerializer->startElementNS( XML_w, XML_r, FSEND );