summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 00273e0)
raw | patch | inline | side by side (parent: 00273e0)
author | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 27 Mar 2008 08:21:53 +0000 (08:21 +0000) | ||
committer | johanengelen <johanengelen@users.sourceforge.net> | |
Thu, 27 Mar 2008 08:21:53 +0000 (08:21 +0000) |
src/ui/clipboard.cpp | patch | blob | history | |
src/ui/clipboard.h | patch | blob | history |
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 0f92230542888e59b4f8ebf3a37311e8d36ad4ea..31a9433658657a2d44f392ce6333b018e97bfb5f 100644 (file)
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
virtual bool pasteSize(bool, bool, bool);
virtual bool pastePathEffect();
virtual Glib::ustring getPathParameter();
+ virtual Glib::ustring getPathObjectId();
ClipboardManagerImpl();
~ClipboardManagerImpl();
}
+/**
+ * @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.
*/
diff --git a/src/ui/clipboard.h b/src/ui/clipboard.h
index 6db6be715dac1807c88ad1133473e86063ec2991..bb214dbf7f10e210b2e117a1602340f72453cd69 100644 (file)
--- a/src/ui/clipboard.h
+++ b/src/ui/clipboard.h
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;
static ClipboardManager *get();
protected: