[Libreoffice-commits] core.git: Branch 'feature/calc-group-interpreter' - 3 commits - sc/inc sc/source

Kohei Yoshida kohei.yoshida at gmail.com
Mon Jul 8 15:34:17 PDT 2013


 sc/inc/column.hxx               |    5 +++--
 sc/source/core/data/column.cxx  |   37 +++++++++++++++++++++++++++----------
 sc/source/core/data/column2.cxx |    4 ----
 3 files changed, 30 insertions(+), 16 deletions(-)

New commits:
commit 75b337db4c61d74c33e1d4aa450f371e5c7bc921
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 8 15:32:42 2013 -0400

    Nobody uses this marker now.
    
    Change-Id: Ib7c8a7b7b1ce7f2b9afbb17a50848ae1d8e28907

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 1323bf8..8008439 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -523,8 +523,6 @@ public:
      */
     void RegroupFormulaCells( SCROW nRow1, SCROW nRow2 );
 
-    void FormulaCellsUndecided( SCROW nRow1, SCROW nRow2 );
-
 #if DEBUG_COLUMN_STORAGE
     void DumpFormulaGroups() const;
 #endif
diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx
index 46bf525..23aaa9f 100644
--- a/sc/source/core/data/column2.cxx
+++ b/sc/source/core/data/column2.cxx
@@ -1541,10 +1541,6 @@ void ScColumn::RegroupFormulaCells( SCROW /*nRow1*/, SCROW /*nRow2*/ )
 {
 }
 
-void ScColumn::FormulaCellsUndecided( SCROW /*nRow1*/, SCROW /*nRow2*/ )
-{
-}
-
 #if DEBUG_COLUMN_STORAGE
 
 namespace {
commit 229831cda6a8cb2b38afea65e9c775dc8c6a4a08
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 8 15:29:40 2013 -0400

    Make update ref on copy a separate method.
    
    Change-Id: I95cb42845535532fca5622d8d4f8b394ff22d4d3

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 6704fb4..1323bf8 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -303,6 +303,9 @@ public:
 
     void        ResetChanged( SCROW nStartRow, SCROW nEndRow );
 
+    bool UpdateReferenceOnCopy(
+        const ScRange& rRange, SCCOL nDx, SCROW nDy, SCTAB nDz, ScDocument* pUndoDoc = NULL );
+
     /**
      * Update reference addresses in formula cell in response to mass cell
      * movement.
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 1268035..8665873 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1991,8 +1991,7 @@ void ScColumn::CopyScenarioFrom( const ScColumn& rSrcCol )
             //  UpdateUsed not needed, already done in TestCopyScenario (obsolete comment ?)
 
             SCsTAB nDz = nTab - rSrcCol.nTab;
-            UpdateReference(
-                URM_COPY, ScRange(nCol, nStart, nTab, nCol, nEnd, nTab), 0, 0, nDz, NULL);
+            UpdateReferenceOnCopy(ScRange(nCol, nStart, nTab, nCol, nEnd, nTab), 0, 0, nDz, NULL);
             UpdateCompile();
         }
 
@@ -2020,8 +2019,8 @@ void ScColumn::CopyScenarioTo( ScColumn& rDestCol ) const
             //  UpdateUsed not needed, is already done in TestCopyScenario (obsolete comment ?)
 
             SCsTAB nDz = rDestCol.nTab - nTab;
-            rDestCol.UpdateReference(
-                URM_COPY, ScRange(rDestCol.nCol, nStart, rDestCol.nTab, rDestCol.nCol, nEnd, rDestCol.nTab),
+            rDestCol.UpdateReferenceOnCopy(
+                ScRange(rDestCol.nCol, nStart, rDestCol.nTab, rDestCol.nCol, nEnd, rDestCol.nTab),
                 0, 0, nDz, NULL);
             rDestCol.UpdateCompile();
         }
@@ -2261,32 +2260,36 @@ public:
 
 }
 
-bool ScColumn::UpdateReference(
-    UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
-    ScDocument* pUndoDoc )
+bool ScColumn::UpdateReferenceOnCopy(
+    const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz, ScDocument* pUndoDoc )
 {
-    if (eUpdateRefMode == URM_COPY)
-    {
-        // When copying, the range equals the destination range where cells
-        // are pasted, and the dx, dy, dz refer to the distance from the
-        // source range.
+    // When copying, the range equals the destination range where cells
+    // are pasted, and the dx, dy, dz refer to the distance from the
+    // source range.
 
-        UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc);
-        sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row());
-        sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
+    UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc);
+    sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row());
+    sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
 
-        // The formula groups at the top and bottom boundaries are expected to
-        // have been split prior to this call. Here, we only do the joining.
+    // The formula groups at the top and bottom boundaries are expected to
+    // have been split prior to this call. Here, we only do the joining.
+    JoinFormulaCellAbove(aPos);
+    if (rRange.aEnd.Row() < MAXROW)
+    {
+        aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1);
         JoinFormulaCellAbove(aPos);
-        if (rRange.aEnd.Row() < MAXROW)
-        {
-            aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1);
-            JoinFormulaCellAbove(aPos);
-        }
-
-        return aHandler.isUpdated();
     }
 
+    return aHandler.isUpdated();
+}
+
+bool ScColumn::UpdateReference(
+    UpdateRefMode eUpdateRefMode, const ScRange& rRange, SCsCOL nDx, SCsROW nDy, SCsTAB nDz,
+    ScDocument* pUndoDoc )
+{
+    if (eUpdateRefMode == URM_COPY)
+        return UpdateReferenceOnCopy(rRange, nDx, nDy, nDz, pUndoDoc);
+
     bool bThisColShifted = (rRange.aStart.Tab() <= nTab && nTab <= rRange.aEnd.Tab() && rRange.aStart.Col() <= nCol && nCol <= rRange.aEnd.Col());
     if (bThisColShifted)
     {
commit addd689f3d612778bc46fa2d4a4818f7dd0ee24d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Mon Jul 8 15:19:04 2013 -0400

    Re-group formula cells on paste.
    
    Change-Id: Ia5251a3bc8387289056abacbb4836b77262aad12

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index e7e98f8..1268035 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -2267,9 +2267,23 @@ bool ScColumn::UpdateReference(
 {
     if (eUpdateRefMode == URM_COPY)
     {
+        // When copying, the range equals the destination range where cells
+        // are pasted, and the dx, dy, dz refer to the distance from the
+        // source range.
+
         UpdateRefOnCopy aHandler(rRange, nDx, nDy, nDz, pUndoDoc);
-        FormulaCellsUndecided(rRange.aStart.Row(), rRange.aEnd.Row());
-        sc::ProcessBlock(maCells.begin(), maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
+        sc::CellStoreType::position_type aPos = maCells.position(rRange.aStart.Row());
+        sc::ProcessBlock(aPos.first, maCells, aHandler, rRange.aStart.Row(), rRange.aEnd.Row());
+
+        // The formula groups at the top and bottom boundaries are expected to
+        // have been split prior to this call. Here, we only do the joining.
+        JoinFormulaCellAbove(aPos);
+        if (rRange.aEnd.Row() < MAXROW)
+        {
+            aPos = maCells.position(aPos.first, rRange.aEnd.Row()+1);
+            JoinFormulaCellAbove(aPos);
+        }
+
         return aHandler.isUpdated();
     }
 


More information about the Libreoffice-commits mailing list