Kaydet (Commit) d701a1a6 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Move virtual ScToken members up to FormulaToken

Change-Id: I20eb3b44d540f459cd1902a7a3b6a5c867e5bc07
üst 19d2f421
...@@ -254,6 +254,71 @@ void FormulaToken::SetError( sal_uInt16 ) ...@@ -254,6 +254,71 @@ void FormulaToken::SetError( sal_uInt16 )
SAL_WARN( "formula.core", "FormulaToken::SetError: virtual dummy called" ); SAL_WARN( "formula.core", "FormulaToken::SetError: virtual dummy called" );
} }
const ScSingleRefData* FormulaToken::GetSingleRef() const
{
OSL_FAIL( "FormulaToken::GetSingleRef: virtual dummy called" );
return nullptr;
}
ScSingleRefData* FormulaToken::GetSingleRef()
{
OSL_FAIL( "FormulaToken::GetSingleRef: virtual dummy called" );
return nullptr;
}
const ScComplexRefData* FormulaToken::GetDoubleRef() const
{
OSL_FAIL( "FormulaToken::GetDoubleRef: virtual dummy called" );
return nullptr;
}
ScComplexRefData* FormulaToken::GetDoubleRef()
{
OSL_FAIL( "FormulaToken::GetDoubleRef: virtual dummy called" );
return nullptr;
}
const ScSingleRefData* FormulaToken::GetSingleRef2() const
{
OSL_FAIL( "FormulaToken::GetSingleRef2: virtual dummy called" );
return nullptr;
}
ScSingleRefData* FormulaToken::GetSingleRef2()
{
OSL_FAIL( "FormulaToken::GetSingleRef2: virtual dummy called" );
return nullptr;
}
const ScMatrix* FormulaToken::GetMatrix() const
{
OSL_FAIL( "FormulaToken::GetMatrix: virtual dummy called" );
return NULL;
}
ScMatrix* FormulaToken::GetMatrix()
{
OSL_FAIL( "FormulaToken::GetMatrix: virtual dummy called" );
return NULL;
}
ScJumpMatrix* FormulaToken::GetJumpMatrix() const
{
OSL_FAIL( "FormulaToken::GetJumpMatrix: virtual dummy called" );
return NULL;
}
const std::vector<ScComplexRefData>* FormulaToken::GetRefList() const
{
OSL_FAIL( "FormulaToken::GetRefList: virtual dummy called" );
return NULL;
}
std::vector<ScComplexRefData>* FormulaToken::GetRefList()
{
OSL_FAIL( "FormulaToken::GetRefList: virtual dummy called" );
return NULL;
}
bool FormulaToken::TextEqual( const FormulaToken& rToken ) const bool FormulaToken::TextEqual( const FormulaToken& rToken ) const
{ {
return *this == rToken; return *this == rToken;
......
...@@ -20,6 +20,10 @@ ...@@ -20,6 +20,10 @@
#ifndef INCLUDED_FORMULA_TOKEN_HXX #ifndef INCLUDED_FORMULA_TOKEN_HXX
#define INCLUDED_FORMULA_TOKEN_HXX #define INCLUDED_FORMULA_TOKEN_HXX
#include <sal/config.h>
#include <vector>
#include <string.h> #include <string.h>
#include <formula/opcode.hxx> #include <formula/opcode.hxx>
#include <tools/mempool.hxx> #include <tools/mempool.hxx>
...@@ -29,6 +33,11 @@ ...@@ -29,6 +33,11 @@
#include <svl/sharedstring.hxx> #include <svl/sharedstring.hxx>
#include <osl/interlck.h> #include <osl/interlck.h>
class ScJumpMatrix;
class ScMatrix;
struct ScComplexRefData;
struct ScSingleRefData;
namespace formula namespace formula
{ {
...@@ -154,6 +163,18 @@ public: ...@@ -154,6 +163,18 @@ public:
virtual sal_uInt16 GetError() const; virtual sal_uInt16 GetError() const;
virtual void SetError( sal_uInt16 ); virtual void SetError( sal_uInt16 );
virtual const ScSingleRefData* GetSingleRef() const;
virtual ScSingleRefData* GetSingleRef();
virtual const ScComplexRefData* GetDoubleRef() const;
virtual ScComplexRefData* GetDoubleRef();
virtual const ScSingleRefData* GetSingleRef2() const;
virtual ScSingleRefData* GetSingleRef2();
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
virtual ScJumpMatrix* GetJumpMatrix() const;
virtual const std::vector<ScComplexRefData>* GetRefList() const;
virtual std::vector<ScComplexRefData>* GetRefList();
virtual FormulaToken* Clone() const { return new FormulaToken(*this); } virtual FormulaToken* Clone() const { return new FormulaToken(*this); }
virtual bool TextEqual( const formula::FormulaToken& rToken ) const; virtual bool TextEqual( const formula::FormulaToken& rToken ) const;
......
...@@ -62,33 +62,6 @@ protected: ...@@ -62,33 +62,6 @@ protected:
public: public:
virtual ~ScToken(); virtual ~ScToken();
/**
Dummy methods to avoid switches and casts where possible,
the real token classes have to overload the appropriate method[s].
The only methods valid anytime if not overloaded are:
- GetByte() since this represents the count of parameters to a function
which of course is 0 on non-functions. formula::FormulaByteToken and ScExternal do
overload it.
- HasForceArray() since also this is only used for operators and
functions and is 0 for other tokens.
Any other non-overloaded method pops up an assertion.
*/
virtual const ScSingleRefData* GetSingleRef() const;
virtual ScSingleRefData* GetSingleRef();
virtual const ScComplexRefData* GetDoubleRef() const;
virtual ScComplexRefData* GetDoubleRef();
virtual const ScSingleRefData* GetSingleRef2() const;
virtual ScSingleRefData* GetSingleRef2();
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
virtual ScJumpMatrix* GetJumpMatrix() const;
virtual const ScRefList* GetRefList() const;
virtual ScRefList* GetRefList();
}; };
#if DEBUG_FORMULA_COMPILER #if DEBUG_FORMULA_COMPILER
......
...@@ -637,71 +637,6 @@ FormulaTokenRef extendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2 ...@@ -637,71 +637,6 @@ FormulaTokenRef extendRangeReference( FormulaToken & rTok1, FormulaToken & rTok2
return FormulaTokenRef(xRes.get()); return FormulaTokenRef(xRes.get());
} }
const ScSingleRefData* ScToken::GetSingleRef() const
{
OSL_FAIL( "ScToken::GetSingleRef: virtual dummy called" );
return nullptr;
}
ScSingleRefData* ScToken::GetSingleRef()
{
OSL_FAIL( "ScToken::GetSingleRef: virtual dummy called" );
return nullptr;
}
const ScComplexRefData* ScToken::GetDoubleRef() const
{
OSL_FAIL( "ScToken::GetDoubleRef: virtual dummy called" );
return nullptr;
}
ScComplexRefData* ScToken::GetDoubleRef()
{
OSL_FAIL( "ScToken::GetDoubleRef: virtual dummy called" );
return nullptr;
}
const ScSingleRefData* ScToken::GetSingleRef2() const
{
OSL_FAIL( "ScToken::GetSingleRef2: virtual dummy called" );
return nullptr;
}
ScSingleRefData* ScToken::GetSingleRef2()
{
OSL_FAIL( "ScToken::GetSingleRef2: virtual dummy called" );
return nullptr;
}
const ScMatrix* ScToken::GetMatrix() const
{
OSL_FAIL( "ScToken::GetMatrix: virtual dummy called" );
return NULL;
}
ScMatrix* ScToken::GetMatrix()
{
OSL_FAIL( "ScToken::GetMatrix: virtual dummy called" );
return NULL;
}
ScJumpMatrix* ScToken::GetJumpMatrix() const
{
OSL_FAIL( "ScToken::GetJumpMatrix: virtual dummy called" );
return NULL;
}
const ScRefList* ScToken::GetRefList() const
{
OSL_FAIL( "ScToken::GetRefList: virtual dummy called" );
return NULL;
}
ScRefList* ScToken::GetRefList()
{
OSL_FAIL( "ScToken::GetRefList: virtual dummy called" );
return NULL;
}
// real implementations of virtual functions // real implementations of virtual functions
const ScSingleRefData* ScSingleRefToken::GetSingleRef() const { return &aSingleRef; } const ScSingleRefData* ScSingleRefToken::GetSingleRef() const { return &aSingleRef; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment