diff options
author | Niklas Nebel <nn@openoffice.org> | 2010-07-28 17:18:56 +0200 |
---|---|---|
committer | Niklas Nebel <nn@openoffice.org> | 2010-07-28 17:18:56 +0200 |
commit | 78b5815bad567be77f9641e82be621815e1bbbe0 (patch) | |
tree | 73fc63fe72a067ca942b6b6f5ec9a3804a6f86af | |
parent | 2c9c72de2c3a2bdc6bbdc58d1ac5d390d85ac4fe (diff) |
calc57: #i113432# restore fix for i94951: catch IndexOutOfBoundsException in ScXMLTableRowCellContext::DoMerge
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 02096f2dc..a443a2ccb 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -487,21 +487,31 @@ void ScXMLTableRowCellContext::DoMerge(const com::sun::star::table::CellAddress& uno::Reference<table::XCellRange> xCellRange(rXMLImport.GetTables().GetCurrentXCellRange()); if ( xCellRange.is() ) { - table::CellRangeAddress aCellAddress; - if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress)) + // Stored merge range may actually be of a larger extend than what + // we support, in which case getCellRangeByPosition() throws + // IndexOutOfBoundsException. Do nothing then. + try { - //unmerge + table::CellRangeAddress aCellAddress; + if (IsMerged(xCellRange, aCellPos.Column, aCellPos.Row, aCellAddress)) + { + //unmerge + uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, + aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY); + if (xMergeable.is()) + xMergeable->merge(sal_False); + } + + //merge uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, - aCellAddress.EndColumn, aCellAddress.EndRow), uno::UNO_QUERY); + aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY); if (xMergeable.is()) - xMergeable->merge(sal_False); + xMergeable->merge(sal_True); + } + catch ( lang::IndexOutOfBoundsException & ) + { + DBG_ERRORFILE("ScXMLTableRowCellContext::DoMerge: range to be merged larger than what we support"); } - - //merge - uno::Reference <util::XMergeable> xMergeable (xCellRange->getCellRangeByPosition(aCellAddress.StartColumn, aCellAddress.StartRow, - aCellAddress.EndColumn + nCols, aCellAddress.EndRow + nRows), uno::UNO_QUERY); - if (xMergeable.is()) - xMergeable->merge(sal_True); } } } |