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

Tushar Bende tushar.bende at synerzip.com
Wed Jun 11 02:31:10 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo79668.docx  |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx     |   13 +++++++++++++
 sw/source/filter/ww8/docxattributeoutput.cxx |    5 +++++
 3 files changed, 18 insertions(+)

New commits:
commit e1d80c0d70562e1f24f150a81a34ee4e3edc90f3
Author: Tushar Bende <tushar.bende at synerzip.com>
Date:   Tue Jun 10 15:52:23 2014 +0530

    fdo#79668 :File getting corrupt after RT
    
    Problem Description : For some documents containing redLine data there was already processing done for paragraph properties pPr
    but when it comes to DocxAttributeOutput::EndParagraphProperties() instead of writing these pPr, LO was calling Redline( pRedlineData )
    which has it's pPr inside w:pPrChange.
    This was the reason when LO calls WriteCollectedParagraphProperties() after calling Redline() it was writing both paragraph properties
    inside single w:shd element.Hence the RT document was getting Corrupt.
    
    Added condition in DocxAttributeOutput::EndParagraphProperties() which is checking for RedlineData and if it's there call
    WriteCollectedParagraphProperties() before calling Redline().
    
    Added Export Test case.
    
    Change-Id: I7000c27fe6ee372cac81d6f22e0d3ca9219a24d7
    Reviewed-on: https://gerrit.libreoffice.org/9712
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo79668.docx b/sw/qa/extras/ooxmlexport/data/fdo79668.docx
new file mode 100644
index 0000000..793fd2a
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo79668.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 5310ce2..250f52d 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -3540,6 +3540,19 @@ DECLARE_OOXMLEXPORT_TEST(testFDO79062, "fdo79062.docx")
     assertXPath(pXmlEndNotes, "/w:endnotes", "Ignorable", "w14 wp14");
 }
 
+DECLARE_OOXMLEXPORT_TEST(testfdo79668,"fdo79668.docx")
+{
+    // fdo#79668: Document was Crashing on DebugUtil build while Saving
+    // because of repeated attribute value in same element.
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+        return;
+    // w:pPr's  w:shd attributes were getting added to w:pPrChange/w:pPr's w:shd hence checking
+    // w:fill for both shd elements
+    assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:shd", "fill", "FFFFFF" );
+    assertXPath ( pXmlDoc, "/w:document/w:body/w:p[9]/w:pPr/w:pPrChange/w:pPr/w:shd", "fill", "FFFFFF" );
+}
+
 DECLARE_OOXMLEXPORT_TEST(testfdo78907,"fdo78907.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index ff6986e..62d1e05 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -649,6 +649,11 @@ void DocxAttributeOutput::EndParagraphProperties( const SfxItemSet* pParagraphMa
 {
     // Call the 'Redline' function. This will add redline (change-tracking) information that regards to paragraph properties.
     // This includes changes like 'Bold', 'Underline', 'Strikethrough' etc.
+
+    // If there is RedlineData present, call WriteCollectedParagraphProperties() for writting pPr before calling Redline().
+    // As there will be another pPr for redline and LO might mix both.
+    if(pRedlineData)
+        WriteCollectedParagraphProperties();
     Redline( pRedlineData );
 
     WriteCollectedParagraphProperties();


More information about the Libreoffice-commits mailing list