diff options
author | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-17 13:06:51 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@collabora.com> | 2014-11-17 13:06:51 -0500 |
commit | 1f69b4cbedf8b8ac290fe0814bd000550e49fb69 (patch) | |
tree | 31316faa003d4cb9b4d43cc9c1c95ff3948d151a | |
parent | Send broadcast range to the area broadcast slot machine. (diff) | |
download | core-1f69b4cbedf8b8ac290fe0814bd000550e49fb69.tar.gz core-1f69b4cbedf8b8ac290fe0814bd000550e49fb69.zip |
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
-rw-r--r-- | sc/inc/column.hxx | 3 | ||||
-rw-r--r-- | sc/source/core/data/column4.cxx | 20 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 4 |
3 files changed, 18 insertions, 9 deletions
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 4e8bb0019bae..654e08bc4611 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 94634dd12769..2d6609db9649 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 701e6d5eb42b..bfc29bdfcd53 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) |