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>
This commit is contained in:
sushil_shinde
2014-05-15 19:22:12 +05:30
committed by Miklos Vajna
parent c3ed5f6d33
commit d2a19aad65
3 changed files with 13 additions and 0 deletions

Binary file not shown.

View File

@@ -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");

View File

@@ -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 );