diff options
author | hasban12138 <1483478664@qq.com> | 2022-04-28 15:13:39 +0800 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2022-05-13 16:41:10 +0200 |
commit | 912f36b9d327575e335e89bc2e97d96a3cd01631 (patch) | |
tree | 57c315ec8bad61807110fe069bdb2b1e6f228860 /sc | |
parent | 0a128b789b932b899ff5d83eea1dbe0f83f65e62 (diff) |
tdf#148837: fix cell range negative selection
In Calc when you select all and then do negative selection, there has a
bug. The reason is in ScMultiSel::SetMarkArea that case will make nBeg
larger than nEndRow and in MarkAllCols start will be larger than end.
So I added a condition in the if clause to make sure that nBeg is not
larger than nEndRow.
Change-Id: I7f39a588bf928b2885207810534d78481589c2f4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133538
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 2490715c112699487915865f4267a880fe7bc4b3)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133861
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/data/markmulti.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sc/source/core/data/markmulti.cxx b/sc/source/core/data/markmulti.cxx index 3f1d4cbf0e6a..30cc0340f0e8 100644 --- a/sc/source/core/data/markmulti.cxx +++ b/sc/source/core/data/markmulti.cxx @@ -231,7 +231,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, S nLast = aRowSel.GetMarkEnd( nBeg, false ); } - if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow ) + if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && nBeg <= nEndRow ) MarkAllCols( nBeg, nEndRow ); else { @@ -242,7 +242,7 @@ void ScMultiSel::SetMarkArea( SCCOL nStartCol, SCCOL nEndCol, SCROW nStartRow, S if ( nBeg != mrSheetLimits.GetMaxRowCount() ) nLast = aRowSel.GetMarkEnd( nBeg, false ); } - if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow ) + if ( nBeg != mrSheetLimits.GetMaxRowCount() && nLast >= nEndRow && nBeg <= nEndRow ) MarkAllCols( nBeg, nEndRow ); } |