sc/source/ui/view/cellsh2.cxx |   10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

New commits:
commit 98bd4ba9f186060ce1bc010838774fc4a73ee807
Author: Eike Rathke <er...@redhat.com>
Date:   Tue Jun 5 19:05:57 2018 +0200

    Resolves: tdf#117372 preserve preselected sort area, if so, then extend or 
not
    
    Previously if an entire column was selected, the top data row was
    taken and then that X,Y position used to extend to the data area.
    Else the current view's X,Y was used to extend to the data area.
    
    Now keep a selection and use current X,Y only if there is no area
    selected.
    
    Change-Id: I19ce52bc2ebf4813b779600a4738ed1f82643aa7
    Reviewed-on: https://gerrit.libreoffice.org/55348
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins <c...@libreoffice.org>
    (cherry picked from commit 5209f21b106a2c21770073d06616458d8e06031b)
    Reviewed-on: https://gerrit.libreoffice.org/55350
    Tested-by: Eike Rathke <er...@redhat.com>

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 24e0c76f1de6..f30773b868df 100644
--- a/sc/source/ui/view/cellsh2.cxx
+++ b/sc/source/ui/view/cellsh2.cxx
@@ -151,7 +151,15 @@ static bool lcl_GetSortParam( const ScViewData* pData, 
const ScSortParam& rSortP
         SCSIZE nCount = pDoc->GetEmptyLinesInBlock( rSortParam.nCol1, 
rSortParam.nRow1, nTab,
                                                     rSortParam.nCol2, 
rSortParam.nRow2, nTab, eFillDir );
         aExternalRange = ScRange( rSortParam.nCol1,
-                ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( 
nCount ), MAXROW), nTab );
+                ::std::min( rSortParam.nRow1 + sal::static_int_cast<SCROW>( 
nCount ), MAXROW), nTab,
+                rSortParam.nCol2, rSortParam.nRow2, nTab);
+        aExternalRange.PutInOrder();
+    }
+    else if (rSortParam.nCol1 != rSortParam.nCol2 || rSortParam.nRow1 != 
rSortParam.nRow2)
+    {
+        // Preserve a preselected area.
+        aExternalRange = ScRange( rSortParam.nCol1, rSortParam.nRow1, nTab, 
rSortParam.nCol2, rSortParam.nRow2, nTab);
+        aExternalRange.PutInOrder();
     }
     else
         aExternalRange = ScRange( pData->GetCurX(), pData->GetCurY(), nTab );
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to