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

Sourav sourav.mahajan at synerzip.com
Mon Mar 17 09:23:23 PDT 2014


 sw/qa/extras/ooxmlexport/data/test76108.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |    7 +++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |   15 ++++++++-------
 3 files changed, 15 insertions(+), 7 deletions(-)

New commits:
commit d44abe1724ee5470c88f5fba5c0217fb37e2205c
Author: Sourav <sourav.mahajan at synerzip.com>
Date:   Sat Mar 15 12:48:18 2014 +0530

    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

diff --git a/sw/qa/extras/ooxmlexport/data/test76108.docx b/sw/qa/extras/ooxmlexport/data/test76108.docx
new file mode 100644
index 0000000..3476dc5
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/test76108.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index aea7db3..ed5eb96 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 eab3f90..42ca6bd 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()


More information about the Libreoffice-commits mailing list