summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorEike Rathke <erack@erack.de>2011-09-11 21:25:20 +0200
committerEike Rathke <erack@erack.de>2011-09-11 21:31:52 +0200
commit90e489f068d09aaaf46ab15d35091198ed84bed1 (patch)
treed99b1a36862c054b7dcb96293c672834bdbda418 /sc
parentSimplified SAL_DEPRECATED, does not need to abstract over func. (diff)
downloadcore-90e489f068d09aaaf46ab15d35091198ed84bed1.tar.gz
core-90e489f068d09aaaf46ab15d35091198ed84bed1.zip
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.
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/data/cell.cxx5
-rw-r--r--sc/source/core/data/cell2.cxx9
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();