LibreOffice Module sd (master) 1
|
Manage the visibility and location of the insertion indicator. More...
#include <SlsInsertionIndicatorHandler.hxx>
Classes | |
class | ForceShowContext |
This context make sure that the insertion indicator is shown (provided that the clipboard is not empty) while the context is alive. More... | |
Public Types | |
enum | Mode { CopyMode , MoveMode , UnknownMode } |
Public Member Functions | |
InsertionIndicatorHandler (SlideSorter &rSlideSorter) | |
~InsertionIndicatorHandler () COVERITY_NOEXCEPT_FALSE | |
void | Start (const bool bIsOverSourceView) |
Activate the insertion marker at the given coordinates. More... | |
void | End (const controller::Animator::AnimationMode eMode) |
Deactivate the insertion marker. More... | |
void | UpdateIndicatorIcon (const SdTransferable *pTransferable) |
Update the indicator icon from the current transferable (from the clipboard or an active drag and drop operation.) More... | |
void | UpdatePosition (const Point &rMouseModelPosition, const Mode eMode) |
Set the position of the insertion marker to the given coordinates. More... | |
void | UpdatePosition (const Point &rMouseModelPosition, const sal_Int8 nDndAction) |
bool | IsActive () const |
Return whether the insertion marker is active. More... | |
sal_Int32 | GetInsertionPageIndex () const |
Return the insertion index that corresponds with the current graphical location of the insertion indicator. More... | |
bool | IsInsertionTrivial (const sal_Int32 nInsertionIndex, const Mode eMode) const |
Determine whether moving the current selection to the current position of the insertion marker would alter the document. More... | |
bool | IsInsertionTrivial (const sal_Int8 nDndAction) |
This method is like the other variant. More... | |
Static Public Member Functions | |
static Mode | GetModeFromDndAction (const sal_Int8 nDndAction) |
Private Member Functions | |
void | SetPosition (const Point &rPoint, const Mode eMode) |
std::shared_ptr< view::InsertAnimator > const & | GetInsertAnimator () |
void | ForceShow () |
Make the insertion indicator visible (that is the show part) and keep it visible, even when the mouse leaves the window (that is the force part). More... | |
void | ForceEnd () |
Private Attributes | |
SlideSorter & | mrSlideSorter |
std::shared_ptr< view::InsertAnimator > | mpInsertAnimator |
std::shared_ptr< view::InsertionIndicatorOverlay > | mpInsertionIndicatorOverlay |
view::InsertPosition | maInsertPosition |
Mode | meMode |
bool | mbIsInsertionTrivial |
bool | mbIsActive |
bool | mbIsReadOnly |
bool | mbIsOverSourceView |
Size | maIconSize |
bool | mbIsForcedShow |
Manage the visibility and location of the insertion indicator.
Its actual display is controlled by the InsertionIndicatorOverlay.
Definition at line 39 of file SlsInsertionIndicatorHandler.hxx.
Enumerator | |
---|---|
CopyMode | |
MoveMode | |
UnknownMode |
Definition at line 45 of file SlsInsertionIndicatorHandler.hxx.
sd::slidesorter::controller::InsertionIndicatorHandler::InsertionIndicatorHandler | ( | SlideSorter & | rSlideSorter | ) |
Definition at line 37 of file SlsInsertionIndicatorHandler.cxx.
References IsReadOnly(), make_shared(), mbIsActive, and meMode.
sd::slidesorter::controller::InsertionIndicatorHandler::~InsertionIndicatorHandler | ( | ) |
Definition at line 50 of file SlsInsertionIndicatorHandler.cxx.
void sd::slidesorter::controller::InsertionIndicatorHandler::End | ( | const controller::Animator::AnimationMode | eMode | ) |
Deactivate the insertion marker.
Definition at line 69 of file SlsInsertionIndicatorHandler.cxx.
References eMode, GetInsertAnimator(), mbIsActive, mbIsForcedShow, mbIsReadOnly, meMode, mpInsertionIndicatorOverlay, mrSlideSorter, and UnknownMode.
Referenced by ForceEnd().
|
private |
Definition at line 89 of file SlsInsertionIndicatorHandler.cxx.
References sd::slidesorter::controller::Animator::AM_Immediate, End(), and mbIsForcedShow.
|
private |
Make the insertion indicator visible (that is the show part) and keep it visible, even when the mouse leaves the window (that is the force part).
We need this when a context menu is displayed (mouse over the popup menu triggers a mouse leave event) while the insertion indicator remains visible in the background.
In effect all calls to End() are ignored until ForceEnd() is called.
Definition at line 84 of file SlsInsertionIndicatorHandler.cxx.
References mbIsForcedShow.
|
private |
Definition at line 171 of file SlsInsertionIndicatorHandler.cxx.
References mpInsertAnimator, and mrSlideSorter.
Referenced by End(), and SetPosition().
sal_Int32 sd::slidesorter::controller::InsertionIndicatorHandler::GetInsertionPageIndex | ( | ) | const |
Return the insertion index that corresponds with the current graphical location of the insertion indicator.
Definition at line 132 of file SlsInsertionIndicatorHandler.cxx.
References sd::slidesorter::view::InsertPosition::GetIndex(), maInsertPosition, and mbIsReadOnly.
Referenced by IsInsertionTrivial().
|
static |
Definition at line 101 of file SlsInsertionIndicatorHandler.cxx.
References CopyMode, MoveMode, and UnknownMode.
Referenced by IsInsertionTrivial(), and UpdatePosition().
|
inline |
Return whether the insertion marker is active.
Definition at line 85 of file SlsInsertionIndicatorHandler.hxx.
References mbIsActive.
bool sd::slidesorter::controller::InsertionIndicatorHandler::IsInsertionTrivial | ( | const sal_Int32 | nInsertionIndex, |
const Mode | eMode | ||
) | const |
Determine whether moving the current selection to the current position of the insertion marker would alter the document.
This would be the case when the selection is not consecutive or would be moved to a position outside and not adjacent to the selection.
Definition at line 178 of file SlsInsertionIndicatorHandler.cxx.
References CopyMode, sd::slidesorter::model::PageEnumerationProvider::CreateSelectedPagesEnumeration(), eMode, sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::PageEnumeration::GetNextElement(), sd::slidesorter::model::PageEnumeration::HasMoreElements(), mbIsOverSourceView, mrSlideSorter, and UnknownMode.
Referenced by IsInsertionTrivial(), and SetPosition().
bool sd::slidesorter::controller::InsertionIndicatorHandler::IsInsertionTrivial | ( | const sal_Int8 | nDndAction | ) |
This method is like the other variant.
It operates implicitly on the current insertion index as would be returned by GetInsertionPageIndex().
Definition at line 223 of file SlsInsertionIndicatorHandler.cxx.
References GetInsertionPageIndex(), GetModeFromDndAction(), and IsInsertionTrivial().
|
private |
Definition at line 140 of file SlsInsertionIndicatorHandler.cxx.
References sd::slidesorter::controller::Animator::AM_Animated, eMode, sd::slidesorter::view::InsertPosition::GetIndex(), GetInsertAnimator(), sd::slidesorter::view::Layouter::GetInsertPosition(), sd::slidesorter::view::SlideSorterView::GetLayouter(), sd::slidesorter::view::InsertPosition::GetLocation(), sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::SlideSorter::GetView(), IsInsertionTrivial(), maIconSize, maInsertPosition, mbIsInsertionTrivial, meMode, mpInsertionIndicatorOverlay, and mrSlideSorter.
Referenced by UpdatePosition().
void sd::slidesorter::controller::InsertionIndicatorHandler::Start | ( | const bool | bIsOverSourceView | ) |
Activate the insertion marker at the given coordinates.
Definition at line 54 of file SlsInsertionIndicatorHandler.cxx.
References sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::IsReadOnly(), mbIsActive, mbIsOverSourceView, mbIsReadOnly, and mrSlideSorter.
void sd::slidesorter::controller::InsertionIndicatorHandler::UpdateIndicatorIcon | ( | const SdTransferable * | pTransferable | ) |
Update the indicator icon from the current transferable (from the clipboard or an active drag and drop operation.)
Definition at line 95 of file SlsInsertionIndicatorHandler.cxx.
References maIconSize, and mpInsertionIndicatorOverlay.
void sd::slidesorter::controller::InsertionIndicatorHandler::UpdatePosition | ( | const Point & | rMouseModelPosition, |
const Mode | eMode | ||
) |
Set the position of the insertion marker to the given coordinates.
Definition at line 112 of file SlsInsertionIndicatorHandler.cxx.
References eMode, mbIsActive, mbIsReadOnly, and SetPosition().
Referenced by UpdatePosition().
void sd::slidesorter::controller::InsertionIndicatorHandler::UpdatePosition | ( | const Point & | rMouseModelPosition, |
const sal_Int8 | nDndAction | ||
) |
Definition at line 125 of file SlsInsertionIndicatorHandler.cxx.
References GetModeFromDndAction(), and UpdatePosition().
|
private |
Definition at line 116 of file SlsInsertionIndicatorHandler.hxx.
Referenced by SetPosition(), and UpdateIndicatorIcon().
|
private |
Definition at line 110 of file SlsInsertionIndicatorHandler.hxx.
Referenced by GetInsertionPageIndex(), and SetPosition().
|
private |
Definition at line 113 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), IsActive(), Start(), and UpdatePosition().
|
private |
Definition at line 117 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), ForceEnd(), and ForceShow().
|
private |
Definition at line 112 of file SlsInsertionIndicatorHandler.hxx.
Referenced by SetPosition().
|
private |
Definition at line 115 of file SlsInsertionIndicatorHandler.hxx.
Referenced by IsInsertionTrivial(), and Start().
|
private |
Definition at line 114 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), GetInsertionPageIndex(), Start(), and UpdatePosition().
|
private |
Definition at line 111 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), and SetPosition().
|
private |
Definition at line 108 of file SlsInsertionIndicatorHandler.hxx.
Referenced by GetInsertAnimator().
|
private |
Definition at line 109 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), SetPosition(), and UpdateIndicatorIcon().
|
private |
Definition at line 107 of file SlsInsertionIndicatorHandler.hxx.
Referenced by End(), GetInsertAnimator(), IsInsertionTrivial(), SetPosition(), and Start().