diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-01 16:04:35 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-01 18:55:53 -0400 |
commit | ed76237e41ecdb58f524e14ea6b8866f8dacf6a9 (patch) | |
tree | a33661b0686eb87e203b5c9f329867eb91c6ce0e /sc/inc/token.hxx | |
parent | 83f77ab0661df992f241e5f9ecb1aa8f8eaeafec (diff) |
Reduce dependency on the matrix header.
Change-Id: Iade09d108aec78f8cbe92f9103f206d0c99fab8e
Diffstat (limited to 'sc/inc/token.hxx')
-rw-r--r-- | sc/inc/token.hxx | 56 |
1 files changed, 15 insertions, 41 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index 109980fce92a..116022a6a9a9 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -26,7 +26,6 @@ #include "formula/opcode.hxx" #include "refdata.hxx" -#include "scmatrix.hxx" #include <tools/mempool.hxx> #include "scdllapi.h" #include "formula/IFunctionDescription.hxx" @@ -163,10 +162,9 @@ class ScMatrixToken : public ScToken private: ScMatrixRef pMatrix; public: - ScMatrixToken( ScMatrixRef p ) : - ScToken( formula::svMatrix ), pMatrix( p ) {} - ScMatrixToken( const ScMatrixToken& r ) : - ScToken( r ), pMatrix( r.pMatrix ) {} + ScMatrixToken( const ScMatrixRef& p ); + ScMatrixToken( const ScMatrixToken& r ); + virtual const ScMatrix* GetMatrix() const; virtual ScMatrix* GetMatrix(); virtual bool operator==( const formula::FormulaToken& rToken ) const; @@ -311,15 +309,11 @@ class SC_DLLPUBLIC ScMatrixCellResultToken : public ScToken virtual ScMatrix* GetMatrix(); protected: - ScConstMatrixRef xMatrix; - formula::FormulaConstTokenRef xUpperLeft; + ScConstMatrixRef xMatrix; + formula::FormulaConstTokenRef xUpperLeft; public: - ScMatrixCellResultToken( const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ) : - ScToken( formula::svMatrixCell ), - xMatrix( pMat), xUpperLeft( pUL) {} - ScMatrixCellResultToken( const ScMatrixCellResultToken& r ) : - ScToken( r ), xMatrix( r.xMatrix ), - xUpperLeft( r.xUpperLeft ) {} + ScMatrixCellResultToken( const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ); + ScMatrixCellResultToken( const ScMatrixCellResultToken& r ); virtual double GetDouble() const; virtual const String & GetString() const; virtual const ScMatrix* GetMatrix() const; @@ -332,11 +326,7 @@ public: static_cast<formula::StackVar>(formula::svUnknown); } inline formula::FormulaConstTokenRef GetUpperLeftToken() const { return xUpperLeft; } - void Assign( const ScMatrixCellResultToken & r ) - { - xMatrix = r.xMatrix; - xUpperLeft = r.xUpperLeft; - } + void Assign( const ScMatrixCellResultToken & r ); }; @@ -348,22 +338,10 @@ private: SCROW nRows; SCCOL nCols; public: - ScMatrixFormulaCellToken( SCCOL nC, SCROW nR, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ) : - ScMatrixCellResultToken(pMat, pUL), - nRows(nR), nCols(nC) {} - - ScMatrixFormulaCellToken( SCCOL nC, SCROW nR ) : - ScMatrixCellResultToken( NULL, NULL ), - nRows( nR ), nCols( nC ) {} - ScMatrixFormulaCellToken( const ScMatrixFormulaCellToken& r ) : - ScMatrixCellResultToken( r ), - nRows( r.nRows ), nCols( r.nCols ) - { - // xUpperLeft is modifiable through - // SetUpperLeftDouble(), so clone it. - if (xUpperLeft) - xUpperLeft = xUpperLeft->Clone(); - } + ScMatrixFormulaCellToken( SCCOL nC, SCROW nR, const ScConstMatrixRef& pMat, formula::FormulaToken* pUL ); + ScMatrixFormulaCellToken( SCCOL nC, SCROW nR ); + ScMatrixFormulaCellToken( const ScMatrixFormulaCellToken& r ); + virtual bool operator==( const formula::FormulaToken& rToken ) const; virtual FormulaToken* Clone() const { return new ScMatrixFormulaCellToken(*this); } void SetMatColsRows( SCCOL nC, SCROW nR ) @@ -399,13 +377,9 @@ public: nothing if xUpperLeft is of different type! */ void SetUpperLeftDouble( double f); - /** Reset matrix and upper left, keep matrix - formula dimension. */ - void ResetResult() - { - xMatrix = NULL; - xUpperLeft = NULL; - } + /** Reset matrix and upper left, keep matrix + formula dimension. */ + void ResetResult(); }; |