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

#include <SlsClipboard.hxx>

Inheritance diagram for sd::slidesorter::controller::Clipboard:
[legend]
Collaboration diagram for sd::slidesorter::controller::Clipboard:
[legend]

Classes

class  UndoContext
 

Public Member Functions

 Clipboard (SlideSorter &rSlideSorter)
 
virtual ~Clipboard () override
 
void HandleSlotCall (SfxRequest &rRequest)
 With the current implementation the forwarded calls to the current function will come back eventually to call the local Do(Cut|Copy|Paste) methods. More...
 
void DoCut ()
 
SD_DLLPUBLIC void DoCopy ()
 
SD_DLLPUBLIC void DoPaste ()
 
void DoDelete ()
 
void StartDrag (const Point &rDragPt, vcl::Window *pWindow)
 
void DragFinished (sal_Int8 nDropAction)
 
sal_Int8 AcceptDrop (const AcceptDropEvent &rEvt, DropTargetHelper &rTargetHelper, ::sd::Window *pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer)
 
sal_Int8 ExecuteDrop (const ExecuteDropEvent &rEvt, DropTargetHelper &rTargetHelper, ::sd::Window *pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer)
 
void Abort ()
 
- Public Member Functions inherited from sd::ViewClipboard
 ViewClipboard (::sd::View &rView)
 
virtual ~ViewClipboard ()
 
void HandlePageDrop (const SdTransferable &rTransferable)
 Handle the drop of a drag-and-drop action where the transferable contains a set of pages. More...
 

Static Public Member Functions

static std::shared_ptr< SdTransferable::UserDataCreateTransferableUserData (SdTransferable *pTransferable)
 Create a slide sorter transferable from the given sd transferable. More...
 

Private Types

enum  DropType {
  DT_PAGE ,
  DT_PAGE_FROM_NAVIGATOR ,
  DT_SHAPE ,
  DT_NONE
}
 Return <TRUE> when the current transferable in the current state of the slidesorter is acceptable to be pasted. More...
 
enum  DropCommand {
  DC_ACCEPT ,
  DC_EXECUTE
}
 This method contains the code for AcceptDrop() and ExecuteDrop() shapes. More...
 
typedef ::std::vector< SdPage * > PageList
 

Private Member Functions

virtual sal_uInt16 DetermineInsertPosition () override
 Return an index of a page after which the pages of the transferable are to be inserted into the target document. More...
 
void CreateSlideTransferable (vcl::Window *pWindow, bool bDrag)
 
sal_Int32 GetInsertionPosition ()
 Determine the position of where to insert the pages in the current transferable of the sd module. More...
 
sal_Int32 PasteTransferable (sal_Int32 nInsertPosition)
 Paste the pages of the transferable of the sd module at the given position. More...
 
void SelectPageRange (sal_Int32 nFirstIndex, sal_Int32 nPageCount)
 Select a range of pages of the model. More...
 
DropType IsDropAccepted () const
 
sal_Int8 ExecuteOrAcceptShapeDrop (DropCommand eCommand, const Point &rPosition, const void *pDropEvent, DropTargetHelper &rTargetHelper, ::sd::Window *pTargetWindow, sal_uInt16 nPage, SdrLayerID nLayer)
 
bool IsInsertionTrivial (SdTransferable const *pTransferable, const sal_Int8 nDndAction) const
 Return whether the insertion defined by the transferable is trivial, ie would not change either source nor target document. More...
 
 DECL_DLLPRIVATE_LINK (ProcessDragFinished, void *, void)
 Asynchronous part of DragFinished. More...
 

Private Attributes

SlideSortermrSlideSorter
 
SlideSorterControllermrController
 
PageList maPagesToRemove
 Remember the pages that are dragged to another document or to another place in the same document so that they can be removed after a move operation. More...
 
std::unique_ptr< UndoContextmxUndoContext
 
std::unique_ptr< SelectionObserver::Context, o3tl::default_delete< SelectionObserver::Context > > mxSelectionObserverContext
 
ImplSVEventmnDragFinishedUserEventId
 

Additional Inherited Members

- Protected Member Functions inherited from sd::ViewClipboard
void AssignMasterPage (const SdTransferable &rTransferable, SdPage const *pMasterPage)
 Assign the (first) master page of the given transferable to the (...) slide. More...
 
virtual sal_uInt16 DetermineInsertPosition ()
 Return an index of a page after which the pages of the transferable are to be inserted into the target document. More...
 
sal_uInt16 InsertSlides (const SdTransferable &rTransferable, sal_uInt16 nInsertPosition)
 Insert the slides in the given transferable behind the last selected slide or, when the selection is empty, behind the last slide. More...
 
