Kaydet (Commit) 550f0797 authored tarafından Kohei Yoshida's avatar Kohei Yoshida

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
üst 34c8c0bb
...@@ -314,7 +314,8 @@ public: ...@@ -314,7 +314,8 @@ public:
bool HasFormulaCell( SCROW nRow1, SCROW nRow2 ) const; 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; svl::SharedString GetSharedString( SCROW nRow ) const;
......
...@@ -213,7 +213,7 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1, ...@@ -213,7 +213,7 @@ void ScColumn::CopyOneCellFromClip( sc::CopyFromClipContext& rCxt, SCROW nRow1,
std::vector<sc::RowSpan> aRanges; std::vector<sc::RowSpan> aRanges;
aRanges.reserve(1); aRanges.reserve(1);
aRanges.push_back(sc::RowSpan(nRow1, nRow2)); aRanges.push_back(sc::RowSpan(nRow1, nRow2));
CloneFormulaCell(*rSrcCell.mpFormula, aRanges); CloneFormulaCell(*rSrcCell.mpFormula, aRanges, NULL);
} }
break; break;
default: default:
...@@ -473,11 +473,11 @@ void ScColumn::DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDele ...@@ -473,11 +473,11 @@ void ScColumn::DeleteRanges( const std::vector<sc::RowSpan>& rRanges, InsertDele
DeleteArea(itSpan->mnRow1, itSpan->mnRow2, nDelFlag, bBroadcast); 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::CellStoreType::iterator itPos = maCells.begin();
sc::CellTextAttrStoreType::iterator itAttrPos = maCellTextAttrs.begin(); sc::CellTextAttrStoreType::iterator itAttrPos = maCellTextAttrs.begin();
sc::StartListeningContext aCxt(*pDocument);
std::vector<ScFormulaCell*> aFormulas; std::vector<ScFormulaCell*> aFormulas;
std::vector<sc::RowSpan>::const_iterator itSpan = rRanges.begin(), itSpanEnd = rRanges.end(); 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 ...@@ -495,8 +495,11 @@ void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc
{ {
// Single, ungrouped formula cell. // Single, ungrouped formula cell.
ScFormulaCell* pCell = new ScFormulaCell(rSrc, *pDocument, aPos); ScFormulaCell* pCell = new ScFormulaCell(rSrc, *pDocument, aPos);
pCell->StartListeningTo(aCxt); if (pCxt)
pCell->SetDirty(); {
pCell->StartListeningTo(*pCxt);
pCell->SetDirty();
}
aFormulas.push_back(pCell); aFormulas.push_back(pCell);
} }
else else
...@@ -513,8 +516,11 @@ void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc ...@@ -513,8 +516,11 @@ void ScColumn::CloneFormulaCell( const ScFormulaCell& rSrc, const std::vector<sc
xGroup->mpTopCell = pCell; xGroup->mpTopCell = pCell;
xGroup->mnLength = nLen; xGroup->mnLength = nLen;
} }
pCell->StartListeningTo(aCxt); if (pCxt)
pCell->SetDirty(); {
pCell->StartListeningTo(*pCxt);
pCell->SetDirty();
}
aFormulas.push_back(pCell); aFormulas.push_back(pCell);
} }
} }
......
...@@ -61,6 +61,7 @@ ...@@ -61,6 +61,7 @@
#include "conditio.hxx" #include "conditio.hxx"
#include "editutil.hxx" #include "editutil.hxx"
#include <columnspanset.hxx> #include <columnspanset.hxx>
#include <listenercontext.hxx>
#include <math.h> #include <math.h>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
...@@ -1163,7 +1164,8 @@ void ScTable::FillFormulaVertical( ...@@ -1163,7 +1164,8 @@ void ScTable::FillFormulaVertical(
} }
aCol[nCol].DeleteRanges(aSpans, IDF_CONTENTS, false); 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; rProgress += nRow2 - nRow1 + 1;
if (pProgress) if (pProgress)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment