summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/token.hxx16
-rw-r--r--sc/source/core/tool/token.cxx30
2 files changed, 46 insertions, 0 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index f742d01ad7a1..8d0d3338f8ec 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -208,6 +208,22 @@ public:
virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScExternalNameToken(*this); }
};
+/** Special token to remember details of ocTableRef "structured references". */
+class ScTableRefToken : public formula::FormulaToken
+{
+ sal_uInt16 mnIndex; ///< index into table / database range collection
+
+ ScTableRefToken(); // disabled
+public:
+ ScTableRefToken( sal_uInt16 nIndex );
+ ScTableRefToken( const ScTableRefToken& r );
+ virtual ~ScTableRefToken();
+
+ virtual sal_uInt16 GetIndex() const SAL_OVERRIDE;
+ virtual bool operator==( const formula::FormulaToken& rToken ) const SAL_OVERRIDE;
+ virtual FormulaToken* Clone() const SAL_OVERRIDE { return new ScTableRefToken(*this); }
+};
+
// Only created from within the interpreter, no conversion from ScRawToken,
// never added to ScTokenArray!
class ScJumpMatrixToken : public formula::FormulaToken
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index ff0b548d822d..47e9237027f5 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -825,6 +825,36 @@ bool ScExternalNameToken::operator==( const FormulaToken& r ) const
return maName.getData() == r.GetString().getData();
}
+ScTableRefToken::ScTableRefToken( sal_uInt16 nIndex ) :
+ FormulaToken( svIndex, ocTableRef),
+ mnIndex(nIndex)
+{
+}
+
+ScTableRefToken::ScTableRefToken( const ScTableRefToken& r ) :
+ FormulaToken(r),
+ mnIndex(r.mnIndex)
+{
+}
+
+ScTableRefToken::~ScTableRefToken() {}
+
+sal_uInt16 ScTableRefToken::GetIndex() const
+{
+ return mnIndex;
+}
+
+bool ScTableRefToken::operator==( const FormulaToken& r ) const
+{
+ if ( !FormulaToken::operator==(r) )
+ return false;
+
+ if (mnIndex != r.GetIndex())
+ return false;
+
+ return true;
+}
+
ScJumpMatrix* ScJumpMatrixToken::GetJumpMatrix() const { return pJumpMatrix; }
bool ScJumpMatrixToken::operator==( const FormulaToken& r ) const
{