summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-22 16:44:10 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-22 21:49:25 -0400
commit71362fb191d87e918fbf066ce639b0df213bd2a7 (patch)
tree3c0f84f1e616f2a97345b2ad63b2fcc36ac1d830
parentea8ed4dac5390935021b0ca579f33393ac50bd30 (diff)
More on ScCellIterator conversion... More to come.
Change-Id: I7b80e8418e8f5ea4ea64f4f05c3709aaf8606bad
-rw-r--r--sc/source/core/tool/detfunc.cxx75
1 files changed, 37 insertions, 38 deletions
diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 57981eccabd4..280658e296cd 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -299,17 +299,16 @@ sal_Bool ScDetectiveFunc::HasError( const ScRange& rRange, ScAddress& rErrPos )
rErrPos = rRange.aStart;
sal_uInt16 nError = 0;
- ScCellIterator aCellIter( pDoc, rRange);
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
+ ScCellIterator aIter( pDoc, rRange);
+ for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
- {
- nError = ((ScFormulaCell*)pCell)->GetErrCode();
- if (nError)
- rErrPos = aCellIter.GetPos();
- }
- pCell = aCellIter.GetNext();
+ const ScCellValue& rVal = aIter.get();
+ if (rVal.meType != CELLTYPE_FORMULA)
+ continue;
+
+ nError = rVal.mpFormula->GetErrCode();
+ if (nError)
+ rErrPos = aIter.GetPos();
}
return (nError != 0);
@@ -792,27 +791,29 @@ sal_uInt16 ScDetectiveFunc::InsertPredLevelArea( const ScRange& rRef,
{
sal_uInt16 nResult = DET_INS_EMPTY;
- ScCellIterator aCellIter( pDoc, rRef);
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
+ ScCellIterator aIter( pDoc, rRef);
+ for (bool bHasCell = aIter.first(); bHasCell; bHasCell = aIter.next())
{
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
- switch( InsertPredLevel( aCellIter.GetPos().Col(), aCellIter.GetPos().Row(), rData, nLevel ) )
- {
- case DET_INS_INSERTED:
- nResult = DET_INS_INSERTED;
- break;
- case DET_INS_CONTINUE:
- if (nResult != DET_INS_INSERTED)
- nResult = DET_INS_CONTINUE;
- break;
- case DET_INS_CIRCULAR:
- if (nResult == DET_INS_EMPTY)
- nResult = DET_INS_CIRCULAR;
- break;
- }
+ if (aIter.get().meType != CELLTYPE_FORMULA)
+ continue;
- pCell = aCellIter.GetNext();
+ const ScAddress& rPos = aIter.GetPos();
+ switch (InsertPredLevel(rPos.Col(), rPos.Row(), rData, nLevel))
+ {
+ case DET_INS_INSERTED:
+ nResult = DET_INS_INSERTED;
+ break;
+ case DET_INS_CONTINUE:
+ if (nResult != DET_INS_INSERTED)
+ nResult = DET_INS_CONTINUE;
+ break;
+ case DET_INS_CIRCULAR:
+ if (nResult == DET_INS_EMPTY)
+ nResult = DET_INS_CIRCULAR;
+ break;
+ default:
+ ;
+ }
}
return nResult;
@@ -893,16 +894,14 @@ sal_uInt16 ScDetectiveFunc::FindPredLevelArea( const ScRange& rRef,
sal_uInt16 nResult = nLevel;
ScCellIterator aCellIter( pDoc, rRef);
- ScBaseCell* pCell = aCellIter.GetFirst();
- while (pCell)
+ for (bool bHasCell = aCellIter.first(); bHasCell; bHasCell = aCellIter.next())
{
- if (pCell->GetCellType() == CELLTYPE_FORMULA)
- {
- sal_uInt16 nTemp = FindPredLevel( aCellIter.GetPos().Col(), aCellIter.GetPos().Row(), nLevel, nDeleteLevel );
- if (nTemp > nResult)
- nResult = nTemp;
- }
- pCell = aCellIter.GetNext();
+ if (aCellIter.get().meType != CELLTYPE_FORMULA)
+ continue;
+
+ sal_uInt16 nTemp = FindPredLevel(aCellIter.GetPos().Col(), aCellIter.GetPos().Row(), nLevel, nDeleteLevel);
+ if (nTemp > nResult)
+ nResult = nTemp;
}
return nResult;