LibreOffice Module sd (master) 1
SlsScrollBarManager.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#pragma once
21
22#include <tools/link.hxx>
23#include <tools/gen.hxx>
25#include <vcl/timer.hxx>
26#include <vcl/vclptr.hxx>
27
28#include <functional>
29
30namespace sd { class Window; }
31
32namespace sd::slidesorter { class SlideSorter; }
33
35
51{
52public:
59 ScrollBarManager (SlideSorter& rSlideSorter);
60
62
67 void Connect();
68
73 void Disconnect();
74
84 void UpdateScrollBars (
85 bool bScrollToCurrentPosition);
86
104 const ::tools::Rectangle& rAvailableArea,
105 const bool bIsHorizontalScrollBarAllowed,
106 const bool bIsVerticalScrollBarAllowed);
107
111 void SetTopLeft (const Point& rNewTopLeft);
112
119 int GetVerticalScrollBarWidth() const;
120
128
140 bool AutoScroll (
141 const Point& rMouseWindowPosition,
142 const ::std::function<void ()>& rAutoScrollFunctor);
143
144 void StopAutoScroll();
145
147
156 void Scroll(
157 const Orientation eOrientation,
158 const sal_Int32 nDistance);
159
160private:
162
167
172
181
189
194
195 ::std::function<void ()> maAutoScrollFunctor;
196
197 void SetWindowOrigin (
198 double nHorizontalPosition,
199 double nVerticalPosition);
200
212 const ::tools::Rectangle& rAvailableArea,
213 const bool bIsHorizontalScrollBarAllowed,
214 const bool bIsVerticalScrollBarAllowed);
215
225 bool bHorizontalScrollBarVisible,
226 bool bVerticalScrollBarVisible,
227 const ::tools::Rectangle& rAvailableArea);
228
229 void CalcAutoScrollOffset (const Point& rMouseWindowPosition);
230 bool RepeatAutoScroll();
231
232 DECL_LINK(HorizontalScrollBarHandler, weld::Scrollbar&, void);
233 DECL_LINK(VerticalScrollBarHandler, weld::Scrollbar&, void);
234 DECL_LINK(AutoScrollTimeoutHandler, Timer *, void);
235
236 void PlaceHorizontalScrollBar (const ::tools::Rectangle& aArea);
237 void PlaceVerticalScrollBar (const ::tools::Rectangle& aArea);
238};
239
240} // end of namespace ::sd::slidesorter::controller
241
242/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Show previews for all the slides in a document and allow the user to insert or delete slides and modi...
Definition: SlideSorter.hxx:62
Manage the horizontal and vertical scroll bars.
VclPtr< ScrollAdaptor > mpHorizontalScrollBar
The horizontal scroll bar.
int GetVerticalScrollBarWidth() const
Return the width of the vertical scroll bar, which–when shown–should be fixed in contrast to its heig...
ScrollBarManager(SlideSorter &rSlideSorter)
Create a new scroll bar manager that manages three controls: the horizontal scroll bar,...
::tools::Rectangle DetermineScrollBarVisibilities(const ::tools::Rectangle &rAvailableArea, const bool bIsHorizontalScrollBarAllowed, const bool bIsVerticalScrollBarAllowed)
Determine the visibility of the scroll bars so that the window content is not clipped in any dimensio...
::tools::Rectangle PlaceScrollBars(const ::tools::Rectangle &rAvailableArea, const bool bIsHorizontalScrollBarAllowed, const bool bIsVerticalScrollBarAllowed)
Place the scroll bars inside the given area.
void UpdateScrollBars(bool bScrollToCurrentPosition)
Set up the scroll bar, i.e.
Size maScrollBorder
The width and height of the border at the inside of the window which when entered while in drag mode ...
void PlaceHorizontalScrollBar(const ::tools::Rectangle &aArea)
double mnHorizontalPosition
Relative horizontal position of the visible area in the view.
void SetWindowOrigin(double nHorizontalPosition, double nVerticalPosition)
VclPtr< sd::Window > mpContentWindow
The content window is the one whose view port is controlled by the scroll bars.
DECL_LINK(HorizontalScrollBarHandler, weld::Scrollbar &, void)
void CalcAutoScrollOffset(const Point &rMouseWindowPosition)
bool TestScrollBarVisibilities(bool bHorizontalScrollBarVisible, bool bVerticalScrollBarVisible, const ::tools::Rectangle &rAvailableArea)
Typically called by DetermineScrollBarVisibilities() this method tests a specific configuration of th...
void Disconnect()
Remove listeners from the scroll bars.
DECL_LINK(VerticalScrollBarHandler, weld::Scrollbar &, void)
void Scroll(const Orientation eOrientation, const sal_Int32 nDistance)
Scroll the slide sorter by setting the thumbs of the scroll bars and by moving the content of the con...
void PlaceVerticalScrollBar(const ::tools::Rectangle &aArea)
Timer maAutoScrollTimer
The auto scroll timer is used for keep scrolling the window when the mouse reaches its border while d...
void SetTopLeft(const Point &rNewTopLeft)
Update the vertical and horizontal scroll bars so that the visible area has the given top and left va...
bool AutoScroll(const Point &rMouseWindowPosition, const ::std::function< void()> &rAutoScrollFunctor)
Call this method to scroll a window while the mouse is in dragging a selection.
void Connect()
Register listeners at the scroll bars.
VclPtr< ScrollAdaptor > mpVerticalScrollBar
The vertical scroll bar.
int GetHorizontalScrollBarHeight() const
Return the height of the horizontal scroll bar, which–when shown–should be fixed in contrast to its w...
double mnVerticalPosition
Relative vertical position of the visible area in the view.
DECL_LINK(AutoScrollTimeoutHandler, Timer *, void)
Orientation