Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

bool Inkscape::UI::ClipboardManagerImpl::paste ( SPDesktop desktop,
bool  in_place 
) [virtual]

Paste from the system clipboard into the active desktop.

in_placeWhether to put the contents where they were when copied

Implements Inkscape::UI::ClipboardManager.

Definition at line 305 of file clipboard.cpp.

References _getBestTarget(), _pasteDocument(), _pasteImage(), _pasteText(), _retrieveClipboard(), _userWarn(), CLIPBOARD_GDK_PIXBUF_TARGET, Inkscape::UI::View::View::doc(), Inkscape::have_viable_layer(), and Inkscape::UI::View::View::messageStack().

    // do any checking whether we really are able to paste before requesting the contents
    if ( desktop == NULL ) {
        return false;
    if ( Inkscape::have_viable_layer(desktop, desktop->messageStack()) == false ) {
        return false;

    Glib::ustring target = _getBestTarget();

    // Special cases of clipboard content handling go here
    // Note that target priority is determined in _getBestTarget.
    // TODO: Handle x-special/gnome-copied-files and text/uri-list to support pasting files

    // if there is an image on the clipboard, paste it
    if ( target == CLIPBOARD_GDK_PIXBUF_TARGET ) {
        return _pasteImage(desktop->doc());
    // if there's only text, paste it into a selected text object or create a new one
    if ( target == CLIPBOARD_TEXT_TARGET ) {
        return _pasteText(desktop);

    // otherwise, use the import extensions
    SPDocument *tempdoc = _retrieveClipboard(target);
    if ( tempdoc == NULL ) {
        _userWarn(desktop, _("Nothing on the clipboard."));
        return false;

    _pasteDocument(desktop, tempdoc, in_place);

    return true;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index