From ea3737623c19fa92b97ec6c3e228ea0f8db7a03b Mon Sep 17 00:00:00 2001 From: Ben Scholzen 'DASPRiD Date: Fri, 29 May 2015 19:21:52 +0200 Subject: Import all defs from clipboard or imported files Fixed bugs: - https://launchpad.net/bugs/1460057 (bzr r14185) --- src/document.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/document.cpp') diff --git a/src/document.cpp b/src/document.cpp index 741e7c812..ebf5d312f 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -1634,11 +1634,18 @@ void SPDocument::setModifiedSinceSave(bool modified) { 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(); + std::vector defsNodes = sp_repr_lookup_name_many(root, "svg:defs"); prevent_id_clashes(source, this); + for (std::vector::iterator defs = defsNodes.begin(); defs != defsNodes.end(); ++defs) { + importDefsNode(source, const_cast(*defs), target_defs); + } +} + +void SPDocument::importDefsNode(SPDocument *source, Inkscape::XML::Node *defs, Inkscape::XML::Node *target_defs) +{ int stagger=0; /* Note, "clipboard" throughout the comments means "the document that is either the clipboard -- cgit v1.2.3