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/source/core | |
parent | 326494b71ce56488760d42c245df745deb713b16 (diff) |
replace ScNameToken with proper FormulaIndexToken
Diffstat (limited to 'sc/source/core')
-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 |
3 files changed, 6 insertions, 42 deletions
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 ) |