LibreOffice Module sd (master) 1
|
This class manages the focus of the slide sorter. More...
#include <SlsFocusManager.hxx>
Classes | |
class | FocusHider |
Create an instance of this class to temporarily hide the focus indicator. More... | |
Public Types | |
enum class | FocusMoveDirection { Left , Right , Up , Down } |
Public Member Functions | |
FocusManager (SlideSorter &rSlideSorter) | |
Create a new focus manager that operates on the pages of the model associated with the given controller. More... | |
~FocusManager () | |
void | MoveFocus (FocusMoveDirection eDirection) |
Move the focus from the currently focused page to one that is displayed adjacent to it, either vertically or horizontally. More... | |
void | ShowFocus (const bool bScrollToFocus=true) |
Show the focus indicator of the current slide. More... | |
void | HideFocus () |
Hide the focus indicator. More... | |
bool | ToggleFocus () |
Toggle the focused state of the current slide. More... | |
bool | HasFocus () const |
Return whether the window managed by the called focus manager has the input focus of the application. More... | |
model::SharedPageDescriptor | GetFocusedPageDescriptor () const |
Return the descriptor of the page that currently has the focus. More... | |
sal_Int32 | GetFocusedPageIndex () const |
Return the index of the page that currently has the focus as it is accepted by the slide sorter model. More... | |
bool | SetFocusedPage (const model::SharedPageDescriptor &rDescriptor) |
Set the focused page to the one described by the given page descriptor. More... | |
void | SetFocusedPage (sal_Int32 nPageIndex) |
Set the focused page to the one described by the given page index. More... | |
bool | SetFocusedPageFromCurrentPage () |
Set the focused page to the one that is the current slide of the Slide Manager. More... | |
bool | IsFocusShowing () const |
Return <TRUE> when the focus indicator is currently shown. More... | |
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. More... | |
void | RemoveFocusChangeListener (const Link< LinkParamNone *, void > &rListener) |
Remove a focus change listener. More... | |
Private Member Functions | |
void | HideFocusIndicator (const model::SharedPageDescriptor &rpDescriptor) |
Reset the focus state of the given descriptor and request a repaint so that the focus indicator is hidden. More... | |
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 that the focus indicator is made visible. More... | |
void | NotifyFocusChangeListeners () const |
Call all currently registered listeners that a focus change has happened. More... | |
Private Attributes | |
SlideSorter & | mrSlideSorter |
sal_Int32 | mnPageIndex |
Index of the page that may be focused. More... | |
bool | mbPageIsFocused |
This flag indicates whether the page pointed to by mpFocusDescriptor has the focus. More... | |
::std::vector< Link< LinkParamNone *, void > > | maFocusChangeListeners |
This class manages the focus of the slide sorter.
There is the focus page which is or is not focused. Initialized to point to the first page it can be set to other pages by using the MoveFocus() method. The focused state of the focus page can be toggled with the ToggleFocus() method.
Definition at line 41 of file SlsFocusManager.hxx.
|
strong |
Enumerator | |
---|---|
Left | |
Right | |
Up | |
Down |
Definition at line 52 of file SlsFocusManager.hxx.
sd::slidesorter::controller::FocusManager::FocusManager | ( | SlideSorter & | rSlideSorter | ) |
Create a new focus manager that operates on the pages of the model associated with the given controller.
The focus page is set to the first page. Focused state is off.
Definition at line 37 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), mnPageIndex, and mrSlideSorter.
sd::slidesorter::controller::FocusManager::~FocusManager | ( | ) |
Definition at line 46 of file SlsFocusManager.cxx.
void sd::slidesorter::controller::FocusManager::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.
rListener | When this method is called multiple times for the same listener the second and all following calls are ignored. Each listener is added only once. |
Definition at line 203 of file SlsFocusManager.cxx.
References maFocusChangeListeners.
Referenced by accessibility::AccessibleSlideSorterView::Implementation::ConnectListeners().
model::SharedPageDescriptor sd::slidesorter::controller::FocusManager::GetFocusedPageDescriptor | ( | ) | const |
Return the descriptor of the page that currently has the focus.
Definition at line 140 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), mnPageIndex, and mrSlideSorter.
Referenced by sd::slidesorter::controller::SelectionObserver::EndObservation(), HideFocus(), sd::slidesorter::controller::SelectionFunction::KeyInput(), sd::slidesorter::controller::SelectionFunction::MoveFocus(), MoveFocus(), and ShowFocus().
|
inline |
Return the index of the page that currently has the focus as it is accepted by the slide sorter model.
Definition at line 110 of file SlsFocusManager.hxx.
References mnPageIndex.
Referenced by accessibility::AccessibleSlideSorterObject::getAccessibleStateSet(), sd::slidesorter::controller::Clipboard::GetInsertionPosition(), and accessibility::IMPL_LINK_NOARG().
bool sd::slidesorter::controller::FocusManager::HasFocus | ( | ) | const |
Return whether the window managed by the called focus manager has the input focus of the application.
Definition at line 135 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetContentWindow(), and mrSlideSorter.
Referenced by IsFocusShowing(), and sd::slidesorter::controller::SelectionFunction::KeyInput().
void sd::slidesorter::controller::FocusManager::HideFocus | ( | ) |
Hide the focus indicator.
Definition at line 117 of file SlsFocusManager.cxx.
References GetFocusedPageDescriptor(), HideFocusIndicator(), and mbPageIsFocused.
Referenced by sd::slidesorter::controller::FocusManager::FocusHider::FocusHider(), and ToggleFocus().
|
private |
Reset the focus state of the given descriptor and request a repaint so that the focus indicator is hidden.
pDescriptor | When NULL is given then the call is ignored. |
Definition at line 172 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetView(), mrSlideSorter, NotifyFocusChangeListeners(), sd::slidesorter::view::SlideSorterView::SetState(), and sd::slidesorter::model::PageDescriptor::ST_Focused.
Referenced by HideFocus(), and MoveFocus().
bool sd::slidesorter::controller::FocusManager::IsFocusShowing | ( | ) | const |
Return <TRUE> when the focus indicator is currently shown.
A prerequisite is that the window managed by this focus manager has the input focus as indicated by a <TRUE> return value of HasFocus(). It is not necessary that the focus indicator is visible. It may have been scrolled outside the visible area.
Definition at line 167 of file SlsFocusManager.cxx.
References HasFocus(), and mbPageIsFocused.
Referenced by sd::slidesorter::controller::SelectionManager::DeleteSelectedPages(), accessibility::AccessibleSlideSorterObject::getAccessibleStateSet(), sd::slidesorter::controller::Clipboard::GetInsertionPosition(), accessibility::IMPL_LINK_NOARG(), and sd::slidesorter::controller::SelectionFunction::KeyInput().
void sd::slidesorter::controller::FocusManager::MoveFocus | ( | FocusMoveDirection | eDirection | ) |
Move the focus from the currently focused page to one that is displayed adjacent to it, either vertically or horizontally.
eDirection | Direction in which to move the focus. Wrap around is done differently when moving vertically or horizontally. Vertical wrap around takes place in the same column, i.e. when you are in the top row and move up you come out in the bottom row in the same column. Horizontal wrap around moves to the next (FocusMoveDirection::Right) or previous (FocusMoveDirection::Left) page. Moving to the right from the last page goes to the first page and vice versa. The current page index is set to the nearest valid page index. |
Definition at line 50 of file SlsFocusManager.cxx.
References Down, sd::slidesorter::view::Layouter::GetColumnCount(), GetFocusedPageDescriptor(), sd::slidesorter::view::SlideSorterView::GetLayouter(), sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::GetPageCount(), sd::slidesorter::SlideSorter::GetView(), HideFocusIndicator(), Left, mbPageIsFocused, mnPageIndex, mrSlideSorter, Right, ShowFocusIndicator(), and Up.
Referenced by sd::slidesorter::controller::SelectionFunction::MoveFocus().
|
private |
Call all currently registered listeners that a focus change has happened.
The focus may be hidden or shown or moved from one page object to another.
Definition at line 218 of file SlsFocusManager.cxx.
References aListeners, and maFocusChangeListeners.
Referenced by HideFocusIndicator(), and ShowFocusIndicator().
void sd::slidesorter::controller::FocusManager::RemoveFocusChangeListener | ( | const Link< LinkParamNone *, void > & | rListener | ) |
Remove a focus change listener.
rListener | It is safe to pass a listener that was not added are has been removed previously. Such calls are ignored. |
Definition at line 212 of file SlsFocusManager.cxx.
References maFocusChangeListeners.
Referenced by accessibility::AccessibleSlideSorterView::Implementation::ReleaseListeners().
bool sd::slidesorter::controller::FocusManager::SetFocusedPage | ( | const model::SharedPageDescriptor & | rDescriptor | ) |
Set the focused page to the one described by the given page descriptor.
The visibility of the focus indicator is not modified.
rDescriptor | One of the page descriptors that are currently managed by the SlideSorterModel. |
Definition at line 145 of file SlsFocusManager.cxx.
References mnPageIndex.
Referenced by sd::slidesorter::controller::SelectionManager::DeleteSelectedPages(), sd::slidesorter::controller::SelectionFunction::GotoPage(), sd::slidesorter::controller::CurrentSlideManager::NotifyCurrentSlideChange(), and SetFocusedPageFromCurrentPage().
void sd::slidesorter::controller::FocusManager::SetFocusedPage | ( | sal_Int32 | nPageIndex | ) |
Set the focused page to the one described by the given page index.
The visibility of the focus indicator is not modified.
nPageIndex | A valid page index that is understood by the SlideSorterModel. |
Definition at line 156 of file SlsFocusManager.cxx.
References mnPageIndex.
bool sd::slidesorter::controller::FocusManager::SetFocusedPageFromCurrentPage | ( | ) |
Set the focused page to the one that is the current slide of the Slide Manager.
Definition at line 162 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetController(), sd::slidesorter::controller::SlideSorterController::GetCurrentSlideManager(), mrSlideSorter, and SetFocusedPage().
Referenced by sd::slidesorter::controller::SelectionObserver::EndObservation().
void sd::slidesorter::controller::FocusManager::ShowFocus | ( | const bool | bScrollToFocus = true | ) |
Show the focus indicator of the current slide.
bScrollToFocus | When <TRUE> (the default) then the view is scrolled so that the focus rectangle lies inside its visible area. |
Definition at line 111 of file SlsFocusManager.cxx.
References GetFocusedPageDescriptor(), mbPageIsFocused, and ShowFocusIndicator().
Referenced by accessibility::AccessibleSlideSorterView::Implementation::Activated(), sd::slidesorter::controller::SelectionFunction::KeyInput(), and ToggleFocus().
|
private |
Set the focus state of the given descriptor, scroll it into the visible area and request a repaint so that the focus indicator is made visible.
pDescriptor | When NULL is given then the call is ignored. |
bScrollToFocus | When <TRUE> (the default) then the view is scrolled so that the focus rectangle lies inside its visible area. |
Definition at line 183 of file SlsFocusManager.cxx.
References sd::slidesorter::SlideSorter::GetController(), sd::slidesorter::SlideSorter::GetView(), sd::slidesorter::controller::SlideSorterController::GetVisibleAreaManager(), mrSlideSorter, NotifyFocusChangeListeners(), sd::slidesorter::view::SlideSorterView::RequestRepaint(), sd::slidesorter::controller::VisibleAreaManager::RequestVisible(), sd::slidesorter::view::SlideSorterView::SetState(), and sd::slidesorter::model::PageDescriptor::ST_Focused.
Referenced by MoveFocus(), and ShowFocus().
bool sd::slidesorter::controller::FocusManager::ToggleFocus | ( | ) |
Toggle the focused state of the current slide.
Definition at line 123 of file SlsFocusManager.cxx.
References HideFocus(), mbPageIsFocused, mnPageIndex, and ShowFocus().
Referenced by sd::slidesorter::controller::SelectionFunction::cancel(), and sd::slidesorter::controller::SelectionManager::DeleteSelectedPages().
|
private |
Definition at line 184 of file SlsFocusManager.hxx.
Referenced by AddFocusChangeListener(), NotifyFocusChangeListeners(), and RemoveFocusChangeListener().
|
private |
This flag indicates whether the page pointed to by mpFocusDescriptor has the focus.
Definition at line 182 of file SlsFocusManager.hxx.
Referenced by HideFocus(), IsFocusShowing(), MoveFocus(), ShowFocus(), and ToggleFocus().
|
private |
Index of the page that may be focused.
It is -1 when the model contains no page.
Definition at line 177 of file SlsFocusManager.hxx.
Referenced by FocusManager(), GetFocusedPageDescriptor(), GetFocusedPageIndex(), MoveFocus(), SetFocusedPage(), and ToggleFocus().
|
private |
Definition at line 172 of file SlsFocusManager.hxx.
Referenced by FocusManager(), GetFocusedPageDescriptor(), HasFocus(), HideFocusIndicator(), MoveFocus(), SetFocusedPageFromCurrentPage(), and ShowFocusIndicator().