sc/source/core/data/table3.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
New commits: commit ba410bdb74e2f1fcc011934380890fc7fa872777 Author: Eike Rathke <er...@redhat.com> Date: Fri Dec 5 19:03:25 2014 +0100 trim also empty leading column ranges, fdo#81501 follow-up Change-Id: Ieaeea85149e4b6d263b112205bb17c155e2d12be (cherry picked from commit c7b57c6c2b15a4b9f65dafb642e3f1da402e62ca) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index fc59e00..c955920 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1539,7 +1539,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 ded77b3983f1ccf7f7b611c59da9f2156ea7a0df Author: Eike Rathke <er...@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 (cherry picked from commit 1e4235f8b2dc693b0fb1edade9db25a631bdbf94) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 63b3df0..fc59e00 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1539,10 +1539,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()); @@ -1574,11 +1575,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)) commit bc3755e041a6cdb678fb8c8093beb6b3a8e3f0e0 Author: Supreme Aryal <supremear...@gmail.com> Date: Thu Dec 4 02:14:06 2014 -0500 Fix high memory usage when sorting cells in Calc. (fdo#81501) Empty columns were being unnecessarily included in the sorting range which caused extra allocation. This happens when you select the entire sheet to sort. There was already code to skip empty trailing cells in rows but not to skip empty columns. Change-Id: Ieac22647bb13165cbf66cb1a93f567e5169fff6a Reviewed-on: https://gerrit.libreoffice.org/13294 Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> (cherry picked from commit c50d8bf596f527bb53b86dd04da652ed72f2c549) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index d4c0aa0..63b3df0 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -1541,6 +1541,8 @@ void ScTable::Sort( 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()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits