From a4a5fe4c66fe35c432127c28be7d52dc52fb4f58 Mon Sep 17 00:00:00 2001
From: Jan Holesovsky <kendy@collabora.com>
Date: Fri, 1 Aug 2014 21:10:22 +0200
Subject: [PATCH 082/137] bnc#862514: Handle corner case in slide sorter
correctly.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
We should never return -1 when bIncludeBordersAndGaps is true; but that could
have happened in a corner case:
* export SAL_USE_VCLPLUGIN=gen
* start LibreOffice
* open a presentation with many slides
* resize the window so that it shows the slides _exactly_, no slide is cut
off in the slide sorter
* point the mouse pointer into the left "Slides" sidebar (slide sorter) so
that it does not cause any mouse-over effect (somehow between the left
border, and the slides - there is space that can do this)
* turn the mouse wheel all the way down so that the last slide is at the
bottom
* turn the mouse wheel up _once_
* turn the mouse wheel down _once_ - it will look like the view does not
change (the last but one is still at the bottom), but you can see the
scrollbar jump to the top
* and now you can again start turning the wheel all the way down to repeat
the procedure :-)
Reviewed-on: https://gerrit.libreoffice.org/10683
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
(cherry picked from commit 48272a9a720039e79c6a684f1f037811ea42ed0c)
Change-Id: I0253c89513222a1f2eb3263068997d10eea0f130
Signed-off-by: Matúš Kukan <matus.kukan@collabora.com>
---
sd/source/ui/slidesorter/view/SlsLayouter.cxx | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
index c4b6ae2..5c9ec8e 100644
--- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx
+++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx
@@ -627,11 +627,15 @@ sal_Int32 Layouter::Implementation::GetRowAtPosition (
// When inside the gap below then nYPosition is not over a page
// object.
if (nDistanceIntoGap > 0)
- nRow = ResolvePositionInGap (
+ {
+ sal_Int32 nResolvedRow = ResolvePositionInGap(
nDistanceIntoGap,
eGapMembership,
nRow,
mnVerticalGap);
+ if (!bIncludeBordersAndGaps || nResolvedRow != -1)
+ nRow = nResolvedRow;
+ }
}
else if (bIncludeBordersAndGaps)
{
@@ -670,11 +674,15 @@ sal_Int32 Layouter::Implementation::GetColumnAtPosition (
// When inside the gap at the right then nXPosition is not over a
// page object.
if (nDistanceIntoGap > 0)
- nColumn = ResolvePositionInGap (
+ {
+ sal_Int32 nResolvedColumn = ResolvePositionInGap(
nDistanceIntoGap,
eGapMembership,
nColumn,
mnHorizontalGap);
+ if (!bIncludeBordersAndGaps || nResolvedColumn != -1)
+ nColumn = nResolvedColumn;
+ }
}
else if (bIncludeBordersAndGaps)
{
--
1.9.3