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-18 08:31:56 -0500 |
commit | 550f0797e64e38a4ef5721857f5057f692680118 (patch) | |
tree | d7acb75b32b7847d93926bc3fa3c238c08122926 /sc/source/core/data | |
parent | 34c8c0bb878be82a25cdaf1d7e623843f00fed6c (diff) |
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
Diffstat (limited to 'sc/source/core/data')
-rw-r--r-- | sc/source/core/data/column4.cxx | 20 | ||||
-rw-r--r-- | sc/source/core/data/table4.cxx | 4 |
2 files changed, 16 insertions, 8 deletions
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) |