diff options
| author | Denis Declara <declara91@gmail.com> | 2012-04-15 12:29:45 +0000 |
|---|---|---|
| committer | Denis Declara <declara91@gmail.com> | 2012-04-15 12:29:45 +0000 |
| commit | 6b5ff661a46ea1779c86f6947006c5ed32926117 (patch) | |
| tree | a5b170f0830854e99ad065055ee2a3996933e614 /src/document.cpp | |
| parent | Improved User interface. (diff) | |
| parent | i18n. Fix for Bug #980518 (Please use c-format). (diff) | |
| download | inkscape-6b5ff661a46ea1779c86f6947006c5ed32926117.tar.gz inkscape-6b5ff661a46ea1779c86f6947006c5ed32926117.zip | |
Trunk merge
(bzr r11073.1.15)
Diffstat (limited to 'src/document.cpp')
| -rw-r--r-- | src/document.cpp | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/document.cpp b/src/document.cpp index b5383c91d..cc139aae0 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -37,17 +37,18 @@ #ifdef HAVE_CONFIG_H # include "config.h" #endif -#include <gtk/gtk.h> #include <string> #include <cstring> #include <2geom/transforms.h> +#include "widgets/desktop-widget.h" #include "desktop.h" #include "dir-util.h" #include "display/drawing-item.h" #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" @@ -60,7 +61,6 @@ #include "sp-object-repr.h" #include "transf_mat_3x4.h" #include "unit-constants.h" -#include "widgets/desktop-widget.h" #include "xml/repr.h" #include "xml/rebase-hrefs.h" #include "libcroco/cr-cascade.h" @@ -1429,10 +1429,31 @@ void SPDocument::setModifiedSinceSave(bool modified) { this->modified_since_save = modified; Gtk::Window *parent = SP_ACTIVE_DESKTOP->getToplevel(); g_assert(parent != NULL); - SPDesktopWidget *dtw = (SPDesktopWidget *) parent->get_data("desktopwidget"); + SPDesktopWidget *dtw = static_cast<SPDesktopWidget *>(parent->get_data("desktopwidget")); 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++ |
