diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-25 11:14:21 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-03-26 01:41:18 -0400 |
commit | 24c5edc895ae979e92fafa222d7eee392fbea0ac (patch) | |
tree | b35d2540d21cf4c708383849e6142dec8e364fb9 | |
parent | 0075402e354dead483ca242962314aae5782134c (diff) |
Another one...
Change-Id: Id2ee7d959cd374ce45a36dbd8d8dc8e4e46f9c83
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 2aad01abf796..5bb14c859b0a 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3154,41 +3154,26 @@ bool ScCompiler::IsColRowName( const String& rName ) else { ScCellIterator aIter( pDoc, ScRange( aOne, aTwo ) ); - for ( ScBaseCell* pCell = aIter.GetFirst(); pCell; pCell = aIter.GetNext() ) + for (bool bHas = aIter.first(); bHas; bHas = aIter.next()) { if ( bFound ) { // stop if everything else is further away if ( nMax < (long)aIter.GetPos().Col() ) break; // aIter } - 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 ) ) { SCCOL nCol = aIter.GetPos().Col(); |