1.12.42
[gnumeric.git] / plugins / applix / boot.c
blobd9bbe7e239beda3b56c19133081e4858d62990ac
2 /*
3 * boot.c : Installation and bootstraping routines to
4 * register the applix plugin.
6 * Copyright (C) 2000-2002 Jody Goldberg (jody@gnome.org)
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of the
11 * License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
21 * USA
23 #include <gnumeric-config.h>
24 #include <gnumeric.h>
25 #include "applix.h"
27 #include <goffice/goffice.h>
28 #include <gnm-plugin.h>
29 #include <workbook-view.h>
30 #include <workbook.h>
32 #include <gsf/gsf-input.h>
33 #include <string.h>
35 GNM_PLUGIN_MODULE_HEADER;
37 gboolean applix_file_probe (GOFileOpener const *fo, GsfInput *input,
38 GOFileProbeLevel pl);
39 void applix_file_open (GOFileOpener const *fo, GOIOContext *io_context,
40 WorkbookView *wb_view, GsfInput *input);
41 void applix_file_save (GOFileSaver const *fs, GOIOContext *io_context,
42 WorkbookView const *wb_view, GsfOutput *output);
44 gboolean
45 applix_file_probe (GOFileOpener const *fo, GsfInput *input, GOFileProbeLevel pl)
47 static guint8 const signature[] = "*BEGIN SPREADSHEETS VERSION";
48 guint8 const *header;
50 return !gsf_input_seek (input, 0, G_SEEK_SET) &&
51 NULL != (header = gsf_input_read (input, sizeof (signature)-1, NULL)) &&
52 0 == memcmp (header, signature, sizeof (signature)-1);
55 void
56 applix_file_open (GOFileOpener const *fo, GOIOContext *io_context,
57 WorkbookView *wb_view, GsfInput *input)
59 applix_read (io_context, wb_view, input);
62 void
63 applix_file_save (GOFileSaver const *fs, GOIOContext *io_context,
64 WorkbookView const *wb_view, GsfOutput *output)
66 applix_write (io_context, wb_view, output);