diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index f88d7b9e04b728f2047e9f031c752c98078f7275..0d285c3f0f3c970b5b80548d4734282bf21e6df6 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
#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"
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);