diff options
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 22 |
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++ |
