sc/source/ui/docshell/dbdocfun.cxx |   24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

New commits:
commit ed62053678166ee6ac76b4fa15569b843e280721
Author: Sahas <sah...@naman.ms>
Date:   Thu Oct 15 23:17:36 2015 +0530

    tdf#80231 sort including formats - ranges with merged column labels
    
    Change-Id: I2b6294163e90210f54ebacf93dae7ad7b974f725
    Reviewed-on: https://gerrit.libreoffice.org/19400
    Tested-by: Jenkins <c...@libreoffice.org>
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/docshell/dbdocfun.cxx 
b/sc/source/ui/docshell/dbdocfun.cxx
index 5d308af..2d762ea 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.
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to