[Libreoffice-commits] core.git: sc/source

Eike Rathke erack at redhat.com
Tue Jun 5 19:05:47 UTC 2018


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

New commits:
commit 5209f21b106a2c21770073d06616458d8e06031b
Author: Eike Rathke <erack at 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 <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>

diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx
index 632dad30442c..5c32f711004d 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 );


More information about the Libreoffice-commits mailing list