From c2d8810625892a8bedcaa192df9b4165e46609ee Mon Sep 17 00:00:00 2001 From: Peter Moulder Date: Tue, 7 Apr 2009 05:31:32 +0000 Subject: Move Inkscape::IO::fixupHrefs to Inkscape::XML::rebase_hrefs in new file xml/rebase-hrefs.*. Give it the old and new base directory, so that it can change hrefs without relying on sodipodi:absref. Also create a new function sp_repr_save_rebased_file that changes all xlink:href attributes as it writes them, so that we don't need to modify the owning document. (Especially useful for "Save a copy" or exporting.) extension/system.cpp: (Inkscape::Extension::save): Don't call sp_document_set_uri even temporarily other than at the same time as calling rebase_hrefs. (Otherwise, existing relative hrefs will point nowhere.) When exporting plain SVG, change the relative hrefs according to the destination filename. (bzr r7643) --- src/xml/repr.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src/xml/repr.h') diff --git a/src/xml/repr.h b/src/xml/repr.h index bbab619f0..549822e4e 100644 --- a/src/xml/repr.h +++ b/src/xml/repr.h @@ -71,13 +71,21 @@ inline Inkscape::XML::Node *sp_repr_next(Inkscape::XML::Node *repr) { Inkscape::XML::Document *sp_repr_read_file(gchar const *filename, gchar const *default_ns); Inkscape::XML::Document *sp_repr_read_mem(gchar const *buffer, int length, gchar const *default_ns); -void sp_repr_write_stream (Inkscape::XML::Node *repr, Inkscape::IO::Writer &out, - gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, - int inlineattrs, int indent); +void sp_repr_write_stream(Inkscape::XML::Node *repr, Inkscape::IO::Writer &out, + gint indent_level, bool add_whitespace, Glib::QueryQuark elide_prefix, + int inlineattrs, int indent, + gchar const *old_href_base = NULL, + gchar const *new_href_base = NULL); Inkscape::XML::Document *sp_repr_read_buf (const Glib::ustring &buf, const gchar *default_ns); Glib::ustring sp_repr_save_buf(Inkscape::XML::Document *doc); -void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, gchar const *default_ns=NULL, bool compress = false); +void sp_repr_save_stream(Inkscape::XML::Document *doc, FILE *to_file, + gchar const *default_ns = NULL, bool compress = false, + gchar const *old_href_base = NULL, + gchar const *new_href_base = NULL); bool sp_repr_save_file(Inkscape::XML::Document *doc, gchar const *filename, gchar const *default_ns=NULL); +bool sp_repr_save_rebased_file(Inkscape::XML::Document *doc, gchar const *filename_utf8, + gchar const *default_ns, + gchar const *old_base, gchar const *new_base_filename); /* CSS stuff */ -- cgit v1.2.3