diff options
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/clipboard.cpp | 21 | ||||
| -rw-r--r-- | src/ui/clipboard.h | 2 |
2 files changed, 13 insertions, 10 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 31a943365..081657cf0 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -95,7 +95,7 @@ public: virtual bool pasteSize(bool, bool, bool); virtual bool pastePathEffect(); virtual Glib::ustring getPathParameter(); - virtual Glib::ustring getPathObjectId(); + virtual Glib::ustring getShapeOrTextObjectId(); ClipboardManagerImpl(); ~ClipboardManagerImpl(); @@ -439,25 +439,28 @@ Glib::ustring ClipboardManagerImpl::getPathParameter() /** - * @brief Get path object id from the clipboard - * @return The retrieved path id string (contents of the id attribute), or "" if no path was found + * @brief Get object id of a shape or text item from the clipboard + * @return The retrieved id string (contents of the id attribute), or "" if no shape or text item was found */ -Glib::ustring ClipboardManagerImpl::getPathObjectId() +Glib::ustring ClipboardManagerImpl::getShapeOrTextObjectId() { SPDocument *tempdoc = _retrieveClipboard(); // any target will do here if ( tempdoc == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Nothing on the clipboard.")); return ""; } - Inkscape::XML::Node - *root = sp_document_repr_root(tempdoc), - *path = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth - if ( path == NULL ) { + Inkscape::XML::Node *root = sp_document_repr_root(tempdoc); + + Inkscape::XML::Node *repr = sp_repr_lookup_name(root, "svg:path", -1); // unlimited search depth + if ( repr == NULL ) + repr = sp_repr_lookup_name(root, "svg:text", -1); + + if ( repr == NULL ) { _userWarn(SP_ACTIVE_DESKTOP, _("Clipboard does not contain a path.")); sp_document_unref(tempdoc); return ""; } - gchar const *svgd = path->attribute("id"); + gchar const *svgd = repr->attribute("id"); return svgd; } diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h index bb214dbf7..609f2a93c 100644 --- a/src/ui/clipboard.h +++ b/src/ui/clipboard.h @@ -46,7 +46,7 @@ public: virtual bool pasteSize(bool separately, bool apply_x, bool apply_y) = 0; virtual bool pastePathEffect() = 0; virtual Glib::ustring getPathParameter() = 0; - virtual Glib::ustring getPathObjectId() = 0; + virtual Glib::ustring getShapeOrTextObjectId() = 0; static ClipboardManager *get(); protected: |
