[Libreoffice-commits] core.git: Branch 'feature/perfwork5' - sc/inc sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Mon Nov 17 10:08:03 PST 2014


 sc/inc/column.hxx               |    3 ++-
 sc/source/core/data/column4.cxx |   20 +++++++++++++-------
 sc/source/core/data/table4.cxx  |    4 +++-
 3 files changed, 18 insertions(+), 9 deletions(-)

New commits:
commit 1f69b4cbedf8b8ac290fe0814bd000550e49fb69
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Mon Nov 17 13:06:51 2014 -0500

    Avoid area listeners and such during formula cell paste replication.
    
    All formula cells get marked dirty and start area-listening at the very
    end of CopyFromClip.  No need to do it in CloneFormulaCells.
    
    Change-Id: I9faf48fd722c2ebcf4b74d5e523317b5d9c71a22

diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 4e8bb00..654e08b 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -316,7 +316,8 @@ public:
 
     bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const;
 
-    void CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc::RowSpan>& rRanges );
+    void CloneFormulaCell(
+        const ScFormulaCell& rSrc, const std::vector<sc::RowSpan>& rRanges, sc::StartListeningContext* pCxt );
 
     svl::SharedString GetSharedString( SCROW nRow ) const;
 
diff --git a/sc/source/core/data/column4.cxx b/sc/source/core/data/column4.cxx
index 94634dd..2d6609d 100644
--- a/sc/source/core/data/column4.cxx
+++ b/sc/source/core/data/column4.cxx
@@ -213,7 +213,7 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1,
                 std::vector<sc::RowSpan> aRanges;
                 aRanges.reserve(1);
                 aRanges.push_back(sc::RowSpan(nRow1, nRow2));
-                CloneFormulaCell(*rSrcCell.mpFormula, aRanges);
+                CloneFormulaCell(*rSrcCell.mpFormula, aRanges, NULL);
             }
             break;
             default:
@@ -473,11 +473,11 @@ void ScColumn::DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDele
         DeleteArea(itSpan->mnRow1, itSpan->mnRow2, nDelFlag, bBroadcast);
 }
 
-void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc::RowSpan>& rRanges )
+void ScColumn::CloneFormulaCell(
+    const ScFormulaCell& rSrc, const std::vector<sc::RowSpan>& rRanges, sc::StartListeningContext* pCxt )
 {
     sc::CellStoreType::iterator itPos = maCells.begin();
     sc::CellTextAttrStoreType::iterator itAttrPos = maCellTextAttrs.begin();
-    sc::StartListeningContext aCxt(*pDocument);
 
     std::vector<ScFormulaCell*> aFormulas;
     std::vector<sc::RowSpan>::const_iterator itSpan = rRanges.begin(), itSpanEnd = rRanges.end();
@@ -495,8 +495,11 @@ void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc
         {
             // Single, ungrouped formula cell.
             ScFormulaCell* pCell = new ScFormulaCell(rSrc, *pDocument, aPos);
-            pCell->StartListeningTo(aCxt);
-            pCell->SetDirty();
+            if (pCxt)
+            {
+                pCell->StartListeningTo(*pCxt);
+                pCell->SetDirty();
+            }
             aFormulas.push_back(pCell);
         }
         else
@@ -513,8 +516,11 @@ void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc
                     xGroup->mpTopCell = pCell;
                     xGroup->mnLength = nLen;
                 }
-                pCell->StartListeningTo(aCxt);
-                pCell->SetDirty();
+                if (pCxt)
+                {
+                    pCell->StartListeningTo(*pCxt);
+                    pCell->SetDirty();
+                }
                 aFormulas.push_back(pCell);
             }
         }
diff --git a/sc/source/core/data/table4.cxx b/sc/source/core/data/table4.cxx
index 701e6d5..bfc29bd 100644
--- a/sc/source/core/data/table4.cxx
+++ b/sc/source/core/data/table4.cxx
@@ -61,6 +61,7 @@
 #include "conditio.hxx"
 #include "editutil.hxx"
 #include <columnspanset.hxx>
+#include <listenercontext.hxx>
 
 #include <math.h>
 #include <boost/scoped_ptr.hpp>
@@ -1163,7 +1164,8 @@ void ScTable::FillFormulaVertical(
     }
 
     aCol[nCol].DeleteRanges(aSpans, IDF_CONTENTS, false);
-    aCol[nCol].CloneFormulaCell(rSrcCell, aSpans);
+    sc::StartListeningContext aCxt(*pDocument);
+    aCol[nCol].CloneFormulaCell(rSrcCell, aSpans, &aCxt);
 
     rProgress += nRow2 - nRow1 + 1;
     if (pProgress)


More information about the Libreoffice-commits mailing list