summaryrefslogtreecommitdiffstats
path: root/src/document.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-04-05 05:06:43 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-04-05 05:06:43 +0000
commit9ff6ffd913086ac953e79231c2a3345f997589fe (patch)
treeca090d1c76e439a0f704de753e8789f2df071b51 /src/document.cpp
parentc++ification: GHashTable > std::map (bug #970237 ; patch by Samuel Chase + so... (diff)
downloadinkscape-9ff6ffd913086ac953e79231c2a3345f997589fe.tar.gz
inkscape-9ff6ffd913086ac953e79231c2a3345f997589fe.zip
Clipboard code cleaning (patch for bug #964852 by Romain, see devmail thread "Some clipboard functions")
(bzr r11153)
Diffstat (limited to '')
-rw-r--r--src/document.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/document.cpp b/src/document.cpp
index 18d714bad..7b68dd499 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -48,6 +48,7 @@
#include "document-private.h"
#include "document-undo.h"
#include "helper/units.h"
+#include "id-clash.h"
#include "inkscape-private.h"
#include "inkscape-version.h"
#include "libavoid/router.h"
@@ -1432,6 +1433,27 @@ void SPDocument::setModifiedSinceSave(bool modified) {
dtw->updateTitle( this->getName() );
}
+
+/**
+ * Paste SVG defs from the document retrieved from the clipboard into the active document.
+ * @param clipdoc The document to paste.
+ * @pre @c clipdoc != NULL and pasting into the active document is possible.
+ */
+void SPDocument::importDefs(SPDocument *source)
+{
+ Inkscape::XML::Node *root = source->getReprRoot();
+ Inkscape::XML::Node *defs = sp_repr_lookup_name(root, "svg:defs", 1);
+ Inkscape::XML::Node *target_defs = this->getDefs()->getRepr();
+
+ prevent_id_clashes(source, this);
+
+ for (Inkscape::XML::Node *def = defs->firstChild() ; def ; def = def->next()) {
+ Inkscape::XML::Node * dup = def->duplicate(this->getReprDoc());
+ target_defs->appendChild(dup);
+ Inkscape::GC::release(dup);
+ }
+}
+
/*
Local Variables:
mode:c++