diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-23 00:23:06 -0400 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-07-24 23:29:38 -0400 |
commit | 4c8f7c0977c30258e6542d0ea070e060958abeb6 (patch) | |
tree | 7c15cc2d27b1f32fec0a0348375d72e9e9d23cf6 /sc | |
parent | 97a640d2a447e71f6d6947b47efe9a7f6a2ce4ce (diff) |
More on removing CalcRelFromAbs().
Change-Id: I6474926d9cd8f9273bae3d8179bd14ee19422357
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/refdata.hxx | 29 | ||||
-rw-r--r-- | sc/source/core/tool/compiler.cxx | 15 | ||||
-rw-r--r-- | sc/source/core/tool/refdata.cxx | 21 | ||||
-rw-r--r-- | sc/source/filter/excel/excform8.cxx | 28 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotform.cxx | 10 |
5 files changed, 47 insertions, 56 deletions
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx index 848bbd608e07..07ea7ef382f6 100644 --- a/sc/inc/refdata.hxx +++ b/sc/inc/refdata.hxx @@ -54,10 +54,10 @@ struct SC_DLLPUBLIC ScSingleRefData /// No default ctor, because used in ScRawToken union, set InitFlags! inline void InitFlags() { mnFlagValue = 0; } ///< all FALSE /// InitAddress: InitFlags and set address - inline void InitAddress( const ScAddress& rAdr ); - inline void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab ); + void InitAddress( const ScAddress& rAdr ); + void InitAddress( SCCOL nCol, SCROW nRow, SCTAB nTab ); /// InitAddressRel: InitFlags and set address, everything relative to rPos - inline void InitAddressRel( const ScAddress& rAdr, const ScAddress& rPos ); + void InitAddressRel( const ScAddress& rAdr, const ScAddress& rPos ); inline void SetColRel( bool bVal ) { Flags.bColRel = (bVal ? true : false ); } inline bool IsColRel() const{ return Flags.bColRel; } inline void SetRowRel( bool bVal ) { Flags.bRowRel = (bVal ? true : false ); } @@ -97,29 +97,6 @@ struct SC_DLLPUBLIC ScSingleRefData #endif }; -inline void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP ) -{ - InitFlags(); - nCol = nColP; - nRow = nRowP; - nTab = nTabP; -} - -inline void ScSingleRefData::InitAddress( const ScAddress& rAdr ) -{ - InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab()); -} - -inline void ScSingleRefData::InitAddressRel( const ScAddress& rAdr, - const ScAddress& rPos ) -{ - InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab()); - SetColRel( true ); - SetRowRel( true ); - SetTabRel( true ); - CalcRelFromAbs( rPos ); -} - inline bool ScSingleRefData::Valid() const { return nCol >= 0 && nCol <= MAXCOL && diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index c63921ff372c..4a871472f3a4 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -5284,7 +5284,7 @@ bool ScCompiler::HandleSingleRef() aRefData.SetColRel( true ); else aRefData.SetRowRel( true ); - aRefData.CalcRelFromAbs( aPos ); + aRefData.SetAddress(aRange.aStart, aPos); pNew->AddSingleReference( aRefData ); } else @@ -5301,7 +5301,7 @@ bool ScCompiler::HandleSingleRef() aRefData.Ref1.SetRowRel( true ); aRefData.Ref2.SetRowRel( true ); } - aRefData.CalcRelFromAbs( aPos ); + aRefData.SetRange(aRange, aPos); if ( bInList ) pNew->AddDoubleReference( aRefData ); else @@ -5328,13 +5328,10 @@ bool ScCompiler::HandleDbData() { ScComplexRefData aRefData; aRefData.InitFlags(); - pDBData->GetArea( (SCTAB&) aRefData.Ref1.nTab, - (SCCOL&) aRefData.Ref1.nCol, - (SCROW&) aRefData.Ref1.nRow, - (SCCOL&) aRefData.Ref2.nCol, - (SCROW&) aRefData.Ref2.nRow); - aRefData.Ref2.nTab = aRefData.Ref1.nTab; - aRefData.CalcRelFromAbs( aPos ); + ScRange aRange; + pDBData->GetArea(aRange); + aRange.aEnd.SetTab(aRange.aStart.Tab()); + aRefData.SetRange(aRange, aPos); ScTokenArray* pNew = new ScTokenArray(); pNew->AddDoubleReference( aRefData ); PushTokenArray( pNew, true ); diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx index 3a7e2b006ba8..439886e25f7d 100644 --- a/sc/source/core/tool/refdata.cxx +++ b/sc/source/core/tool/refdata.cxx @@ -19,6 +19,27 @@ #include "refdata.hxx" +void ScSingleRefData::InitAddress( const ScAddress& rAdr ) +{ + InitAddress( rAdr.Col(), rAdr.Row(), rAdr.Tab()); +} + +void ScSingleRefData::InitAddress( SCCOL nColP, SCROW nRowP, SCTAB nTabP ) +{ + InitFlags(); + nCol = nColP; + nRow = nRowP; + nTab = nTabP; +} + +void ScSingleRefData::InitAddressRel( const ScAddress& rAdr, const ScAddress& rPos ) +{ + SetColRel(true); + SetRowRel(true); + SetTabRel(true); + SetAddress(rAdr, rPos); +} + void ScSingleRefData::SetColDeleted( bool bVal ) { Flags.bColDeleted = (bVal ? true : false ); diff --git a/sc/source/filter/excel/excform8.cxx b/sc/source/filter/excel/excform8.cxx index 8efbc1a97a65..3eec9bae1964 100644 --- a/sc/source/filter/excel/excform8.cxx +++ b/sc/source/filter/excel/excform8.cxx @@ -319,31 +319,33 @@ ConvErr ExcelToSc8::Convert( const ScTokenArray*& rpTokArray, XclImpStream& aIn, case 0x03: // Col 4 - ref case 0x06: // RwV 4 - val case 0x07: // ColV 4 - val + { aIn >> nRow >> nCol; - - aSRD.InitAddress( ScAddress( static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab() ) ); + ScAddress aAddr(static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab()); + aSRD.InitAddress(aAddr); if( nEptg == 0x02 || nEptg == 0x06 ) - aSRD.SetRowRel( sal_True ); + aSRD.SetRowRel(true); else - aSRD.SetColRel( sal_True ); + aSRD.SetColRel(true); - aSRD.CalcRelFromAbs( aEingPos ); + aSRD.SetAddress(aAddr, aEingPos); aStack << aPool.StoreNlf( aSRD ); - break; + } + break; case 0x0A: // Radical 13 - ref + { aIn >> nRow >> nCol; aIn.Ignore( 9 ); - - aSRD.InitAddress( ScAddress( static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab() ) ); - - aSRD.SetColRel( sal_True ); - - aSRD.CalcRelFromAbs( aEingPos ); + ScAddress aAddr(static_cast<SCCOL>(nCol & 0xFF), static_cast<SCROW>(nRow), aEingPos.Tab()); + aSRD.InitAddress(aAddr); + aSRD.SetColRel(true); + aSRD.SetAddress(aAddr, aEingPos); aStack << aPool.StoreNlf( aSRD ); - break; + } + break; case 0x0B: // RadicalS 13 x ref aIn.Ignore( 13 ); aExtensions.push_back( EXTENSION_NLR ); diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 0278c757fb27..33e8456532da 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -295,20 +295,14 @@ void LotusToSc::ReadSRD( ScSingleRefData& rSRD, sal_uInt8 nRelBit ) Read( nTab ); Read( nCol ); - sal_Bool b3D = ( static_cast< SCTAB >( nTab ) != aEingPos.Tab() ); + bool b3D = (static_cast<SCTAB>(nTab) != aEingPos.Tab()); rSRD.SetColRel( ( nRelBit & 0x01 ) != 0 ); - rSRD.nCol = static_cast< SCsCOL >( nCol ); - rSRD.SetRowRel( ( nRelBit & 0x02 ) != 0 ); - rSRD.nRow = static_cast< SCsROW >( nRow ); - rSRD.SetTabRel( ( ( nRelBit & 0x04) != 0 ) || !b3D ); - rSRD.nTab = static_cast< SCsTAB >( nTab ); - rSRD.SetFlag3D( b3D ); - rSRD.CalcRelFromAbs( aEingPos ); + rSRD.SetAddress(ScAddress(nCol, nRow, nTab), aEingPos); } |