diff options
author | Eike Rathke <erack@redhat.com> | 2018-06-05 19:05:57 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2018-06-06 10:03:23 +0200 |
commit | 98bd4ba9f186060ce1bc010838774fc4a73ee807 (patch) | |
tree | aaf3d9c2fabdaac914f999b81e9a2ecc991ff299 | |
parent | b8bfa9051242393cc940382fd2a2f34af4db11af (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>
(cherry picked from commit 5209f21b106a2c21770073d06616458d8e06031b)
Reviewed-on: https://gerrit.libreoffice.org/55350
Tested-by: Eike Rathke <erack@redhat.com>
-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 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 ); |