[Libreoffice-commits] .: sc/source

Eike Rathke erack at kemper.freedesktop.org
Sun Sep 11 12:31:58 PDT 2011


 sc/source/core/data/cell.cxx  |    5 +++++
 sc/source/core/data/cell2.cxx |    9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

New commits:
commit 90e489f068d09aaaf46ab15d35091198ed84bed1
Author: Eike Rathke <erack at erack.de>
Date:   Sun Sep 11 21:25:20 2011 +0200

    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.

diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx
index 3246391..8b1b99e 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 648cd23..098a6a3 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();


More information about the Libreoffice-commits mailing list