summaryrefslogtreecommitdiffstats
path: root/src/extension/internal/svg.cpp
diff options
context:
space:
mode:
authorPeter Moulder <peter.moulder@monash.edu>2009-04-07 05:31:32 +0000
committerpjrm <pjrm@users.sourceforge.net>2009-04-07 05:31:32 +0000
commitc2d8810625892a8bedcaa192df9b4165e46609ee (patch)
tree86bf3792eb9043b59435c17ae9415138d2e81a21 /src/extension/internal/svg.cpp
parentfunctional noop: Clarify g_strcanon behaviour by not redundantly reassigning ... (diff)
downloadinkscape-c2d8810625892a8bedcaa192df9b4165e46609ee.tar.gz
inkscape-c2d8810625892a8bedcaa192df9b4165e46609ee.zip
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)
Diffstat (limited to '')
-rw-r--r--src/extension/internal/svg.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/extension/internal/svg.cpp b/src/extension/internal/svg.cpp
index 4a323d7d7..a3589e905 100644
--- a/src/extension/internal/svg.cpp
+++ b/src/extension/internal/svg.cpp
@@ -198,7 +198,7 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena
gchar *save_path = g_path_get_dirname(filename);
- gboolean const spns = (!mod->get_id()
+ bool const spns = ( !mod->get_id()
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)
|| !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE));
@@ -212,10 +212,8 @@ Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filena
repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
}
- Inkscape::IO::fixupHrefs( doc, save_path, spns );
-
- gboolean const s = sp_repr_save_file(repr->document(), filename, SP_SVG_NS_URI);
- if (s == FALSE) {
+ if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI,
+ doc->base, filename)) {
throw Inkscape::Extension::Output::save_failed();
}