summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2015-03-12 02:44:42 +0100
committerEike Rathke <erack@redhat.com>2015-03-12 02:47:17 +0100
commit1714dd654ee04918c0814fd09cd8522493d804b4 (patch)
tree730548e7c0f3b6f96edb5f3ea828164a4a51a7a6
parentdbbe0f81e23cfd8139fad1ab94f2817d3bab02e6 (diff)
TableRef: parse item specifiers
Change-Id: If1419844544be08fa14b6c78c755abba35fff353
-rw-r--r--sc/inc/compiler.hxx2
-rw-r--r--sc/source/core/tool/compiler.cxx29
2 files changed, 31 insertions, 0 deletions
diff --git a/sc/inc/compiler.hxx b/sc/inc/compiler.hxx
index ec99d45ce260..b4b194598c72 100644
--- a/sc/inc/compiler.hxx
+++ b/sc/inc/compiler.hxx
@@ -381,7 +381,9 @@ public:
// Check if it is a valid english function name
bool IsEnglishSymbol( const OUString& rName );
+
bool IsErrorConstant( const OUString& ) const;
+ bool IsTableRefItem( const OUString& ) const;
/**
* When auto correction is set, the jump command reorder must be enabled.
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index ff06f179f991..fb999b45b64d 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -3282,6 +3282,27 @@ bool ScCompiler::IsErrorConstant( const OUString& rName ) const
return false;
}
+bool ScCompiler::IsTableRefItem( const OUString& rName ) const
+{
+ OpCodeHashMap::const_iterator iLook( mxSymbols->getHashMap()->find( rName));
+ if (iLook != mxSymbols->getHashMap()->end())
+ {
+ switch ((*iLook).second)
+ {
+ case ocTableRefItemAll:
+ case ocTableRefItemHeaders:
+ case ocTableRefItemData:
+ case ocTableRefItemTotals:
+ case ocTableRefItemThisRow:
+ maRawToken.SetOpCode( (*iLook).second );
+ return true;
+ default:
+ ;
+ }
+ }
+ return false;
+}
+
void ScCompiler::SetAutoCorrection( bool bVal )
{
assert(mbJumpCommandReorder);
@@ -3596,9 +3617,17 @@ bool ScCompiler::NextNewToken( bool bInArray )
bAsciiUpper = lcl_UpperAsciiOrI18n( aUpper, aOrg, meGrammar);
if (cSymbol[0] == '#')
{
+ // Check for TableRef item specifiers first.
+ if (!maTableRefs.empty())
+ {
+ if (IsTableRefItem( aUpper ))
+ return true;
+ }
+
// This can be only an error constant, if any.
if (IsErrorConstant( aUpper))
return true;
+
break; // do; create ocBad token or set error.
}
if (IsOpCode( aUpper, bInArray ))