diff options
author | Eike Rathke <erack@erack.de> | 2011-09-11 21:25:20 +0200 |
---|---|---|
committer | Eike Rathke <erack@erack.de> | 2011-09-11 21:31:52 +0200 |
commit | 90e489f068d09aaaf46ab15d35091198ed84bed1 (patch) | |
tree | d99b1a36862c054b7dcb96293c672834bdbda418 | |
parent | d88bceafa0227e0e7bfe6bad1221eb93d3a9619a (diff) |
fix fdo#39485 recalculate matrix formula dimension correctly
ScFormulaCell::GetMatrixEdge() when recalculating its dimension obtained
the matrix origin of itself instead of a neighboring matrix formula if
encountered such, effectively adding that other matrix to its own cells
occupying dimension.
-rw-r--r-- | sc/source/core/data/cell.cxx | 5 | ||||
-rw-r--r-- | sc/source/core/data/cell2.cxx | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 324639129c41..8b1b99ea613c 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -1798,7 +1798,12 @@ void ScFormulaCell::SetMatColsRows( SCCOL nCols, SCROW nRows ) if (pMat) pMat->SetMatColsRows( nCols, nRows); else if (nCols || nRows) + { aResult.SetToken( new ScMatrixFormulaCellToken( nCols, nRows)); + // Setting the new token actually forces an empty result at this top + // left cell, so have that recalculated. + SetDirty(); + } } diff --git a/sc/source/core/data/cell2.cxx b/sc/source/core/data/cell2.cxx index 648cd2365270..098a6a308725 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -624,7 +624,8 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) { pFCell->GetMatColsRows( nC, nR ); if ( nC == 0 || nR == 0 ) - { // aus altem Dokument geladen, neu erzeugen + { + // No ScMatrixFormulaCellToken available yet, calculate new. nC = 1; nR = 1; ScAddress aTmpOrg; @@ -637,7 +638,8 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) pCell = pDocument->GetCell( aAdr ); if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->cMatrixFlag == MM_REFERENCE - && GetMatrixOrigin( aTmpOrg ) && aTmpOrg == aOrg ) + && ((ScFormulaCell*)pCell)->GetMatrixOrigin( aTmpOrg ) + && aTmpOrg == aOrg ) { nC++; aAdr.IncCol(); @@ -653,7 +655,8 @@ sal_uInt16 ScFormulaCell::GetMatrixEdge( ScAddress& rOrgPos ) pCell = pDocument->GetCell( aAdr ); if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->cMatrixFlag == MM_REFERENCE - && GetMatrixOrigin( aTmpOrg ) && aTmpOrg == aOrg ) + && ((ScFormulaCell*)pCell)->GetMatrixOrigin( aTmpOrg ) + && aTmpOrg == aOrg ) { nR++; aAdr.IncRow(); |