summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSahas <sahasr@naman.ms>2015-10-15 23:17:36 +0530
committerEike Rathke <erack@redhat.com>2015-10-23 14:40:41 +0000
commited62053678166ee6ac76b4fa15569b843e280721 (patch)
tree3a139768a063cc0699c58354439b8ced8edb125d
parentf40241928d5698b9c60c61657ca2a43eb3b0e268 (diff)
tdf#80231 sort including formats - ranges with merged column labels
Change-Id: I2b6294163e90210f54ebacf93dae7ad7b974f725 Reviewed-on: https://gerrit.libreoffice.org/19400 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Eike Rathke <erack@redhat.com>
-rw-r--r--sc/source/ui/docshell/dbdocfun.cxx24
1 files changed, 12 insertions, 12 deletions
diff --git a/sc/source/ui/docshell/dbdocfun.cxx b/sc/source/ui/docshell/dbdocfun.cxx
index 5d308af5f19a..2d762ea40bb7 100644
--- a/sc/source/ui/docshell/dbdocfun.cxx
+++ b/sc/source/ui/docshell/dbdocfun.cxx
@@ -511,8 +511,19 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
return false;
}
+ // Adjust aLocalParam cols/rows to used data area. Keep sticky top row or
+ // column (depending on direction) in any case, not just if it has headers,
+ // so empty leading cells will be sorted to the end.
+ bool bShrunk = false;
+ rDoc.ShrinkToUsedDataArea( bShrunk, nTab, aLocalParam.nCol1, aLocalParam.nRow1,
+ aLocalParam.nCol2, aLocalParam.nRow2, false, aLocalParam.bByRow, !aLocalParam.bByRow);
+
+ SCROW nStartRow = aLocalParam.nRow1;
+ if (aLocalParam.bByRow && aLocalParam.bHasHeader && nStartRow < aLocalParam.nRow2)
+ ++nStartRow;
+
if ( aLocalParam.bIncludePattern && rDoc.HasAttrib(
- aLocalParam.nCol1, aLocalParam.nRow1, nTab,
+ aLocalParam.nCol1, nStartRow , nTab,
aLocalParam.nCol2, aLocalParam.nRow2, nTab,
HASATTR_MERGED | HASATTR_OVERLAPPED ) )
{
@@ -526,17 +537,6 @@ bool ScDBDocFunc::Sort( SCTAB nTab, const ScSortParam& rSortParam,
WaitObject aWait( ScDocShell::GetActiveDialogParent() );
- // Adjust aLocalParam cols/rows to used data area. Keep sticky top row or
- // column (depending on direction) in any case, not just if it has headers,
- // so empty leading cells will be sorted to the end.
- bool bShrunk = false;
- rDoc.ShrinkToUsedDataArea( bShrunk, nTab, aLocalParam.nCol1, aLocalParam.nRow1,
- aLocalParam.nCol2, aLocalParam.nRow2, false, aLocalParam.bByRow, !aLocalParam.bByRow);
-
- SCROW nStartRow = aLocalParam.nRow1;
- if (aLocalParam.bByRow && aLocalParam.bHasHeader && nStartRow < aLocalParam.nRow2)
- ++nStartRow;
-
// Calculate the script types for all cells in the sort range beforehand.
// This will speed up the row height adjustment that takes place after the
// sort.