summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-03-25 11:21:47 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-03-26 01:41:18 -0400
commitd799201cd4776353e927587bebab5f4e693845e5 (patch)
tree4bcd06342c588ee43da653c1889d8ecba095f384 /sc
parent24c5edc895ae979e92fafa222d7eee392fbea0ac (diff)
This one too.
Change-Id: Ie0965d1b61d32c943bde3f295e73423008f6b77b
Diffstat (limited to 'sc')
-rw-r--r--sc/source/core/tool/compiler.cxx42
1 files changed, 13 insertions, 29 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index 5bb14c859b0a..80428a4fb070 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3025,42 +3025,26 @@ bool ScCompiler::IsColRowName( const String& rName )
nThisTab <= rNameRange.aEnd.Tab()) )
continue; // for
ScCellIterator aIter( pDoc, rNameRange );
- for ( ScBaseCell* pCell = aIter.GetFirst(); pCell && !bInList;
- pCell = aIter.GetNext() )
+ for (bool bHas = aIter.first(); bHas && !bInList; bHas = aIter.next())
{
// Don't crash if cell (via CompileNameFormula) encounters
// a formula cell without code and
// HasStringData/Interpret/Compile is executed and all that
// recursive..
// Furthermore, *this* cell won't be touched, since no RPN exists yet.
- CellType eType = pCell->GetCellType();
- bool bOk = ( (eType == CELLTYPE_FORMULA ?
- ((ScFormulaCell*)pCell)->GetCode()->GetCodeLen() > 0
- && ((ScFormulaCell*)pCell)->aPos != aPos // noIter
- : true ) );
- if ( bOk && pCell->HasStringData() )
+ CellType eType = aIter.getType();
+ bool bOk = false;
+ if (eType == CELLTYPE_FORMULA)
{
- String aStr;
- switch ( eType )
- {
- case CELLTYPE_STRING:
- aStr = ((ScStringCell*)pCell)->GetString();
- break;
- case CELLTYPE_FORMULA:
- aStr = ((ScFormulaCell*)pCell)->GetString();
- break;
- case CELLTYPE_EDIT:
- aStr = ((ScEditCell*)pCell)->GetString();
- break;
- case CELLTYPE_NONE:
- case CELLTYPE_VALUE:
- case CELLTYPE_NOTE:
-#if OSL_DEBUG_LEVEL > 0
- case CELLTYPE_DESTROYED:
-#endif
- ; // nothing, prevent compiler warning
- break;
- }
+ ScFormulaCell* pFC = aIter.getFormulaCell();
+ bOk = (pFC->GetCode()->GetCodeLen() > 0) && (pFC->aPos != aPos);
+ }
+ else
+ bOk = true;
+
+ if (bOk && aIter.hasString())
+ {
+ OUString aStr = aIter.getString();
if ( ScGlobal::GetpTransliteration()->isEqual( aStr, aName ) )
{
aRef.InitFlags();