From 43d06c7da14a174c6b2b41f9849b0cf098de4770 Mon Sep 17 00:00:00 2001 From: mental Date: Wed, 11 Jun 2008 15:56:11 +0000 Subject: [PATCH] plumb XML::Documents in everywhere --- src/box3d-side.cpp | 7 ++-- src/box3d.cpp | 7 ++-- src/color-profile.cpp | 5 ++- src/color-profile.h | 2 +- src/dialogs/tiledialog.cpp | 2 +- src/extension/internal/svg.cpp | 2 +- src/gradient-chemistry.cpp | 2 +- src/knotholder.cpp | 2 +- src/live_effects/lpeobject.cpp | 7 ++-- src/main.cpp | 2 +- src/marker.cpp | 7 ++-- src/persp3d.cpp | 7 ++-- src/sp-anchor.cpp | 7 ++-- src/sp-clippath.cpp | 7 ++-- src/sp-defs.cpp | 9 +++-- src/sp-ellipse.cpp | 28 +++++++-------- src/sp-feblend.cpp | 8 ++--- src/sp-fecolormatrix.cpp | 8 ++--- src/sp-fecomponenttransfer-funcnode.cpp | 8 ++--- src/sp-fecomponenttransfer.cpp | 8 ++--- src/sp-fecomposite.cpp | 8 ++--- src/sp-feconvolvematrix.cpp | 8 ++--- src/sp-fediffuselighting.cpp | 8 ++--- src/sp-fedisplacementmap.cpp | 8 ++--- src/sp-fedistantlight.cpp | 8 ++--- src/sp-feflood.cpp | 8 ++--- src/sp-feimage.cpp | 8 ++--- src/sp-femerge.cpp | 8 ++--- src/sp-femergenode.cpp | 8 ++--- src/sp-femorphology.cpp | 8 ++--- src/sp-feoffset.cpp | 8 ++--- src/sp-fepointlight.cpp | 8 ++--- src/sp-fespecularlighting.cpp | 8 ++--- src/sp-fespotlight.cpp | 8 ++--- src/sp-fetile.cpp | 8 ++--- src/sp-feturbulence.cpp | 8 ++--- src/sp-filter-primitive.cpp | 9 +++-- src/sp-filter.cpp | 8 ++--- src/sp-flowdiv.cpp | 47 +++++++++++-------------- src/sp-flowregion.cpp | 18 +++++----- src/sp-flowtext.cpp | 9 +++-- src/sp-font-face.cpp | 7 ++-- src/sp-font.cpp | 7 ++-- src/sp-gaussian-blur.cpp | 8 ++--- src/sp-glyph-kerning.cpp | 7 ++-- src/sp-glyph.cpp | 7 ++-- src/sp-gradient.cpp | 29 +++++++-------- src/sp-image.cpp | 7 ++-- src/sp-item-group.cpp | 9 +++-- src/sp-item.cpp | 6 ++-- src/sp-line.cpp | 7 ++-- src/sp-lpe-item.cpp | 6 ++-- src/sp-mask.cpp | 7 ++-- src/sp-metadata.cpp | 8 ++--- src/sp-missing-glyph.cpp | 7 ++-- src/sp-namedview.cpp | 7 ++-- src/sp-object-group.cpp | 9 +++-- src/sp-object.cpp | 19 +++++----- src/sp-object.h | 7 ++-- src/sp-offset.cpp | 7 ++-- src/sp-path.cpp | 7 ++-- src/sp-polygon.cpp | 7 ++-- src/sp-polyline.cpp | 7 ++-- src/sp-rect.cpp | 7 ++-- src/sp-root.cpp | 7 ++-- src/sp-shape.cpp | 6 ++-- src/sp-skeleton.cpp | 8 ++--- src/sp-spiral.cpp | 7 ++-- src/sp-star.cpp | 7 ++-- src/sp-style-elem.cpp | 7 ++-- src/sp-symbol.cpp | 7 ++-- src/sp-text.cpp | 9 +++-- src/sp-tref.cpp | 7 ++-- src/sp-tspan.cpp | 30 ++++++++-------- src/sp-use.cpp | 7 ++-- src/text-editing.cpp | 4 +-- src/widgets/toolbox.cpp | 16 ++++----- 77 files changed, 313 insertions(+), 362 deletions(-) diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index fba61e129..0086d1101 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -29,7 +29,7 @@ static void box3d_side_class_init (Box3DSideClass *klass); static void box3d_side_init (Box3DSide *side); static void box3d_side_build (SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); -static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void box3d_side_set (SPObject *object, unsigned int key, const gchar *value); static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags); @@ -103,14 +103,13 @@ box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node } static Inkscape::XML::Node * -box3d_side_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +box3d_side_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { Box3DSide *side = SP_BOX3D_SIDE (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { // this is where we end up when saving as plain SVG (also in other circumstances?) // thus we don' set "sodipodi:type" so that the box is only saved as an ordinary svg:path - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -131,7 +130,7 @@ box3d_side_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) g_free (d); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/box3d.cpp b/src/box3d.cpp index db06359ec..f4921bc1a 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -47,7 +47,7 @@ static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::N static void box3d_release(SPObject *object); static void box3d_set(SPObject *object, unsigned int key, const gchar *value); static void box3d_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *box3d_description(SPItem *item); static NR::Matrix box3d_set_transform(SPItem *item, NR::Matrix const &xform); @@ -256,14 +256,13 @@ box3d_update(SPObject *object, SPCtx *ctx, guint flags) } -static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPBox3D *box = SP_BOX3D(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { // this is where we end up when saving as plain SVG (also in other circumstances?) // thus we don' set "sodipodi:type" so that the box is only saved as an ordinary svg:g - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:g"); } @@ -302,7 +301,7 @@ static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Node *r } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/color-profile.cpp b/src/color-profile.cpp index 6f7869990..876280f29 100644 --- a/src/color-profile.cpp +++ b/src/color-profile.cpp @@ -342,12 +342,11 @@ void ColorProfile::set( SPObject *object, unsigned key, gchar const *value ) /** * Callback: write attributes to associated repr. */ -Inkscape::XML::Node* ColorProfile::write( SPObject *object, Inkscape::XML::Node *repr, guint flags ) +Inkscape::XML::Node* ColorProfile::write( SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags ) { ColorProfile *cprof = COLORPROFILE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:color-profile"); } @@ -368,7 +367,7 @@ Inkscape::XML::Node* ColorProfile::write( SPObject *object, Inkscape::XML::Node } if (cprof_parent_class->write) { - (* cprof_parent_class->write)(object, repr, flags); + (* cprof_parent_class->write)(object, xml_doc, repr, flags); } return repr; diff --git a/src/color-profile.h b/src/color-profile.h index 03b7e072b..7fbc7812e 100644 --- a/src/color-profile.h +++ b/src/color-profile.h @@ -56,7 +56,7 @@ private: static void release( SPObject *object ); static void build( SPObject *object, SPDocument *document, Inkscape::XML::Node *repr ); static void set( SPObject *object, unsigned key, gchar const *value ); - static Inkscape::XML::Node *write( SPObject *object, Inkscape::XML::Node *repr, guint flags ); + static Inkscape::XML::Node *write( SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags ); #if ENABLE_LCMS static DWORD _getInputFormat( icColorSpaceSignature space ); void _clearProfile(); diff --git a/src/dialogs/tiledialog.cpp b/src/dialogs/tiledialog.cpp index e851ed8ed..289d42c80 100644 --- a/src/dialogs/tiledialog.cpp +++ b/src/dialogs/tiledialog.cpp @@ -340,7 +340,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h NR::Matrix const &affine = NR::Matrix(NR::translate(move)); sp_item_set_i2d_affine(item, sp_item_i2d_affine(item) * affine); sp_item_write_transform(item, repr, item->transform, NULL); - SP_OBJECT (current_row->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT (current_row->data)->updateRepr(); cnt +=1; } g_slist_free (current_row); diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp index 19d770af0..5afb62d25 100644 --- a/src/extension/internal/svg.cpp +++ b/src/extension/internal/svg.cpp @@ -209,7 +209,7 @@ Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri) } else { rdoc = sp_repr_document_new ("svg:svg"); repr = rdoc->root(); - repr = sp_document_root (doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD); + repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); } Inkscape::IO::fixupHrefs( doc, save_path, spns ); diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 303db8849..3e6a70174 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -75,7 +75,7 @@ sp_gradient_ensure_vector_normalized(SPGradient *gr) /* If gr hrefs some other gradient, remove the href */ if (gr->ref->getObject()) { /* We are hrefing someone, so require flattening */ - SP_OBJECT(gr)->updateRepr(((SPObject *) gr)->repr, SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL); + SP_OBJECT(gr)->updateRepr(SP_OBJECT_WRITE_EXT | SP_OBJECT_WRITE_ALL); sp_gradient_repr_set_link(SP_OBJECT_REPR(gr), NULL); } diff --git a/src/knotholder.cpp b/src/knotholder.cpp index f78198275..781d5a3bc 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -161,7 +161,7 @@ KnotHolder::knot_ungrabbed_handler(SPKnot *knot) this->released(this->item); } else { SPObject *object = (SPObject *) this->item; - object->updateRepr(object->repr, SP_OBJECT_WRITE_EXT); + object->updateRepr(); /* do cleanup tasks (e.g., for LPE items write the parameter values * that were changed by dragging the handle to SVG) diff --git a/src/live_effects/lpeobject.cpp b/src/live_effects/lpeobject.cpp index 432a484ee..a73f9ccd6 100644 --- a/src/live_effects/lpeobject.cpp +++ b/src/live_effects/lpeobject.cpp @@ -28,7 +28,7 @@ static void livepatheffect_build(SPObject *object, SPDocument *document, Inkscap static void livepatheffect_release(SPObject *object); static void livepatheffect_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *livepatheffect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *livepatheffect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void livepatheffect_on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data); @@ -203,7 +203,7 @@ livepatheffect_set(SPObject *object, unsigned key, gchar const *value) * Virtual write: write object attributes to repr. */ static Inkscape::XML::Node * -livepatheffect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +livepatheffect_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { #ifdef LIVEPATHEFFECT_VERBOSE g_print("Write livepatheffect"); @@ -212,7 +212,6 @@ livepatheffect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) LivePathEffectObject *lpeobj = LIVEPATHEFFECT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("inkscape:path-effect"); } @@ -224,7 +223,7 @@ livepatheffect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) lpeobj->lpe->writeParamsToSVG(); if (((SPObjectClass *) livepatheffect_parent_class)->write) - (* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) livepatheffect_parent_class)->write)(object, xml_doc, repr, flags); return repr; } diff --git a/src/main.cpp b/src/main.cpp index 83170931f..6eae51c0c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -861,7 +861,7 @@ sp_main_console(int argc, char const **argv) Inkscape::XML::Node *repr; rdoc = sp_repr_document_new("svg:svg"); repr = rdoc->root(); - repr = sp_document_root(doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD); + repr = sp_document_root(doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD); sp_repr_save_file(repr->document(), sp_export_svg, SP_SVG_NS_URI); } if (sp_export_ps) { diff --git a/src/marker.cpp b/src/marker.cpp index aacbee875..5d2b501f5 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -46,7 +46,7 @@ static void sp_marker_build (SPObject *object, SPDocument *document, Inkscape::X static void sp_marker_release (SPObject *object); static void sp_marker_set (SPObject *object, unsigned int key, const gchar *value); static void sp_marker_update (SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_marker_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_marker_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static NRArenaItem *sp_marker_private_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags); static void sp_marker_private_hide (SPItem *item, unsigned int key); @@ -489,14 +489,13 @@ sp_marker_update (SPObject *object, SPCtx *ctx, guint flags) * Writes the object's properties into its repr object. */ static Inkscape::XML::Node * -sp_marker_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_marker_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPMarker *marker; marker = SP_MARKER (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:marker"); } @@ -543,7 +542,7 @@ sp_marker_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/persp3d.cpp b/src/persp3d.cpp index a2da34e7a..4c2c620be 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -30,7 +30,7 @@ static void persp3d_build(SPObject *object, SPDocument *document, Inkscape::XML: static void persp3d_release(SPObject *object); static void persp3d_set(SPObject *object, unsigned key, gchar const *value); static void persp3d_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *persp3d_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *persp3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void persp3d_on_repr_attr_changed (Inkscape::XML::Node * repr, const gchar *key, const gchar *oldval, const gchar *newval, bool is_interactive, void * data); @@ -256,14 +256,13 @@ persp3d_document_first_persp (SPDocument *document) { * Virtual write: write object attributes to repr. */ static Inkscape::XML::Node * -persp3d_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +persp3d_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { Persp3D *persp = SP_PERSP3D(object); if ((flags & SP_OBJECT_WRITE_BUILD & SP_OBJECT_WRITE_EXT) && !repr) { // this is where we end up when saving as plain SVG (also in other circumstances?); // hence we don't set the sodipodi:type attribute - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("inkscape:perspective"); } @@ -283,7 +282,7 @@ persp3d_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) persp3d_parent_class)->write) - (* ((SPObjectClass *) persp3d_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) persp3d_parent_class)->write)(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp index e16836957..aabefdfdb 100644 --- a/src/sp-anchor.cpp +++ b/src/sp-anchor.cpp @@ -32,7 +32,7 @@ static void sp_anchor_init(SPAnchor *anchor); static void sp_anchor_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_anchor_release(SPObject *object); static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_anchor_description(SPItem *item); static gint sp_anchor_event(SPItem *item, SPEvent *event); @@ -143,12 +143,11 @@ static void sp_anchor_set(SPObject *object, unsigned int key, const gchar *value #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPAnchor *anchor = SP_ANCHOR(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:a"); } @@ -165,7 +164,7 @@ static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Nod } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index 7a0d3ed5b..f56564cbe 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -45,7 +45,7 @@ static void sp_clippath_set(SPObject *object, unsigned int key, gchar const *val static void sp_clippath_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_clippath_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_clippath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); SPClipPathView *sp_clippath_view_new_prepend(SPClipPathView *list, unsigned int key, NRArenaItem *arenaitem); SPClipPathView *sp_clippath_view_list_remove(SPClipPathView *list, SPClipPathView *view); @@ -242,15 +242,14 @@ sp_clippath_modified(SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_clippath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_clippath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:clipPath"); } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp index 35324c62f..aa0cb0be7 100644 --- a/src/sp-defs.cpp +++ b/src/sp-defs.cpp @@ -26,7 +26,7 @@ static void sp_defs_init(SPDefs *defs); static void sp_defs_release(SPObject *object); static void sp_defs_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_defs_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *parent_class; @@ -121,18 +121,17 @@ static void sp_defs_modified(SPObject *object, guint flags) } } -static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { if (!repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:defs"); } GSList *l = NULL; for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { - Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags); + Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } @@ -149,7 +148,7 @@ static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Node } if (((SPObjectClass *) (parent_class))->write) { - (* ((SPObjectClass *) (parent_class))->write)(object, repr, flags); + (* ((SPObjectClass *) (parent_class))->write)(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-ellipse.cpp b/src/sp-ellipse.cpp index 4b68a2ca6..d2750b765 100644 --- a/src/sp-ellipse.cpp +++ b/src/sp-ellipse.cpp @@ -78,7 +78,7 @@ static void sp_genericellipse_snappoints(SPItem const *item, SnapPointsIter p); static void sp_genericellipse_set_shape(SPShape *shape); static void sp_genericellipse_update_patheffect (SPLPEItem *lpeitem, bool write); -static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Node *repr, +static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gboolean sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr); @@ -342,13 +342,12 @@ sp_genericellipse_normalize(SPGenericEllipse *ellipse) /* Now we keep: 0 <= start < end <= 2*PI */ } -static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse = SP_GENERICELLIPSE(object); if (flags & SP_OBJECT_WRITE_EXT) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -362,7 +361,7 @@ static Inkscape::XML::Node *sp_genericellipse_write(SPObject *object, Inkscape:: } if (((SPObjectClass *) ge_parent_class)->write) - ((SPObjectClass *) ge_parent_class)->write(object, repr, flags); + ((SPObjectClass *) ge_parent_class)->write(object, xml_doc, repr, flags); return repr; } @@ -373,7 +372,7 @@ static void sp_ellipse_class_init(SPEllipseClass *klass); static void sp_ellipse_init(SPEllipse *ellipse); static void sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); -static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_ellipse_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_ellipse_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_ellipse_description(SPItem *item); @@ -434,14 +433,13 @@ sp_ellipse_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *re } static Inkscape::XML::Node * -sp_ellipse_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_ellipse_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse; ellipse = SP_GENERICELLIPSE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:ellipse"); } @@ -451,7 +449,7 @@ sp_ellipse_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_svg_double(repr, "ry", ellipse->ry.computed); if (((SPObjectClass *) ellipse_parent_class)->write) - (* ((SPObjectClass *) ellipse_parent_class)->write) (object, repr, flags); + (* ((SPObjectClass *) ellipse_parent_class)->write) (object, xml_doc, repr, flags); return repr; } @@ -521,7 +519,7 @@ static void sp_circle_class_init(SPCircleClass *klass); static void sp_circle_init(SPCircle *circle); static void sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); -static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_circle_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_circle_set(SPObject *object, unsigned int key, gchar const *value); static gchar *sp_circle_description(SPItem *item); @@ -582,14 +580,13 @@ sp_circle_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep } static Inkscape::XML::Node * -sp_circle_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_circle_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ellipse; ellipse = SP_GENERICELLIPSE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:circle"); } @@ -598,7 +595,7 @@ sp_circle_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_svg_double(repr, "r", ellipse->rx.computed); if (((SPObjectClass *) circle_parent_class)->write) - ((SPObjectClass *) circle_parent_class)->write(object, repr, flags); + ((SPObjectClass *) circle_parent_class)->write(object, xml_doc, repr, flags); return repr; } @@ -644,7 +641,7 @@ static void sp_arc_class_init(SPArcClass *klass); static void sp_arc_init(SPArc *arc); static void sp_arc_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); -static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_arc_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_arc_set(SPObject *object, unsigned int key, gchar const *value); static void sp_arc_modified(SPObject *object, guint flags); @@ -757,13 +754,12 @@ sp_arc_set_elliptical_path_attribute(SPArc *arc, Inkscape::XML::Node *repr) } static Inkscape::XML::Node * -sp_arc_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_arc_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGenericEllipse *ge = SP_GENERICELLIPSE(object); SPArc *arc = SP_ARC(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -792,7 +788,7 @@ sp_arc_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_arc_set_elliptical_path_attribute(arc, repr); if (((SPObjectClass *) arc_parent_class)->write) - ((SPObjectClass *) arc_parent_class)->write(object, repr, flags); + ((SPObjectClass *) arc_parent_class)->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-feblend.cpp b/src/sp-feblend.cpp index 1c560e81b..0522a38e3 100644 --- a/src/sp-feblend.cpp +++ b/src/sp-feblend.cpp @@ -39,7 +39,7 @@ static void sp_feBlend_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feBlend_release(SPObject *object); static void sp_feBlend_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feBlend_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feBlend_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feBlend_build_renderer(SPFilterPrimitive *sp_prim, NR::Filter *filter); static SPFilterPrimitiveClass *feBlend_parent_class; @@ -201,7 +201,7 @@ sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feBlend_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feBlend_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -209,12 +209,12 @@ sp_feBlend_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? // repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feBlend_parent_class)->write) { - ((SPObjectClass *) feBlend_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feBlend_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fecolormatrix.cpp b/src/sp-fecolormatrix.cpp index 4f4ca5f37..181b7cd03 100644 --- a/src/sp-fecolormatrix.cpp +++ b/src/sp-fecolormatrix.cpp @@ -38,7 +38,7 @@ static void sp_feColorMatrix_build(SPObject *object, SPDocument *document, Inksc static void sp_feColorMatrix_release(SPObject *object); static void sp_feColorMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feColorMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feColorMatrix_parent_class; @@ -186,7 +186,7 @@ sp_feColorMatrix_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -194,12 +194,12 @@ sp_feColorMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feColorMatrix_parent_class)->write) { - ((SPObjectClass *) feColorMatrix_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feColorMatrix_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fecomponenttransfer-funcnode.cpp b/src/sp-fecomponenttransfer-funcnode.cpp index 8b506a45e..91194a31a 100644 --- a/src/sp-fecomponenttransfer-funcnode.cpp +++ b/src/sp-fecomponenttransfer-funcnode.cpp @@ -40,7 +40,7 @@ static void sp_fefuncnode_build(SPObject *object, SPDocument *document, Inkscape static void sp_fefuncnode_release(SPObject *object); static void sp_fefuncnode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fefuncnode_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_fefuncnode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_fefuncnode_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *feFuncNode_parent_class; @@ -309,12 +309,12 @@ sp_fefuncnode_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_fefuncnode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_fefuncnode_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFeFuncNode *fefuncnode = SP_FEFUNCNODE(object); if (!repr) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } (void)fefuncnode; @@ -327,7 +327,7 @@ TODO: I'm not sure what to do here... sp_repr_set_css_double(repr, "elevation", fefuncnode->elevation);*/ if (((SPObjectClass *) feFuncNode_parent_class)->write) { - ((SPObjectClass *) feFuncNode_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feFuncNode_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fecomponenttransfer.cpp b/src/sp-fecomponenttransfer.cpp index d8ee639e4..e11f5ab3f 100644 --- a/src/sp-fecomponenttransfer.cpp +++ b/src/sp-fecomponenttransfer.cpp @@ -39,7 +39,7 @@ static void sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint fl static void sp_feComponentTransfer_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static void sp_feComponentTransfer_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feComponentTransfer_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); -static Inkscape::XML::Node *sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPFilterPrimitiveClass *feComponentTransfer_parent_class; GType @@ -208,7 +208,7 @@ sp_feComponentTransfer_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -216,12 +216,12 @@ sp_feComponentTransfer_write(SPObject *object, Inkscape::XML::Node *repr, guint // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feComponentTransfer_parent_class)->write) { - ((SPObjectClass *) feComponentTransfer_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feComponentTransfer_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fecomposite.cpp b/src/sp-fecomposite.cpp index cb1726be7..11d101bd6 100644 --- a/src/sp-fecomposite.cpp +++ b/src/sp-fecomposite.cpp @@ -33,7 +33,7 @@ static void sp_feComposite_build(SPObject *object, SPDocument *document, Inkscap static void sp_feComposite_release(SPObject *object); static void sp_feComposite_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feComposite_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feComposite_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feComposite_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feComposite_parent_class; @@ -230,7 +230,7 @@ sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feComposite_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feComposite_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -238,12 +238,12 @@ sp_feComposite_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feComposite_parent_class)->write) { - ((SPObjectClass *) feComposite_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feComposite_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-feconvolvematrix.cpp b/src/sp-feconvolvematrix.cpp index cc9073407..816c793e1 100644 --- a/src/sp-feconvolvematrix.cpp +++ b/src/sp-feconvolvematrix.cpp @@ -38,7 +38,7 @@ static void sp_feConvolveMatrix_build(SPObject *object, SPDocument *document, In static void sp_feConvolveMatrix_release(SPObject *object); static void sp_feConvolveMatrix_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feConvolveMatrix_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feConvolveMatrix_parent_class; @@ -284,7 +284,7 @@ sp_feConvolveMatrix_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -292,12 +292,12 @@ sp_feConvolveMatrix_write(SPObject *object, Inkscape::XML::Node *repr, guint fla // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feConvolveMatrix_parent_class)->write) { - ((SPObjectClass *) feConvolveMatrix_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feConvolveMatrix_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fediffuselighting.cpp b/src/sp-fediffuselighting.cpp index a44ac5894..96dee569b 100644 --- a/src/sp-fediffuselighting.cpp +++ b/src/sp-fediffuselighting.cpp @@ -45,7 +45,7 @@ static void sp_feDiffuseLighting_child_added(SPObject *object, Inkscape::XML::Node *ref); static void sp_feDiffuseLighting_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feDiffuseLighting_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); -static Inkscape::XML::Node *sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feDiffuseLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static void sp_feDiffuseLighting_children_modified(SPFeDiffuseLighting *sp_diffuselighting); @@ -239,7 +239,7 @@ sp_feDiffuseLighting_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFeDiffuseLighting *fediffuselighting = SP_FEDIFFUSELIGHTING(object); @@ -249,7 +249,7 @@ sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint fl // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } @@ -270,7 +270,7 @@ sp_feDiffuseLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint fl repr->setAttribute("lighting-color", NULL); if (((SPObjectClass *) feDiffuseLighting_parent_class)->write) { - ((SPObjectClass *) feDiffuseLighting_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feDiffuseLighting_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fedisplacementmap.cpp b/src/sp-fedisplacementmap.cpp index b53238093..a30dd2f9b 100644 --- a/src/sp-fedisplacementmap.cpp +++ b/src/sp-fedisplacementmap.cpp @@ -34,7 +34,7 @@ static void sp_feDisplacementMap_release(SPObject *object); static void sp_feDisplacementMap_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_feDisplacementMap_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); -static Inkscape::XML::Node *sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPFilterPrimitiveClass *feDisplacementMap_parent_class; @@ -208,7 +208,7 @@ sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -216,12 +216,12 @@ sp_feDisplacementMap_write(SPObject *object, Inkscape::XML::Node *repr, guint fl // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feDisplacementMap_parent_class)->write) { - ((SPObjectClass *) feDisplacementMap_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feDisplacementMap_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fedistantlight.cpp b/src/sp-fedistantlight.cpp index 7125b50ab..3ac3a5016 100644 --- a/src/sp-fedistantlight.cpp +++ b/src/sp-fedistantlight.cpp @@ -39,7 +39,7 @@ static void sp_fedistantlight_build(SPObject *object, SPDocument *document, Inks static void sp_fedistantlight_release(SPObject *object); static void sp_fedistantlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fedistantlight_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_fedistantlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_fedistantlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *feDistantLight_parent_class; @@ -202,12 +202,12 @@ sp_fedistantlight_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_fedistantlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_fedistantlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFeDistantLight *fedistantlight = SP_FEDISTANTLIGHT(object); if (!repr) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } if (fedistantlight->azimuth_set) @@ -216,7 +216,7 @@ sp_fedistantlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags sp_repr_set_css_double(repr, "elevation", fedistantlight->elevation); if (((SPObjectClass *) feDistantLight_parent_class)->write) { - ((SPObjectClass *) feDistantLight_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feDistantLight_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-feflood.cpp b/src/sp-feflood.cpp index 685859c63..75cc37734 100644 --- a/src/sp-feflood.cpp +++ b/src/sp-feflood.cpp @@ -33,7 +33,7 @@ static void sp_feFlood_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feFlood_release(SPObject *object); static void sp_feFlood_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feFlood_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feFlood_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feFlood_parent_class; @@ -166,7 +166,7 @@ sp_feFlood_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feFlood_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feFlood_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -174,12 +174,12 @@ sp_feFlood_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feFlood_parent_class)->write) { - ((SPObjectClass *) feFlood_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feFlood_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-feimage.cpp b/src/sp-feimage.cpp index 2628d397c..117e9ffca 100644 --- a/src/sp-feimage.cpp +++ b/src/sp-feimage.cpp @@ -38,7 +38,7 @@ static void sp_feImage_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feImage_release(SPObject *object); static void sp_feImage_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feImage_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feImage_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feImage_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feImage_parent_class; @@ -213,7 +213,7 @@ sp_feImage_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feImage_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feImage_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -221,12 +221,12 @@ sp_feImage_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feImage_parent_class)->write) { - ((SPObjectClass *) feImage_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feImage_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-femerge.cpp b/src/sp-femerge.cpp index 3cf5ea312..9e45d44ab 100644 --- a/src/sp-femerge.cpp +++ b/src/sp-femerge.cpp @@ -34,7 +34,7 @@ static void sp_feMerge_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feMerge_release(SPObject *object); static void sp_feMerge_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feMerge_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feMerge_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feMerge_parent_class; @@ -145,7 +145,7 @@ sp_feMerge_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feMerge_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -153,12 +153,12 @@ sp_feMerge_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feMerge_parent_class)->write) { - ((SPObjectClass *) feMerge_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feMerge_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-femergenode.cpp b/src/sp-femergenode.cpp index b886295a8..153a61988 100644 --- a/src/sp-femergenode.cpp +++ b/src/sp-femergenode.cpp @@ -30,7 +30,7 @@ static void sp_feMergeNode_build(SPObject *object, SPDocument *document, Inkscap static void sp_feMergeNode_release(SPObject *object); static void sp_feMergeNode_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMergeNode_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feMergeNode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feMergeNode_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *feMergeNode_parent_class; @@ -143,7 +143,7 @@ sp_feMergeNode_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feMergeNode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feMergeNode_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { //SPFeMergeNode *feMergeNode = SP_FEMERGENODE(object); @@ -153,12 +153,12 @@ sp_feMergeNode_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feMergeNode_parent_class)->write) { - ((SPObjectClass *) feMergeNode_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feMergeNode_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-femorphology.cpp b/src/sp-femorphology.cpp index 33ab62621..01290391f 100644 --- a/src/sp-femorphology.cpp +++ b/src/sp-femorphology.cpp @@ -35,7 +35,7 @@ static void sp_feMorphology_build(SPObject *object, SPDocument *document, Inksca static void sp_feMorphology_release(SPObject *object); static void sp_feMorphology_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feMorphology_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feMorphology_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feMorphology_parent_class; @@ -180,7 +180,7 @@ sp_feMorphology_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feMorphology_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -188,12 +188,12 @@ sp_feMorphology_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feMorphology_parent_class)->write) { - ((SPObjectClass *) feMorphology_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feMorphology_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-feoffset.cpp b/src/sp-feoffset.cpp index 67a8b99e2..228424c70 100644 --- a/src/sp-feoffset.cpp +++ b/src/sp-feoffset.cpp @@ -34,7 +34,7 @@ static void sp_feOffset_build(SPObject *object, SPDocument *document, Inkscape:: static void sp_feOffset_release(SPObject *object); static void sp_feOffset_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feOffset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feOffset_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feOffset_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feOffset_parent_class; @@ -164,7 +164,7 @@ sp_feOffset_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feOffset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feOffset_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -173,12 +173,12 @@ sp_feOffset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // Not. Causes coredumps. // repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feOffset_parent_class)->write) { - ((SPObjectClass *) feOffset_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feOffset_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fepointlight.cpp b/src/sp-fepointlight.cpp index 211fb726b..5317b96fc 100644 --- a/src/sp-fepointlight.cpp +++ b/src/sp-fepointlight.cpp @@ -39,7 +39,7 @@ static void sp_fepointlight_build(SPObject *object, SPDocument *document, Inksca static void sp_fepointlight_release(SPObject *object); static void sp_fepointlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fepointlight_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_fepointlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_fepointlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *fePointLight_parent_class; @@ -225,12 +225,12 @@ sp_fepointlight_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_fepointlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_fepointlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFePointLight *fepointlight = SP_FEPOINTLIGHT(object); if (!repr) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } if (fepointlight->x_set) @@ -241,7 +241,7 @@ sp_fepointlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_css_double(repr, "z", fepointlight->z); if (((SPObjectClass *) fePointLight_parent_class)->write) { - ((SPObjectClass *) fePointLight_parent_class)->write(object, repr, flags); + ((SPObjectClass *) fePointLight_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fespecularlighting.cpp b/src/sp-fespecularlighting.cpp index 3a21d9844..c4e2902d6 100644 --- a/src/sp-fespecularlighting.cpp +++ b/src/sp-fespecularlighting.cpp @@ -45,7 +45,7 @@ static void sp_feSpecularLighting_child_added(SPObject *object, Inkscape::XML::Node *ref); static void sp_feSpecularLighting_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_feSpecularLighting_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref); -static Inkscape::XML::Node *sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feSpecularLighting_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static void sp_feSpecularLighting_children_modified(SPFeSpecularLighting *sp_specularlighting); @@ -266,7 +266,7 @@ sp_feSpecularLighting_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFeSpecularLighting *fespecularlighting = SP_FESPECULARLIGHTING(object); @@ -276,7 +276,7 @@ sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint f // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (fespecularlighting->surfaceScale_set) @@ -292,7 +292,7 @@ sp_feSpecularLighting_write(SPObject *object, Inkscape::XML::Node *repr, guint f repr->setAttribute("lighting-color", c); } if (((SPObjectClass *) feSpecularLighting_parent_class)->write) { - ((SPObjectClass *) feSpecularLighting_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feSpecularLighting_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fespotlight.cpp b/src/sp-fespotlight.cpp index e45b123ed..b66912468 100644 --- a/src/sp-fespotlight.cpp +++ b/src/sp-fespotlight.cpp @@ -39,7 +39,7 @@ static void sp_fespotlight_build(SPObject *object, SPDocument *document, Inkscap static void sp_fespotlight_release(SPObject *object); static void sp_fespotlight_set(SPObject *object, unsigned int key, gchar const *value); static void sp_fespotlight_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_fespotlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_fespotlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *feSpotLight_parent_class; @@ -328,12 +328,12 @@ sp_fespotlight_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_fespotlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_fespotlight_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFeSpotLight *fespotlight = SP_FESPOTLIGHT(object); if (!repr) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } if (fespotlight->x_set) @@ -354,7 +354,7 @@ sp_fespotlight_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_css_double(repr, "limitingConeAngle", fespotlight->limitingConeAngle); if (((SPObjectClass *) feSpotLight_parent_class)->write) { - ((SPObjectClass *) feSpotLight_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feSpotLight_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-fetile.cpp b/src/sp-fetile.cpp index 61cb68bda..598ccdb84 100644 --- a/src/sp-fetile.cpp +++ b/src/sp-fetile.cpp @@ -32,7 +32,7 @@ static void sp_feTile_build(SPObject *object, SPDocument *document, Inkscape::XM static void sp_feTile_release(SPObject *object); static void sp_feTile_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feTile_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feTile_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feTile_parent_class; @@ -145,7 +145,7 @@ sp_feTile_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feTile_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -153,12 +153,12 @@ sp_feTile_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feTile_parent_class)->write) { - ((SPObjectClass *) feTile_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feTile_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-feturbulence.cpp b/src/sp-feturbulence.cpp index 5d351884c..fcaf6c56f 100644 --- a/src/sp-feturbulence.cpp +++ b/src/sp-feturbulence.cpp @@ -38,7 +38,7 @@ static void sp_feTurbulence_build(SPObject *object, SPDocument *document, Inksca static void sp_feTurbulence_release(SPObject *object); static void sp_feTurbulence_set(SPObject *object, unsigned int key, gchar const *value); static void sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_feTurbulence_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_feTurbulence_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *feTurbulence_parent_class; @@ -230,7 +230,7 @@ sp_feTurbulence_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_feTurbulence_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_feTurbulence_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: if (flags & SP_OBJECT_WRITE_EXT) { @@ -238,12 +238,12 @@ sp_feTurbulence_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) feTurbulence_parent_class)->write) { - ((SPObjectClass *) feTurbulence_parent_class)->write(object, repr, flags); + ((SPObjectClass *) feTurbulence_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index 39661788e..ccde93889 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -36,7 +36,7 @@ static void sp_filter_primitive_build(SPObject *object, SPDocument *document, In static void sp_filter_primitive_release(SPObject *object); static void sp_filter_primitive_set(SPObject *object, unsigned int key, gchar const *value); static void sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_filter_primitive_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_filter_primitive_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *filter_primitive_parent_class; @@ -177,7 +177,7 @@ sp_filter_primitive_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_filter_primitive_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_filter_primitive_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { //SPFilterPrimitive *filterPrimitive = SP_FILTER_PRIMITIVE(object); @@ -187,13 +187,12 @@ sp_filter_primitive_write(SPObject *object, Inkscape::XML::Node *repr, guint fla // is this sane? //repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - /// \todo FIXME: Plumb an appropriate XML::Document into this - repr = SP_OBJECT_REPR(object)->duplicate(NULL); + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) filter_primitive_parent_class)->write) { - ((SPObjectClass *) filter_primitive_parent_class)->write(object, repr, flags); + ((SPObjectClass *) filter_primitive_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index b76bc553b..e075087d3 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -51,7 +51,7 @@ static void sp_filter_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_filter_remove_child(SPObject *object, Inkscape::XML::Node *child); -static Inkscape::XML::Node *sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void filter_ref_changed(SPObject *old_ref, SPObject *ref, SPFilter *filter); static void filter_ref_modified(SPObject *href, guint flags, SPFilter *filter); @@ -281,12 +281,12 @@ sp_filter_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { SPFilter *filter = SP_FILTER(object); if (!repr) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } if ((flags & SP_OBJECT_WRITE_ALL) || filter->filterUnits_set) { @@ -350,7 +350,7 @@ sp_filter_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) filter_parent_class)->write) { - ((SPObjectClass *) filter_parent_class)->write(object, repr, flags); + ((SPObjectClass *) filter_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 308831d28..6d679701f 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -20,7 +20,7 @@ static void sp_flowdiv_class_init (SPFlowdivClass *klass); static void sp_flowdiv_init (SPFlowdiv *group); static void sp_flowdiv_release (SPObject *object); -static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowdiv_modified (SPObject *object, guint flags); static void sp_flowdiv_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); @@ -29,7 +29,7 @@ static void sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *val static void sp_flowtspan_class_init (SPFlowtspanClass *klass); static void sp_flowtspan_init (SPFlowtspan *group); static void sp_flowtspan_release (SPObject *object); -static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowtspan_modified (SPObject *object, guint flags); static void sp_flowtspan_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); @@ -38,7 +38,7 @@ static void sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *v static void sp_flowpara_class_init (SPFlowparaClass *klass); static void sp_flowpara_init (SPFlowpara *group); static void sp_flowpara_release (SPObject *object); -static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowpara_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_flowpara_modified (SPObject *object, guint flags); static void sp_flowpara_build (SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); @@ -47,13 +47,13 @@ static void sp_flowpara_set (SPObject *object, unsigned int key, const gchar *va static void sp_flowline_class_init (SPFlowlineClass *klass); static void sp_flowline_release (SPObject *object); static void sp_flowline_init (SPFlowline *group); -static Inkscape::XML::Node *sp_flowline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowline_modified (SPObject *object, guint flags); static void sp_flowregionbreak_class_init (SPFlowregionbreakClass *klass); static void sp_flowregionbreak_release (SPObject *object); static void sp_flowregionbreak_init (SPFlowregionbreak *group); -static Inkscape::XML::Node *sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowregionbreak_modified (SPObject *object, guint flags); static SPItemClass * flowdiv_parent_class; @@ -193,20 +193,19 @@ sp_flowdiv_set (SPObject *object, unsigned int key, const gchar *value) } static Inkscape::XML::Node * -sp_flowdiv_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { // SPFlowdiv *group = SP_FLOWDIV (object); if ( flags&SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowDiv"); GSList *l = NULL; for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA(child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } @@ -230,7 +229,7 @@ sp_flowdiv_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (flowdiv_parent_class))->write) - ((SPObjectClass *) (flowdiv_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowdiv_parent_class))->write (object, xml_doc, repr, flags); return repr; } @@ -367,18 +366,17 @@ sp_flowtspan_set (SPObject *object, unsigned int key, const gchar *value) (((SPObjectClass *) flowtspan_parent_class)->set) (object, key, value); } static Inkscape::XML::Node * -sp_flowtspan_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowSpan"); GSList *l = NULL; for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA (child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } @@ -402,7 +400,7 @@ sp_flowtspan_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (flowtspan_parent_class))->write) - ((SPObjectClass *) (flowtspan_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowtspan_parent_class))->write (object, xml_doc, repr, flags); return repr; } @@ -539,20 +537,19 @@ sp_flowpara_set (SPObject *object, unsigned int key, const gchar *value) (((SPObjectClass *) flowpara_parent_class)->set) (object, key, value); } static Inkscape::XML::Node * -sp_flowpara_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowpara_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { // SPFlowpara *group = SP_FLOWPARA (object); if ( flags&SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara"); GSList *l = NULL; for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_FLOWPARA (child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } @@ -576,7 +573,7 @@ sp_flowpara_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (flowpara_parent_class))->write) - ((SPObjectClass *) (flowpara_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowpara_parent_class))->write (object, xml_doc, repr, flags); return repr; } @@ -644,16 +641,15 @@ sp_flowline_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; } static Inkscape::XML::Node * -sp_flowline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowline_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowLine"); } else { } if (((SPObjectClass *) (flowline_parent_class))->write) - ((SPObjectClass *) (flowline_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowline_parent_class))->write (object, xml_doc, repr, flags); return repr; } @@ -721,16 +717,15 @@ sp_flowregionbreak_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; } static Inkscape::XML::Node * -sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowregionbreak_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags&SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowLine"); } else { } if (((SPObjectClass *) (flowregionbreak_parent_class))->write) - ((SPObjectClass *) (flowregionbreak_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowregionbreak_parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index b989b52fb..3a6cdeee3 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -32,7 +32,7 @@ static void sp_flowregion_child_added (SPObject * object, Inkscape::XML::Node * static void sp_flowregion_remove_child (SPObject * object, Inkscape::XML::Node * child); static void sp_flowregion_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_flowregion_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowregion_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar * sp_flowregion_description (SPItem * item); @@ -46,7 +46,7 @@ static void sp_flowregionexclude_child_added (SPObject * object, Inkscape::XML:: static void sp_flowregionexclude_remove_child (SPObject * object, Inkscape::XML::Node * child); static void sp_flowregionexclude_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_flowregionexclude_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar * sp_flowregionexclude_description (SPItem * item); @@ -231,17 +231,16 @@ sp_flowregion_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowregion_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { if ( repr == NULL ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:flowRegion"); } GSList *l = NULL; for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { - Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags); + Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } @@ -258,7 +257,7 @@ sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (flowregion_parent_class))->write) - ((SPObjectClass *) (flowregion_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowregion_parent_class))->write (object, xml_doc, repr, flags); return repr; } @@ -448,17 +447,16 @@ sp_flowregionexclude_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if (flags & SP_OBJECT_WRITE_BUILD) { if ( repr == NULL ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:flowRegionExclude"); } GSList *l = NULL; for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { - Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags); + Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } @@ -475,7 +473,7 @@ sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint f } if (((SPObjectClass *) (flowregionexclude_parent_class))->write) - ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index 552adb36e..d47d52dbe 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -43,7 +43,7 @@ static void sp_flowtext_child_added(SPObject *object, Inkscape::XML::Node *child static void sp_flowtext_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_flowtext_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_flowtext_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_flowtext_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_flowtext_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_flowtext_set(SPObject *object, unsigned key, gchar const *value); @@ -291,16 +291,15 @@ sp_flowtext_set(SPObject *object, unsigned key, gchar const *value) } static Inkscape::XML::Node * -sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ( flags & SP_OBJECT_WRITE_BUILD ) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if ( repr == NULL ) repr = xml_doc->createElement("svg:flowRoot"); GSList *l = NULL; for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node *c_repr = NULL; if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } if ( c_repr ) l = g_slist_prepend(l, c_repr); } @@ -318,7 +317,7 @@ sp_flowtext_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp index ad4d586fc..31886b718 100644 --- a/src/sp-font-face.cpp +++ b/src/sp-font-face.cpp @@ -60,7 +60,7 @@ static void sp_fontface_init(SPFontFace *font); static void sp_fontface_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_fontface_release(SPObject *object); static void sp_fontface_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_fontface_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_fontface_remove_child(SPObject *object, Inkscape::XML::Node *child); @@ -459,12 +459,11 @@ sp_fontface_update(SPObject *object, SPCtx *ctx, guint flags) #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFontFace *face = SP_FONTFACE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:font-face"); } @@ -528,7 +527,7 @@ static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::N } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-font.cpp b/src/sp-font.cpp index 528aabaab..fe6bf282a 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -29,7 +29,7 @@ static void sp_font_init(SPFont *font); static void sp_font_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_font_release(SPObject *object); static void sp_font_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_font_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_font_remove_child(SPObject *object, Inkscape::XML::Node *child); @@ -245,12 +245,11 @@ sp_font_update(SPObject *object, SPCtx *ctx, guint flags) #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPFont *font = SP_FONT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:font"); } @@ -271,7 +270,7 @@ static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Node } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-gaussian-blur.cpp b/src/sp-gaussian-blur.cpp index 4d1c37880..94efc5727 100644 --- a/src/sp-gaussian-blur.cpp +++ b/src/sp-gaussian-blur.cpp @@ -40,7 +40,7 @@ static void sp_gaussianBlur_build(SPObject *object, SPDocument *document, Inksca static void sp_gaussianBlur_release(SPObject *object); static void sp_gaussianBlur_set(SPObject *object, unsigned int key, gchar const *value); static void sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_gaussianBlur_build_renderer(SPFilterPrimitive *primitive, NR::Filter *filter); static SPFilterPrimitiveClass *gaussianBlur_parent_class; @@ -155,7 +155,7 @@ sp_gaussianBlur_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { // Inkscape-only object, not copied during an "plain SVG" dump: @@ -164,12 +164,12 @@ sp_gaussianBlur_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? // repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); // FIXME } } if (((SPObjectClass *) gaussianBlur_parent_class)->write) { - ((SPObjectClass *) gaussianBlur_parent_class)->write(object, repr, flags); + ((SPObjectClass *) gaussianBlur_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index b8a2bb1ed..173747af3 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -27,7 +27,7 @@ static void sp_glyph_kerning_init(SPGlyphKerning *glyph); static void sp_glyph_kerning_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_glyph_kerning_release(SPObject *object); static void sp_glyph_kerning_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_glyph_kerning_update(SPObject *object, SPCtx *ctx, guint flags); static SPObjectClass *parent_class; @@ -196,12 +196,11 @@ sp_glyph_kerning_update(SPObject *object, SPCtx *ctx, guint flags) #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { // SPGlyphKerning *glyph = SP_GLYPH_KERNING(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:glyphkerning");//fix this! } @@ -226,7 +225,7 @@ static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::X } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp index 4860b42ed..719d1d25b 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -25,7 +25,7 @@ static void sp_glyph_init(SPGlyph *glyph); static void sp_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_glyph_release(SPObject *object); static void sp_glyph_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_glyph_update(SPObject *object, SPCtx *ctx, guint flags); static SPObjectClass *parent_class; @@ -257,12 +257,11 @@ sp_glyph_update(SPObject *object, SPCtx *ctx, guint flags) #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { // SPGlyph *glyph = SP_GLYPH(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:glyph"); } @@ -292,7 +291,7 @@ static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Node } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index b9ed10cbc..82724303f 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -57,7 +57,7 @@ static void sp_stop_init(SPStop *stop); static void sp_stop_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_stop_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *sp_stop_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_stop_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *stop_parent_class; @@ -201,12 +201,11 @@ sp_stop_set(SPObject *object, unsigned key, gchar const *value) * Virtual write: write object attributes to repr. */ static Inkscape::XML::Node * -sp_stop_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_stop_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPStop *stop = SP_STOP(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:stop"); } @@ -214,7 +213,7 @@ sp_stop_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) gfloat opacity = stop->opacity; if (((SPObjectClass *) stop_parent_class)->write) - (* ((SPObjectClass *) stop_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) stop_parent_class)->write)(object, xml_doc, repr, flags); // Since we do a hackish style setting here (because SPStyle does not support stop-color and // stop-opacity), we must do it AFTER calling the parent write method; otherwise @@ -302,7 +301,7 @@ static void sp_gradient_child_added(SPObject *object, Inkscape::XML::Node *ref); static void sp_gradient_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_gradient_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_gradient_write(SPObject *object, Inkscape::XML::Node *repr, +static Inkscape::XML::Node *sp_gradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void gradient_ref_modified(SPObject *href, guint flags, SPGradient *gradient); @@ -642,18 +641,18 @@ sp_gradient_modified(SPObject *object, guint flags) * Write gradient attributes to repr. */ static Inkscape::XML::Node * -sp_gradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_gradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGradient *gr = SP_GRADIENT(object); if (((SPObjectClass *) gradient_parent_class)->write) - (* ((SPObjectClass *) gradient_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) gradient_parent_class)->write)(object, xml_doc, repr, flags); if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l = NULL; for (SPObject *child = sp_object_first_child(object); child; child = SP_OBJECT_NEXT(child)) { Inkscape::XML::Node *crepr; - crepr = child->updateRepr(NULL, flags); + crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } while (l) { @@ -1312,7 +1311,7 @@ static void sp_lineargradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_lineargradient_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, +static Inkscape::XML::Node *sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPPainter *sp_lineargradient_painter_new(SPPaintServer *ps, @@ -1429,12 +1428,11 @@ sp_lineargradient_set(SPObject *object, unsigned key, gchar const *value) * Callback: write attributes to associated repr. */ static Inkscape::XML::Node * -sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_lineargradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPLinearGradient *lg = SP_LINEARGRADIENT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:linearGradient"); } @@ -1448,7 +1446,7 @@ sp_lineargradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags sp_repr_set_svg_double(repr, "y2", lg->y2.computed); if (((SPObjectClass *) lg_parent_class)->write) - (* ((SPObjectClass *) lg_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) lg_parent_class)->write)(object, xml_doc, repr, flags); return repr; } @@ -1587,7 +1585,7 @@ static void sp_radialgradient_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_radialgradient_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::XML::Node *repr, +static Inkscape::XML::Node *sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPPainter *sp_radialgradient_painter_new(SPPaintServer *ps, @@ -1728,12 +1726,11 @@ sp_radialgradient_set(SPObject *object, unsigned key, gchar const *value) * Write radial gradient attributes to associated repr. */ static Inkscape::XML::Node * -sp_radialgradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_radialgradient_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPRadialGradient *rg = SP_RADIALGRADIENT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:radialGradient"); } @@ -1744,7 +1741,7 @@ sp_radialgradient_write(SPObject *object, Inkscape::XML::Node *repr, guint flags if ((flags & SP_OBJECT_WRITE_ALL) || rg->fy._set) sp_repr_set_svg_double(repr, "fy", rg->fy.computed); if (((SPObjectClass *) rg_parent_class)->write) - (* ((SPObjectClass *) rg_parent_class)->write)(object, repr, flags); + (* ((SPObjectClass *) rg_parent_class)->write)(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 7a1d3534d..44479de12 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -67,7 +67,7 @@ static void sp_image_build (SPObject * object, SPDocument * document, Inkscape:: static void sp_image_release (SPObject * object); static void sp_image_set (SPObject *object, unsigned int key, const gchar *value); static void sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags); -static Inkscape::XML::Node *sp_image_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_image_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_image_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); static void sp_image_print (SPItem * item, SPPrintContext *ctx); @@ -1003,14 +1003,13 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) } static Inkscape::XML::Node * -sp_image_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPImage *image; image = SP_IMAGE (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:image"); } @@ -1026,7 +1025,7 @@ sp_image_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) #endif // ENABLE_LCMS if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 109b55eb7..556a349ed 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -57,7 +57,7 @@ static void sp_group_remove_child (SPObject * object, Inkscape::XML::Node * chil static void sp_group_order_changed (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref); static void sp_group_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_group_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_group_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_group_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_group_set(SPObject *object, unsigned key, char const *value); static void sp_group_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); @@ -218,7 +218,7 @@ sp_group_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_group_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_group_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPGroup *group; SPObject *child; @@ -229,12 +229,11 @@ sp_group_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l; if (!repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:g"); } l = NULL; for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { - crepr = child->updateRepr(NULL, flags); + crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); } while (l) { @@ -261,7 +260,7 @@ sp_group_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 566ff8cb8..0784d404c 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -82,7 +82,7 @@ static void sp_item_build(SPObject *object, SPDocument *document, Inkscape::XML: static void sp_item_release(SPObject *object); static void sp_item_set(SPObject *object, unsigned key, gchar const *value); static void sp_item_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_item_private_description(SPItem *item); static void sp_item_private_snappoints(SPItem const *item, SnapPointsIter p); @@ -654,7 +654,7 @@ sp_item_update(SPObject *object, SPCtx *ctx, guint flags) } static Inkscape::XML::Node * -sp_item_write(SPObject *const object, Inkscape::XML::Node *repr, guint flags) +sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPItem *item = SP_ITEM(object); @@ -686,7 +686,7 @@ sp_item_write(SPObject *const object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-line.cpp b/src/sp-line.cpp index 5fed6a62e..1f5c1b181 100644 --- a/src/sp-line.cpp +++ b/src/sp-line.cpp @@ -28,7 +28,7 @@ static void sp_line_init (SPLine *line); static void sp_line_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_line_set (SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_line_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_line_description (SPItem * item); static NR::Matrix sp_line_set_transform(SPItem *item, NR::Matrix const &xform); @@ -159,12 +159,11 @@ sp_line_update (SPObject *object, SPCtx *ctx, guint flags) static Inkscape::XML::Node * -sp_line_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_line_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPLine *line = SP_LINE (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:line"); } @@ -178,7 +177,7 @@ sp_line_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_svg_double(repr, "y2", line->y2.computed); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 7a18c10b5..3bf5a28ee 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -43,7 +43,7 @@ static void sp_lpe_item_release(SPObject *object); static void sp_lpe_item_set(SPObject *object, unsigned int key, gchar const *value); static void sp_lpe_item_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_lpe_item_modified (SPObject *object, unsigned int flags); -static Inkscape::XML::Node *sp_lpe_item_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_lpe_item_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags); static void sp_lpe_item_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref); static void sp_lpe_item_remove_child (SPObject * object, Inkscape::XML::Node * child); @@ -251,7 +251,7 @@ sp_lpe_item_modified (SPObject *object, unsigned int flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_lpe_item_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_lpe_item_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPLPEItem *lpeitem = (SPLPEItem *) object; @@ -263,7 +263,7 @@ sp_lpe_item_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *)(parent_class))->write) { - ((SPObjectClass *)(parent_class))->write(object, repr, flags); + ((SPObjectClass *)(parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index 4bdf1d40e..c6febeb40 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -43,7 +43,7 @@ static void sp_mask_set (SPObject *object, unsigned int key, const gchar *value) static void sp_mask_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_mask_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_mask_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_mask_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); SPMaskView *sp_mask_view_new_prepend (SPMaskView *list, unsigned int key, NRArenaItem *arenaitem); SPMaskView *sp_mask_view_list_remove (SPMaskView *list, SPMaskView *view); @@ -257,15 +257,14 @@ sp_mask_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_mask_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_mask_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:mask"); } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-metadata.cpp b/src/sp-metadata.cpp index 9fb67feb4..920b7d64d 100644 --- a/src/sp-metadata.cpp +++ b/src/sp-metadata.cpp @@ -41,7 +41,7 @@ static void sp_metadata_build (SPObject * object, SPDocument * document, Inkscap static void sp_metadata_release (SPObject *object); static void sp_metadata_set (SPObject *object, unsigned int key, const gchar *value); static void sp_metadata_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_metadata_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_metadata_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *metadata_parent_class; @@ -183,7 +183,7 @@ sp_metadata_update(SPObject *object, SPCtx *ctx, guint flags) * \brief Writes it's settings to an incoming repr object, if any */ static Inkscape::XML::Node * -sp_metadata_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_metadata_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { debug("0x%08x",(unsigned int)object); //SPMetadata *metadata = SP_METADATA(object); @@ -193,12 +193,12 @@ sp_metadata_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) if (repr) { repr->mergeFrom(SP_OBJECT_REPR (object), "id"); } else { - repr = SP_OBJECT_REPR (object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR (object)->duplicate(doc); } } if (((SPObjectClass *) metadata_parent_class)->write) - ((SPObjectClass *) metadata_parent_class)->write(object, repr, flags); + ((SPObjectClass *) metadata_parent_class)->write(object, doc, repr, flags); return repr; } diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp index 7cd75b3b8..23a8a08a1 100644 --- a/src/sp-missing-glyph.cpp +++ b/src/sp-missing-glyph.cpp @@ -25,7 +25,7 @@ static void sp_missing_glyph_init(SPMissingGlyph *glyph); static void sp_missing_glyph_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_missing_glyph_release(SPObject *object); static void sp_missing_glyph_set(SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *parent_class; @@ -150,12 +150,11 @@ g_warning(": SP_ATTR_VERT_ADV_Y: %f", number); #define COPY_ATTR(rd,rs,key) (rd)->setAttribute((key), rs->attribute(key)); -static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { // SPMissingGlyph *glyph = SP_MISSING_GLYPH(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:glyph"); } @@ -175,7 +174,7 @@ static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::X } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 9851e146a..54e84927a 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -53,7 +53,7 @@ static void sp_namedview_release(SPObject *object); static void sp_namedview_set(SPObject *object, unsigned int key, const gchar *value); static void sp_namedview_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *child); -static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_namedview_setup_guides(SPNamedView * nv); @@ -687,7 +687,7 @@ static void sp_namedview_remove_child(SPObject *object, Inkscape::XML::Node *chi } } -static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { if ( ( flags & SP_OBJECT_WRITE_EXT ) && repr != SP_OBJECT_REPR(object) ) @@ -695,8 +695,7 @@ static Inkscape::XML::Node *sp_namedview_write(SPObject *object, Inkscape::XML:: if (repr) { repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - /// \todo FIXME: Plumb an appropriate XML::Document into this - repr = SP_OBJECT_REPR(object)->duplicate(NULL); + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 888fe2d8e..1d5c04339 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -22,7 +22,7 @@ static void sp_objectgroup_init (SPObjectGroup *objectgroup); static void sp_objectgroup_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref); static void sp_objectgroup_remove_child (SPObject * object, Inkscape::XML::Node * child); static void sp_objectgroup_order_changed (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref); -static Inkscape::XML::Node *sp_objectgroup_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *parent_class; @@ -98,7 +98,7 @@ sp_objectgroup_order_changed (SPObject *object, Inkscape::XML::Node *child, Inks } static Inkscape::XML::Node * -sp_objectgroup_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPObjectGroup *group; SPObject *child; @@ -109,12 +109,11 @@ sp_objectgroup_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l; if (!repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:g"); } l = NULL; for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { - crepr = child->updateRepr(NULL, flags); + crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); } while (l) { @@ -129,7 +128,7 @@ sp_objectgroup_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-object.cpp b/src/sp-object.cpp index d26079260..d7cdd5b92 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -85,7 +85,7 @@ static void sp_object_release(SPObject *object); static void sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_object_private_set(SPObject *object, unsigned int key, gchar const *value); -static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); /* Real handlers of repr signals */ @@ -1076,7 +1076,7 @@ sp_object_repr_attr_changed(Inkscape::XML::Node *repr, gchar const *key, gchar c // manual changes to extension attributes require the normal // attributes, which depend on them, to be updated immediately if (is_interactive) { - object->updateRepr(repr, 0); + object->updateRepr(0); } } @@ -1112,10 +1112,10 @@ sp_xml_get_space_string(unsigned int space) * Callback for write event. */ static Inkscape::XML::Node * -sp_object_private_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_object_private_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { if (!repr && (flags & SP_OBJECT_WRITE_BUILD)) { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); if (!( flags & SP_OBJECT_WRITE_EXT )) { repr->setAttribute("inkscape:collect", NULL); } @@ -1180,7 +1180,7 @@ SPObject::updateRepr(unsigned int flags) { if (!SP_OBJECT_IS_CLONED(this)) { Inkscape::XML::Node *repr=SP_OBJECT_REPR(this); if (repr) { - return updateRepr(repr, flags); + return updateRepr(repr->document(), repr, flags); } else { g_critical("Attempt to update non-existent repr"); return NULL; @@ -1196,7 +1196,9 @@ SPObject::updateRepr(unsigned int flags) { * saving as "Plain SVG" */ Inkscape::XML::Node * -SPObject::updateRepr(Inkscape::XML::Node *repr, unsigned int flags) { +SPObject::updateRepr(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags) { + g_assert(doc != NULL); + if (SP_OBJECT_IS_CLONED(this)) { /* cloned objects have no repr */ return NULL; @@ -1205,13 +1207,12 @@ SPObject::updateRepr(Inkscape::XML::Node *repr, unsigned int flags) { if (!(flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = SP_OBJECT_REPR(this); } - return ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write(this, repr, flags); + return ((SPObjectClass *) G_OBJECT_GET_CLASS(this))->write(this, doc, repr, flags); } else { g_warning("Class %s does not implement ::write", G_OBJECT_TYPE_NAME(this)); if (!repr) { if (flags & SP_OBJECT_WRITE_BUILD) { - /// \todo FIXME: Plumb an appropriate XML::Document into this - repr = SP_OBJECT_REPR(this)->duplicate(NULL); + repr = SP_OBJECT_REPR(this)->duplicate(doc); } /// \todo FIXME: else probably error (Lauris) */ } else { diff --git a/src/sp-object.h b/src/sp-object.h index 5d22e33e4..ccc063d5f 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -67,6 +67,7 @@ namespace Inkscape { namespace XML { class Node; +class Document; } } @@ -374,7 +375,7 @@ struct SPObject : public GObject { /** @brief Updates the object's repr based on the object's state. * * This method updates the the repr attached to the object to reflect the object's current - * state; see the two-argument version for details. + * state; see the three-argument version for details. * * @param flags object write flags that apply to this update * @@ -402,7 +403,7 @@ struct SPObject : public GObject { * * @return the updated repr */ - Inkscape::XML::Node *updateRepr(Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node *updateRepr(Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); /** @brief Queues an deferred update of this object's display. * @@ -518,7 +519,7 @@ struct SPObjectClass { /* Modification handler */ void (* modified) (SPObject *object, unsigned int flags); - Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Node *repr, unsigned int flags); + Inkscape::XML::Node * (* write) (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, unsigned int flags); }; diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index f3c5cfada..d3711a9f6 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -75,7 +75,7 @@ static void sp_offset_finalize(GObject *obj); static void sp_offset_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); -static Inkscape::XML::Node *sp_offset_write (SPObject * object, Inkscape::XML::Node * repr, +static Inkscape::XML::Node *sp_offset_write (SPObject * object, Inkscape::XML::Document *doc, Inkscape::XML::Node * repr, guint flags); static void sp_offset_set (SPObject * object, unsigned int key, const gchar * value); @@ -259,12 +259,11 @@ sp_offset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep * Virtual write: write offset attributes to corresponding repr. */ static Inkscape::XML::Node * -sp_offset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_offset_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPOffset *offset = SP_OFFSET (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(object)->document(); repr = xml_doc->createElement("svg:path"); } @@ -292,7 +291,7 @@ sp_offset_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) g_free (d); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags | SP_SHAPE_WRITE_PATH); return repr; diff --git a/src/sp-path.cpp b/src/sp-path.cpp index e16147b12..173e44440 100644 --- a/src/sp-path.cpp +++ b/src/sp-path.cpp @@ -53,7 +53,7 @@ static void sp_path_release(SPObject *object); static void sp_path_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_path_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *sp_path_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_path_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static NR::Matrix sp_path_set_transform(SPItem *item, NR::Matrix const &xform); static gchar * sp_path_description(SPItem *item); static void sp_path_convert_to_guides(SPItem *item); @@ -298,12 +298,11 @@ sp_path_set(SPObject *object, unsigned int key, gchar const *value) * Writes the path object into a Inkscape::XML::Node */ static Inkscape::XML::Node * -sp_path_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_path_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPShape *shape = (SPShape *) object; if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -327,7 +326,7 @@ sp_path_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) SP_PATH(shape)->connEndPair.writeRepr(repr); if (((SPObjectClass *)(parent_class))->write) { - ((SPObjectClass *)(parent_class))->write(object, repr, flags); + ((SPObjectClass *)(parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-polygon.cpp b/src/sp-polygon.cpp index d90f829b9..9b9c91c55 100644 --- a/src/sp-polygon.cpp +++ b/src/sp-polygon.cpp @@ -27,7 +27,7 @@ static void sp_polygon_class_init(SPPolygonClass *pc); static void sp_polygon_init(SPPolygon *polygon); static void sp_polygon_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); -static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_polygon_description(SPItem *item); @@ -114,7 +114,7 @@ static gchar *sp_svg_write_polygon(const NArtBpath *bpath) return g_strdup(os.str().c_str()); } -static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPShape *shape = SP_SHAPE(object); // Tolerable workaround: we need to update the object's curve before we set points= @@ -122,7 +122,6 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::No sp_shape_set_shape(shape); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:polygon"); } @@ -133,7 +132,7 @@ static Inkscape::XML::Node *sp_polygon_write(SPObject *object, Inkscape::XML::No g_free(str); if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-polyline.cpp b/src/sp-polyline.cpp index 4a39afd1b..08f446d61 100644 --- a/src/sp-polyline.cpp +++ b/src/sp-polyline.cpp @@ -25,7 +25,7 @@ static void sp_polyline_init (SPPolyLine *polyline); static void sp_polyline_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); static void sp_polyline_set (SPObject *object, unsigned int key, const gchar *value); -static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_polyline_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar * sp_polyline_description (SPItem * item); @@ -151,14 +151,13 @@ sp_polyline_set (SPObject *object, unsigned int key, const gchar *value) } static Inkscape::XML::Node * -sp_polyline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_polyline_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPPolyLine *polyline; polyline = SP_POLYLINE (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:polyline"); } @@ -167,7 +166,7 @@ sp_polyline_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-rect.cpp b/src/sp-rect.cpp index b02f52f1e..072c52199 100644 --- a/src/sp-rect.cpp +++ b/src/sp-rect.cpp @@ -39,7 +39,7 @@ static void sp_rect_init(SPRect *rect); static void sp_rect_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_rect_set(SPObject *object, unsigned key, gchar const *value); static void sp_rect_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_rect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_rect_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static gchar *sp_rect_description(SPItem *item); static NR::Matrix sp_rect_set_transform(SPItem *item, NR::Matrix const &xform); @@ -197,12 +197,11 @@ sp_rect_update(SPObject *object, SPCtx *ctx, guint flags) } static Inkscape::XML::Node * -sp_rect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_rect_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPRect *rect = SP_RECT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:rect"); } @@ -214,7 +213,7 @@ sp_rect_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) sp_repr_set_svg_double(repr, "y", rect->y.computed); if (((SPObjectClass *) parent_class)->write) - ((SPObjectClass *) parent_class)->write(object, repr, flags); + ((SPObjectClass *) parent_class)->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-root.cpp b/src/sp-root.cpp index c3fdeb24b..94b561bcc 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -48,7 +48,7 @@ static void sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, In static void sp_root_remove_child(SPObject *object, Inkscape::XML::Node *child); static void sp_root_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_root_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_root_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_root_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static NRArenaItem *sp_root_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags); static void sp_root_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); @@ -577,12 +577,11 @@ sp_root_modified(SPObject *object, guint flags) * Writes the object into the repr object, then calls the parent's write routine. */ static Inkscape::XML::Node * -sp_root_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_root_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPRoot *root = SP_ROOT(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:svg"); } @@ -611,7 +610,7 @@ sp_root_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 99e4ed485..2ed92c5f5 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -57,7 +57,7 @@ static void sp_shape_release (SPObject *object); static void sp_shape_set(SPObject *object, unsigned key, gchar const *value); static void sp_shape_update (SPObject *object, SPCtx *ctx, unsigned int flags); static void sp_shape_modified (SPObject *object, unsigned int flags); -static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_shape_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); void sp_shape_print (SPItem * item, SPPrintContext * ctx); @@ -219,10 +219,10 @@ sp_shape_set(SPObject *object, unsigned int key, gchar const *value) } static Inkscape::XML::Node * -sp_shape_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_shape_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { if (((SPObjectClass *)(parent_class))->write) { - ((SPObjectClass *)(parent_class))->write(object, repr, flags); + ((SPObjectClass *)(parent_class))->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-skeleton.cpp b/src/sp-skeleton.cpp index ee0c9626b..ec6c9b437 100644 --- a/src/sp-skeleton.cpp +++ b/src/sp-skeleton.cpp @@ -48,7 +48,7 @@ static void sp_skeleton_build(SPObject *object, SPDocument *document, Inkscape:: static void sp_skeleton_release(SPObject *object); static void sp_skeleton_set(SPObject *object, unsigned int key, gchar const *value); static void sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags); -static Inkscape::XML::Node *sp_skeleton_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_skeleton_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPObjectClass *skeleton_parent_class; @@ -180,7 +180,7 @@ sp_skeleton_update(SPObject *object, SPCtx *ctx, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_skeleton_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_skeleton_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags) { debug("0x%p",object); //SPSkeleton *skeleton = SP_SKELETON(object); @@ -191,12 +191,12 @@ sp_skeleton_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) // is this sane? repr->mergeFrom(SP_OBJECT_REPR(object), "id"); } else { - repr = SP_OBJECT_REPR(object)->duplicate(NULL); // FIXME + repr = SP_OBJECT_REPR(object)->duplicate(doc); } } if (((SPObjectClass *) skeleton_parent_class)->write) { - ((SPObjectClass *) skeleton_parent_class)->write(object, repr, flags); + ((SPObjectClass *) skeleton_parent_class)->write(object, doc, repr, flags); } return repr; diff --git a/src/sp-spiral.cpp b/src/sp-spiral.cpp index 1d4723641..3a37a8da2 100644 --- a/src/sp-spiral.cpp +++ b/src/sp-spiral.cpp @@ -31,7 +31,7 @@ static void sp_spiral_class_init (SPSpiralClass *klass); static void sp_spiral_init (SPSpiral *spiral); static void sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); -static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_spiral_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_spiral_set (SPObject *object, unsigned int key, const gchar *value); static void sp_spiral_update (SPObject *object, SPCtx *ctx, guint flags); @@ -141,12 +141,11 @@ sp_spiral_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * * Virtual write: write spiral attributes to corresponding repr. */ static Inkscape::XML::Node * -sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_spiral_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPSpiral *spiral = SP_SPIRAL (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -179,7 +178,7 @@ sp_spiral_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) g_free (d); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags | SP_SHAPE_WRITE_PATH); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags | SP_SHAPE_WRITE_PATH); return repr; } diff --git a/src/sp-star.cpp b/src/sp-star.cpp index cf6f11403..96bc9180a 100644 --- a/src/sp-star.cpp +++ b/src/sp-star.cpp @@ -34,7 +34,7 @@ static void sp_star_class_init (SPStarClass *klass); static void sp_star_init (SPStar *star); static void sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * repr); -static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_star_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_star_set (SPObject *object, unsigned int key, const gchar *value); static void sp_star_update (SPObject *object, SPCtx *ctx, guint flags); @@ -129,12 +129,11 @@ sp_star_build (SPObject * object, SPDocument * document, Inkscape::XML::Node * r } static Inkscape::XML::Node * -sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_star_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPStar *star = SP_STAR (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:path"); } @@ -158,7 +157,7 @@ sp_star_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) g_free (d); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index fa756242c..46c311920 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -12,7 +12,7 @@ static void sp_style_elem_class_init(SPStyleElemClass *klass); static void sp_style_elem_build(SPObject *object, SPDocument *doc, Inkscape::XML::Node *repr); static void sp_style_elem_set(SPObject *object, unsigned const key, gchar const *const value); static void sp_style_elem_read_content(SPObject *); -static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Node *, guint flags); +static Inkscape::XML::Node *sp_style_elem_write(SPObject *, Inkscape::XML::Document *, Inkscape::XML::Node *, guint flags); static SPObjectClass *parent_class; @@ -120,10 +120,9 @@ child_order_changed_cb(Inkscape::XML::Node *, Inkscape::XML::Node *, } static Inkscape::XML::Node * -sp_style_elem_write(SPObject *const object, Inkscape::XML::Node *repr, guint const flags) +sp_style_elem_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint const flags) { if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:style"); } @@ -140,7 +139,7 @@ sp_style_elem_write(SPObject *const object, Inkscape::XML::Node *repr, guint con /* todo: media */ if (((SPObjectClass *) parent_class)->write) - ((SPObjectClass *) parent_class)->write(object, repr, flags); + ((SPObjectClass *) parent_class)->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 943257c8b..7420f660e 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -36,7 +36,7 @@ static void sp_symbol_set (SPObject *object, unsigned int key, const gchar *valu static void sp_symbol_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref); static void sp_symbol_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_symbol_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_symbol_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_symbol_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static NRArenaItem *sp_symbol_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags); static void sp_symbol_hide (SPItem *item, unsigned int key); @@ -382,14 +382,13 @@ sp_symbol_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_symbol_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPSymbol *symbol; symbol = SP_SYMBOL (object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:symbol"); } @@ -397,7 +396,7 @@ sp_symbol_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); if (((SPObjectClass *) (parent_class))->write) - ((SPObjectClass *) (parent_class))->write (object, repr, flags); + ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 810df2530..ceb8dc5a5 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -65,7 +65,7 @@ static void sp_text_child_added (SPObject *object, Inkscape::XML::Node *rch, Ink static void sp_text_remove_child (SPObject *object, Inkscape::XML::Node *rch); static void sp_text_update (SPObject *object, SPCtx *ctx, guint flags); static void sp_text_modified (SPObject *object, guint flags); -static Inkscape::XML::Node *sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_text_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_text_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); static NRArenaItem *sp_text_show (SPItem *item, NRArena *arena, unsigned key, unsigned flags); @@ -299,12 +299,11 @@ sp_text_modified (SPObject *object, guint flags) } static Inkscape::XML::Node * -sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_text_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPText *text = SP_TEXT (object); if (flags & SP_OBJECT_WRITE_BUILD) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); if (!repr) repr = xml_doc->createElement("svg:text"); GSList *l = NULL; @@ -313,7 +312,7 @@ sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) if (SP_IS_STRING(child)) { crepr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } else { - crepr = child->updateRepr(NULL, flags); + crepr = child->updateRepr(xml_doc, NULL, flags); } if (crepr) l = g_slist_prepend (l, crepr); } @@ -344,7 +343,7 @@ sp_text_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", NULL); if (((SPObjectClass *) (text_parent_class))->write) - ((SPObjectClass *) (text_parent_class))->write (object, repr, flags); + ((SPObjectClass *) (text_parent_class))->write (object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 0c6da3518..ad85b4d85 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -63,7 +63,7 @@ static void sp_tref_release(SPObject *object); static void sp_tref_set(SPObject *object, unsigned int key, gchar const *value); static void sp_tref_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_tref_modified(SPObject *object, guint flags); -static Inkscape::XML::Node *sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_tref_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); static gchar *sp_tref_description(SPItem *item); @@ -290,14 +290,13 @@ sp_tref_modified(SPObject *object, guint flags) * Writes its settings to an incoming repr object, if any. */ static Inkscape::XML::Node * -sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_tref_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { debug("0x%p",object); SPTRef *tref = SP_TREF(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:tref"); } @@ -311,7 +310,7 @@ sp_tref_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) tref_parent_class)->write) { - ((SPObjectClass *) tref_parent_class)->write(object, repr, flags); + ((SPObjectClass *) tref_parent_class)->write(object, xml_doc, repr, flags); } return repr; diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 7d56e177b..c86c852d7 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -58,7 +58,7 @@ static void sp_tspan_set(SPObject *object, unsigned key, gchar const *value); static void sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_tspan_modified(SPObject *object, unsigned flags); static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags); -static Inkscape::XML::Node *sp_tspan_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_tspan_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static char *sp_tspan_description (SPItem *item); static SPItemClass *tspan_parent_class; @@ -230,11 +230,10 @@ static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &tr } static Inkscape::XML::Node * -sp_tspan_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPTSpan *tspan = SP_TSPAN(object); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); - + if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:tspan"); } @@ -246,9 +245,9 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_TEXTPATH(child) ) { - //c_repr = child->updateRepr(NULL, flags); // shouldn't happen + //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } @@ -264,7 +263,7 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { child->updateRepr(flags); } else if ( SP_IS_TEXTPATH(child) ) { - //c_repr = child->updateRepr(NULL, flags); // shouldn't happen + //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(child) ) { SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str()); } @@ -272,7 +271,7 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) tspan_parent_class)->write) - ((SPObjectClass *) tspan_parent_class)->write(object, repr, flags); + ((SPObjectClass *) tspan_parent_class)->write(object, xml_doc, repr, flags); return repr; } @@ -299,7 +298,7 @@ static void sp_textpath_release(SPObject *object); static void sp_textpath_set(SPObject *object, unsigned key, gchar const *value); static void sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_textpath_modified(SPObject *object, unsigned flags); -static Inkscape::XML::Node *sp_textpath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_textpath_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static SPItemClass *textpath_parent_class; @@ -502,11 +501,10 @@ sp_textpath_modified(SPObject *object, unsigned flags) } } static Inkscape::XML::Node * -sp_textpath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPTextPath *textpath = SP_TEXTPATH(object); - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); - + if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { repr = xml_doc->createElement("svg:textPath"); } @@ -531,9 +529,9 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { - c_repr = child->updateRepr(NULL, flags); + c_repr = child->updateRepr(xml_doc, NULL, flags); } else if ( SP_IS_TEXTPATH(child) ) { - //c_repr = child->updateRepr(NULL, flags); // shouldn't happen + //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(child) ) { c_repr = xml_doc->createTextNode(SP_STRING(child)->string.c_str()); } @@ -549,7 +547,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { child->updateRepr(flags); } else if ( SP_IS_TEXTPATH(child) ) { - //c_repr = child->updateRepr(NULL, flags); // shouldn't happen + //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else if ( SP_IS_STRING(child) ) { SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str()); } @@ -557,7 +555,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) } if (((SPObjectClass *) textpath_parent_class)->write) - ((SPObjectClass *) textpath_parent_class)->write(object, repr, flags); + ((SPObjectClass *) textpath_parent_class)->write(object, xml_doc, repr, flags); return repr; } diff --git a/src/sp-use.cpp b/src/sp-use.cpp index ec37ef391..2af7e1394 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -47,7 +47,7 @@ static void sp_use_finalize(GObject *obj); static void sp_use_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr); static void sp_use_release(SPObject *object); static void sp_use_set(SPObject *object, unsigned key, gchar const *value); -static Inkscape::XML::Node *sp_use_write(SPObject *object, Inkscape::XML::Node *repr, guint flags); +static Inkscape::XML::Node *sp_use_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags); static void sp_use_update(SPObject *object, SPCtx *ctx, guint flags); static void sp_use_modified(SPObject *object, guint flags); @@ -242,17 +242,16 @@ sp_use_set(SPObject *object, unsigned key, gchar const *value) } static Inkscape::XML::Node * -sp_use_write(SPObject *object, Inkscape::XML::Node *repr, guint flags) +sp_use_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) { SPUse *use = SP_USE(object); if ((flags & SP_OBJECT_WRITE_BUILD) && !repr) { - Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(object)); repr = xml_doc->createElement("svg:use"); } if (((SPObjectClass *) (parent_class))->write) { - ((SPObjectClass *) (parent_class))->write(object, repr, flags); + ((SPObjectClass *) (parent_class))->write(object, xml_doc, repr, flags); } sp_repr_set_svg_double(repr, "x", use->x.computed); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 4b115f374..a225c1a00 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -398,7 +398,7 @@ Inkscape::Text::Layout::iterator sp_te_insert_line (SPItem *item, Inkscape::Text // TODO // I think the only case to put here is arbitrary gaps, which nobody uses yet } - item->updateRepr(SP_OBJECT_REPR(item),SP_OBJECT_WRITE_EXT); + item->updateRepr(); unsigned char_index = layout->iteratorToCharIndex(position); te_update_layout_now(item); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); @@ -520,7 +520,7 @@ sp_te_insert(SPItem *item, Inkscape::Text::Layout::iterator const &position, gch } } - item->updateRepr(SP_OBJECT_REPR(item),SP_OBJECT_WRITE_EXT); + item->updateRepr(); unsigned char_index = layout->iteratorToCharIndex(position); te_update_layout_now(item); item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); diff --git a/src/widgets/toolbox.cpp b/src/widgets/toolbox.cpp index 76ca4e02e..ee65e73ab 100644 --- a/src/widgets/toolbox.cpp +++ b/src/widgets/toolbox.cpp @@ -1680,7 +1680,7 @@ static void sp_stb_magnitude_value_changed( GtkAdjustment *adj, GObject *dataKlu sp_repr_set_svg_double(repr, "sodipodi:arg2", (sp_repr_get_double_attribute(repr, "sodipodi:arg1", 0.5) + M_PI / (gint)adj->value)); - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } @@ -1721,7 +1721,7 @@ static void sp_stb_proportion_value_changed( GtkAdjustment *adj, GObject *dataKl sp_repr_set_svg_double(repr, "sodipodi:r1", r2*adj->value); } - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } @@ -1763,7 +1763,7 @@ static void sp_stb_sides_flat_state_changed( EgeSelectOneAction *act, GObject *d if (SP_IS_STAR((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); repr->setAttribute("inkscape:flatsided", flat ? "true" : "false" ); - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } @@ -1800,7 +1800,7 @@ static void sp_stb_rounded_value_changed( GtkAdjustment *adj, GObject *dataKludg if (SP_IS_STAR((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); sp_repr_set_svg_double(repr, "inkscape:rounded", (gdouble) adj->value); - SP_OBJECT(items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT(items->data)->updateRepr(); modmade = true; } } @@ -1834,7 +1834,7 @@ static void sp_stb_randomized_value_changed( GtkAdjustment *adj, GObject *dataKl if (SP_IS_STAR((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); sp_repr_set_svg_double(repr, "inkscape:randomized", (gdouble) adj->value); - SP_OBJECT(items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT(items->data)->updateRepr(); modmade = true; } } @@ -2871,7 +2871,7 @@ sp_spl_tb_value_changed(GtkAdjustment *adj, GObject *tbl, gchar const *value_nam if (SP_IS_SPIRAL((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); sp_repr_set_svg_double( repr, namespaced_name, adj->value ); - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } @@ -3999,7 +3999,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) if (SP_IS_ARC((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); repr->setAttribute("sodipodi:open", "true"); - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } @@ -4011,7 +4011,7 @@ static void sp_arctb_open_state_changed( EgeSelectOneAction *act, GObject *tbl ) if (SP_IS_ARC((SPItem *) items->data)) { Inkscape::XML::Node *repr = SP_OBJECT_REPR((SPItem *) items->data); repr->setAttribute("sodipodi:open", NULL); - SP_OBJECT((SPItem *) items->data)->updateRepr(repr, SP_OBJECT_WRITE_EXT); + SP_OBJECT((SPItem *) items->data)->updateRepr(); modmade = true; } } -- 2.30.2