diff options
-rw-r--r-- | formula/inc/formula/token.hxx | 1 | ||||
-rw-r--r-- | formula/inc/formula/tokenarray.hxx | 1 | ||||
-rw-r--r-- | formula/source/core/api/FormulaCompiler.cxx | 6 | ||||
-rw-r--r-- | formula/source/core/api/token.cxx | 22 |
4 files changed, 27 insertions, 3 deletions
diff --git a/formula/inc/formula/token.hxx b/formula/inc/formula/token.hxx index be1b2f6acd..8b4f53a4f9 100644 --- a/formula/inc/formula/token.hxx +++ b/formula/inc/formula/token.hxx @@ -113,6 +113,7 @@ public: inline StackVar GetType() const { return eType; } BOOL IsFunction() const; // pure functions, no operators BOOL IsMatrixFunction() const; // if a function _always_ returns a Matrix + bool IsExternalRef() const; BYTE GetParamCount() const; inline void IncRef() const { nRefCnt++; } inline void DecRef() const diff --git a/formula/inc/formula/tokenarray.hxx b/formula/inc/formula/tokenarray.hxx index 54e8179c3f..ff1cabb190 100644 --- a/formula/inc/formula/tokenarray.hxx +++ b/formula/inc/formula/tokenarray.hxx @@ -125,6 +125,7 @@ public: FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); } FormulaToken* PrevRPN(); + bool HasExternalRef() const; BOOL HasOpCode( OpCode ) const; BOOL HasOpCodeRPN( OpCode ) const; /// Token of type svIndex or opcode ocColRowName diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx index 2cd662d18d..3c87ce3855 100644 --- a/formula/source/core/api/FormulaCompiler.cxx +++ b/formula/source/core/api/FormulaCompiler.cxx @@ -881,7 +881,7 @@ BOOL FormulaCompiler::GetToken() } if( pToken->GetOpCode() == ocSubTotal ) glSubTotal = TRUE; - else if ( pToken->GetOpCode() == ocExternalRef ) + else if ( pToken->IsExternalRef() ) { return HandleExternalReference(*pToken); } @@ -1175,7 +1175,7 @@ void FormulaCompiler::Factor() bCorrected = TRUE; } } - else if ( eOp == ocExternalRef ) + else if ( pToken->IsExternalRef() ) { PutCode(pToken); eOp = NextToken(); @@ -1595,7 +1595,7 @@ FormulaToken* FormulaCompiler::CreateStringFromToken( rtl::OUStringBuffer& rBuff } if( bNext ) { - if (eOp == ocExternalRef) + if (t->IsExternalRef()) { CreateStringFromExternal(rBuffer, pTokenP); } diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index ccc740633c..028197c1d5 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -145,6 +145,18 @@ BOOL FormulaToken::IsMatrixFunction() const return formula::FormulaCompiler::IsMatrixFunction(GetOpCode()); } +bool FormulaToken::IsExternalRef() const +{ + switch (eType) + { + case svExternalSingleRef: + case svExternalDoubleRef: + case svExternalName: + return true; + } + return false; +} + BOOL FormulaToken::operator==( const FormulaToken& rToken ) const { // don't compare reference count! @@ -550,6 +562,16 @@ FormulaToken* FormulaTokenArray::PeekPrevNoSpaces() return NULL; } +bool FormulaTokenArray::HasExternalRef() const +{ + for ( USHORT j=0; j < nLen; j++ ) + { + if (pCode[j]->IsExternalRef()) + return true; + } + return false; +} + BOOL FormulaTokenArray::HasOpCode( OpCode eOp ) const { for ( USHORT j=0; j < nLen; j++ ) |