sc/inc/document.hxx | 6 +++++- sc/inc/table.hxx | 6 +++++- sc/source/core/data/documen3.cxx | 2 +- sc/source/core/data/table3.cxx | 23 ++++++++++++----------- sc/source/ui/docshell/dbdocfun.cxx | 1 + 5 files changed, 24 insertions(+), 14 deletions(-)
New commits: commit 367ced60eb74264571f9d8918df115873634b2da Author: Eike Rathke <er...@redhat.com> Date: Fri Dec 5 21:32:06 2014 +0100 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) diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 41e1093..c135508 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1683,8 +1683,12 @@ public: SC_DLLPUBLIC SvNumberFormatter* GetFormatTable() const; SC_DLLPUBLIC SvNumberFormatter* CreateFormatTable() const; + /** Sort a range of data. + @param rSortParam may get adjusted to the actual range used if it did + encompass leading or trailing empty blocks + */ void Sort( - SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, + SCTAB nTab, ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, ScProgress* pProgress, sc::ReorderParam* pUndo ); void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress ); diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx index 10c703a..1053ea7 100644 --- a/sc/inc/table.hxx +++ b/sc/inc/table.hxx @@ -834,8 +834,12 @@ public: void StripHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); void ExtendHidden( SCCOL& rX1, SCROW& rY1, SCCOL& rX2, SCROW& rY2 ); + /** Sort a range of data. + @param rSortParam may get adjusted to the actual range used if it did + encompass leading or trailing empty blocks + */ void Sort( - const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, + ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, ScProgress* pProgress, sc::ReorderParam* pUndo ); void Reorder( const sc::ReorderParam& rParam, ScProgress* pProgress ); diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index b0b0d82..f35d941 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -1342,7 +1342,7 @@ bool ScDocument::UpdateOutlineRow( SCROW nStartRow, SCROW nEndRow, SCTAB nTab, b } void ScDocument::Sort( - SCTAB nTab, const ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, + SCTAB nTab, ScSortParam& rSortParam, bool bKeepQuery, bool bUpdateRefs, ScProgress* pProgress, sc::ReorderParam* pUndo ) { if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] ) diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index c955920..c5b7d43 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) diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx index fe254a2..bb97463 100644 --- a/sc/source/ui/docshell/dbdocfun.cxx +++ b/sc/source/ui/docshell/dbdocfun.cxx @@ -556,6 +556,7 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam, ScInputOptions aInputOption = SC_MOD()->GetInputOptions(); bool bUpdateRefs = aInputOption.GetSortRefUpdate(); ScProgress aProgress(&rDocShell, ScGlobal::GetRscString(STR_PROGRESS_SORTING), 0); + // aLocalParam range now may get adapted to exclude empty edges rDoc.Sort(nTab, aLocalParam, bRepeatQuery, bUpdateRefs, &aProgress, &aUndoParam); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits