~valavanisalex/ubuntu/oneiric/inkscape/inkscape_0.48.1-2ubuntu4

« back to all changes in this revision

Viewing changes to src/extension/internal/svg.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook, Ted Gould, Kees Cook
  • Date: 2009-06-24 14:00:43 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090624140043-07stp20mry48hqup
Tags: 0.47~pre0-0ubuntu1
* New upstream release

[ Ted Gould ]
* debian/control: Adding libgsl0 and removing version specifics on boost

[ Kees Cook ]
* debian/watch: updated to run uupdate and mangle pre-release versions.
* Dropped patches that have been taken upstream:
  - 01_mips
  - 02-poppler-0.8.3
  - 03-chinese-inkscape
  - 05_fix_latex_patch
  - 06_gcc-4.4
  - 07_cdr2svg
  - 08_skip-bad-utf-on-pdf-import
  - 09_gtk-clist
  - 10_belarussian
  - 11_libpng
  - 12_desktop
  - 13_slider
  - 100_svg_import_improvements
  - 102_sp_pattern_painter_free
  - 103_bitmap_type_print

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
    /* SVG in */
53
53
    ext = Inkscape::Extension::build_from_mem(
54
 
        "<inkscape-extension>\n"
 
54
        "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
55
55
            "<name>" N_("SVG Input") "</name>\n"
56
56
            "<id>" SP_MODULE_KEY_INPUT_SVG "</id>\n"
57
57
            "<input>\n"
58
58
                "<extension>.svg</extension>\n"
59
 
                "<mimetype>image/x-svg</mimetype>\n"
 
59
                "<mimetype>image/svg+xml</mimetype>\n"
60
60
                "<filetypename>" N_("Scalable Vector Graphic (*.svg)") "</filetypename>\n"
61
61
                "<filetypetooltip>" N_("Inkscape native file format and W3C standard") "</filetypetooltip>\n"
62
62
                "<output_extension>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</output_extension>\n"
65
65
 
66
66
    /* SVG out Inkscape */
67
67
    ext = Inkscape::Extension::build_from_mem(
68
 
        "<inkscape-extension>\n"
 
68
        "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
69
69
            "<name>" N_("SVG Output Inkscape") "</name>\n"
70
70
            "<id>" SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE "</id>\n"
71
71
            "<output>\n"
72
72
                "<extension>.svg</extension>\n"
73
 
                "<mimetype>image/x-svg</mimetype>\n"
 
73
                "<mimetype>image/x-inkscape-svg</mimetype>\n"
74
74
                "<filetypename>" N_("Inkscape SVG (*.svg)") "</filetypename>\n"
75
75
                "<filetypetooltip>" N_("SVG format with Inkscape extensions") "</filetypetooltip>\n"
76
 
                "<dataloss>FALSE</dataloss>\n"
 
76
                "<dataloss>false</dataloss>\n"
77
77
            "</output>\n"
78
78
        "</inkscape-extension>", new Svg());
79
79
 
80
80
    /* SVG out */
81
81
    ext = Inkscape::Extension::build_from_mem(
82
 
        "<inkscape-extension>\n"
 
82
        "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
83
83
            "<name>" N_("SVG Output") "</name>\n"
84
84
            "<id>" SP_MODULE_KEY_OUTPUT_SVG "</id>\n"
85
85
            "<output>\n"
86
86
                "<extension>.svg</extension>\n"
87
 
                "<mimetype>image/x-svg</mimetype>\n"
 
87
                "<mimetype>image/svg+xml</mimetype>\n"
88
88
                "<filetypename>" N_("Plain SVG (*.svg)") "</filetypename>\n"
89
89
                "<filetypetooltip>" N_("Scalable Vector Graphics format as defined by the W3C") "</filetypetooltip>\n"
90
90
            "</output>\n"
175
175
    \param     doc   Document to save.
176
176
    \param     uri   The filename to save the file to.
177
177
 
178
 
    This function first checks it's parameters, and makes sure that
 
178
    This function first checks its parameters, and makes sure that
179
179
    we're getting good data.  It also checks the module ID of the
180
 
    incoming module to figure out if this is save should include
 
180
    incoming module to figure out whether this save should include
181
181
    the Inkscape namespace stuff or not.  The result of that comparison
182
182
    is stored in the spns variable.
183
183
 
191
191
    all of this code.  I just stole it.
192
192
*/
193
193
void
194
 
Svg::save (Inkscape::Extension::Output *mod, SPDocument *doc, const gchar *uri)
 
194
Svg::save(Inkscape::Extension::Output *mod, SPDocument *doc, gchar const *filename)
195
195
{
196
196
    g_return_if_fail(doc != NULL);
197
 
    g_return_if_fail(uri != NULL);
198
 
 
199
 
    gchar *save_path = g_path_get_dirname (uri);
200
 
 
201
 
    gboolean const spns = (!mod->get_id()
 
197
    g_return_if_fail(filename != NULL);
 
198
 
 
199
    gchar *save_path = g_path_get_dirname(filename);
 
200
 
 
201
    bool const spns = ( !mod->get_id()
202
202
      || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVG_INKSCAPE)
203
203
      || !strcmp (mod->get_id(), SP_MODULE_KEY_OUTPUT_SVGZ_INKSCAPE));
204
204
 
209
209
    } else {
210
210
        rdoc = sp_repr_document_new ("svg:svg");
211
211
        repr = rdoc->root();
212
 
        repr = sp_document_root (doc)->updateRepr(repr, SP_OBJECT_WRITE_BUILD);
 
212
        repr = sp_document_root (doc)->updateRepr(rdoc, repr, SP_OBJECT_WRITE_BUILD);
213
213
    }
214
214
 
215
 
    Inkscape::IO::fixupHrefs( doc, save_path, spns );
216
 
 
217
 
    gboolean const s = sp_repr_save_file (repr->document(), uri, SP_SVG_NS_URI);
218
 
    if (s == FALSE) {
 
215
    if (!sp_repr_save_rebased_file(repr->document(), filename, SP_SVG_NS_URI,
 
216
                                   doc->base, filename)) {
219
217
        throw Inkscape::Extension::Output::save_failed();
220
218
    }
221
219