[Libreoffice-commits] core.git: 2 commits - sc/source

Eike Rathke erack at redhat.com
Fri Dec 5 10:07:02 PST 2014


 sc/source/core/data/table3.cxx |   14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

New commits:
commit c7b57c6c2b15a4b9f65dafb642e3f1da402e62ca
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 5 19:03:25 2014 +0100

    trim also empty leading column ranges, fdo#81501 follow-up
    
    Change-Id: Ieaeea85149e4b6d263b112205bb17c155e2d12be

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index 3456148..9a7de8f8 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1541,7 +1541,10 @@ void ScTable::Sort(
         pUndo->mbUpdateRefs = bUpdateRefs;
     }
 
-    while (aSortParam.nCol2 > aSortParam.nCol1 && aCol[aSortParam.nCol2].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
+    // Trim empty leading and trailing column ranges.
+    while (aSortParam.nCol1 < aSortParam.nCol2 && aCol[aSortParam.nCol1].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
+        ++aSortParam.nCol1;
+    while (aSortParam.nCol1 < aSortParam.nCol2 && aCol[aSortParam.nCol2].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
         --aSortParam.nCol2;
 
     if (rSortParam.bByRow)
commit 1e4235f8b2dc693b0fb1edade9db25a631bdbf94
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Dec 5 18:36:03 2014 +0100

    actually use identical code for both byRow and byCol, fdo#81501 follow-up
    
    Change-Id: I982e03a12dd80be0787f22dce4495065775e7de0

diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index edeeaeb..3456148 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1541,10 +1541,11 @@ void ScTable::Sort(
         pUndo->mbUpdateRefs = bUpdateRefs;
     }
 
+    while (aSortParam.nCol2 > aSortParam.nCol1 && aCol[aSortParam.nCol2].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2))
+        --aSortParam.nCol2;
+
     if (rSortParam.bByRow)
     {
-        while (aSortParam.nCol2 > aSortParam.nCol1 && aCol[aSortParam.nCol2].IsEmptyData())
-            --aSortParam.nCol2;
         SCROW nLastRow = 0;
         for (SCCOL nCol = aSortParam.nCol1; nCol <= aSortParam.nCol2; nCol++)
             nLastRow = std::max(nLastRow, aCol[nCol].GetLastDataPos());
@@ -1576,11 +1577,7 @@ void ScTable::Sort(
     }
     else
     {
-        SCCOL nLastCol;
-        for (nLastCol = aSortParam.nCol2;
-             (nLastCol > aSortParam.nCol1) && aCol[nLastCol].IsEmptyBlock(aSortParam.nRow1, aSortParam.nRow2); nLastCol--)
-        {
-        }
+        SCCOL nLastCol = aSortParam.nCol2;
         SCCOL nCol1 = (rSortParam.bHasHeader ?
             aSortParam.nCol1 + 1 : aSortParam.nCol1);
         if (!IsSorted(nCol1, nLastCol))


More information about the Libreoffice-commits mailing list