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

bool Inkscape::UI::ClipboardManagerImpl::paste ( 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 297 of file clipboard.cpp.

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

    // do any checking whether we really are able to paste before requesting the contents
    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
    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();
    // if there's only text, paste it into a selected text object or create a new one
    if ( target == CLIPBOARD_TEXT_TARGET ) return _pasteText();

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

    _pasteDocument(tempdoc, in_place);

    return true;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index