sc/inc/refdata.hxx               |    3 ---
 sc/source/core/tool/refdata.cxx  |    7 -------
 sc/source/core/tool/refupdat.cxx |   36 ++++++++++++++++++++++--------------
 3 files changed, 22 insertions(+), 24 deletions(-)

New commits:
commit 1d070b2e03ae34519077edf856502ad285c7cfcb
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Tue Jul 23 10:43:38 2013 -0400

    CalcRelFromAbs() is no more.
    
    Change-Id: I974d8282eaf49a6c6d56fe209012f5e54170acc2

diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 07ea7ef..145da50 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 439886e..3d49fa8 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 8ad478b..ca993bd 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);
 }
 
 //------------------------------------------------------------------
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to