summaryrefslogtreecommitdiffstats
path: root/src/ui/clipboard.cpp
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2008-06-15 16:22:56 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2008-06-15 16:22:56 +0000
commit054adec9bea2b1473badbfcbb2ad0c4616269759 (patch)
treed20c43acd49c36f5399cc1ffb64ff11cff56a0e4 /src/ui/clipboard.cpp
parentExtend the .inx RELAX NG schema to allow the appearance="minimal" option that... (diff)
downloadinkscape-054adec9bea2b1473badbfcbb2ad0c4616269759.tar.gz
inkscape-054adec9bea2b1473badbfcbb2ad0c4616269759.zip
new command: relink clone to copied object
(bzr r5948)
Diffstat (limited to 'src/ui/clipboard.cpp')
-rw-r--r--src/ui/clipboard.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp
index 991a69911..8907b3b0c 100644
--- a/src/ui/clipboard.cpp
+++ b/src/ui/clipboard.cpp
@@ -95,6 +95,7 @@ public:
virtual bool pastePathEffect();
virtual Glib::ustring getPathParameter();
virtual Glib::ustring getShapeOrTextObjectId();
+ virtual const gchar *getFirstObjectID();
ClipboardManagerImpl();
~ClipboardManagerImpl();
@@ -273,6 +274,40 @@ bool ClipboardManagerImpl::paste(bool in_place)
return true;
}
+/**
+ * @brief Returns the id of the first visible copied object
+ */
+const gchar *ClipboardManagerImpl::getFirstObjectID()
+{
+ SPDocument *tempdoc = _retrieveClipboard("image/x-inkscape-svg");
+ if ( tempdoc == NULL ) {
+ return NULL;
+ }
+
+ Inkscape::XML::Node
+ *root = sp_document_repr_root(tempdoc);
+
+ if (!root)
+ return NULL;
+
+ Inkscape::XML::Node *ch = sp_repr_children(root);
+ while (ch != NULL &&
+ strcmp(ch->name(), "svg:g") &&
+ strcmp(ch->name(), "svg:path") &&
+ strcmp(ch->name(), "svg:use") &&
+ strcmp(ch->name(), "svg:text") &&
+ strcmp(ch->name(), "svg:image") &&
+ strcmp(ch->name(), "svg:rect")
+ )
+ ch = ch->next();
+
+ if (ch) {
+ return ch->attribute("id");
+ }
+
+ return NULL;
+}
+
/**
* @brief Implements the Paste Style action