- Static Protected Member Functions inherited from sd::ViewClipboard
static SdPageGetFirstMasterPage (const SdTransferable &rTransferable)
 Return the first master page of the given transferable. More...
 

Detailed Description

Definition at line 52 of file SlsClipboard.hxx.

Member Typedef Documentation

◆ PageList

Definition at line 103 of file SlsClipboard.hxx.

Member Enumeration Documentation

◆ DropCommand

This method contains the code for AcceptDrop() and ExecuteDrop() shapes.

There are only minor differences for the two cases at this level.

Parameters
eCommandThis parameter specifies whether to do an AcceptDrop() or ExecuteDrop().
rPositionSince the event is given as void pointer we can not take the mouse position from it. The caller has to supply it in this parameter.
pDropEventEvent though the AcceptDropEvent and ExecuteDropEvent are very similar they do not have a common base class. Because of that we have to use a void* to pass these structs.
nPageWhen the page number is given as 0xffff then it is replaced by the number of the page at the mouse position. If the mouse is not over a page then neither AcceptDrop() nor ExecuteDrop() are executed.
Enumerator
DC_ACCEPT 
DC_EXECUTE 

Definition at line 183 of file SlsClipboard.hxx.

◆ DropType

Return <TRUE> when the current transferable in the current state of the slidesorter is acceptable to be pasted.

For this the transferable has to a) exist, b) contain one or more regular draw pages, no master pages. When master pages are involved, either in the transferable or in the slide sorter (by it displaying master pages) the drop of the transferable is not accepted. The reason is the missing implementation of proper handling master pages copy-and-paste.

Enumerator
DT_PAGE 
DT_PAGE_FROM_NAVIGATOR 
DT_SHAPE 
DT_NONE 

Definition at line 161 of file SlsClipboard.hxx.

Constructor & Destructor Documentation

◆ Clipboard()

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

Definition at line 135 of file SlsClipboard.cxx.

References GetController().

◆ ~Clipboard()

sd::slidesorter::controller::Clipboard::~Clipboard ( )
overridevirtual

Definition at line 143 of file SlsClipboard.cxx.

References mnDragFinishedUserEventId, and Application::RemoveUserEvent().

Member Function Documentation

◆ Abort()

void sd::slidesorter::controller::Clipboard::Abort ( )

Definition at line 806 of file SlsClipboard.cxx.

References mxSelectionObserverContext.

◆ AcceptDrop()

sal_Int8 sd::slidesorter::controller::Clipboard::AcceptDrop ( const AcceptDropEvent rEvt,
DropTargetHelper &  rTargetHelper,
::sd::Window pTargetWindow,
sal_uInt16  nPage,
SdrLayerID  nLayer 
)

◆ CreateSlideTransferable()

void sd::slidesorter::controller::Clipboard::CreateSlideTransferable ( vcl::Window pWindow,
bool  bDrag 
)
private

◆ CreateTransferableUserData()

std::shared_ptr< SdTransferable::UserData > sd::slidesorter::controller::Clipboard::CreateTransferableUserData ( SdTransferable pTransferable)
static

◆ DECL_DLLPRIVATE_LINK()

sd::slidesorter::controller::Clipboard::DECL_DLLPRIVATE_LINK ( ProcessDragFinished  ,
void *  ,
void   
)
private

Asynchronous part of DragFinished.

The argument is the sal_Int8 nDropAction, disguised as void*.

◆ DetermineInsertPosition()

sal_uInt16 sd::slidesorter::controller::Clipboard::DetermineInsertPosition ( )
overrideprivatevirtual

Return an index of a page after which the pages of the transferable are to be inserted into the target document.

Reimplemented from sd::ViewClipboard.

Definition at line 815 of file SlsClipboard.cxx.

References sd::slidesorter::model::SlideSorterModel::GetCoreIndex(), sd::slidesorter::controller::SlideSorterController::GetInsertionIndicatorHandler(), sd::slidesorter::SlideSorter::GetModel(), mrController, and mrSlideSorter.

◆ DoCopy()

void sd::slidesorter::controller::Clipboard::DoCopy ( )

◆ DoCut()

void sd::slidesorter::controller::Clipboard::DoCut ( )

◆ DoDelete()

void sd::slidesorter::controller::Clipboard::DoDelete ( )

◆ DoPaste()

void sd::slidesorter::controller::Clipboard::DoPaste ( )

◆ DragFinished()

void sd::slidesorter::controller::Clipboard::DragFinished ( sal_Int8  nDropAction)

◆ ExecuteDrop()

sal_Int8 sd::slidesorter::controller::Clipboard::ExecuteDrop ( const ExecuteDropEvent rEvt,
DropTargetHelper &  rTargetHelper,
::sd::Window pTargetWindow,
sal_uInt16  nPage,
SdrLayerID  nLayer 
)

