diff options
author | Eike Rathke <erack@erack.de> | 2011-09-13 12:23:21 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@suse.com> | 2011-09-13 12:24:01 -0400 |
commit | 6dcc0967b83b77ab289abcb1a3531469c6444a93 (patch) | |
tree | c5937397149a6c5ea4e1cbb10c02b1588b2e924f | |
parent | 8ceb17039c1bbfcb8d64eef9265b99238addcf6a (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.
Signed-off-by: Kohei Yoshida <kohei.yoshida@suse.com>
-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 4651a2ca8..862cb4d3a 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -1681,7 +1681,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 5bac8e30b..10230997d 100644 --- a/sc/source/core/data/cell2.cxx +++ b/sc/source/core/data/cell2.cxx @@ -609,7 +609,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; @@ -622,7 +623,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(); @@ -638,7 +640,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(); |