summaryrefslogtreecommitdiff
path: root/sc/source/core/data/table3.cxx
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2014-12-05 21:32:06 +0100
committerEike Rathke <erack@redhat.com>2014-12-05 21:47:20 +0100
commit367ced60eb74264571f9d8918df115873634b2da (patch)
treee1530ec2e7778bc356b7995ba248e43952404c8e /sc/source/core/data/table3.cxx
parentba410bdb74e2f1fcc011934380890fc7fa872777 (diff)
Ctrl+A and Data Sort took ages to broadcast ALL cells
... now that also empty cells are to be broadcasted. Set dirty and broadcast only the effective data range as determined by Sort. This is more a workaround, a cleaner solution would be to refactor the SetDirty() algorithm to iterate only through broadcasters and use AreaBroadcast() to notify area listeners. However, this can also be easily backported to 4-3. Change-Id: I6d68ca0088cec6a8328a3e93364ac928ef69babe (cherry picked from commit 9a568c41ccd1ccf6073758973da5914a44f629d2)
Diffstat (limited to 'sc/source/core/data/table3.cxx')
-rw-r--r--sc/source/core/data/table3.cxx23
1 files changed, 12 insertions, 11 deletions
diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx
index c9559209f98a..c5b7d43796d6 100644
--- a/sc/source/core/data/table3.cxx
+++ b/sc/source/core/data/table3.cxx
@@ -1523,10 +1523,9 @@ void ScTable::DecoladeRow( ScSortInfoArray* pArray, SCROW nRow1, SCROW nRow2 )
}
void ScTable::Sort(
- const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
+ ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs,
ScProgress* pProgress, sc::ReorderParam* pUndo )
{
- aSortParam = rSortParam;
InitSortCollator( rSortParam );
bGlobalKeepQuery = bKeepQuery;
@@ -1540,19 +1539,20 @@ void ScTable::Sort(
}
// 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;
+ while (rSortParam.nCol1 < rSortParam.nCol2 && aCol[rSortParam.nCol1].IsEmptyBlock(rSortParam.nRow1, rSortParam.nRow2))
+ ++rSortParam.nCol1;
+ while (rSortParam.nCol1 < rSortParam.nCol2 && aCol[rSortParam.nCol2].IsEmptyBlock(rSortParam.nRow1, rSortParam.nRow2))
+ --rSortParam.nCol2;
if (rSortParam.bByRow)
{
SCROW nLastRow = 0;
- for (SCCOL nCol = aSortParam.nCol1; nCol <= aSortParam.nCol2; nCol++)
+ for (SCCOL nCol = rSortParam.nCol1; nCol <= rSortParam.nCol2; nCol++)
nLastRow = std::max(nLastRow, aCol[nCol].GetLastDataPos());
- nLastRow = std::min(nLastRow, aSortParam.nRow2);
+ rSortParam.nRow2 = nLastRow = std::min(nLastRow, rSortParam.nRow2);
SCROW nRow1 = (rSortParam.bHasHeader ?
- aSortParam.nRow1 + 1 : aSortParam.nRow1);
+ rSortParam.nRow1 + 1 : rSortParam.nRow1);
+ aSortParam = rSortParam; // must be assigned before calling IsSorted()
if (!IsSorted(nRow1, nLastRow))
{
if(pProgress)
@@ -1578,9 +1578,10 @@ void ScTable::Sort(
}
else
{
- SCCOL nLastCol = aSortParam.nCol2;
+ SCCOL nLastCol = rSortParam.nCol2;
SCCOL nCol1 = (rSortParam.bHasHeader ?
- aSortParam.nCol1 + 1 : aSortParam.nCol1);
+ rSortParam.nCol1 + 1 : rSortParam.nCol1);
+ aSortParam = rSortParam; // must be assigned before calling IsSorted()
if (!IsSorted(nCol1, nLastCol))
{
if(pProgress)