summaryrefslogtreecommitdiffstats
path: root/src/sp-item.cpp
diff options
context:
space:
mode:
authorJeff Schiller <codedread@gmail.com>2008-08-23 06:13:23 +0000
committerjeff_schiller <jeff_schiller@users.sourceforge.net>2008-08-23 06:13:23 +0000
commit7dba27edc91ec41f0ab7fa30aab75c31e97a1947 (patch)
treeff29af2d0b0b053f4464a94eff8978bbdcf13dfe /src/sp-item.cpp
parentHopefully fix for the recently experienced crashes when building with -O2. I ... (diff)
downloadinkscape-7dba27edc91ec41f0ab7fa30aab75c31e97a1947.tar.gz
inkscape-7dba27edc91ec41f0ab7fa30aab75c31e97a1947.zip
Support for title and desc elements when serializing as Plain SVG.
(bzr r6709)
Diffstat (limited to 'src/sp-item.cpp')
-rw-r--r--src/sp-item.cpp26
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);