[Libreoffice-commits] core.git: Branch 'feature/formula-core-rework' - sc/inc sc/source
Kohei Yoshida
kohei.yoshida at gmail.com
Mon Mar 25 08:28:12 PDT 2013
sc/inc/dociter.hxx | 4 --
sc/source/core/data/dociter.cxx | 64 ---------------------------------------
sc/source/core/tool/chgtrack.cxx | 5 +--
3 files changed, 3 insertions(+), 70 deletions(-)
New commits:
commit b8118d349fa1f4b7436c188851c9b5ce74bdd1f4
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Mar 25 11:29:46 2013 -0400
Remove the last use of GetFirst() & GetNext().
Though I had to cheat this by using getHackedBaseCell(). So I still
need to rework the call site to not rely on ScBaseCell...
Change-Id: I53fc715770b99ef1f2091f90046091d28cdaaee8
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index a0ffa5c..141a1ba 100644
--- a/sc/inc/dociter.hxx
+++ b/sc/inc/dociter.hxx
@@ -229,7 +229,6 @@ private:
ScFormulaCell* mpCurFormula; // points to the original.
};
- ScBaseCell* GetThis();
void init();
bool getCurrent();
public:
@@ -239,8 +238,7 @@ public:
bool bSTotal = false);
ScCellIterator(ScDocument* pDoc,
const ScRange& rRange, bool bSTotal = false);
- ScBaseCell* GetFirst();
- ScBaseCell* GetNext();
+
const ScAddress& GetPos() const { return maCurPos; }
CellType getType() const;
diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx
index ebbfd65..3a39454 100644
--- a/sc/source/core/data/dociter.cxx
+++ b/sc/source/core/data/dociter.cxx
@@ -993,70 +993,6 @@ void ScCellIterator::init()
}
}
-ScBaseCell* ScCellIterator::GetThis()
-{
- ScColumn* pCol = &(mpDoc->maTabs[maCurPos.Tab()])->aCol[maCurPos.Col()];
- for ( ;; )
- {
- if (maCurPos.Row() > maEndPos.Row())
- {
- maCurPos.SetRow(maStartPos.Row());
- do
- {
- maCurPos.IncCol();
- if (maCurPos.Col() > maEndPos.Col())
- {
- maCurPos.SetCol(maStartPos.Col());
- maCurPos.IncTab();
- if (maCurPos.Tab() > maEndPos.Tab())
- return NULL; // Over and out
- }
- pCol = &(mpDoc->maTabs[maCurPos.Tab()])->aCol[maCurPos.Col()];
- } while ( pCol->maItems.empty() );
- pCol->Search(maCurPos.Row(), mnIndex);
- }
-
- while ( (mnIndex < pCol->maItems.size()) && (pCol->maItems[mnIndex].nRow < maCurPos.Row()) )
- ++mnIndex;
-
- if (mnIndex < pCol->maItems.size() && pCol->maItems[mnIndex].nRow <= maEndPos.Row())
- {
- maCurPos.SetRow(pCol->maItems[mnIndex].nRow);
- if (!mbSubTotal || !mpDoc->maTabs[maCurPos.Tab()]->RowFiltered(maCurPos.Row()))
- {
- ScBaseCell* pCell = pCol->maItems[mnIndex].pCell;
-
- if ( mbSubTotal && pCell->GetCellType() == CELLTYPE_FORMULA
- && ((ScFormulaCell*)pCell)->IsSubTotal() )
- maCurPos.IncRow(); // Don't subtotal rows
- else
- return pCell; // Found it!
- }
- else
- maCurPos.IncRow();
- }
- else
- maCurPos.SetRow(maEndPos.Row() + 1); // Next column
- }
-}
-
-ScBaseCell* ScCellIterator::GetFirst()
-{
- if ( !ValidTab(maCurPos.Tab()) )
- return NULL;
-
- maCurPos = maStartPos;
- ScColumn* pCol = &(mpDoc->maTabs[maCurPos.Tab()])->aCol[maCurPos.Col()];
- pCol->Search(maCurPos.Row(), mnIndex);
- return GetThis();
-}
-
-ScBaseCell* ScCellIterator::GetNext()
-{
- maCurPos.IncRow();
- return GetThis();
-}
-
bool ScCellIterator::getCurrent()
{
ScColumn* pCol = &(mpDoc->maTabs[maCurPos.Tab()])->aCol[maCurPos.Col()];
diff --git a/sc/source/core/tool/chgtrack.cxx b/sc/source/core/tool/chgtrack.cxx
index 652c132..7e06deb 100644
--- a/sc/source/core/tool/chgtrack.cxx
+++ b/sc/source/core/tool/chgtrack.cxx
@@ -2655,9 +2655,9 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange,
ScAddress aPos;
ScBigAddress aBigPos;
ScCellIterator aIter( pRefDoc, rOrgRange );
- ScBaseCell* pCell = aIter.GetFirst();
- while ( pCell )
+ for (bool bHas = aIter.first(); bHas; bHas = aIter.next())
{
+ ScBaseCell* pCell = aIter.getHackedBaseCell();
if ( ScChangeActionContent::GetContentCellType( pCell ) )
{
aBigPos.Set( aIter.GetPos().Col() + nDx, aIter.GetPos().Row() + nDy,
@@ -2673,7 +2673,6 @@ void ScChangeTrack::LookUpContents( const ScRange& rOrgRange,
//! korrekt zu erfassen
}
}
- pCell = aIter.GetNext();
}
}
}
More information about the Libreoffice-commits
mailing list