summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-07-23 10:43:38 -0400
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-07-24 23:29:38 -0400
commit7409a57d25f4f08fdc03a59afef829aab5dad026 (patch)
tree68e5913f48666e81c368ed7ca43748a7a6cffcc0 /sc
parent0e7f4c9c7d5d2a341448b9a7186b0cd972d0f8c0 (diff)
CalcRelFromAbs() is no more.
Change-Id: I974d8282eaf49a6c6d56fe209012f5e54170acc2
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/refdata.hxx3
-rw-r--r--sc/source/core/tool/refdata.cxx7
-rw-r--r--sc/source/core/tool/refupdat.cxx36
3 files changed, 22 insertions, 24 deletions
diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 07ea7ef382f6..145da50d1cb2 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -88,7 +88,6 @@ struct SC_DLLPUBLIC ScSingleRefData
SCCOL GetCol() const;
SCTAB GetTab() const;
- void CalcRelFromAbs( const ScAddress& rPos );
bool operator==( const ScSingleRefData& ) const;
bool operator!=( const ScSingleRefData& ) const;
@@ -135,8 +134,6 @@ struct ScComplexRefData
Ref1.InitAddress( nCol1, nRow1, nTab1 );
Ref2.InitAddress( nCol2, nRow2, nTab2 );
}
- inline void CalcRelFromAbs( const ScAddress& rPos )
- { Ref1.CalcRelFromAbs( rPos ); Ref2.CalcRelFromAbs( rPos ); }
inline bool IsDeleted() const
{ return Ref1.IsDeleted() || Ref2.IsDeleted(); }
inline bool Valid() const
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index 439886e25f7d..3d49fa861bcf 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -75,13 +75,6 @@ bool ScSingleRefData::IsDeleted() const
return IsColDeleted() || IsRowDeleted() || IsTabDeleted();
}
-void ScSingleRefData::CalcRelFromAbs( const ScAddress& rPos )
-{
- nRelCol = nCol - rPos.Col();
- nRelRow = nRow - rPos.Row();
- nRelTab = nTab - rPos.Tab();
-}
-
ScAddress ScSingleRefData::toAbs( const ScAddress& rPos ) const
{
SCCOL nRetCol = Flags.bColRel ? nRelCol + rPos.Col() : nCol;
diff --git a/sc/source/core/tool/refupdat.cxx b/sc/source/core/tool/refupdat.cxx
index 8ad478b3d172..ca993bdee26b 100644
--- a/sc/source/core/tool/refupdat.cxx
+++ b/sc/source/core/tool/refupdat.cxx
@@ -830,39 +830,47 @@ ScRefUpdateRes ScRefUpdate::Move(
void ScRefUpdate::MoveRelWrap( ScDocument* pDoc, const ScAddress& rPos,
SCCOL nMaxCol, SCROW nMaxRow, ScComplexRefData& rRef )
{
+ ScRange aAbsRange = rRef.toAbs(rPos);
if( rRef.Ref1.IsColRel() )
{
- rRef.Ref1.nCol = rRef.Ref1.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref1.nCol, static_cast<SCsCOL>(0), nMaxCol );
+ SCCOL nCol = aAbsRange.aStart.Col();
+ lcl_MoveItWrap(nCol, static_cast<SCsCOL>(0), nMaxCol);
+ aAbsRange.aStart.SetCol(nCol);
}
if( rRef.Ref2.IsColRel() )
{
- rRef.Ref2.nCol = rRef.Ref2.nRelCol + rPos.Col();
- lcl_MoveItWrap( rRef.Ref2.nCol, static_cast<SCsCOL>(0), nMaxCol );
+ SCCOL nCol = aAbsRange.aEnd.Col();
+ lcl_MoveItWrap(nCol, static_cast<SCsCOL>(0), nMaxCol);
+ aAbsRange.aEnd.SetCol(nCol);
}
if( rRef.Ref1.IsRowRel() )
{
- rRef.Ref1.nRow = rRef.Ref1.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref1.nRow, static_cast<SCsROW>(0), nMaxRow );
+ SCROW nRow = aAbsRange.aStart.Row();
+ lcl_MoveItWrap(nRow, static_cast<SCsROW>(0), nMaxRow);
+ aAbsRange.aStart.SetRow(nRow);
}
if( rRef.Ref2.IsRowRel() )
{
- rRef.Ref2.nRow = rRef.Ref2.nRelRow + rPos.Row();
- lcl_MoveItWrap( rRef.Ref2.nRow, static_cast<SCsROW>(0), nMaxRow );
+ SCROW nRow = aAbsRange.aEnd.Row();
+ lcl_MoveItWrap(nRow, static_cast<SCsROW>(0), nMaxRow);
+ aAbsRange.aEnd.SetRow(nRow);
}
SCsTAB nMaxTab = (SCsTAB) pDoc->GetTableCount() - 1;
if( rRef.Ref1.IsTabRel() )
{
- rRef.Ref1.nTab = rRef.Ref1.nRelTab + rPos.Tab();
- lcl_MoveItWrap( rRef.Ref1.nTab, static_cast<SCsTAB>(0), static_cast<SCTAB>(nMaxTab) );
+ SCTAB nTab = aAbsRange.aStart.Tab();
+ lcl_MoveItWrap(nTab, static_cast<SCsTAB>(0), static_cast<SCTAB>(nMaxTab));
+ aAbsRange.aStart.SetTab(nTab);
}
if( rRef.Ref2.IsTabRel() )
{
- rRef.Ref2.nTab = rRef.Ref2.nRelTab + rPos.Tab();
- lcl_MoveItWrap( rRef.Ref2.nTab, static_cast<SCsTAB>(0), static_cast<SCTAB>(nMaxTab) );
+ SCTAB nTab = aAbsRange.aEnd.Tab();
+ lcl_MoveItWrap(nTab, static_cast<SCsTAB>(0), static_cast<SCTAB>(nMaxTab));
+ aAbsRange.aEnd.SetTab(nTab);
}
- rRef.PutInOrder();
- rRef.CalcRelFromAbs( rPos );
+
+ aAbsRange.PutInOrder();
+ rRef.SetRange(aAbsRange, rPos);
}
//------------------------------------------------------------------