Kaydet (Commit) 8db49324 authored tarafından PriyankaGaikwad's avatar PriyankaGaikwad Kaydeden (comit) David Tardon

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/9330Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst 584b4159
......@@ -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();
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment