ufe 6.2
Universal Front End is a DCC-agnostic component that will allow a DCC to browse and edit data in multiple data models
Ufe::ClipboardHandler Class Referenceabstract

#include <clipboardHandler.h>

Public Types

typedef std::shared_ptr< ClipboardHandlerPtr
 

Public Member Functions

 ClipboardHandler ()=default
 Constructor. More...
 
 ClipboardHandler (const ClipboardHandler &)=default
 Default copy constructor. More...
 
virtual ~ClipboardHandler ()=default
 Destructor. More...
 
virtual UndoableCommand::Ptr cutCmd_ (const SceneItem::Ptr &item)
 
virtual UndoableCommand::Ptr copyCmd_ (const SceneItem::Ptr &item)
 
virtual UndoableCommand::Ptr cutCmd_ (const Selection &selection)=0
 
virtual UndoableCommand::Ptr copyCmd_ (const Selection &selection)=0
 
virtual PasteClipboardCommand::Ptr pasteCmd_ (const SceneItem::Ptr &parentItem)=0
 
virtual UndoableCommand::Ptr pasteCmd_ (const Selection &parentItems)=0
 
virtual bool hasItemsToPaste_ ()=0
 
virtual bool canBeCut_ (const SceneItem::Ptr &item)=0
 
virtual void preCopy_ ()=0
 Utility method to perform any cleanup before the copy operation is executed. More...
 
virtual void preCut_ ()=0
 Utility method to perform any cleanup before the cut operation is executed. More...
 

Static Public Member Functions

static Ptr clipboardHandler (Rtid)
 
static UndoableCommand::Ptr cutCmd (const Selection &selection)
 
static UndoableCommand::Ptr copyCmd (const Selection &selection)
 
static UndoableCommand::Ptr pasteCmd (const Selection &parentItems)
 
static PasteClipboardCommand::Ptr pasteCmd (const SceneItem::Ptr &parentItem)
 
static bool hasItemsToPaste (const Rtid &rtid)
 
static bool canBeCut (const SceneItem::Ptr &item)
 
static void preCopy ()
 
static void preCut ()
 

Detailed Description

This base class defines an interface that runtimes can implement to provide cut/copy and paste operations for sceneItem and Selection.

Definition at line 27 of file clipboardHandler.h.

Member Typedef Documentation

◆ Ptr

typedef std::shared_ptr<ClipboardHandler> Ufe::ClipboardHandler::Ptr

Definition at line 30 of file clipboardHandler.h.

Constructor & Destructor Documentation

◆ ClipboardHandler() [1/2]

Ufe::ClipboardHandler::ClipboardHandler ( )
default

Constructor.

◆ ClipboardHandler() [2/2]

Ufe::ClipboardHandler::ClipboardHandler ( const ClipboardHandler )
default

Default copy constructor.

◆ ~ClipboardHandler()

virtual Ufe::ClipboardHandler::~ClipboardHandler ( )
virtualdefault

Destructor.

Member Function Documentation

◆ canBeCut()

static bool Ufe::ClipboardHandler::canBeCut ( const SceneItem::Ptr item)
static

Convenience method that calls canBeCut_ on the appropriate clipboard handler.

Parameters
[in]itemSceneItem to be tested for cut.
Note
Returns false if input item is nullptr or no clipboard handler exists for runtime of item.

◆ canBeCut_()

virtual bool Ufe::ClipboardHandler::canBeCut_ ( const SceneItem::Ptr item)
pure virtual

Utility method to test if an item meets specific conditions for the cut action.

Parameters
[in]itemSceneItem to be tested for cut.
Returns
true if the item can be cut, otherwise false.

◆ clipboardHandler()

static Ptr Ufe::ClipboardHandler::clipboardHandler ( Rtid  )
static

Convenience method to retrieve the Clipboard Handler from the input runtime id. The handler interface will remain valid as long as the given runtime remains set in the runtime manager.

◆ copyCmd()

static UndoableCommand::Ptr Ufe::ClipboardHandler::copyCmd ( const Selection selection)
static

Convenience method that groups the items from the input selection into their runtime ID and calls the corresponding virtual copyCmd_ on each clipboard handler. Creates a command to perform the copy operation. The command is not executed.

Exceptions
EmptyClipboardSelectionif the input selection is empty.
NoClipboardHandlerif no clipboard handler found for runtime in selection.
EmptyClipboardOperationif there is/are no command(s) generated (empty composite cmd).
Parameters
[in]selectionThe input selection to copy.
Returns
Command whose execution will copy the input items.

◆ copyCmd_() [1/2]

virtual UndoableCommand::Ptr Ufe::ClipboardHandler::copyCmd_ ( const SceneItem::Ptr item)
virtual

Creates a command which will copy the input item. The command is not executed. The default implementation provided puts the input item in a Selection and then calls the corresponding method which takes a Selection argument.

Parameters
[in]itemThe item to copy.
Exceptions
std::invalid_argumentif the argument is a null pointer.
Returns
Command whose execution will copy the input items.

◆ copyCmd_() [2/2]

