From 1e060e94629aac8b37d59e34159198aa9e8f4b39 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Fri, 13 Mar 2015 18:18:57 +0000 Subject: add items to ScTableRefToken Change-Id: I23ddec273f7d3df0d5342b73c54ae411b9ef3782 --- sc/source/core/tool/compiler.cxx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index 718817611ec2..ca677699a6d6 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3308,23 +3308,44 @@ bool ScCompiler::IsErrorConstant( const OUString& rName ) const bool ScCompiler::IsTableRefItem( const OUString& rName ) const { + bool bItem = false; OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName)); if (iLook != mxSymbols->getHashMap()->end()) { + // Only called when there actually is a current TableRef, hence + // accessing maTableRefs.back() is safe. + ScTableRefToken* p = dynamic_cast(maTableRefs.back().mxToken.get()); + assert(p); // not a ScTableRefToken can't be + switch ((*iLook).second) { case ocTableRefItemAll: + bItem = true; + p->AddItem( ScTableRefToken::ALL); + break; case ocTableRefItemHeaders: + bItem = true; + p->AddItem( ScTableRefToken::HEADERS); + break; case ocTableRefItemData: + bItem = true; + p->AddItem( ScTableRefToken::DATA); + break; case ocTableRefItemTotals: + bItem = true; + p->AddItem( ScTableRefToken::TOTALS); + break; case ocTableRefItemThisRow: - maRawToken.SetOpCode( (*iLook).second ); - return true; + bItem = true; + p->AddItem( ScTableRefToken::THIS_ROW); + break; default: ; } + if (bItem) + maRawToken.SetOpCode( (*iLook).second ); } - return false; + return bItem; } void ScCompiler::SetAutoCorrection( bool bVal ) -- cgit