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

Tushar Bende tushar.bende at synerzip.com
Fri Nov 15 01:57:37 PST 2013


 sw/qa/extras/ooxmlexport/data/cell-grid-span.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |   10 ++++++++++
 sw/source/filter/writer/wrtswtbl.cxx              |    6 +++++-
 3 files changed, 15 insertions(+), 1 deletion(-)

New commits:
commit 8f7c127c4be32a91052ea962aafd0af8a1645714
Author: Tushar Bende <tushar.bende at synerzip.com>
Date:   Thu Nov 14 20:04:23 2013 +0530

    Fix for LibreOffice crash during Document RoundTrip
    
    Description: Some Documents were crashing LO During Roundtrip.
    This was because of setting wrong gridSpan value during export.
    
    Conflicts:
    	sw/qa/extras/ooxmlexport/ooxmlexport.cxx
    
    Change-Id: Ibcb6d4f00520500a98c16eb40dec3b052ad6b3f9
    Reviewed-on: https://gerrit.libreoffice.org/6672
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx
new file mode 100644
index 0000000..de71d48
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index ce9a0a9..30f7115 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1811,6 +1811,16 @@ DECLARE_OOXML_TEST(testTextBoxGradientAngle, "fdo65295.docx")
     CPPUNIT_ASSERT_EQUAL(sal_Int16( 45 * 10), aGradient8.Angle);
 }
 
+DECLARE_OOXML_TEST(testCellGridSpan, "cell-grid-span.docx")
+{
+    // The problem was during export gridSpan value for 1st & 2nd cells for test document
+    // used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation
+    // Varifying gridSpan element is not present in RoundTriped Document (As it's Default value is 1).
+    xmlDocPtr pXmlDoc = parseExport();
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0);
+    assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0);
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/writer/wrtswtbl.cxx b/sw/source/filter/writer/wrtswtbl.cxx
index c75de62..18d4896 100644
--- a/sw/source/filter/writer/wrtswtbl.cxx
+++ b/sw/source/filter/writer/wrtswtbl.cxx
@@ -651,7 +651,11 @@ void SwWriteTable::FillTableRowsCols( long nStartRPos, sal_uInt16 nStartRow,
             SwWriteTableCol aSrchCol( nCPos );
             SwWriteTableCols::const_iterator it = aCols.find( &aSrchCol );
             OSL_ENSURE( it != aCols.end(), "missing column" );
-            nCol = it - aCols.begin();
+            if(it != aCols.end())
+            {
+                // if find fails for some nCPos value then it used to set nCol value with size of aCols.
+                nCol = it - aCols.begin();
+            }
 
             if( !ShouldExpandSub( pBox, bSubExpanded, nDepth ) )
             {


More information about the Libreoffice-commits mailing list