[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 2 commits - sc/source

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Jan 4 07:00:49 PST 2012


 sc/source/core/data/table5.cxx         |   16 ++++++++++------
 sc/source/core/tool/detfunc.cxx        |    6 +++++-
 sc/source/core/tool/reftokenhelper.cxx |   17 +++--------------
 3 files changed, 18 insertions(+), 21 deletions(-)

New commits:
commit 26d174c1a31a74c39820aa621118f02cff4d43a6
Author: Laurent Godard <lgodard.libre at laposte.net>
Date:   Wed Jan 4 15:28:35 2012 +0100

    move static casts outside loops
    
    some little perf. improvements on saving spreadsheets

diff --git a/sc/source/core/data/table5.cxx b/sc/source/core/data/table5.cxx
index f5a2abe..fffd42f 100644
--- a/sc/source/core/data/table5.cxx
+++ b/sc/source/core/data/table5.cxx
@@ -966,9 +966,11 @@ void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& r
 {
     using ::sal::static_int_cast;
 
-    pRowFlags->AndValue(0, MAXROW, static_int_cast<sal_uInt8>(~nFlagMask));
+    sal_uInt8 nFlagMaskComplement = static_int_cast<sal_uInt8>(~nFlagMask);
+
+    pRowFlags->AndValue(0, MAXROW, nFlagMaskComplement);
     for (SCCOL i = 0; i <= MAXCOL; ++i)
-        pColFlags[i] &= static_int_cast<sal_uInt8>(~nFlagMask);
+        pColFlags[i] &= nFlagMaskComplement;
 
     {
         // row hidden flags.
@@ -981,7 +983,7 @@ void lcl_syncFlags(ScFlatBoolColSegments& rColSegments, ScFlatBoolRowSegments& r
                 break;
 
             if (aData.mbValue)
-                pRowFlags->OrValue(nRow, aData.mnRow2, static_int_cast<sal_uInt8>(nFlagMask));
+                pRowFlags->OrValue(nRow, aData.mnRow2, nFlagMask);
 
             nRow = aData.mnRow2 + 1;
         }
@@ -1014,16 +1016,18 @@ void ScTable::SyncColRowFlags()
 {
     using ::sal::static_int_cast;
 
+    sal_uInt8 nManualBreakComplement = static_int_cast<sal_uInt8>(~CR_MANUALBREAK);
+
     // Manual breaks.
-    pRowFlags->AndValue(0, MAXROW, static_int_cast<sal_uInt8>(~CR_MANUALBREAK));
+    pRowFlags->AndValue(0, MAXROW, nManualBreakComplement);
     for (SCCOL i = 0; i <= MAXCOL; ++i)
-        pColFlags[i] &= static_int_cast<sal_uInt8>(~CR_MANUALBREAK);
+        pColFlags[i] &= nManualBreakComplement;
 
     if (!maRowManualBreaks.empty())
     {
         for (set<SCROW>::const_iterator itr = maRowManualBreaks.begin(), itrEnd = maRowManualBreaks.end();
               itr != itrEnd; ++itr)
-            pRowFlags->OrValue(*itr, static_int_cast<sal_uInt8>(CR_MANUALBREAK));
+            pRowFlags->OrValue(*itr, CR_MANUALBREAK);
     }
 
     if (!maColManualBreaks.empty())
commit 5ecc8a0d2524d841f5edd21495602f09819e574d
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Jan 3 20:24:40 2012 -0500

    Get the reference jump feature to work with relative references.
    
    By 'reference jump feature' I mean Ctrl-[ and Ctrl-].

diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx
index 75fe312..567ba49 100644
--- a/sc/source/core/tool/detfunc.cxx
+++ b/sc/source/core/tool/detfunc.cxx
@@ -1422,6 +1422,7 @@ void ScDetectiveFunc::GetAllPreds(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
         for (ScToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
         {
             ScTokenRef pRef(static_cast<ScToken*>(p->Clone()));
+            pRef->CalcAbsIfRel(aCellIter.GetPos());
             ScRefTokenHelper::join(rRefTokens, pRef);
         }
     }
@@ -1444,10 +1445,13 @@ void ScDetectiveFunc::GetAllSuccs(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW n
         ScDetectiveRefIter aRefIter(pFCell);
         for (ScToken* p = aRefIter.GetNextRefToken(); p; p = aRefIter.GetNextRefToken())
         {
+            ScAddress aPos = aCellIter.GetPos();
             ScTokenRef pRef(static_cast<ScToken*>(p->Clone()));
+            pRef->CalcAbsIfRel(aPos);
             if (ScRefTokenHelper::intersects(aSrcRange, pRef))
             {
-                pRef = ScRefTokenHelper::createRefToken(aCellIter.GetPos());
+                // This address is absolute.
+                pRef = ScRefTokenHelper::createRefToken(aPos);
                 ScRefTokenHelper::join(rRefTokens, pRef);
             }
         }
diff --git a/sc/source/core/tool/reftokenhelper.cxx b/sc/source/core/tool/reftokenhelper.cxx
index 0a7ed4e..7528257 100644
--- a/sc/source/core/tool/reftokenhelper.cxx
+++ b/sc/source/core/tool/reftokenhelper.cxx
@@ -138,20 +138,9 @@ void ScRefTokenHelper::compileRangeRepresentation(
 
 void singleRefToAddr(const ScSingleRefData& rRef, ScAddress& rAddr)
 {
-    if (rRef.IsColRel())
-        rAddr.SetCol(rRef.nRelCol);
-    else
-        rAddr.SetCol(rRef.nCol);
-
-    if (rRef.IsRowRel())
-        rAddr.SetRow(rRef.nRelRow);
-    else
-        rAddr.SetRow(rRef.nRow);
-
-    if (rRef.IsTabRel())
-        rAddr.SetTab(rRef.nRelTab);
-    else
-        rAddr.SetTab(rRef.nTab);
+    rAddr.SetCol(rRef.nCol);
+    rAddr.SetRow(rRef.nRow);
+    rAddr.SetTab(rRef.nTab);
 }
 
 bool ScRefTokenHelper::getRangeFromToken(ScRange& rRange, const ScTokenRef& pToken, bool bExternal)


More information about the Libreoffice-commits mailing list