diff options
author | Eike Rathke <erack@erack.de> | 2011-08-24 01:39:19 +0200 |
---|---|---|
committer | Eike Rathke <erack@erack.de> | 2011-08-24 01:39:43 +0200 |
commit | fcac4e3eb4df6dcd4d6f6955a5d369262bcd1ea4 (patch) | |
tree | 2b48f9ffe8469737fe4ee297c0ffe1c83f228881 /sc | |
parent | 326494b71ce56488760d42c245df745deb713b16 (diff) |
replace ScNameToken with proper FormulaIndexToken
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/token.hxx | 18 | ||||
-rw-r--r-- | sc/source/core/data/cell.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 4 | ||||
-rw-r--r-- | sc/source/core/tool/token.cxx | 40 | ||||
-rw-r--r-- | sc/source/filter/excel/xeformula.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/tokenuno.cxx | 2 |
6 files changed, 8 insertions, 62 deletions
diff --git a/sc/inc/token.hxx b/sc/inc/token.hxx index cec672fddb95..90c9dfbc48ac 100644 --- a/sc/inc/token.hxx +++ b/sc/inc/token.hxx @@ -236,24 +236,6 @@ public: virtual FormulaToken* Clone() const { return new ScExternalDoubleRefToken(*this); } }; -class ScNameToken : public ScToken -{ -private: - sal_uInt16 mnIndex; - bool mbGlobal; // true = global, false = local -private: - ScNameToken(); // disabled -public: - ScNameToken(sal_uInt16 nIndex, bool bGlobal, OpCode eOpCode = ocName); - ScNameToken(const ScNameToken& r); - virtual ~ScNameToken(); - virtual sal_uInt8 GetByte() const; - virtual void SetByte(sal_uInt8 aGlobal); - virtual sal_uInt16 GetIndex() const; - virtual bool operator==( const formula::FormulaToken& rToken ) const; - virtual FormulaToken* Clone() const { return new ScNameToken(*this); } -}; - class ScExternalNameToken : public ScToken { private: diff --git a/sc/source/core/data/cell.cxx b/sc/source/core/data/cell.cxx index 4d030ccd6aea..d2700c09adb3 100644 --- a/sc/source/core/data/cell.cxx +++ b/sc/source/core/data/cell.cxx @@ -133,7 +133,7 @@ ScBaseCell* lclCloneCell( const ScBaseCell& rSrcCell, ScDocument& rDestDoc, cons void adjustRangeName(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOldDoc, const ScAddress& aNewPos, const ScAddress& aOldPos) { - bool bOldGlobal = static_cast<bool>(pToken->GetByte()); + bool bOldGlobal = pToken->IsGlobal(); SCTAB aOldTab = aOldPos.Tab(); rtl::OUString aRangeName; int nOldIndex = pToken->GetIndex(); @@ -183,7 +183,7 @@ void adjustRangeName(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOl } sal_Int32 nIndex = pRangeData->GetIndex(); pToken->SetIndex(nIndex); - pToken->SetByte(bNewGlobal); + pToken->SetGlobal(bNewGlobal); } void adjustDBRange(ScToken* pToken, ScDocument& rNewDoc, const ScDocument* pOldDoc) diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index ab918071e09e..8d1ad64e4742 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -3979,7 +3979,7 @@ bool ScCompiler::HandleRange() { ScRangeData* pRangeData = NULL; - bool bGlobal = pToken->GetByte(); + bool bGlobal = pToken->IsGlobal(); if (bGlobal) // global named range. pRangeData = pDoc->GetRangeName()->findByIndex( pToken->GetIndex() ); @@ -5157,7 +5157,7 @@ void ScCompiler::CreateStringFromIndex(rtl::OUStringBuffer& rBuffer,FormulaToken { case ocName: { - bool bGlobal = _pTokenP->GetByte(); + bool bGlobal = _pTokenP->IsGlobal(); ScRangeData* pData = NULL; if (bGlobal) // global named range. diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index e9c4e67b718c..c34a1ac9d801 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -388,7 +388,7 @@ FormulaToken* ScRawToken::CreateToken() const IF_NOT_OPCODE_ERROR( ocPush, ScMatrixToken); return new ScMatrixToken( pMat ); case svIndex : - return new ScNameToken(name.nIndex, name.bGlobal, eOp); + return new FormulaIndexToken( eOp, name.nIndex, name.bGlobal); case svExternalSingleRef: { String aTabName(extref.cTabName); @@ -959,42 +959,6 @@ bool ScExternalDoubleRefToken::operator ==( const FormulaToken& r ) const // ============================================================================ -ScNameToken::ScNameToken(sal_uInt16 nIndex, bool bGlobal, OpCode eOpCode) : - ScToken(svIndex, eOpCode), mnIndex(nIndex), mbGlobal(bGlobal) {} - -ScNameToken::ScNameToken(const ScNameToken& r) : - ScToken(r), mnIndex(r.mnIndex), mbGlobal(r.mbGlobal) {} - -ScNameToken::~ScNameToken() {} - -sal_uInt8 ScNameToken::GetByte() const -{ - return static_cast<sal_uInt8>(mbGlobal); -} - -void ScNameToken::SetByte(sal_uInt8 aGlobal) -{ - mbGlobal = static_cast<bool>(aGlobal); -} - -sal_uInt16 ScNameToken::GetIndex() const -{ - return mnIndex; -} - -bool ScNameToken::operator==( const FormulaToken& r ) const -{ - if ( !FormulaToken::operator==(r) ) - return false; - - if (mbGlobal != static_cast<bool>(r.GetByte())) - return false; - - return mnIndex == r.GetIndex(); -} - -// ============================================================================ - ScExternalNameToken::ScExternalNameToken( sal_uInt16 nFileId, const String& rName ) : ScToken( svExternalName, ocPush), mnFileId(nFileId), @@ -1637,7 +1601,7 @@ FormulaToken* ScTokenArray::AddMatrix( const ScMatrixRef& p ) FormulaToken* ScTokenArray::AddRangeName( sal_uInt16 n, bool bGlobal ) { - return Add(new ScNameToken(n, bGlobal)); + return Add( new FormulaIndexToken( ocName, n, bGlobal)); } FormulaToken* ScTokenArray::AddExternalName( sal_uInt16 nFileId, const String& rName ) diff --git a/sc/source/filter/excel/xeformula.cxx b/sc/source/filter/excel/xeformula.cxx index a3ab112d4525..86acbc47da38 100644 --- a/sc/source/filter/excel/xeformula.cxx +++ b/sc/source/filter/excel/xeformula.cxx @@ -2053,7 +2053,7 @@ void XclExpFmlaCompImpl::ProcessExternalRangeRef( const XclExpScToken& rTokData void XclExpFmlaCompImpl::ProcessDefinedName( const XclExpScToken& rTokData ) { SCTAB nTab = SCTAB_GLOBAL; - bool bGlobal = static_cast<bool>(rTokData.mpScToken->GetByte()); + bool bGlobal = rTokData.mpScToken->IsGlobal(); if (!bGlobal && mxData->mpScBasePos) nTab = mxData->mpScBasePos->Tab(); diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 2e6658b2b57f..a963834ca09a 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -399,7 +399,7 @@ bool ScTokenConversion::ConvertToTokenSequence( ScDocument& rDoc, { sheet::NameToken aNameToken; aNameToken.Index = static_cast<sal_Int32>( rToken.GetIndex() ); - aNameToken.Global = static_cast<sal_Bool>( rToken.GetByte() ); + aNameToken.Global = static_cast<sal_Bool>( rToken.IsGlobal() ); rAPI.Data <<= aNameToken; } break; |