diff options
author | Eike Rathke <erack@redhat.com> | 2018-06-05 19:05:57 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-05 21:05:24 +0200 |
commit | 5209f21b106a2c21770073d06616458d8e06031b (patch) | |
tree | 1f008c1cb03c8dc1aae6c0b7a831206e59dab647 | |
parent | c25b63b430595e6470284644bf2f2197b3e8eed7 (diff) |
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@redhat.com>
Tested-by: Jenkins <ci@libreoffice.org>
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 10 |
1 files changed, 9 insertions, 1 deletions
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 ); |