From 3ac4277ba1ad8925329bbe8a1c5ed3684b9b8ee7 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Thu, 7 Nov 2013 14:16:48 -0500 Subject: Thread-safe way to check for presence of references in formula tokens. Change-Id: I995668d1e183dc0dae4f354889bc13053e858723 --- formula/source/core/api/token.cxx | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'formula') diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 8f0cfa828c5b..ae1655eb9365 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -130,6 +130,22 @@ bool FormulaToken::IsExternalRef() const return bRet; } +bool FormulaToken::IsRef() const +{ + switch (eType) + { + case svSingleRef: + case svDoubleRef: + case svExternalSingleRef: + case svExternalDoubleRef: + return true; + default: + ; + } + + return false; +} + bool FormulaToken::operator==( const FormulaToken& rToken ) const { // don't compare reference count! @@ -538,6 +554,17 @@ FormulaToken* FormulaTokenArray::PeekPrevNoSpaces() return NULL; } +bool FormulaTokenArray::HasReferences() const +{ + for (sal_uInt16 i = 0; i < nLen; ++i) + { + if (pCode[i]->IsRef()) + return true; + } + + return false; +} + bool FormulaTokenArray::HasExternalRef() const { for ( sal_uInt16 j=0; j < nLen; j++ ) -- cgit