diff options
Diffstat (limited to 'src/ui/clipboard.cpp')
| -rw-r--r-- | src/ui/clipboard.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index 0f9223054..31a943365 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -95,6 +95,7 @@ public: virtual bool pasteSize(bool, bool, bool); virtual bool pastePathEffect(); virtual Glib::ustring getPathParameter(); + virtual Glib::ustring getPathObjectId(); ClipboardManagerImpl(); ~ClipboardManagerImpl(); @@ -438,6 +439,30 @@ 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 + */ +Glib::ustring ClipboardManagerImpl::getPathObjectId() +{ + 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 ) { + _userWarn(SP_ACTIVE_DESKTOP, _("Clipboard does not contain a path.")); + sp_document_unref(tempdoc); + return ""; + } + gchar const *svgd = path->attribute("id"); + return svgd; +} + + +/** * @brief Iterate over a list of items and copy them to the clipboard. */ void ClipboardManagerImpl::_copySelection(Inkscape::Selection *selection) |