◆ ExecuteOrAcceptShapeDrop()

sal_Int8 sd::slidesorter::controller::Clipboard::ExecuteOrAcceptShapeDrop ( DropCommand  eCommand,
const Point rPosition,
const void *  pDropEvent,
DropTargetHelper &  rTargetHelper,
::sd::Window pTargetWindow,
sal_uInt16  nPage,
SdrLayerID  nLayer 
)
private

◆ GetInsertionPosition()

sal_Int32 sd::slidesorter::controller::Clipboard::GetInsertionPosition ( )
private

◆ HandleSlotCall()

void sd::slidesorter::controller::Clipboard::HandleSlotCall ( SfxRequest rRequest)

With the current implementation the forwarded calls to the current function will come back eventually to call the local Do(Cut|Copy|Paste) methods.

A shortcut is possible but would be an unclean hack.

Definition at line 153 of file SlsClipboard.cxx.

References DoCopy(), DoCut(), DoDelete(), SfxRequest::Done(), DoPaste(), sd::ViewShell::GetCurrentFunction(), sd::slidesorter::model::SlideSorterModel::GetEditMode(), sd::slidesorter::SlideSorter::GetModel(), SfxRequest::GetSlot(), sd::slidesorter::SlideSorter::GetViewShell(), MasterPage, and mrSlideSorter.

Referenced by sd::slidesorter::controller::SlotManager::FuSupport().

◆ IsDropAccepted()

Clipboard::DropType sd::slidesorter::controller::Clipboard::IsDropAccepted ( ) const
private

◆ IsInsertionTrivial()

bool sd::slidesorter::controller::Clipboard::IsInsertionTrivial ( SdTransferable const *  pTransferable,
const sal_Int8  nDndAction 
) const
private

Return whether the insertion defined by the transferable is trivial, ie would not change either source nor target document.

Definition at line 794 of file SlsClipboard.cxx.

References sd::slidesorter::controller::TransferableData::GetFromTransferable(), sd::slidesorter::controller::SlideSorterController::GetInsertionIndicatorHandler(), sd::slidesorter::SlideSorter::GetViewShell(), mrController, and mrSlideSorter.

Referenced by AcceptDrop(), and ExecuteDrop().

◆ PasteTransferable()

sal_Int32 sd::slidesorter::controller::Clipboard::PasteTransferable ( sal_Int32  nInsertPosition)
private

◆ SelectPageRange()

void sd::slidesorter::controller::Clipboard::SelectPageRange ( sal_Int32  nFirstIndex,
sal_Int32  nPageCount 
)
private

Select a range of pages of the model.

Typically usage is the selection of newly inserted pages.

Parameters
nFirstIndexThe index of the first page to select.
nPageCountThe number of pages to select.

Definition at line 344 of file SlsClipboard.cxx.

References sd::slidesorter::controller::PageSelector::DeselectAllPages(), sd::slidesorter::controller::SlideSorterController::GetCurrentSlideManager(), sd::slidesorter::SlideSorter::GetModel(), sd::slidesorter::model::SlideSorterModel::GetPageDescriptor(), sd::slidesorter::controller::SlideSorterController::GetPageSelector(), i, mrController, mrSlideSorter, and sd::slidesorter::controller::PageSelector::SelectPage().

Referenced by DoPaste().

◆ StartDrag()

void sd::slidesorter::controller::Clipboard::StartDrag ( const Point rDragPt,
vcl::Window pWindow 
)

Member Data Documentation

◆ maPagesToRemove

PageList sd::slidesorter::controller::Clipboard::maPagesToRemove
private

Remember the pages that are dragged to another document or to another place in the same document so that they can be removed after a move operation.

Definition at line 108 of file SlsClipboard.hxx.

Referenced by CreateSlideTransferable(), CreateTransferableUserData(), and StartDrag().

◆ mnDragFinishedUserEventId

ImplSVEvent* sd::slidesorter::controller::Clipboard::mnDragFinishedUserEventId
private

Definition at line 117 of file SlsClipboard.hxx.

Referenced by DragFinished(), and ~Clipboard().

◆ mrController

SlideSorterController& sd::slidesorter::controller::Clipboard::mrController
private

◆ mrSlideSorter

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

◆ mxSelectionObserverContext

std::unique_ptr<SelectionObserver::Context, o3tl::default_delete<SelectionObserver::Context> > sd::slidesorter::controller::Clipboard::mxSelectionObserverContext
private

Definition at line 116 of file SlsClipboard.hxx.

Referenced by Abort(), and ExecuteDrop().

◆ mxUndoContext

std::unique_ptr<UndoContext> sd::slidesorter::controller::Clipboard::mxUndoContext
private

Definition at line 114 of file SlsClipboard.hxx.

Referenced by ExecuteDrop().


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