diff options
Diffstat (limited to 'src/sp-item.cpp')
| -rw-r--r-- | src/sp-item.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/sp-item.cpp b/src/sp-item.cpp index f88d7b9e0..0d285c3f0 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -55,6 +55,8 @@ #include "sp-filter-reference.h" #include "filter-chemistry.h" #include "sp-guide.h" +#include "sp-title.h" +#include "sp-desc.h" #include "libnr/nr-matrix-fns.h" #include "libnr/nr-matrix-scale-ops.h" @@ -657,8 +659,32 @@ sp_item_update(SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { + SPObject *child; SPItem *item = SP_ITEM(object); + // in the case of SP_OBJECT_WRITE_BUILD, the item should always be newly created, + // so we need to add any children from the underlying object to the new repr + if (flags & SP_OBJECT_WRITE_BUILD) { + Inkscape::XML::Node *crepr; + GSList *l; + l = NULL; + for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { + if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; + crepr = child->updateRepr(xml_doc, NULL, flags); + if (crepr) l = g_slist_prepend (l, crepr); + } + while (l) { + repr->addChild((Inkscape::XML::Node *) l->data, NULL); + Inkscape::GC::release((Inkscape::XML::Node *) l->data); + l = g_slist_remove (l, l->data); + } + } else { + for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; + child->updateRepr(flags); + } + } + gchar *c = sp_svg_transform_write(item->transform); repr->setAttribute("transform", c); g_free(c); |
