summaryrefslogtreecommitdiff
path: root/sc/inc/token.hxx
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2009-01-08 10:47:13 +0000
commit87307aba9e8dbca16672e6df701d9f905b9e1786 (patch)
treec4c94029c34c3a5dc7e0ed2d6cee8cebc5d31e6b /sc/inc/token.hxx
parentb142ca03365a5a5bfd8487fda9bfeea2e6db0d0b (diff)
CWS-TOOLING: integrate CWS frmdlg
2008-12-18 09:13:09 +0100 oj r265667 : merge from odff05 2008-12-18 07:58:16 +0100 oj r265658 : #i94555# patch from <regina>, ODFF: Add GAMMA, CHISQDIST, CHISQINV. Make the 'cumulative' parameter of GAMMADIST optional. Adapt the domain of CHIDIST to allow negative x. Remove the constraint "degrees of freedom < 1.0E5" from CHIDIST and CHIINV. Plus a mechanism to write the now optional parameter of GAMMADIST to PODF and ODFF if omitted, for backwards compatibility. 2008-12-15 14:06:11 +0100 oj r265490 : CWS-TOOLING: rebase CWS frmdlg to trunk@264807 (milestone: DEV300:m37) 2008-12-15 13:55:28 +0100 oj r265488 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:55:07 +0100 oj r265487 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:48 +0100 oj r265486 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:36 +0100 oj r265485 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:54:24 +0100 oj r265484 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:48:11 +0100 oj r265483 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:31:12 +0100 oj r265479 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:13:58 +0100 oj r265477 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:10:09 +0100 oj r265476 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 13:05:11 +0100 oj r265475 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:47:17 +0100 oj r265467 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:46:19 +0100 oj r265466 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 10:45:47 +0100 oj r265465 : CWS-TOOLING: do not delete this file, it's needed for 'cws rebase -C' CWS: frmdlg New MWS: DEV300 New milestone: m37 2008-12-15 07:35:07 +0100 oj r265458 : add dependency to formula 2008-12-15 07:34:24 +0100 oj r265457 : add dependency to formula 2008-12-12 13:22:00 +0100 msc r265413 : #i97089# 2008-12-12 13:20:25 +0100 msc r265412 : #i97089# 2008-12-12 12:35:12 +0100 msc r265406 : #i97089# 2008-12-12 12:34:16 +0100 msc r265405 : #i97089# 2008-12-12 12:33:05 +0100 msc r265404 : #i97089# 2008-12-12 12:31:11 +0100 msc r265403 : #i97089# 2008-12-08 11:59:10 +0100 oj r264981 : insert RTL_LOG 2008-12-08 11:50:17 +0100 oj r264980 : some small changes 2008-12-05 12:57:57 +0100 oj r264902 : eof changed 2008-12-05 12:56:46 +0100 oj r264901 : eof changed 2008-12-05 12:28:47 +0100 oj r264899 : wrong var used 2008-12-05 10:08:57 +0100 oj r264890 : token order reversed 2008-12-04 13:49:22 +0100 oc r264843 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:45:27 +0100 oc r264842 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:42:54 +0100 oc r264841 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:37:41 +0100 oc r264840 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 13:34:11 +0100 oc r264839 : #i96688: Adapt autotests because of outsourced functionwizard 2008-12-04 12:35:31 +0100 oj r264835 : new help ids for struct and function tabpage 2008-12-04 12:00:35 +0100 oj r264828 : set explicit help id 2008-12-03 14:53:27 +0100 oj r264786 : #i96845# change ref button 2008-12-03 14:51:49 +0100 oj r264785 : #i96845# change ref button 2008-12-03 08:51:57 +0100 oj r264746 : convert dos to unix lineends 2008-12-03 08:50:45 +0100 oj r264745 : convert dos to unix lineends 2008-12-03 08:50:05 +0100 oj r264744 : convert dos to unix lineends 2008-12-02 12:28:33 +0100 oj r264686 : clear help text when new helpid is set 2008-12-02 12:28:02 +0100 oj r264685 : set help id for listbox category 2008-12-02 07:15:56 +0100 oj r264655 : remove define to auto generate help ids 2008-12-01 14:36:43 +0100 oj r264604 : use temp var 2008-12-01 14:18:31 +0100 oj r264601 : moved ScJumpToken to formula 2008-12-01 14:18:11 +0100 oj r264600 : moved ScJumpToken to formula 2008-12-01 14:14:35 +0100 oj r264599 : moved ScJumpToken from sc 2008-12-01 10:48:51 +0100 oj r264589 : change quickhelptext from Shrink to Select 2008-12-01 10:28:41 +0100 oj r264588 : fix opcode data, has to be Any.Void 2008-11-28 11:16:48 +0100 oj r264532 : add help ids 2008-11-28 10:16:56 +0100 oj r264529 : set help id 2008-11-28 10:16:43 +0100 oj r264528 : set help id 2008-11-26 13:55:04 +0100 oj r264381 : #94535# use of optional instead of deleting a string myself and some small changes 2008-11-26 09:53:20 +0100 oj r264346 : compile error with debug/without debug 2008-11-25 07:41:28 +0100 oj r264271 : put static into the method which make use of them 2008-11-24 08:16:07 +0100 oj r264196 : removed not needed classes for op code 2008-11-24 08:13:44 +0100 oj r264195 : removed not needed classes for op code 2008-11-21 14:05:53 +0100 oj r264135 : make GetOpCode inline 2008-11-21 12:35:27 +0100 oj r264124 : hold symbols 2008-11-20 09:27:27 +0100 oj r264028 : merged code from DEV300_m35 which got lost 2008-11-19 20:42:12 +0100 oj r264022 : more changes for formula dialog remove 2008-11-19 20:37:41 +0100 oj r264021 : removed unused var 2008-11-19 20:35:35 +0100 oj r264020 : some more changes at token 2008-11-19 10:59:47 +0100 oj r263967 : deleted 2008-11-19 10:58:24 +0100 oj r263966 : add forui and for res files 2008-11-18 15:27:36 +0100 oj r263777 : unused para removed 2008-11-18 15:23:23 +0100 oj r263775 : add insert button to add field dlg 2008-11-18 13:39:53 +0100 oj r263764 : enable the formula dialog as well for conditional print as for conditional formatting 2008-11-18 12:03:25 +0100 oj r263760 : rename isRef in IsRef 2008-11-17 11:46:16 +0100 oj r263711 : patches for function handling 2008-11-17 11:36:22 +0100 oj r263710 : add new for forui and res file 2008-11-17 09:21:12 +0100 oj r263704 : patches for some resource for libformula 2008-11-15 12:45:30 +0100 oj r263701 : changes for formula editor extraction 2008-11-07 08:23:27 +0100 oj r263416 : merge from DEV300:m35 2008-11-07 08:22:35 +0100 oj r263415 : merge from DEV300:m35 2008-11-07 08:22:16 +0100 oj r263414 : merge from DEV300:m35 2008-11-07 08:21:41 +0100 oj r263413 : merge from DEV300:m35 2008-11-07 08:21:31 +0100 oj r263412 : merge from DEV300:m35 2008-11-07 08:20:38 +0100 oj r263411 : merge from DEV300:m35 2008-11-07 08:20:00 +0100 oj r263410 : merge from DEV300:m35 2008-11-07 08:18:50 +0100 oj r263409 : merge from DEV300:m35 2008-11-07 08:18:19 +0100 oj r263408 : merge from DEV300:m35 2008-11-07 08:10:27 +0100 oj r263407 : merge from DEV300:m35 2008-10-21 07:43:46 +0200 oj r262560 : some compile errors resolved 2008-10-17 16:40:01 +0200 oj r262291 : dep for 1st target 2008-10-07 10:08:39 +0200 oj r262077 : copy 2008-10-07 09:45:31 +0200 oj r262076 : #i94535# 2008-10-07 09:44:26 +0200 oj r262075 : #i94535# new base class 2008-10-07 09:43:21 +0200 oj r262074 : moved to formula 2008-10-07 09:41:51 +0200 oj r262073 : new images 2008-10-07 09:03:01 +0200 oj r262072 : new ids for formula 2008-10-02 08:46:27 +0200 oj r262024 : #i94535# move the formula compiler to formula 2008-10-02 08:08:54 +0200 oj r262023 : #i94535# 2008-10-02 08:06:28 +0200 oj r262022 : #i94535# 2008-10-02 08:05:52 +0200 oj r262021 : #i94535# 2008-10-01 17:15:29 +0200 oj r262014 : #i94535# 2008-10-01 17:12:40 +0200 oj r262013 : new module formula 2008-10-01 17:04:55 +0200 oj r262012 : #i94535# 2008-10-01 16:49:03 +0200 oj r262010 : #i94535# 2008-10-01 16:46:59 +0200 oj r262009 : #i94535#
Diffstat (limited to 'sc/inc/token.hxx')
-rw-r--r--sc/inc/token.hxx486
1 files changed, 68 insertions, 418 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx
index 0dd582504aac..6413c8a77992 100644
--- a/sc/inc/token.hxx
+++ b/sc/inc/token.hxx
@@ -33,111 +33,46 @@
#include <memory>
#include <vector>
-#include "opcode.hxx"
+#include "formula/opcode.hxx"
#include "refdata.hxx"
#include "scmatrix.hxx"
-#include "intruref.hxx"
+#include "formula/intruref.hxx"
#include <tools/mempool.hxx>
#include "scdllapi.h"
-
-enum StackVarEnum
-{
- svByte,
- svDouble,
- svString,
- svSingleRef,
- svDoubleRef,
- svMatrix,
- svIndex,
- svJump,
- svExternal, // Byte + String
- svFAP, // FormulaAutoPilot only, ever exported
- svJumpMatrix, // 2003-07-02
- svRefList, // ocUnion result
- svEmptyCell, // Result is an empty cell, e.g. in LOOKUP()
-
- svMatrixCell, // Result is a matrix with bells and
- // whistles as needed for _the_ matrix
- // formula result.
-
- svHybridCell, // A temporary condition of a formula
- // cell during import, having a double
- // and/or string result and a formula
- // string to be compiled.
- svExternalSingleRef,
- svExternalDoubleRef,
- svExternalName,
- svError, // error token
- svMissing = 0x70, // 0 or ""
- svSep, // separator, ocSep, ocOpen, ocClose
- svUnknown // unknown StackType
-};
-
-#ifdef PRODUCT
-// save memory since compilers tend to int an enum
-typedef BYTE StackVar;
-#else
-// have enum names in debugger
-typedef StackVarEnum StackVar;
-#endif
+#include "formula/IFunctionDescription.hxx"
+#include "formula/token.hxx"
class ScJumpMatrix;
-
class ScToken;
-typedef ScSimpleIntrusiveReference< class ScToken > ScTokenRef;
-typedef ScSimpleIntrusiveReference< const class ScToken > ScConstTokenRef;
typedef ::std::vector< ScComplexRefData > ScRefList;
+typedef formula::SimpleIntrusiveReference< class ScToken > ScTokenRef;
-class SC_DLLPUBLIC ScToken
+class SC_DLLPUBLIC ScToken : public formula::FormulaToken
{
private:
-
- const StackVar eType; // type of data
- mutable USHORT nRefCnt; // reference count
-
// not implemented, prevent usage
ScToken();
ScToken& operator=( const ScToken& );
protected:
- static String aDummyString;
-
- ScToken( StackVar eTypeP ) :
- eType( eTypeP ), nRefCnt(0) {}
- ScToken( const ScToken& r ) :
- eType( r.eType ), nRefCnt(0) {}
+ ScToken( formula::StackVar eTypeP,OpCode e = ocPush ) : formula::FormulaToken(eTypeP,e) {}
+ ScToken( const ScToken& r ): formula::FormulaToken(r) {}
public:
virtual ~ScToken();
- inline void Delete() { delete this; }
- inline StackVar GetType() const { return eType; }
- BOOL IsFunction() const; // pure functions, no operators
- BOOL IsMatrixFunction() const; // if a function _always_ returns a Matrix
- BYTE GetParamCount() const;
- inline void IncRef() const { nRefCnt++; }
- inline void DecRef() const
- {
- if (!--nRefCnt)
- const_cast<ScToken*>(this)->Delete();
- }
- inline USHORT GetRef() const { return nRefCnt; }
-
/**
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:
- - GetOpCode() since for a token type not needing an explicit OpCode set
- the implicit OpCode is ocPush.
-
- GetByte() since this represents the count of parameters to a function
- which of course is 0 on non-functions. ScByteToken and ScExternal do
+ 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
@@ -146,14 +81,6 @@ public:
Any other non-overloaded method pops up an assertion.
*/
- virtual OpCode GetOpCode() const;
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual bool HasForceArray() const;
- virtual void SetForceArray( bool b );
- virtual double GetDouble() const;
- virtual double& GetDoubleAsReference();
- virtual const String& GetString() const;
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual const ScComplexRefData& GetDoubleRef() const;
@@ -164,27 +91,12 @@ public:
virtual void CalcRelFromAbs( const ScAddress& );
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
- virtual USHORT GetIndex() const;
- virtual void SetIndex( USHORT n );
- virtual short* GetJump() const;
- virtual const String& GetExternal() const;
- virtual ScToken* GetFAPOrigToken() const;
virtual ScJumpMatrix* GetJumpMatrix() const;
virtual const ScRefList* GetRefList() const;
virtual ScRefList* GetRefList();
- virtual USHORT GetError() const;
- virtual void SetError( USHORT );
- ScToken* Clone() const;
-
- virtual BOOL operator==( const ScToken& rToken ) const;
- BOOL TextEqual( const ScToken& rToken ) const;
- BOOL Is3DRef() const; // reference with 3D flag set
-
-//UNUSED2008-05 // If token in RPN resulted from resolving a name and contains an absolute
-//UNUSED2008-05 // reference. Token must be obtained through ScTokenArray::GetNextReferenceRPN()
-//UNUSED2008-05 // or similar.
-//UNUSED2008-05 BOOL IsRPNReferenceAbsName() const;
+ virtual BOOL TextEqual( const formula::FormulaToken& rToken ) const;
+ virtual BOOL Is3DRef() const; // reference with 3D flag set
/** If rTok1 and rTok2 both are SingleRef or DoubleRef tokens, extend/merge
ranges as needed for ocRange.
@@ -198,179 +110,37 @@ public:
A reused or new'ed ScDoubleRefToken, or a NULL TokenRef if rTok1 or
rTok2 are not of sv(Single|Double)Ref
*/
- static ScTokenRef ExtendRangeReference( ScToken & rTok1, ScToken & rTok2, const ScAddress & rPos, bool bReuseDoubleRef );
-
- static size_t GetStrLenBytes( xub_StrLen nLen )
- { return nLen * sizeof(sal_Unicode); }
- static size_t GetStrLenBytes( const String& rStr )
- { return GetStrLenBytes( rStr.Len() ); }
+ static formula::FormulaTokenRef ExtendRangeReference( formula::FormulaToken & rTok1, formula::FormulaToken & rTok2, const ScAddress & rPos, bool bReuseDoubleRef );
};
-
-/** Tokens that need a different OpCode than ocPush are derived from this. */
-class ScOpToken : public ScToken
-{
-private:
- OpCode eOp;
-public:
- ScOpToken( OpCode e, StackVar v ) :
- ScToken( v ), eOp( e ) {}
- ScOpToken( const ScOpToken & r ) :
- ScToken( r ), eOp( r.eOp ) {}
- /** This is dirty and only the compiler should use it! */
- inline void NewOpCode( OpCode e ) { eOp = e; }
- virtual OpCode GetOpCode() const;
-
- // No operator== to be overloaded, ScToken::operator== already checks the
- // OpCode as well via GetOpCode().
-};
-
-
-class ScByteToken : public ScOpToken
-{
-private:
- BYTE nByte;
- bool bHasForceArray;
-protected:
- ScByteToken( OpCode e, BYTE n, StackVar v, bool b ) :
- ScOpToken( e, v ), nByte( n ),
- bHasForceArray( b ) {}
-public:
- ScByteToken( OpCode e, BYTE n, bool b ) :
- ScOpToken( e, svByte ), nByte( n ),
- bHasForceArray( b ) {}
- ScByteToken( OpCode e, BYTE n ) :
- ScOpToken( e, svByte ), nByte( n ),
- bHasForceArray( false ) {}
- ScByteToken( OpCode e ) :
- ScOpToken( e, svByte ), nByte( 0 ),
- bHasForceArray( false ) {}
- ScByteToken( const ScByteToken& r ) :
- ScOpToken( r ), nByte( r.nByte ),
- bHasForceArray( r.bHasForceArray ) {}
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual bool HasForceArray() const;
- virtual void SetForceArray( bool b );
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScByteToken );
-};
-
-
-// A special token for the FormulaAutoPilot only. Keeps a reference pointer of
-// the token of which it was created for comparison.
-class ScFAPToken : public ScByteToken
-{
-private:
- ScTokenRef pOrigToken;
-public:
- ScFAPToken( OpCode e, BYTE n, ScToken* p ) :
- ScByteToken( e, n, svFAP, false ),
- pOrigToken( p ) {}
- ScFAPToken( const ScFAPToken& r ) :
- ScByteToken( r ), pOrigToken( r.pOrigToken ) {}
- virtual ScToken* GetFAPOrigToken() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScDoubleToken : public ScToken
-{
-private:
- double fDouble;
-public:
- ScDoubleToken( double f ) :
- ScToken( svDouble ), fDouble( f ) {}
- ScDoubleToken( const ScDoubleToken& r ) :
- ScToken( r ), fDouble( r.fDouble ) {}
- virtual double GetDouble() const;
- virtual double& GetDoubleAsReference();
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleToken );
-};
-
-
-class ScStringToken : public ScToken
-{
-private:
- String aString;
-public:
- ScStringToken( const String& r ) :
- ScToken( svString ), aString( r ) {}
- ScStringToken( const ScStringToken& r ) :
- ScToken( r ), aString( r.aString ) {}
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-
- DECL_FIXEDMEMPOOL_NEWDEL( ScStringToken );
-};
-
-
-/** Identical to ScStringToken, but with explicit OpCode instead of implicit
- ocPush, and an optional BYTE for ocBad tokens. */
-class ScStringOpToken : public ScByteToken
-{
-private:
- String aString;
-public:
- ScStringOpToken( OpCode e, const String& r ) :
- ScByteToken( e, 0, svString, false ), aString( r ) {}
- ScStringOpToken( const ScStringOpToken& r ) :
- ScByteToken( r ), aString( r.aString ) {}
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScSingleRefToken : public ScToken
{
private:
ScSingleRefData aSingleRef;
public:
- ScSingleRefToken( const ScSingleRefData& r ) :
- ScToken( svSingleRef ), aSingleRef( r ) {}
+ ScSingleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svSingleRef, e ), aSingleRef( r ) {}
ScSingleRefToken( const ScSingleRefToken& r ) :
ScToken( r ), aSingleRef( r.aSingleRef ) {}
virtual const ScSingleRefData& GetSingleRef() const;
virtual ScSingleRefData& GetSingleRef();
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScSingleRefToken(*this); }
DECL_FIXEDMEMPOOL_NEWDEL( ScSingleRefToken );
};
-
-/** Identical to ScSingleRefToken, but with explicit OpCode instead of implicit
- ocPush. */
-class ScSingleRefOpToken : public ScOpToken
-{
-private:
- ScSingleRefData aSingleRef;
-public:
- ScSingleRefOpToken( OpCode e, const ScSingleRefData& r ) :
- ScOpToken( e, svSingleRef ), aSingleRef( r ) {}
- ScSingleRefOpToken( const ScSingleRefOpToken& r ) :
- ScOpToken( r ), aSingleRef( r.aSingleRef ) {}
- virtual const ScSingleRefData& GetSingleRef() const;
- virtual ScSingleRefData& GetSingleRef();
- virtual void CalcAbsIfRel( const ScAddress& );
- virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScDoubleRefToken : public ScToken
{
private:
ScComplexRefData aDoubleRef;
public:
- ScDoubleRefToken( const ScComplexRefData& r ) :
- ScToken( svDoubleRef ), aDoubleRef( r ) {}
- ScDoubleRefToken( const ScSingleRefData& r ) :
- ScToken( svDoubleRef )
+ ScDoubleRefToken( const ScComplexRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svDoubleRef, e ), aDoubleRef( r ) {}
+ ScDoubleRefToken( const ScSingleRefData& r, OpCode e = ocPush ) :
+ ScToken( formula::svDoubleRef, e )
{
aDoubleRef.Ref1 = r;
aDoubleRef.Ref2 = r;
@@ -385,118 +155,75 @@ public:
virtual ScSingleRefData& GetSingleRef2();
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScDoubleRefToken(*this); }
DECL_FIXEDMEMPOOL_NEWDEL( ScDoubleRefToken );
};
-
-/** Identical to ScDoubleRefToken, but with explicit OpCode instead of implicit
- ocPush. */
-class ScDoubleRefOpToken : public ScOpToken
-{
-private:
- ScComplexRefData aDoubleRef;
-public:
- ScDoubleRefOpToken( OpCode e, const ScComplexRefData& r ) :
- ScOpToken( e, svDoubleRef ), aDoubleRef( r ) {}
- ScDoubleRefOpToken( OpCode e, const ScSingleRefData& r ) :
- ScOpToken( e, svDoubleRef )
- {
- aDoubleRef.Ref1 = r;
- aDoubleRef.Ref2 = r;
- }
- ScDoubleRefOpToken( const ScDoubleRefOpToken& r ) :
- ScOpToken( r ), aDoubleRef( r.aDoubleRef ) {}
- 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 void CalcAbsIfRel( const ScAddress& );
- virtual void CalcRelFromAbs( const ScAddress& );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
class ScMatrixToken : public ScToken
{
private:
ScMatrixRef pMatrix;
public:
ScMatrixToken( ScMatrix* p ) :
- ScToken( svMatrix ), pMatrix( p ) {}
+ ScToken( formula::svMatrix ), pMatrix( p ) {}
ScMatrixToken( const ScMatrixToken& r ) :
ScToken( r ), pMatrix( r.pMatrix ) {}
virtual const ScMatrix* GetMatrix() const;
virtual ScMatrix* GetMatrix();
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScIndexToken : public ScOpToken
-{
-private:
- USHORT nIndex;
-public:
- ScIndexToken( OpCode e, USHORT n ) :
- ScOpToken( e, svIndex ), nIndex( n ) {}
- ScIndexToken( const ScIndexToken& r ) :
- ScOpToken( r ), nIndex( r.nIndex ) {}
- virtual USHORT GetIndex() const;
- virtual void SetIndex( USHORT n );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixToken(*this); }
};
-class ScExternalSingleRefToken : public ScOpToken
+class ScExternalSingleRefToken : public ScToken
{
private:
sal_uInt16 mnFileId;
String maTabName;
- SingleRefData maSingleRef;
+ ScSingleRefData maSingleRef;
ScExternalSingleRefToken(); // disabled
public:
- ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const SingleRefData& r );
+ ScExternalSingleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScSingleRefData& r );
ScExternalSingleRefToken( const ScExternalSingleRefToken& r );
virtual ~ScExternalSingleRefToken();
virtual USHORT GetIndex() const;
virtual const String& GetString() const;
- virtual const SingleRefData& GetSingleRef() const;
- virtual SingleRefData& GetSingleRef();
+ virtual const ScSingleRefData& GetSingleRef() const;
+ virtual ScSingleRefData& GetSingleRef();
virtual BOOL operator==( const ScToken& rToken ) const;
};
-class ScExternalDoubleRefToken : public ScOpToken
+class ScExternalDoubleRefToken : public ScToken
{
private:
sal_uInt16 mnFileId;
String maTabName; // name of the first sheet
- ComplRefData maDoubleRef;
+ ScComplexRefData maDoubleRef;
ScExternalDoubleRefToken(); // disabled
public:
- ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ComplRefData& r );
+ ScExternalDoubleRefToken( sal_uInt16 nFileId, const String& rTabName, const ScComplexRefData& r );
ScExternalDoubleRefToken( const ScExternalDoubleRefToken& r );
virtual ~ScExternalDoubleRefToken();
virtual USHORT GetIndex() const;
virtual const String& GetString() const;
- virtual const SingleRefData& GetSingleRef() const;
- virtual SingleRefData& GetSingleRef();
- virtual const SingleRefData& GetSingleRef2() const;
- virtual SingleRefData& GetSingleRef2();
- virtual const ComplRefData& GetDoubleRef() const;
- virtual ComplRefData& GetDoubleRef();
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual const ScSingleRefData& GetSingleRef() const;
+ virtual ScSingleRefData& GetSingleRef();
+ virtual const ScSingleRefData& GetSingleRef2() const;
+ virtual ScSingleRefData& GetSingleRef2();
+ virtual const ScComplexRefData& GetDoubleRef() const;
+ virtual ScComplexRefData& GetDoubleRef();
+ virtual BOOL operator==( const ScToken& rToken ) const;
};
-class ScExternalNameToken : public ScOpToken
+class ScExternalNameToken : public ScToken
{
private:
sal_uInt16 mnFileId;
@@ -513,29 +240,6 @@ public:
};
-class ScJumpToken : public ScOpToken
-{
-private:
- short* pJump;
-public:
- ScJumpToken( OpCode e, short* p ) :
- ScOpToken( e, svJump )
- {
- pJump = new short[ p[0] + 1 ];
- memcpy( pJump, p, (p[0] + 1) * sizeof(short) );
- }
- ScJumpToken( const ScJumpToken& r ) :
- ScOpToken( r )
- {
- pJump = new short[ r.pJump[0] + 1 ];
- memcpy( pJump, r.pJump, (r.pJump[0] + 1) * sizeof(short) );
- }
- virtual ~ScJumpToken();
- virtual short* GetJump() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
// Only created from within the interpreter, no conversion from ScRawToken,
// never added to ScTokenArray!
class ScJumpMatrixToken : public ScToken
@@ -544,12 +248,13 @@ private:
ScJumpMatrix* pJumpMatrix;
public:
ScJumpMatrixToken( ScJumpMatrix* p ) :
- ScToken( svJumpMatrix ), pJumpMatrix( p ) {}
+ ScToken( formula::svJumpMatrix ), pJumpMatrix( p ) {}
ScJumpMatrixToken( const ScJumpMatrixToken& r ) :
ScToken( r ), pJumpMatrix( r.pJumpMatrix ) {}
virtual ~ScJumpMatrixToken();
virtual ScJumpMatrix* GetJumpMatrix() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScJumpMatrixToken(*this); }
};
@@ -561,74 +266,15 @@ private:
ScRefList aRefList;
public:
ScRefListToken() :
- ScToken( svRefList ) {}
+ ScToken( formula::svRefList ) {}
ScRefListToken( const ScRefListToken & r ) :
ScToken( r ), aRefList( r.aRefList ) {}
virtual void CalcAbsIfRel( const ScAddress& );
virtual void CalcRelFromAbs( const ScAddress& );
virtual const ScRefList* GetRefList() const;
virtual ScRefList* GetRefList();
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class SC_DLLPUBLIC ScExternalToken : public ScOpToken
-{
-private:
- String aExternal;
- BYTE nByte;
-public:
- ScExternalToken( OpCode e, BYTE n, const String& r ) :
- ScOpToken( e, svExternal ), aExternal( r ),
- nByte( n ) {}
- ScExternalToken( OpCode e, const String& r ) :
- ScOpToken( e, svExternal ), aExternal( r ),
- nByte( 0 ) {}
- ScExternalToken( const ScExternalToken& r ) :
- ScOpToken( r ), aExternal( r.aExternal ),
- nByte( r.nByte ) {}
- virtual const String& GetExternal() const;
- virtual BYTE GetByte() const;
- virtual void SetByte( BYTE n );
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScMissingToken : public ScOpToken
-{
-public:
- ScMissingToken() :
- ScOpToken( ocMissing, svMissing ) {}
- ScMissingToken( const ScMissingToken& r ) :
- ScOpToken( r ) {}
- virtual double GetDouble() const;
- virtual const String& GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScUnknownToken : public ScOpToken
-{
-public:
- ScUnknownToken( OpCode e ) :
- ScOpToken( e, svUnknown ) {}
- ScUnknownToken( const ScUnknownToken& r ) :
- ScOpToken( r ) {}
- virtual BOOL operator==( const ScToken& rToken ) const;
-};
-
-
-class ScErrorToken : public ScToken
-{
- USHORT nError;
-public:
- ScErrorToken( USHORT nErr ) :
- ScToken( svError ), nError( nErr) {}
- ScErrorToken( const ScErrorToken& r ) :
- ScToken( r ), nError( r.nError) {}
- virtual USHORT GetError() const;
- virtual void SetError( USHORT nErr );
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScRefListToken(*this); }
};
@@ -638,7 +284,7 @@ class ScEmptyCellToken : public ScToken
bool bDisplayedAsString :1;
public:
explicit ScEmptyCellToken( bool bInheritedP, bool bDisplayAsString ) :
- ScToken( svEmptyCell ),
+ ScToken( formula::svEmptyCell ),
bInherited( bInheritedP ),
bDisplayedAsString( bDisplayAsString ) {}
ScEmptyCellToken( const ScEmptyCellToken& r ) :
@@ -649,7 +295,8 @@ public:
bool IsDisplayedAsString() const { return bDisplayedAsString; }
virtual double GetDouble() const;
virtual const String & GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScEmptyCellToken(*this); }
};
@@ -662,10 +309,10 @@ class ScMatrixCellResultToken : public ScToken
protected:
ScConstMatrixRef xMatrix;
- ScConstTokenRef xUpperLeft;
+ formula::FormulaConstTokenRef xUpperLeft;
public:
- ScMatrixCellResultToken( ScMatrix* pMat, ScToken* pUL ) :
- ScToken( svMatrixCell ),
+ ScMatrixCellResultToken( ScMatrix* pMat, formula::FormulaToken* pUL ) :
+ ScToken( formula::svMatrixCell ),
xMatrix( pMat), xUpperLeft( pUL) {}
ScMatrixCellResultToken( const ScMatrixCellResultToken& r ) :
ScToken( r ), xMatrix( r.xMatrix ),
@@ -673,14 +320,15 @@ public:
virtual double GetDouble() const;
virtual const String & GetString() const;
virtual const ScMatrix* GetMatrix() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
- StackVar GetUpperLeftType() const
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixCellResultToken(*this); }
+ formula::StackVar GetUpperLeftType() const
{
return xUpperLeft ?
xUpperLeft->GetType() :
- static_cast<StackVar>(svUnknown);
+ static_cast<formula::StackVar>(formula::svUnknown);
}
- ScConstTokenRef GetUpperLeftToken() const { return xUpperLeft; }
+ inline formula::FormulaConstTokenRef GetUpperLeftToken() const { return xUpperLeft; }
void Assign( const ScMatrixCellResultToken & r )
{
xMatrix = r.xMatrix;
@@ -709,7 +357,8 @@ public:
if (xUpperLeft)
xUpperLeft = xUpperLeft->Clone();
}
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScMatrixFormulaCellToken(*this); }
void SetMatColsRows( SCCOL nC, SCROW nR )
{
nRows = nR;
@@ -736,10 +385,10 @@ public:
appropriate Assign() call, other tokens
are assigned to xUpperLeft and xMatrix will
be assigned NULL. */
- void Assign( const ScToken & r );
+ void Assign( const formula::FormulaToken & r );
- /** Modify xUpperLeft if svDouble, or create
- new ScDoubleToken if not set yet. Does
+ /** Modify xUpperLeft if formula::svDouble, or create
+ new formula::FormulaDoubleToken if not set yet. Does
nothing if xUpperLeft is of different type! */
void SetUpperLeftDouble( double f);
@@ -763,7 +412,7 @@ public:
ScHybridCellToken( double f,
const String & rStr,
const String & rFormula ) :
- ScToken( svHybridCell ),
+ ScToken( formula::svHybridCell ),
fDouble( f ), aString( rStr ),
aFormula( rFormula ) {}
ScHybridCellToken( const ScHybridCellToken& r ) :
@@ -772,7 +421,8 @@ public:
const String & GetFormula() const { return aFormula; }
virtual double GetDouble() const;
virtual const String & GetString() const;
- virtual BOOL operator==( const ScToken& rToken ) const;
+ virtual BOOL operator==( const formula::FormulaToken& rToken ) const;
+ virtual FormulaToken* Clone() const { return new ScHybridCellToken(*this); }
};
@@ -791,7 +441,7 @@ class SingleDoubleRefModifier
public:
SingleDoubleRefModifier( ScToken& rT )
{
- if ( rT.GetType() == svSingleRef )
+ if ( rT.GetType() == formula::svSingleRef )
{
pS = &rT.GetSingleRef();
aDub.Ref1 = aDub.Ref2 = *pS;
@@ -826,7 +476,7 @@ public:
SingleDoubleRefProvider( const ScToken& r )
: Ref1( r.GetSingleRef() ),
- Ref2( r.GetType() == svDoubleRef ?
+ Ref2( r.GetType() == formula::svDoubleRef ?
r.GetDoubleRef().Ref2 : Ref1 )
{}
SingleDoubleRefProvider( const ScSingleRefData& r )