sc/source/ui/view/gridwin4.cxx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
New commits: commit fe8f91884b75ec9aca3628ec2db45ee322222f01 Author: Pranam Lashkari <lpra...@collabora.com> AuthorDate: Wed May 29 23:32:34 2024 +0300 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Fri May 31 16:49:57 2024 +0200 LOK: bound provider can give tile indexes in reverse order after undo make sure we know correct top left and bottom right index and corrdinates Change-Id: I9277443f9c4d2e8d7d489d09071a3709316ceec0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168234 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index d487afb9db03..13ad72e720b9 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -1380,10 +1380,21 @@ namespace aBoundsProvider.GetStartIndexAndPosition(nStartIndex, nStartPosPx); ++nStartIndex; aBoundsProvider.GetEndIndexAndPosition(nEndIndex, nEndPosPx); - nTopLeftTileOffset = nTileStartPosPx - nStartPosPx; - nTopLeftTileOrigin = nStartPosPx; - nTopLeftTileIndex = nStartIndex; - nBottomRightTileIndex = nEndIndex; + bool reverse = nStartIndex > nEndIndex; + if (reverse) + { + nTopLeftTileOffset = nTileEndPosPx - nEndPosPx; + nTopLeftTileOrigin = nEndPosPx; + nTopLeftTileIndex = nEndIndex; + nBottomRightTileIndex = nStartIndex; + } + else { + nTopLeftTileOffset = nTileStartPosPx - nStartPosPx; + nTopLeftTileOrigin = nStartPosPx; + nTopLeftTileIndex = nStartIndex; + nBottomRightTileIndex = nEndIndex; + } + } void lcl_RTLAdjustTileColOffset(ScViewData& rViewData, sal_Int32& nTileColOffset,