Thread-safe way to check for presence of references in formula tokens.
Change-Id: I995668d1e183dc0dae4f354889bc13053e858723
This commit is contained in:
@@ -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++ )
|
||||
|
@@ -106,7 +106,10 @@ public:
|
||||
inline void Delete() { delete this; }
|
||||
inline StackVar GetType() const { return eType; }
|
||||
bool IsFunction() const; // pure functions, no operators
|
||||
bool IsExternalRef() const;
|
||||
|
||||
bool IsExternalRef() const;
|
||||
bool IsRef() const;
|
||||
|
||||
sal_uInt8 GetParamCount() const;
|
||||
|
||||
inline void IncRef() const
|
||||
|
@@ -116,6 +116,8 @@ public:
|
||||
FormulaToken* LastRPN() { nIndex = nRPN; return PrevRPN(); }
|
||||
FormulaToken* PrevRPN();
|
||||
|
||||
bool HasReferences() const;
|
||||
|
||||
bool HasExternalRef() const;
|
||||
bool HasOpCode( OpCode ) const;
|
||||
bool HasOpCodeRPN( OpCode ) const;
|
||||
|
@@ -518,8 +518,7 @@ sal_uInt16 ScRangeData::GetErrCode() const
|
||||
|
||||
bool ScRangeData::HasReferences() const
|
||||
{
|
||||
pCode->Reset();
|
||||
return pCode->GetNextReference() != NULL;
|
||||
return pCode->HasReferences();
|
||||
}
|
||||
|
||||
sal_uInt32 ScRangeData::GetUnoType() const
|
||||
|
Reference in New Issue
Block a user