summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2013-11-07 14:16:48 -0500
committerKohei Yoshida <kohei.yoshida@collabora.com>2013-11-11 16:17:28 -0500
commit3ac4277ba1ad8925329bbe8a1c5ed3684b9b8ee7 (patch)
tree70b27ea6a553f1922ecda72ca44d4fd194bc0126 /formula
parent6122a6c272436f0f1959f160406d2e4ecdd1a733 (diff)
Thread-safe way to check for presence of references in formula tokens.
Change-Id: I995668d1e183dc0dae4f354889bc13053e858723
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/token.cxx27
1 files changed, 27 insertions, 0 deletions
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++ )