summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-25 11:29:46 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-26 01:41:19 -0400
commitf74e52fe79692bba8603411246a30fc1bfa55f58 (patch)
treec7fef82142d9f6d2b6cfa9be37aa9371d5d53966
parentd799201cd4776353e927587bebab5f4e693845e5 (diff)
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
-rw-r--r--sc/inc/dociter.hxx4
-rw-r--r--sc/source/core/data/dociter.cxx64
-rw-r--r--sc/source/core/tool/chgtrack.cxx5
3 files changed, 3 insertions, 70 deletions
diff --git a/sc/inc/dociter.hxx b/sc/inc/dociter.hxx
index a0ffa5c99a44..141a1bae9023 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 ebbfd65bdb49..3a39454008b3 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 652c1320c8ea..7e06debe02b3 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();
}
}
}