summaryrefslogtreecommitdiffstats
path: root/src/ui/clipboard.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2008-03-27 08:21:53 +0000
committerjohanengelen <johanengelen@users.sourceforge.net>2008-03-27 08:21:53 +0000
commit122389c971716a2c686bdd992e5a06aa0baff187 (patch)
tree81c735e731eb42ea123f852fc1909087684a1398 /src/ui/clipboard.cpp
parent* configure.ac: s/0.45+devel/0.46+devel/. (diff)
downloadinkscape-122389c971716a2c686bdd992e5a06aa0baff187.tar.gz
inkscape-122389c971716a2c686bdd992e5a06aa0baff187.zip
add method to lookup path object id from Clipboard
(bzr r5201)
Diffstat (limited to 'src/ui/clipboard.cpp')
-rw-r--r--src/ui/clipboard.cpp25
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)