sc/inc/refdata.hxx              |    5 ++---
 sc/source/core/tool/refdata.cxx |   24 +++++-------------------
 sc/source/core/tool/token.cxx   |   12 ++----------
 3 files changed, 9 insertions(+), 32 deletions(-)

New commits:
commit 2d399787bb705324d53cfba74ff08f65f51ae002
Author: Kohei Yoshida <kohei.yosh...@gmail.com>
Date:   Mon Jul 15 20:17:19 2013 -0400

    SmartRelAbs() is no more.
    
    Change-Id: I8822d6dc36f49fe1e77100275616d8017b0a7627

diff --git a/sc/inc/refdata.hxx b/sc/inc/refdata.hxx
index 2e5b5c7..0eef078 100644
--- a/sc/inc/refdata.hxx
+++ b/sc/inc/refdata.hxx
@@ -83,7 +83,6 @@ struct SC_DLLPUBLIC ScSingleRefData
 
     ScAddress toAbs( const ScAddress& rPos ) const;
 
-            void SmartRelAbs( const ScAddress& rPos );
             void CalcRelFromAbs( const ScAddress& rPos );
             void CalcAbsIfRel( const ScAddress& rPos );
             bool operator==( const ScSingleRefData& ) const;
@@ -151,8 +150,6 @@ struct ScComplexRefData
             Ref1.InitAddress( nCol1, nRow1, nTab1 );
             Ref2.InitAddress( nCol2, nRow2, nTab2 );
         }
-    inline void SmartRelAbs( const ScAddress& rPos )
-        { Ref1.SmartRelAbs( rPos ); Ref2.SmartRelAbs( rPos ); }
     inline void CalcRelFromAbs( const ScAddress& rPos )
         { Ref1.CalcRelFromAbs( rPos ); Ref2.CalcRelFromAbs( rPos ); }
     inline void CalcAbsIfRel( const ScAddress& rPos )
@@ -165,6 +162,8 @@ struct ScComplexRefData
         tab if one sheet, or >=0 if more than one sheets. */
     inline  bool ValidExternal() const;
 
+    ScRange toAbs( const ScAddress& rPos ) const;
+
     /// Absolute references have to be up-to-date when calling this!
     void PutInOrder();
     inline bool operator==( const ScComplexRefData& r ) const
diff --git a/sc/source/core/tool/refdata.cxx b/sc/source/core/tool/refdata.cxx
index cdfaded..fa479d0 100644
--- a/sc/source/core/tool/refdata.cxx
+++ b/sc/source/core/tool/refdata.cxx
@@ -43,25 +43,6 @@ ScAddress ScSingleRefData::toAbs( const ScAddress& rPos ) 
const
     return ScAddress(nRetCol, nRetRow, nRetTab);
 }
 
-void ScSingleRefData::SmartRelAbs( const ScAddress& rPos )
-{
-    if ( Flags.bColRel )
-        nCol = nRelCol + rPos.Col();
-    else
-        nRelCol = nCol - rPos.Col();
-
-    if ( Flags.bRowRel )
-        nRow = nRelRow + rPos.Row();
-    else
-        nRelRow = nRow - rPos.Row();
-
-    if ( Flags.bTabRel )
-        nTab = nRelTab + rPos.Tab();
-    else
-        nRelTab = nTab - rPos.Tab();
-}
-
-
 void ScSingleRefData::CalcAbsIfRel( const ScAddress& rPos )
 {
     if ( Flags.bColRel )
@@ -269,4 +250,9 @@ ScComplexRefData& ScComplexRefData::Extend( const 
ScComplexRefData & rRef, const
     return Extend( rRef.Ref1, rPos).Extend( rRef.Ref2, rPos);
 }
 
+ScRange ScComplexRefData::toAbs( const ScAddress& rPos ) const
+{
+    return ScRange(Ref1.toAbs(rPos), Ref2.toAbs(rPos));
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx
index f8e3e3b..5dccc7c 100644
--- a/sc/source/core/tool/token.cxx
+++ b/sc/source/core/tool/token.cxx
@@ -496,19 +496,11 @@ bool ScToken::TextEqual( const FormulaToken& _rToken ) 
const
             aTemp2 = rToken.GetDoubleRef();
 
         ScAddress aPos;
-        aTemp1.SmartRelAbs(aPos);
-        aTemp2.SmartRelAbs(aPos);
+        ScRange aRange1 = aTemp1.toAbs(aPos), aRange2 = aTemp2.toAbs(aPos);
 
         //  memcmp doesn't work because of the alignment byte after bFlags.
         //  After SmartRelAbs only absolute parts have to be compared.
-        return aTemp1.Ref1.nCol   == aTemp2.Ref1.nCol   &&
-               aTemp1.Ref1.nRow   == aTemp2.Ref1.nRow   &&
-               aTemp1.Ref1.nTab   == aTemp2.Ref1.nTab   &&
-               aTemp1.Ref1.mnFlagValue == aTemp2.Ref1.mnFlagValue &&
-               aTemp1.Ref2.nCol   == aTemp2.Ref2.nCol   &&
-               aTemp1.Ref2.nRow   == aTemp2.Ref2.nRow   &&
-               aTemp1.Ref2.nTab   == aTemp2.Ref2.nTab   &&
-               aTemp1.Ref2.mnFlagValue == aTemp2.Ref2.mnFlagValue;
+        return aRange1 == aRange2 && aTemp1.Ref1.mnFlagValue == 
aTemp2.Ref1.mnFlagValue && aTemp1.Ref2.mnFlagValue == aTemp2.Ref2.mnFlagValue;
     }
     else
         return *this == _rToken;     // else normal operator==
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to