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
25 #include <gnumeric-config.h>
28 #include <application.h>
32 #include <number-match.h>
34 #include <parse-util.h>
35 #include <sheet-style.h>
37 #include <style-border.h>
38 #include <style-color.h>
39 #include <selection.h>
42 #include <goffice/goffice.h>
43 #include <workbook-view.h>
47 #include <gsf/gsf-output.h>
51 GOErrorInfo
*parse_error
;
52 WorkbookView
const *wb_view
;
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;
61 #define d(level, code)
65 applix_write_header (ApplixWriteState
const *state
)
67 gsf_output_printf (state
->sink
,
68 "*BEGIN SPREADSHEETS VERSION=442/430 "
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
)));
80 applix_write_colormap (ApplixWriteState
*state
)
85 applix_write (GOIOContext
*io_context
, WorkbookView
const *wb_view
, GsfOutput
*sink
)
87 ApplixWriteState state
;
89 /* Init the state variable */
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
);