Commit 8a48a5c7 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Add psion plugin from Frodo Looijaard <frodol@dds.nl>

2001-07-24  Jody Goldberg <jgoldberg@home.com>

	* plugins/Makefile.am (SUBDIRS) : Add psion plugin from
	Frodo Looijaard <frodol@dds.nl>
parent 93b1ddb6
Gnumeric 0.69
Andreas:
* Rewrite descriptive statistics analysis improving error checks
and labels for data sets and removing duplicate calculation
code.
Jody:
* More important things.
Morten:
* Fix MODE.
Frodo Looijaard:
* Add the psion support.
Zbigniew:
* i18n fixes.
......
......@@ -36,8 +36,14 @@ else
GDA_DIR=
endif
if WITH_PSICONV
PSICONV_DIR=psiconv
else
PSICONV_DIR=
endif
SUBDIRS_FILE_FORMATS = excel lotus-123 oleo sc sylk xbase html dif plan-perfect \
xml_sax applix $(GNOME_GLOSSARY_DIR)
xml_sax applix $(GNOME_GLOSSARY_DIR) $(PSICONV_DIR)
SUBDIRS_FUNCTIONS = $(PYTHON_DIR) $(PERL_DIR) $(GUILE_DIR) $(GB_DIR) \
numtheory derivatives $(GDA_DIR) $(PYFUNC_DIR)
......
......@@ -437,6 +437,19 @@ write_window2 (BiffPut *bp, MsBiffVersion ver, ExcelSheet *sheet)
ms_biff_put_commit (bp);
}
/* See: S59DCA.HTM */
static void
write_pane (BiffPut *bp, MsBiffVersion ver, ExcelSheet *sheet)
{
guint8 *data = ms_biff_put_len_next (bp, BIFF_PANE, 10);
MS_OLE_SET_GUINT16 (data + 0, 0); /* x */
MS_OLE_SET_GUINT16 (data + 2, 0); /* y */
MS_OLE_SET_GUINT16 (data + 4, 0); /* top row */
MS_OLE_SET_GUINT32 (data + 6, 0); /* left col */
MS_OLE_SET_GUINT32 (data + 8, 0); /* active pane */
}
/*
* No documentation exists for this record, but this makes
* sense given the other record formats.
......@@ -548,13 +561,6 @@ write_bits (BiffPut *bp, ExcelWorkbook *wb, MsBiffVersion ver)
write_window1 (bp, ver, wb->gnum_wb_view);
if (ver >= MS_BIFF_V8 && 0 /* if we have panes */) {
/* See: S59DCA.HTM */
data = ms_biff_put_len_next (bp, BIFF_PANE, 2);
MS_OLE_SET_GUINT16 (data, 0x0);
ms_biff_put_commit (bp);
}
/* See: S59D5B.HTM */
data = ms_biff_put_len_next (bp, BIFF_BACKUP, 2);
MS_OLE_SET_GUINT16 (data, 0x0);
......@@ -3220,6 +3226,8 @@ write_sheet_tail (IOContext *context, BiffPut *bp, ExcelSheet *sheet)
write_window1 (bp, ver, sheet->wb->gnum_wb_view);
write_window2 (bp, ver, sheet);
if (sheet_is_frozen (sheet->gnum_sheet))
write_pane (bp, ver, sheet);
if (ver >= MS_BIFF_V8) {
/* Dont over think this just force the fraction into a/1000 */
......
......@@ -14,7 +14,7 @@
#include "sheet.h"
#include "cell.h"
#include "parse-util.h"
#include "command-context-corba.h"
#include "workbook-control-corba.h"
#include "selection.h"
#include "commands.h"
......
......@@ -15,7 +15,7 @@
#include "cell.h"
#include "parse-util.h"
#include "commands.h"
#include "command-context-corba.h"
#include "workbook-control-corba.h"
#include "selection.h"
#include <gbrun/libgbrun.h>
......
2001-07-24 Jody Goldberg <jgoldberg@home.com>
* boot.c : ditto.
* plugin.xml : new file
* Makefile.am : ditto.
* psiconv-read.c : ditto.
* psiconv-plugin.h : ditto.
# TODO: Use %PSICONV_FLAGS% and %PSICONV_LIBS%
INCLUDES = \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-I$(includedir) -I$(top_srcdir)/src \
$(GNOME_INCLUDEDIR) $(PSICONV_CFLAGS)
gnumeric_plugin_psiconvdir = $(gnumeric_plugindir)/psiconv
gnumeric_plugin_psiconv_DATA = plugin.xml
gnumeric_plugin_psiconv_LTLIBRARIES = psiconv.la
psiconv_la_LDFLAGS = -module -avoid-version $(PSICONV_LIBS)
psiconv_la_SOURCES = boot.c psiconv-read.c psiconv-plugin.h
EXTRA_DIST = $(gnumeric_plugin_psiconv_DATA)
/* vim: set sw=8:
* $Id$
*/
/*
* boot.c : Installation and bootstraping routines to
* register the psiconv plugin.
*
* Copyright (C) 2000 Frodo Looijaard (frodol@hdds.nl)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
#include "config.h"
#include "gnumeric.h"
#include "io-context.h"
#include "plugin.h"
#include "plugin-util.h"
#include "module-plugin-defs.h"
#include "psiconv-plugin.h"
#include "workbook-view.h"
#include "workbook.h"
#include <stdio.h>
#include <string.h>
#include <gnome.h>
GNUMERIC_MODULE_PLUGIN_INFO_DECL;
gboolean psiconv_file_probe (GnumFileOpener const *fo, const gchar *file_name,
FileProbeLevel pl);
void psiconv_file_open (GnumFileOpener const *fo, IOContext *io_context,
WorkbookView *wb_view, const char *filename);
gboolean
psiconv_file_probe (GnumFileOpener const *fo, const gchar *file_name, FileProbeLevel pl)
{
FILE *file;
gboolean res;
file = fopen (file_name, "rb");
if (file == NULL)
return FALSE;
res = psiconv_read_header (file);
fclose (file);
return res;
}
void
psiconv_file_open (GnumFileOpener const *fo, IOContext *io_context,
WorkbookView *wb_view, const char *filename)
{
FILE *file;
ErrorInfo *error;
Workbook *wb;
file = gnumeric_fopen_error_info (filename, "r", &error);
if (file == NULL) {
gnumeric_io_error_info_set (io_context, error);
} else {
wb = wb_view_workbook(wb_view);
psiconv_read (io_context, wb, file);
fclose (file);
}
}
<?xml version="1.0"?>
<plugin id="Gnumeric_psiconv">
<information name="Psiconv" description="Imports Psion 5 series Sheet files "/>
<loader type="g_module">
<attribute name="module_file" value="psiconv.so"/>
</loader>
<services>
<service type="file_opener" id="psiconv" priority="100" probe="TRUE">
<information description="Psion (*.psisheet) file format"/>
<file_patterns>
<file_pattern type="shell_pattern" value="*.psisheet"/>
</file_patterns>
<save_info saver_id="" format_level="manual_remember"/>
</service>
</services>
</plugin>
#ifndef PLUGIN_PSICONV_PLUGIN_H
#define PLUGIN_PSICONV_PLUGIN_H
#include "gnumeric.h"
#include "io-context.h"
#include <stdio.h>
gboolean psiconv_read_header (FILE *file);
void psiconv_read (IOContext *io_context, Workbook *wb, FILE *file);
#endif /* PLUGIN_PSICONV_PLUGIN_H */
/* vim: set sw=8: */
/*
* psiconv-read.c : Routines to read Psion 5 series Sheet files
*
* Copyright (C) 2001 Frodo Looijaard (frodol@dds.nl)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*/
/* Search for `TODO' for a list of things to do */
/* TODO: Limit the number of include files a bit */
#include "config.h"
#include <libgnome/libgnome.h>
#include "psiconv-plugin.h"
#include "application.h"
#include "expr.h"
#include "value.h"
#include "sheet.h"
#include "number-match.h"
#include "cell.h"
#include "parse-util.h"
#include "sheet-style.h"
#include "style.h"
#include "style-border.h"
#include "style-color.h"
#include "selection.h"
#include "position.h"
#include "ranges.h"
#include "io-context.h"
#include "workbook-view.h"
#include "workbook.h"
#include "error-info.h"
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <psiconv/parse.h>
static void
append_zeros (char *s, int n)
{
if (n > 0) {
s = s + strlen (s);
*s++ = '.';
while (n--)
*s++ = '0';
*s = 0;
}
}
static CellRef *
cellref_new(int row, gboolean row_abs,int col, gboolean col_abs)
{
CellRef *res = g_new (CellRef,1);
res->sheet = NULL;
res->row = row;
res->col = col;
res->row_relative = row_abs?0:1;
res->col_relative = col_abs?0:1;
return res;
}
static void
set_format(MStyle *style, const psiconv_sheet_numberformat psi_numberformat)
{
/* 100 should be long enough, but to be really safe, use strncpy */
char fmt_string[100];
/* TODO: Dates and times are still wrong. What about localisation? */
strcpy(fmt_string,"");
if (psi_numberformat->code == psiconv_numberformat_fixeddecimal) {
strcpy(fmt_string,"0");
append_zeros(fmt_string, psi_numberformat->decimal);
} else if (psi_numberformat->code == psiconv_numberformat_scientific) {
strcpy(fmt_string,"0");
append_zeros(fmt_string, psi_numberformat->decimal);
strcat (fmt_string, "E+00");
} else if (psi_numberformat->code == psiconv_numberformat_currency) {
/* TODO: Determine currency symbol somehow */
strcpy(fmt_string,"$0");
append_zeros(fmt_string, psi_numberformat->decimal);
} else if (psi_numberformat->code == psiconv_numberformat_percent) {
strcpy(fmt_string,"0");
append_zeros(fmt_string, psi_numberformat->decimal);
strcat (fmt_string, "%");
} else if (psi_numberformat->code == psiconv_numberformat_triads) {
strcpy(fmt_string,"#,##0");
append_zeros(fmt_string, psi_numberformat->decimal);
} else if (psi_numberformat->code == psiconv_numberformat_text) {
strcpy(fmt_string,"@");
} else if (psi_numberformat->code == psiconv_numberformat_date_dmm) {
strcpy(fmt_string,"d-mm");
} else if (psi_numberformat->code == psiconv_numberformat_date_mmd) {
strcpy(fmt_string,"mm-d");
} else if (psi_numberformat->code == psiconv_numberformat_date_ddmmyy) {
strcpy(fmt_string,"dd-mm-yy");
} else if (psi_numberformat->code == psiconv_numberformat_date_mmddyy) {
strcpy(fmt_string,"mm-dd-yy");
} else if (psi_numberformat->code == psiconv_numberformat_date_yymmdd) {
strcpy(fmt_string,"yy-mm-dd");
} else if (psi_numberformat->code == psiconv_numberformat_date_dmmm) {
strcpy(fmt_string,"d mmm");
} else if (psi_numberformat->code == psiconv_numberformat_date_dmmmyy) {
strcpy(fmt_string,"d mmm yy");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_ddmmmyy) {
strcpy(fmt_string,"dd mmm yy");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_mmm) { strcpy(fmt_string,"mmm");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_monthname) {
strcpy(fmt_string,"mmmm");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_mmmyy) {
strcpy(fmt_string,"mmm yy");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_monthnameyy) {
strcpy(fmt_string,"mmmm yy");
} else if (psi_numberformat->code ==
psiconv_numberformat_date_monthnamedyyyy) {
strcpy(fmt_string,"mmmm d, yyyy");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_ddmmyyyyhhii) {
strcpy(fmt_string,"dd-mm-yyyy h:mm AM/PM");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_ddmmyyyyHHii) {
strcpy(fmt_string,"dd-mm-yyyy h:mm");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_mmddyyyyhhii) {
strcpy(fmt_string,"mm-dd-yyyy h:mm AM/PM");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_mmddyyyyHHii) {
strcpy(fmt_string,"mm-dd-yyyy h:mm");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_yyyymmddhhii) {
strcpy(fmt_string,"yyyy-mm-dd h:mm AM/PM");
} else if (psi_numberformat->code ==
psiconv_numberformat_datetime_yyyymmddHHii) {
strcpy(fmt_string,"yyyy-mm-dd h:mm");
} else if (psi_numberformat->code == psiconv_numberformat_time_hhii) {
strcpy(fmt_string,"h:mm AM/PM");
} else if (psi_numberformat->code == psiconv_numberformat_time_hhiiss) {
strcpy(fmt_string,"h:mm:ss AM/PM");
} else if (psi_numberformat->code == psiconv_numberformat_time_HHii) {
strcpy(fmt_string,"h:mm");
} else if (psi_numberformat->code == psiconv_numberformat_time_HHiiss) {
strcpy(fmt_string,"h:mm:ss");
} /* TODO: Add True/False */
if (fmt_string[0])
mstyle_set_format_text (style, fmt_string);
}
static StyleColor *
get_color(const psiconv_color color)
{
return style_color_new(color->red*256,color->green*256,color->blue*256);
}
static void
set_layout(MStyle * style,const psiconv_sheet_cell_layout psi_layout)
{
StyleColor *color;
set_format(style,psi_layout->numberformat);
mstyle_set_font_size(style,psi_layout->character->font_size);
mstyle_set_font_italic(style,psi_layout->character->italic?TRUE:FALSE);
mstyle_set_font_bold(style,psi_layout->character->bold?TRUE:FALSE);
mstyle_set_font_uline(style,
psi_layout->character->underline?TRUE:FALSE);
mstyle_set_font_strike(style,
psi_layout->character->strikethrough?TRUE:FALSE);
mstyle_set_font_name(style,psi_layout->character->font->name);
color = get_color(psi_layout->character->color);
if (color)
mstyle_set_color(style,MSTYLE_COLOR_FORE,color);
/* TODO: Character level layouts: super_sub */
/* TODO: Paragraph level layouts: all */
/* TODO: Background color: add transparant if white */
#if 0
color = get_color(psi_layout->paragraph->back_color);
if (color) {
mstyle_set_color(style,MSTYLE_COLOR_BACK,color);
mstyle_set_color(style,MSTYLE_COLOR_PATTERN,color);
/* TODO: Replace 24 with some symbol */
mstyle_set_pattern(style,1);
}
#endif
}
static void
set_style(Sheet *sheet, int row, int col,
const psiconv_sheet_cell_layout psi_layout,
const MStyle *default_style)
{
MStyle *style;
style = mstyle_copy(default_style);
if (!style)
return;
set_layout(style,psi_layout);
sheet_style_set_pos(sheet,col,row,style);
}
static void
set_value(Cell *cell, const psiconv_sheet_cell psi_cell)
{
Value *v;
if (psi_cell->type == psiconv_cell_int)
v = value_new_int(psi_cell->data.dat_int);
else if (psi_cell->type == psiconv_cell_float)
v = value_new_float(psi_cell->data.dat_float);
else if (psi_cell->type == psiconv_cell_string)
v = value_new_string(psi_cell->data.dat_string);
else if (psi_cell->type == psiconv_cell_bool)
v = value_new_bool(psi_cell->data.dat_bool);
else if (psi_cell->type == psiconv_cell_blank)
v = value_new_empty();
else if (psi_cell->type == psiconv_cell_error)
/* TODO: value_new_error */
v = value_new_empty();
else
/* TODO: value_new_error */
v = value_new_empty();
if (v)
cell_set_value(cell,v,NULL);
}
static ExprTree *
parse_subexpr(const psiconv_formula psi_formula)
{
int nrargs=0; /* -1 for variable */
int kind=-1; /* 0 for dat, 1 for operator, 2 for formula, 3 for special,
-1 for unknown */
psiconv_formula psi_form1,psi_form2;
ExprTree *expr1=NULL,*expr2=NULL;
CellRef *cr1=NULL,*cr2=NULL;
switch(psi_formula->type) {
/* Translates values */
case psiconv_formula_dat_float:
case psiconv_formula_dat_int:
case psiconv_formula_dat_string:
case psiconv_formula_dat_cellblock:
case psiconv_formula_dat_vcellblock:
nrargs = 0;
kind = 0;
break;
/* Translates to binary operators */
case psiconv_formula_op_lt:
case psiconv_formula_op_le:
case psiconv_formula_op_gt:
case psiconv_formula_op_ge:
case psiconv_formula_op_ne:
case psiconv_formula_op_eq:
case psiconv_formula_op_add:
case psiconv_formula_op_sub:
case psiconv_formula_op_mul:
case psiconv_formula_op_div:
/* case psiconv_formula_op_pow: */
/* case psiconv_formula_op_and: */
/* case psiconv_formula_op_or: */
/* case psiconv_formula_op_con: */
nrargs = 2;
kind = 1;
break;
/* Translates to unary operators */
case psiconv_formula_op_pos:
case psiconv_formula_op_neg:
case psiconv_formula_op_not:
nrargs = 1;
kind = 1;
break;
/* Specially handled */
case psiconv_formula_dat_cellref:
case psiconv_formula_op_bra:
nrargs = 1;
kind = 3;
break;
/* Should never happen; caught by the default */
/* case psiconv_formula_mark_eof: */
/* case psiconv_formula_mark_opsep: */
/* case psiconv_formula_mark_opend: */
default:
/* kind = -1; */
/* break; */
}
if (kind == -1) {
/* Unknown value */
return NULL;
} else if (kind == 0) {
/* Handling data */
Value *v = NULL;
switch(psi_formula->type) {
case psiconv_formula_dat_float:
v = value_new_float(psi_formula->data.dat_float);
break;
case psiconv_formula_dat_int:
v = value_new_int(psi_formula->data.dat_int);
break;
case psiconv_formula_dat_string:
v = value_new_string(psi_formula->data.dat_string);
break;
case psiconv_formula_dat_cellblock:
cr1 = cellref_new
(psi_formula->data.dat_cellblock.first.row.offset,
psi_formula->data.dat_cellblock.first.row.absolute,
psi_formula->data.dat_cellblock.first.column.offset,
psi_formula->data.dat_cellblock.first.column.absolute);
cr2 = cellref_new
(psi_formula->data.dat_cellblock.last.row.offset,
psi_formula->data.dat_cellblock.last.row.absolute,
psi_formula->data.dat_cellblock.last.column.offset,
psi_formula->data.dat_cellblock.last.column.absolute);
if (!cr1 || !cr2)
break;
v = value_new_cellrange(cr1,cr2,1,1);
break;
default:
}
if (!v)
return NULL;
return expr_tree_new_constant(v);
} else if (kind == 1) {
/* Handling the operators */
if (nrargs >= 1) {
if (!(psi_form1 = psiconv_list_get
(psi_formula->data.fun_operands,0)))
return NULL;
if (!(expr1 = parse_subexpr(psi_form1)))
return NULL;
}
if (nrargs >= 2) {
if (!(psi_form2 = psiconv_list_get
(psi_formula->data.fun_operands,1))) {
expr_tree_unref(expr1);
return NULL;
}
if (!(expr2 = parse_subexpr(psi_form2))) {
expr_tree_unref(expr1);
return NULL;
}
}
switch(psi_formula->type) {
case psiconv_formula_op_lt:
return expr_tree_new_binary(expr1,OPER_LT,expr2);
case psiconv_formula_op_le:
return expr_tree_new_binary(expr1,OPER_LTE,expr2);
case psiconv_formula_op_gt:
return expr_tree_new_binary(expr1,OPER_GT,expr2);
case psiconv_formula_op_ge:
return expr_tree_new_binary(expr1,OPER_GTE,expr2);
case psiconv_formula_op_ne:
return expr_tree_new_binary(expr1,OPER_NOT_EQUAL,expr2);
case psiconv_formula_op_eq:
return expr_tree_new_binary(expr1,OPER_EQUAL,expr2);
case psiconv_formula_op_add:
return expr_tree_new_binary(expr1,OPER_ADD,expr2);
case psiconv_formula_op_sub:
return expr_tree_new_binary(expr1,OPER_SUB,expr2);
case psiconv_formula_op_mul:
return expr_tree_new_binary(expr1,OPER_MULT,expr2);
case psiconv_formula_op_div:
return expr_tree_new_binary(expr1,OPER_DIV,expr2);
case psiconv_formula_op_pos:
return expr_tree_new_unary(OPER_UNARY_PLUS,expr1);
case psiconv_formula_op_neg:
return expr_tree_new_unary(OPER_UNARY_NEG,expr1);
default:
expr_tree_unref(expr1);
expr_tree_unref(expr2);
return NULL;
}
} else if (kind == 3) {
switch(psi_formula->type) {
case psiconv_formula_dat_cellref:
cr1 = cellref_new
(psi_formula->data.dat_cellref.row.offset,
psi_formula->data.dat_cellref.row.absolute,
psi_formula->data.dat_cellref.column.offset,
psi_formula->data.dat_cellref.column.absolute);
if (!cr1)
return NULL;
return expr_tree_new_var(cr1);
case psiconv_formula_op_bra:
if (!(psi_form1 = psiconv_list_get
(psi_formula->data.fun_operands,0)))
return NULL;
return parse_subexpr(psi_form1);
default:
}
}
return NULL;
}
static void
set_expr(Cell *cell, const psiconv_formula psi_formula)
{
ExprTree *expr = parse_subexpr(psi_formula);
if (expr)
cell_set_expr(cell,expr,NULL);
}
static void
add_cell(Sheet *sheet, const psiconv_sheet_cell psi_cell,
const psiconv_formula_list psi_formulas, const MStyle * default_style)
{
Cell *cell;
psiconv_formula psi_formula;
cell = sheet_cell_fetch(sheet,psi_cell->column,psi_cell->row);
if (!cell)
return;
/* set_expr might fail, so we do the set_value even if there is an
formula associated with this cell */
set_value(cell,psi_cell);
if (psi_cell->calculated) {
/* If psiconv_list_get fails, something is very wrong... */
if ((psi_formula = psiconv_get_formula(psi_formulas,
psi_cell->ref_formula))) {
set_expr(cell,psi_formula);
/* TODO: Is this the right function to call? */
cell_eval_content(cell);
}
}
/* TODO: Perhaps this must be moved above set_format */
set_style(sheet,psi_cell->row,psi_cell->column,psi_cell->layout,
default_style);
}
static void
add_cells(Sheet *sheet, const psiconv_sheet_cell_list psi_cells,
const psiconv_formula_list psi_formulas,
const MStyle *default_style)
{
psiconv_u32 i;
psiconv_sheet_cell psi_cell;
for (i = 0; i < psiconv_list_length(psi_cells); i++) {
/* If psiconv_list_get fails, something is very wrong... */
if ((psi_cell = psiconv_list_get(psi_cells,i)))
add_cell(sheet,psi_cell,psi_formulas, default_style);
}
}
static void
add_worksheet(Workbook *wb, psiconv_sheet_worksheet psi_worksheet,int nr,
psiconv_formula_list psi_formulas)
{
Sheet *sheet;
char *sheet_name;
MStyle *default_style;
sheet_name = g_strdup_printf (_("Sheet%d"),nr);
sheet = sheet_new (wb, sheet_name);
g_free (sheet_name);
if (!sheet)
return;
/* Default layout */
default_style = mstyle_new_default();
if (!default_style) {
sheet_destroy(sheet);
return;
}
set_layout(default_style,psi_worksheet->default_layout);
/* TODO: Add show_zeros */
add_cells(sheet,psi_worksheet->cells,psi_formulas,default_style);
/* TODO: What about the NULL? */
sheet_flag_recompute_spans(sheet);
workbook_sheet_attach (wb,sheet,NULL);
}
static void
add_workbook(Workbook *wb, psiconv_sheet_workbook_section psi_workbook)
{
psiconv_u32 i;