Update Spanish translation
[gnumeric.git] / plugins / applix / applix-write.c
blobc29e919761cfc601b453f17623886f61a4e7a905
2 /*
3 * applix-write.c : Routines to write applix version 4 spreadsheets.
5 * I have no docs or specs for this format that are useful.
6 * This is a guess based on some sample sheets.
8 * Copyright (C) 2000-2002 Jody Goldberg (jody@gnome.org)
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
23 * USA
25 #include <gnumeric-config.h>
26 #include <gnumeric.h>
27 #include "applix.h"
28 #include <application.h>
29 #include <expr.h>
30 #include <value.h>
31 #include <sheet.h>
32 #include <number-match.h>
33 #include <cell.h>
34 #include <parse-util.h>
35 #include <sheet-style.h>
36 #include <style.h>
37 #include <style-border.h>
38 #include <style-color.h>
39 #include <selection.h>
40 #include <position.h>
41 #include <ranges.h>
42 #include <goffice/goffice.h>
43 #include <workbook-view.h>
44 #include <workbook.h>
46 #include <string.h>
47 #include <gsf/gsf-output.h>
49 typedef struct {
50 GsfOutput *sink;
51 GOErrorInfo *parse_error;
52 WorkbookView const *wb_view;
53 Workbook *wb;
54 } ApplixWriteState;
56 /* #define NO_DEBUG_APPLIX */
57 #ifndef NO_DEBUG_APPLIX
58 #define d(level, code) do { if (debug_applix_write > level) { code } } while (0)
59 static int debug_applix_write = 0;
60 #else
61 #define d(level, code)
62 #endif
64 static void
65 applix_write_header (ApplixWriteState const *state)
67 gsf_output_printf (state->sink,
68 "*BEGIN SPREADSHEETS VERSION=442/430 "
69 "ENCODING=7BIT\n");
70 gsf_output_printf (state->sink, "Num ExtLinks: 0\n");
71 gsf_output_printf (state->sink,
72 "Spreadsheet Dump Rev 4.42 Line Length 80\n");
73 #warning "FIXME: filename is fs encoded; that's not right, but neither is UTF-8."
74 gsf_output_printf (state->sink,
75 "Current Doc Real Name: %s",
76 go_doc_get_uri (GO_DOC (state->wb)));
79 static void
80 applix_write_colormap (ApplixWriteState *state)
84 void
85 applix_write (GOIOContext *io_context, WorkbookView const *wb_view, GsfOutput *sink)
87 ApplixWriteState state;
89 /* Init the state variable */
90 state.sink = sink;
91 state.parse_error = NULL;
92 state.wb_view = wb_view;
93 state.wb = wb_view_get_workbook (wb_view);
95 d (1, fprintf (stderr, "------------Start writing"););
96 applix_write_header (&state);
97 applix_write_colormap (&state);
98 d (1, fprintf (stderr, "------------Finish writing"););
100 if (state.parse_error != NULL)
101 go_io_error_info_set (io_context, state.parse_error);