diff options
author | Noel Grandin <noel@peralex.com> | 2016-08-08 15:38:59 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-08-11 06:05:32 +0000 |
commit | 3716b144265dda695d7dd447dbe692a3f84c588e (patch) | |
tree | 6b8d8751e306841102f6808fbb5403dac193c35c /sd | |
parent | b796b24793827583550279d40bfe565c66ad284d (diff) |
loplugin:constantparam
Change-Id: Ia06b9b189033b9409d7a59a211866f66a0614886
Reviewed-on: https://gerrit.libreoffice.org/28016
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'sd')
3 files changed, 43 insertions, 60 deletions
diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index d6b3ce6b3bcb..7f46fa296119 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -425,14 +425,12 @@ bool SlideSorterController::Command ( { GetScrollBarManager().Scroll( ScrollBarManager::Orientation_Vertical, - ScrollBarManager::Unit_Slide, -pData->GetNotchDelta()); } else { GetScrollBarManager().Scroll( ScrollBarManager::Orientation_Horizontal, - ScrollBarManager::Unit_Slide, -pData->GetNotchDelta()); } mrSlideSorter.GetView().UpdatePageUnderMouse(rEvent.GetMousePosPixel()); diff --git a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx index b56a319dadec..b3cf776755f1 100644 --- a/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx +++ b/sd/source/ui/slidesorter/controller/SlsScrollBarManager.cxx @@ -540,7 +540,6 @@ IMPL_LINK_NOARG_TYPED(ScrollBarManager, AutoScrollTimeoutHandler, Timer *, void) void ScrollBarManager::Scroll( const Orientation eOrientation, - const Unit eUnit, const sal_Int32 nDistance) { bool bIsVertical (false); @@ -556,60 +555,49 @@ void ScrollBarManager::Scroll( Point aNewTopLeft ( mpHorizontalScrollBar ? mpHorizontalScrollBar->GetThumbPos() : 0, mpVerticalScrollBar ? mpVerticalScrollBar->GetThumbPos() : 0); - switch (eUnit) - { - case Unit_Pixel: - if (bIsVertical) - aNewTopLeft.Y() += nDistance; - else - aNewTopLeft.X() += nDistance; - break; - - case Unit_Slide: + + view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter()); + + // Calculate estimate of new location. + if (bIsVertical) + aNewTopLeft.Y() += nDistance * rLayouter.GetPageObjectSize().Height(); + else + aNewTopLeft.X() += nDistance * rLayouter.GetPageObjectSize().Width(); + + // Adapt location to show whole slides. + if (bIsVertical) + if (nDistance > 0) { - view::Layouter& rLayouter (mrSlideSorter.GetView().GetLayouter()); - - // Calculate estimate of new location. - if (bIsVertical) - aNewTopLeft.Y() += nDistance * rLayouter.GetPageObjectSize().Height(); - else - aNewTopLeft.X() += nDistance * rLayouter.GetPageObjectSize().Width(); - - // Adapt location to show whole slides. - if (bIsVertical) - if (nDistance > 0) - { - const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( - Point(aNewTopLeft.X(), aNewTopLeft.Y()+mpVerticalScrollBar->GetVisibleSize()), - true)); - aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Bottom() - - mpVerticalScrollBar->GetVisibleSize(); - } - else - { - const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( - Point(aNewTopLeft.X(), aNewTopLeft.Y()), - true)); - aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Top(); - } - else - if (nDistance > 0) - { - const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( - Point(aNewTopLeft.X()+mpVerticalScrollBar->GetVisibleSize(), aNewTopLeft.Y()), - true)); - aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Right() - - mpVerticalScrollBar->GetVisibleSize(); - } - else - { - const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( - Point(aNewTopLeft.X(), aNewTopLeft.Y()), - true)); - aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Left(); - } + const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( + Point(aNewTopLeft.X(), aNewTopLeft.Y()+mpVerticalScrollBar->GetVisibleSize()), + true)); + aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Bottom() + - mpVerticalScrollBar->GetVisibleSize(); } - } + else + { + const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( + Point(aNewTopLeft.X(), aNewTopLeft.Y()), + true)); + aNewTopLeft.Y() = rLayouter.GetPageObjectBox(nIndex,true).Top(); + } + else + if (nDistance > 0) + { + const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( + Point(aNewTopLeft.X()+mpVerticalScrollBar->GetVisibleSize(), aNewTopLeft.Y()), + true)); + aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Right() + - mpVerticalScrollBar->GetVisibleSize(); + } + else + { + const sal_Int32 nIndex (rLayouter.GetIndexAtPoint( + Point(aNewTopLeft.X(), aNewTopLeft.Y()), + true)); + aNewTopLeft.X() = rLayouter.GetPageObjectBox(nIndex,true).Left(); + } + mrSlideSorter.GetController().GetVisibleAreaManager().DeactivateCurrentSlideTracking(); SetTopLeft(aNewTopLeft); } diff --git a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx index 8b40acd9bf4f..44aab4d5af37 100644 --- a/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx +++ b/sd/source/ui/slidesorter/inc/controller/SlsScrollBarManager.hxx @@ -148,18 +148,15 @@ public: void clearAutoScrollFunctor(); enum Orientation { Orientation_Horizontal, Orientation_Vertical }; - enum Unit { Unit_Pixel, Unit_Slide }; /** Scroll the slide sorter by setting the thumbs of the scroll bars and by moving the content of the content window. @param eOrientation Defines whether to scroll horizontally or vertically. - @param eUnit - Defines whether the distance is a pixel value or the number of - slides to scroll. + @param nDistance + distance in slides. */ void Scroll( const Orientation eOrientation, - const Unit eUnit, const sal_Int32 nDistance); private: |