virtual UndoableCommand::Ptr Ufe::ClipboardHandler::copyCmd_ ( const Selection selection)
pure virtual

Creates a command which will copy the items in the input selection. The command is not executed. The items are copied to the clipboard.

Parameters
[in]selectionSelection of items to copy.

◆ cutCmd()

static UndoableCommand::Ptr Ufe::ClipboardHandler::cutCmd ( const Selection selection)
static

Convenience method that groups the items from the input selection into their runtime ID and calls the corresponding virtual cutCmd_ on each clipboard handler. Creates a command to perform the cut operation. The command is not executed.

Exceptions
EmptyClipboardSelectionif the input selection is empty.
NoClipboardHandlerif no clipboard handler found for runtime in selection.
EmptyClipboardOperationif there is/are no command(s) generated (empty composite cmd).
Parameters
[in]selectionThe input selection to cut.
Returns
Command whose execution will cut the input items.

◆ cutCmd_() [1/2]

virtual UndoableCommand::Ptr Ufe::ClipboardHandler::cutCmd_ ( const SceneItem::Ptr item)
virtual

Creates a command which will cut the input item. The command is not executed. The default implementation provided puts the input item in a Selection and then calls the corresponding method which takes a Selection argument.

Parameters
[in]itemThe item to cut.
Exceptions
std::invalid_argumentif the argument is a null pointer.
Returns
Command whose execution will cut the input items.

◆ cutCmd_() [2/2]

virtual UndoableCommand::Ptr Ufe::ClipboardHandler::cutCmd_ ( const Selection selection)
pure virtual

Creates a command which will cut the items in the input selection. The command is not executed. The items are copied to the clipboard, then they are deleted.

Parameters
[in]selectionSelection of items to cut.

◆ hasItemsToPaste()

static bool Ufe::ClipboardHandler::hasItemsToPaste ( const Rtid rtid)
static

Convenience method that calls hasItemsToPaste_ on the appropriate clipboard handler.

Parameters
[in]rtidRuntime ID for the clipboard handler to call.
Note
Returns false if no clipboard handler exists for given runtime ID.

◆ hasItemsToPaste_()

virtual bool Ufe::ClipboardHandler::hasItemsToPaste_ ( )
pure virtual

Utility method to check if the clipboard handler has any items to paste.

Returns
true if there are items to paste, otherwise false.

◆ pasteCmd() [1/2]

static PasteClipboardCommand::Ptr Ufe::ClipboardHandler::pasteCmd ( const SceneItem::Ptr parentItem)
static

Convenience method that gets the clipboard handler corresponding to the runtime ID of the input item and then calls the virtual method pasteCmd_.

Exceptions
std::invalid_argumentif the input item is a null pointer.
NoClipboardHandlerif no clipboard handler found for runtime of item.
Parameters
[in]parentItemThe target parent item into which the clipboard is pasted.
Returns
Command whose execution will paste the input items.

◆ pasteCmd() [2/2]

static UndoableCommand::Ptr Ufe::ClipboardHandler::pasteCmd ( const Selection parentItems)
static

Convenience method that groups the items from the input selection into their runtime ID and calls the corresponding virtual pasteCmd_ on each clipboard handler. Creates a command to perform the paste operation. The command is not executed.

Exceptions
EmptyClipboardSelectionif the input selection is empty.
NoClipboardHandlerif no clipboard handler found for runtime in selection.
EmptyClipboardOperationif there is/are no command(s) generated (empty composite cmd).
Parameters
[in]parentItemsThe target parent items into which the clipboard is pasted.
Returns
Command whose execution will paste the input items.

◆ pasteCmd_() [1/2]

virtual PasteClipboardCommand::Ptr Ufe::ClipboardHandler::pasteCmd_ ( const SceneItem::Ptr parentItem)
pure virtual

Creates a command which will paste the item(s) from clipboard to the input parent destination item. The command is not executed.

Parameters
[in]parentItemThe parent where to try and paste the the clipboard item(s).
Returns
Command whose execution will paste the input items.

◆ pasteCmd_() [2/2]

virtual UndoableCommand::Ptr Ufe::ClipboardHandler::pasteCmd_ ( const Selection parentItems)
pure virtual

Creates a command which will be paste the item(s) from the clipboard to the most suitable parent destination item. The command is not executed.

Parameters
[in]parentItemsThe parent items where to try and paste the clipboard item(s).
Returns
Command whose execution will paste the input items.

◆ preCopy()

static void Ufe::ClipboardHandler::preCopy ( )
static

Convenience method that calls preCopy_ for each clipboard handler that exists for for all the registered runtimes.

◆ preCopy_()

virtual void Ufe::ClipboardHandler::preCopy_ ( )
pure virtual

Utility method to perform any cleanup before the copy operation is executed.

◆ preCut()

static void Ufe::ClipboardHandler::preCut ( )
static

Convenience method that calls preCut_ for each clipboard handler that exists for for all the registered runtimes.

◆ preCut_()

virtual void Ufe::ClipboardHandler::preCut_ ( )
pure virtual

Utility method to perform any cleanup before the cut operation is executed.


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