LibreOffice Module sd (master) 1
SlsFocusManager.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
23
24#include <sal/types.h>
25#include <tools/link.hxx>
26#include <vector>
27
28namespace sd::slidesorter
29{
30class SlideSorter;
31}
32
34{
42{
43public:
48 FocusManager(SlideSorter& rSlideSorter);
49
51
53 {
54 Left,
55 Right,
56 Up,
57 Down
58 };
59
73 void MoveFocus(FocusMoveDirection eDirection);
74
80 void ShowFocus(const bool bScrollToFocus = true);
81
84 void HideFocus();
85
90 bool ToggleFocus();
91
95 bool HasFocus() const;
96
103
110 sal_Int32 GetFocusedPageIndex() const { return mnPageIndex; }
111
118 bool SetFocusedPage(const model::SharedPageDescriptor& rDescriptor);
119
125 void SetFocusedPage(sal_Int32 nPageIndex);
126
131
138 bool IsFocusShowing() const;
139
148
155
161 {
162 public:
164 ~FocusHider() COVERITY_NOEXCEPT_FALSE;
165
166 private:
169 };
170
171private:
173
177 sal_Int32 mnPageIndex;
178
183
184 ::std::vector<Link<LinkParamNone*, void>> maFocusChangeListeners;
185
191 void HideFocusIndicator(const model::SharedPageDescriptor& rpDescriptor);
192
202 void ShowFocusIndicator(const model::SharedPageDescriptor& rpDescriptor,
203 const bool bScrollToFocus);
204
209 void NotifyFocusChangeListeners() const;
210};
211
212} // end of namespace ::sd::slidesorter::controller
213
214/* 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
Create an instance of this class to temporarily hide the focus indicator.
This class manages the focus of the slide sorter.
void MoveFocus(FocusMoveDirection eDirection)
Move the focus from the currently focused page to one that is displayed adjacent to it,...
void NotifyFocusChangeListeners() const
Call all currently registered listeners that a focus change has happened.
bool ToggleFocus()
Toggle the focused state of the current slide.
model::SharedPageDescriptor GetFocusedPageDescriptor() const
Return the descriptor of the page that currently has the focus.
::std::vector< Link< LinkParamNone *, void > > maFocusChangeListeners
void RemoveFocusChangeListener(const Link< LinkParamNone *, void > &rListener)
Remove a focus change listener.
void HideFocus()
Hide the focus indicator.
bool mbPageIsFocused
This flag indicates whether the page pointed to by mpFocusDescriptor has the focus.
bool SetFocusedPage(const model::SharedPageDescriptor &rDescriptor)
Set the focused page to the one described by the given page descriptor.
void ShowFocus(const bool bScrollToFocus=true)
Show the focus indicator of the current slide.
FocusManager(SlideSorter &rSlideSorter)
Create a new focus manager that operates on the pages of the model associated with the given controll...
void HideFocusIndicator(const model::SharedPageDescriptor &rpDescriptor)
Reset the focus state of the given descriptor and request a repaint so that the focus indicator is hi...
void AddFocusChangeListener(const Link< LinkParamNone *, void > &rListener)
Add a listener that is called when the focus is shown or hidden or set to another page object.
void ShowFocusIndicator(const model::SharedPageDescriptor &rpDescriptor, const bool bScrollToFocus)
Set the focus state of the given descriptor, scroll it into the visible area and request a repaint so...
bool IsFocusShowing() const
Return <TRUE> when the focus indicator is currently shown.
sal_Int32 mnPageIndex
Index of the page that may be focused.
bool HasFocus() const
Return whether the window managed by the called focus manager has the input focus of the application.
bool SetFocusedPageFromCurrentPage()
Set the focused page to the one that is the current slide of the Slide Manager.
sal_Int32 GetFocusedPageIndex() const
Return the index of the page that currently has the focus as it is accepted by the slide sorter model...
std::shared_ptr< PageDescriptor > SharedPageDescriptor
Left
Right