[Libreoffice-commits] core.git: sw/qa sw/source

PriyankaGaikwad priyanka.gaikwad at synerzip.com
Wed May 14 04:00:04 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo78599.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   10 ++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   10 ++++++++++
 3 files changed, 20 insertions(+)

New commits:
commit 8db493240a2caced1ab72a9e0fc87d39a6d3f12d
Author: PriyankaGaikwad <priyanka.gaikwad at synerzip.com>
Date:   Mon May 12 17:54:30 2014 +0530

    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 at redhat.com>
    Tested-by: David Tardon <dtardon at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78599.docx b/sw/qa/extras/ooxmlexport/data/fdo78599.docx
new file mode 100644
index 0000000..3c81780
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78599.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 87097d9..df265ff 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 4598bb7..74c47c6 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;


More information about the Libreoffice-commits mailing list