diff options
author | Tushar Bende <tushar.bende@synerzip.com> | 2013-11-14 20:04:23 +0530 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-11-15 09:57:16 +0000 |
commit | 8f7c127c4be32a91052ea962aafd0af8a1645714 (patch) | |
tree | 5b0fb1bc9547dca1e735276f31126d1a7bb267ad | |
parent | 20075205724ede61c35bcbf4781e3f7bf5811a78 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/cell-grid-span.docx | bin | 0 -> 14652 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/writer/wrtswtbl.cxx | 6 |
3 files changed, 15 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx Binary files differnew file mode 100644 index 000000000000..de71d48188a2 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/cell-grid-span.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index ce9a0a965aec..30f711547391 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 c75de62d7a46..18d489689995 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 ) ) { |