LibreOffice Module sd (master) 1
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
sd::slidesorter::controller::InsertionIndicatorHandler Class Reference

Manage the visibility and location of the insertion indicator. More...

#include <SlsInsertionIndicatorHandler.hxx>

Collaboration diagram for sd::slidesorter::controller::InsertionIndicatorHandler:
[legend]

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

SlideSortermrSlideSorter
 
std::shared_ptr< view::InsertAnimatormpInsertAnimator
 
std::shared_ptr< view::InsertionIndicatorOverlaympInsertionIndicatorOverlay
 
view::InsertPosition maInsertPosition
 
Mode meMode
 
bool mbIsInsertionTrivial
 
bool mbIsActive
 
bool mbIsReadOnly
 
bool mbIsOverSourceView
 
Size maIconSize
 
bool mbIsForcedShow
 

Detailed Description

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.

Member Enumeration Documentation

◆ Mode

Enumerator
CopyMode 
MoveMode 
UnknownMode 

Definition at line 45 of file SlsInsertionIndicatorHandler.hxx.

Constructor & Destructor Documentation

◆ InsertionIndicatorHandler()

sd::slidesorter::controller::InsertionIndicatorHandler::InsertionIndicatorHandler ( SlideSorter rSlideSorter)

Definition at line 37 of file SlsInsertionIndicatorHandler.cxx.

References IsReadOnly(), make_shared(), mbIsActive, and meMode.

◆ ~InsertionIndicatorHandler()

sd::slidesorter::controller::InsertionIndicatorHandler::~InsertionIndicatorHandler ( )

Definition at line 50 of file SlsInsertionIndicatorHandler.cxx.

Member Function Documentation

◆ End()

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().

◆ ForceEnd()

void sd::slidesorter::controller::InsertionIndicatorHandler::ForceEnd ( )
private

◆ ForceShow()

void sd::slidesorter::controller::InsertionIndicatorHandler::ForceShow ( )
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.

◆ GetInsertAnimator()

std::shared_ptr< view::InsertAnimator > const & sd::slidesorter::controller::InsertionIndicatorHandler::GetInsertAnimator ( )
private

Definition at line 171 of file SlsInsertionIndicatorHandler.cxx.

References mpInsertAnimator, and mrSlideSorter.

Referenced by End(), and SetPosition().

◆ GetInsertionPageIndex()

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().

◆ GetModeFromDndAction()

InsertionIndicatorHandler::Mode sd::slidesorter::controller::InsertionIndicatorHandler::GetModeFromDndAction ( const sal_Int8  nDndAction)
static

Definition at line 101 of file SlsInsertionIndicatorHandler.cxx.

References CopyMode, MoveMode, and UnknownMode.

Referenced by IsInsertionTrivial(), and UpdatePosition().

◆ IsActive()

bool sd::slidesorter::controller::InsertionIndicatorHandler::IsActive ( ) const
inline

Return whether the insertion marker is active.

Definition at line 85 of file SlsInsertionIndicatorHandler.hxx.

References mbIsActive.

◆ IsInsertionTrivial() [1/2]

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().

◆ IsInsertionTrivial() [2/2]

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().

◆ SetPosition()

void sd::slidesorter::controller::InsertionIndicatorHandler::SetPosition ( const Point rPoint,
const Mode  eMode 
)
private

◆ Start()

void sd::slidesorter::controller::InsertionIndicatorHandler::Start ( const bool  bIsOverSourceView)

◆ UpdateIndicatorIcon()

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.

◆ UpdatePosition() [1/2]

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().

◆ UpdatePosition() [2/2]

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().

Member Data Documentation

◆ maIconSize

Size sd::slidesorter::controller::InsertionIndicatorHandler::maIconSize
private

Definition at line 116 of file SlsInsertionIndicatorHandler.hxx.

Referenced by SetPosition(), and UpdateIndicatorIcon().

◆ maInsertPosition

view::InsertPosition sd::slidesorter::controller::InsertionIndicatorHandler::maInsertPosition
private

Definition at line 110 of file SlsInsertionIndicatorHandler.hxx.

Referenced by GetInsertionPageIndex(), and SetPosition().

◆ mbIsActive

bool sd::slidesorter::controller::InsertionIndicatorHandler::mbIsActive
private

Definition at line 113 of file SlsInsertionIndicatorHandler.hxx.

Referenced by End(), IsActive(), Start(), and UpdatePosition().

◆ mbIsForcedShow

bool sd::slidesorter::controller::InsertionIndicatorHandler::mbIsForcedShow
private

Definition at line 117 of file SlsInsertionIndicatorHandler.hxx.

Referenced by End(), ForceEnd(), and ForceShow().

◆ mbIsInsertionTrivial

bool sd::slidesorter::controller::InsertionIndicatorHandler::mbIsInsertionTrivial
private

Definition at line 112 of file SlsInsertionIndicatorHandler.hxx.

Referenced by SetPosition().

◆ mbIsOverSourceView

bool sd::slidesorter::controller::InsertionIndicatorHandler::mbIsOverSourceView
private

Definition at line 115 of file SlsInsertionIndicatorHandler.hxx.

Referenced by IsInsertionTrivial(), and Start().

◆ mbIsReadOnly

bool sd::slidesorter::controller::InsertionIndicatorHandler::mbIsReadOnly
private

◆ meMode

Mode sd::slidesorter::controller::InsertionIndicatorHandler::meMode
private

Definition at line 111 of file SlsInsertionIndicatorHandler.hxx.

Referenced by End(), and SetPosition().

◆ mpInsertAnimator

std::shared_ptr<view::InsertAnimator> sd::slidesorter::controller::InsertionIndicatorHandler::mpInsertAnimator
private

Definition at line 108 of file SlsInsertionIndicatorHandler.hxx.

Referenced by GetInsertAnimator().

◆ mpInsertionIndicatorOverlay

std::shared_ptr<view::InsertionIndicatorOverlay> sd::slidesorter::controller::InsertionIndicatorHandler::mpInsertionIndicatorOverlay
private

Definition at line 109 of file SlsInsertionIndicatorHandler.hxx.

Referenced by End(), SetPosition(), and UpdateIndicatorIcon().

◆ mrSlideSorter

SlideSorter& sd::slidesorter::controller::InsertionIndicatorHandler::mrSlideSorter
private

The documentation for this class was generated from the following files: