sc/inc/column.hxx | 2 ++ sc/inc/table.hxx | 2 ++ sc/source/core/data/column3.cxx | 15 +++++++++++++++ sc/source/core/data/document.cxx | 18 ++++++++++-------- sc/source/core/data/table1.cxx | 6 ++++++ 5 files changed, 35 insertions(+), 8 deletions(-)
New commits: commit 5873c22ed9b634b4b97d5932f305ae2f5e080b0d Author: Kohei Yoshida <kohei.yosh...@gmail.com> Date: Tue Jun 25 12:29:46 2013 -0400 Replace ScCellIterator with sc::ProcessFormula. Change-Id: I0adf57e5e80972175633dd0c69d465544aa7d7a9 diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx index 79c37fc..3cbd7b8 100644 --- a/sc/inc/column.hxx +++ b/sc/inc/column.hxx @@ -455,6 +455,8 @@ public: void BroadcastCells( const std::vector<SCROW>& rRows ); void EndFormulaListening( sc::ColumnBlockPosition& rBlockPos, SCROW nRow1, SCROW nRow2 ); + void InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ); + private: void CopyCellsInRangeToColumn( diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index fe88f09..e945477 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -847,6 +847,8 @@ public: void FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) const; + void InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ); + /** Replace behaves differently to the Search; adjust the rCol and rRow accordingly. 'Replace' replaces at the 'current' position, but in order to achieve diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index c85f914..16a4d0a 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -115,6 +115,21 @@ void ScColumn::EndFormulaListening( sc::ColumnBlockPosition& rBlockPos, SCROW nR sc::ProcessFormula(rBlockPos.miCellPos, maCells, nRow1, nRow2, aFunc); } +struct DirtyCellInterpreter +{ + void operator() (size_t, ScFormulaCell* p) + { + if (p->GetDirty()) + p->Interpret(); + } +}; + +void ScColumn::InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ) +{ + DirtyCellInterpreter aFunc; + sc::ProcessFormula(maCells.begin(), maCells, nRow1, nRow2, aFunc); +} + void ScColumn::Delete( SCROW nRow ) { std::pair<sc::CellStoreType::iterator,size_t> aPos = maCells.position(nRow); diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index f40e416..3ed67c3 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -3482,20 +3482,22 @@ void ScDocument::SetTableOpDirty( const ScRange& rRange ) SetAutoCalc( bOldAutoCalc ); } - void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges ) { + if (!GetAutoCalc()) + return; + for (size_t nPos=0, nRangeCount = rRanges.size(); nPos < nRangeCount; nPos++) { - ScCellIterator aIter( this, *rRanges[ nPos ] ); - for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) + const ScRange& rRange = *rRanges[nPos]; + for (SCTAB nTab = rRange.aStart.Tab(); nTab <= rRange.aEnd.Tab(); ++nTab) { - if (aIter.getType() != CELLTYPE_FORMULA) - continue; + ScTable* pTab = FetchTable(nTab); + if (!pTab) + return; - ScFormulaCell* p = aIter.getFormulaCell(); - if (p->GetDirty() && GetAutoCalc()) - p->Interpret(); + pTab->InterpretDirtyCells( + rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row()); } } } diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index d3d26a8..2de23b1 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -2209,6 +2209,12 @@ void ScTable::FillMatrix( ScMatrix& rMat, SCCOL nCol1, SCROW nRow1, SCCOL nCol2, aCol[nCol].FillMatrix(rMat, nMatCol, nRow1, nRow2); } +void ScTable::InterpretDirtyCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) +{ + for (SCCOL nCol = nCol1; nCol <= nCol2; ++nCol) + aCol[nCol].InterpretDirtyCells(nRow1, nRow2); +} + const SvtBroadcaster* ScTable::GetBroadcaster( SCCOL nCol, SCROW nRow ) const { if (!ValidColRow(nCol, nRow)) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits