Commit be3b2686 authored by Arturo Espinosa's avatar Arturo Espinosa

New style system from Michael Meeks.



New style system from Michael Meeks.
parent 93b1c9d2
No preview for this file type
No preview for this file type
1999-10-22 Miguel de Icaza <miguel@gnu.org>
* Makefile.am ($(GRAPH_CORBA_GENERATED)): Do not use BUILT_SOURCES
as suggested by Tom.
1999-09-30 Miguel de Icaza <miguel@gnu.org>
* New ChangeLog file.
......
......@@ -17,6 +17,7 @@ GRAPH_CORBA_GENERATED = \
Graph.h
graph_SOURCES = \
$(GRAPH_CORBA_GENERATED)\
graph.c \
graph.h \
graph-vector.c \
......@@ -37,21 +38,19 @@ graph_SOURCES = \
layout-view.h \
main.c \
vector.c \
vector.h \
$(GRAPH_CORBA_GENERATED)
vector.h
graph_LDADD = \
$(EXTRA_GNOME_LIBS) \
$(INTLLIBS)
BUILT_SOURCES = $(GRAPH_CORBA_GENERATED)
$(GRAPH_CORBA_GENERATED): my_graph_idl
my_graph_idl: Graph.idl $(top_srcdir)/src/Gnumeric-value.idl $(top_srcdir)/src/Gnumeric.idl
$(GRAPH_CORBA_GENERATED): Graph.idl $(top_srcdir)/src/Gnumeric-value.idl $(top_srcdir)/src/Gnumeric.idl
orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) -I$(top_srcdir) $(srcdir)/Graph.idl
touch my_graph_idl
CLEANFILES = my_graph_idl
idldir = $(datadir)/idl
idl_DATA = Graph.idl
MYHACKAROUNDAUTOMAKE=$(shell echo $(GNUMERIC_CORBA_GENERATED))
EXTRA_DIST = $(idl_DATA) $(MYHACKAROUNDAUTOMAKE) graph.gnorba
\ No newline at end of file
......@@ -2,6 +2,16 @@
* ms-formula-read.c (ms_excel_parse_formula): Fix for non-shared
references to cells below row 256.
1999-10-20 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_sheet_insert): Set XF before sheet_cell_fetch
for big speedup. (ms_excel_read_formula): ditto.
1999-10-19 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_get_stylefont ms_excel_set_xf): use new
'helper' functions.
1999-10-08 Jody Goldberg <jgoldberg@home.com>
......@@ -29,6 +39,70 @@
* boot.c (excel_probe) : Only free the MsOle object if it
was created successfully.
1999-09-29 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_cell:MULBLANK) : Insert blanks in
reverse order, to decrease the load on the insert routines.
1999-09-26 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_cell:COLINFO) : Seems like
XL periodically sends column widths for phantom columns.
1999-10-19 Morten Welinder <terra@diku.dk>
* ms-formula-read.c (ms_excel_parse_formula): Get row as 16 bit value,
for both AREA_3D and AREA[N].
1999-10-18 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_xf): Ref count colors correctly.
1999-10-16 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_cell_font): renamed + kill Cell.
(style_optimize): kill Cell argument.
(ms_excel_set_cell_xf): use style_attach + kill Cell arg. + renamed.
(ms_excel_sheet_insert, ms_excel_read_formula),
(ms_excel_sheet_insert_val): update removing Cell argument.
(ms_excel_sheet_insert_blank): Create.
(ms_excel_read_cell): use insert_blank.
1999-10-15 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_cell_xf): Update style creation +
only setup border if it non NULL, fixup optimization regions.
(ms_excel_set_cell_font): update + add array argument.
(style_optimize): split out. (ms_excel_read_sheet): Add post-optimize.
1999-10-13 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_cell_font): New String in style.
1999-10-11 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_cell_xf): better optimize region
generation.
1999-10-10 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_sheet_new): Initialize range.
(ms_excel_set_cell_xf): Add range optimization.
(ms_bug_get_padding): Kill.
* ms-excel-read.h (ExcelSheet): Add style_optimize field.
1999-10-09 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_set_cell_xf): Adapt to new Border support.
1999-10-07 Michael Meeks <mmeeks@gnu.org>
* ms-excel-read.c (ms_excel_set_cell_xf): Large hack to new style
code. (biff_font_data_get_style_font): kill it.
(biff_font_data_new): remove setting up fd->style_font.
(biff_font_data_destroy): kill style_font bits.
1999-10-02 Jody Goldberg <jgoldberg@home.com>
* *.c : Ensure that we include config.h first.
......
......@@ -18,6 +18,7 @@
#include "ms-escher.h"
#include "print-info.h"
#include "selection.h"
#include "border.h"
#include "utils.h" /* for cell_name */
/* #define NO_DEBUG_EXCEL */
......@@ -41,33 +42,15 @@ static ExcelSheet *ms_excel_sheet_new (ExcelWorkbook *wb,
static void ms_excel_workbook_attach (ExcelWorkbook *wb,
ExcelSheet *ans);
/*static guint16
ms_bug_get_padding (const BiffQuery *q, guint16 opcode)
{
guint8 ls_op = (opcode & 0x00ff);
guint ans=0;
#define STYLE_TOP (MSTYLE_BORDER_TOP - MSTYLE_BORDER_TOP)
#define STYLE_BOTTOM (MSTYLE_BORDER_BOTTOM - MSTYLE_BORDER_TOP)
#define STYLE_LEFT (MSTYLE_BORDER_LEFT - MSTYLE_BORDER_TOP)
#define STYLE_RIGHT (MSTYLE_BORDER_RIGHT - MSTYLE_BORDER_TOP)
#define STYLE_DIAGONAL (MSTYLE_BORDER_DIAGONAL - MSTYLE_BORDER_TOP)
#define STYLE_REV_DIAGONAL (MSTYLE_BORDER_REV_DIAGONAL - MSTYLE_BORDER_TOP)
switch (ls_op)
{
case BIFF_SST:
ans=1;
break;
case BIFF_MS_O_DRAWING_GROUP:
case BIFF_MS_O_DRAWING:
ans=0;
break;
default:
#if BIFF_DEBUG > 0
printf ("Unknown padding to fix bug on record 0x%x\n", opcode);
#endif
break;
}
#if BIFF_DEBUG > 0
printf ("ms_bug_get_padding 0x%x = %d\n",
opcode, ans);
#endif
return ans;
}*/
/* TODO : enable diagonal */
#define STYLE_ORIENT_MAX 4
void
ms_excel_unexpected_biff (BiffQuery *q, char const *const state)
......@@ -96,13 +79,13 @@ biff_guint32_hash (const guint32 *d)
static gint
biff_guint16_equal (const guint16 *a, const guint16 *b)
{
if (*a==*b) return 1;
if (*a == *b) return 1;
return 0;
}
static gint
biff_guint32_equal (const guint32 *a, const guint32 *b)
{
if (*a==*b) return 1;
if (*a == *b) return 1;
return 0;
}
......@@ -259,7 +242,7 @@ biff_get_error_text (const guint8 err)
switch (err)
{
case 0: buf = gnumeric_err_NULL; break;
case 7: buf = gnumeric_err_DIV0; break;
case 7: buf = gnumeric_err_DIV0; break;
case 15: buf = gnumeric_err_VALUE; break;
case 23: buf = gnumeric_err_REF; break;
case 29: buf = gnumeric_err_NAME; break;
......@@ -455,27 +438,6 @@ biff_boundsheet_data_destroy (gpointer key, BiffBoundsheetData *d, gpointer user
return 1;
}
static StyleFont*
biff_font_data_get_style_font (BiffFontData *fd)
{
StyleFont *ans;
if (!fd->fontname) {
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
printf ("Curious no font name on %d\n", fd->index);
}
#endif
style_font_ref (gnumeric_default_font);
return gnumeric_default_font;
}
ans = style_font_new (fd->fontname, fd->height / 20.0, 1.0,
fd->boldness >= 0x2bc, fd->italic);
return ans;
}
/**
* NB. 'fount' is the correct, and original _English_
**/
......@@ -534,8 +496,6 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q)
fd->fontname, fd->height / 20, fd->color_idx);
}
#endif
fd->style_font = biff_font_data_get_style_font (fd);
fd->index = g_hash_table_size (wb->font_data);
if (fd->index >= 4) /* Wierd: for backwards compatibility */
fd->index++;
......@@ -546,8 +506,6 @@ static gboolean
biff_font_data_destroy (gpointer key, BiffFontData *fd, gpointer userdata)
{
g_free (fd->fontname);
if (fd->style_font)
style_font_unref (fd->style_font);
g_free (fd);
return 1;
}
......@@ -992,16 +950,18 @@ ms_excel_get_font (ExcelSheet *sheet, guint16 font_idx)
}
static StyleColor *
ms_excel_set_cell_font (ExcelSheet *sheet, Cell *cell, BiffXFData const *xf)
ms_excel_get_stylefont (ExcelSheet *sheet, BiffXFData const *xf,
MStyle *mstyle)
{
BiffFontData const * fd = ms_excel_get_font (sheet, xf->font_idx);
if (fd == NULL)
return NULL;
if (fd->style_font)
cell_set_font_from_style (cell, fd->style_font);
else
printf ("Duff StyleFont\n");
mstyle_set_font_name (mstyle, fd->fontname);
mstyle_set_font_size (mstyle, fd->height / 20.0);
mstyle_set_font_bold (mstyle, fd->boldness >= 0x2bc);
mstyle_set_font_italic (mstyle, fd->italic);
return ms_excel_palette_get (sheet->wb->palette, fd->color_idx, NULL);
}
......@@ -1022,38 +982,78 @@ ms_excel_get_xf (ExcelSheet *sheet, int const xfidx)
}
static void
ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
style_optimize (ExcelSheet *sheet, int col, int row)
{
g_return_if_fail (sheet != NULL);
if (col < 0) { /* Finish the job */
sheet_style_optimize (sheet->gnum_sheet, sheet->style_optimize);
return;
}
/*
* Generate a range inside which to optimise cell style regions.
*/
if (row > sheet->style_optimize.start.row + 2) {
sheet_style_optimize (sheet->gnum_sheet, sheet->style_optimize);
sheet->style_optimize.start.col = col;
if (row > 0) /* Overlap upwards */
sheet->style_optimize.start.row = row - 1;
else
sheet->style_optimize.start.row = 0;
sheet->style_optimize.end.col = col;
sheet->style_optimize.end.row = row;
} else {
if (col > sheet->style_optimize.end.col)
sheet->style_optimize.end.col = col;
if (col < sheet->style_optimize.start.col)
sheet->style_optimize.start.col = col;
if (row > sheet->style_optimize.end.row)
sheet->style_optimize.end.row = row;
if (row < sheet->style_optimize.end.row)
sheet->style_optimize.start.row = row;
}
}
static void
ms_excel_set_xf (ExcelSheet *sheet, int col, int row, guint16 xfidx)
{
BiffXFData const *xf = ms_excel_get_xf (sheet, xfidx);
StyleColor *fore, *back, *basefore;
int back_index;
MStyle *mstyle;
Range range;
g_return_if_fail (xf);
g_return_if_fail (cell->value);
/*
* Well set it up then ! FIXME: hack !
*/
cell_set_alignment (cell, xf->halign, xf->valign, ORIENT_HORIZ,
xf->wrap);
basefore = ms_excel_set_cell_font (sheet, cell, xf);
mstyle = mstyle_new ();
mstyle_set_align_v (mstyle, xf->valign);
mstyle_set_align_h (mstyle, xf->halign);
mstyle_set_fit_in_cell (mstyle, xf->wrap);
basefore = ms_excel_get_stylefont (sheet, xf, mstyle);
if (sheet->wb->palette) {
int lp;
StyleColor *tmp[4];
for (lp=0;lp<4;lp++)
tmp[lp] = ms_excel_palette_get (sheet->wb->palette,
xf->border_color[lp],
NULL);
cell_set_border (cell, xf->border_type, tmp);
int i;
for (i = 0; i < STYLE_ORIENT_MAX; i++) {
MStyleBorder *border;
border = border_fetch (xf->border_type [i],
ms_excel_palette_get (sheet->wb->palette,
xf->border_color[i],
NULL),
MSTYLE_BORDER_TOP + i);
if (border)
mstyle_set_border (mstyle, MSTYLE_BORDER_TOP + i, border);
}
}
if (xf->style_format)
cell_set_format_from_style (cell, xf->style_format);
mstyle_set_format (mstyle, xf->style_format->format);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 0) {
printf ("%s : Pattern = %d\n",
cell_name (cell->col->pos, cell->row->pos),
cell_name (col, row),
xf->fill_pattern_idx);
}
#endif
......@@ -1062,7 +1062,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
#ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 2) {
printf ("Cell Color : '%s' : (%d, %d)\n",
cell_name (cell->col->pos, cell->row->pos),
cell_name (col, row),
xf->pat_foregnd_col, xf->pat_backgnd_col);
}
#endif
......@@ -1073,7 +1073,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
#ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 2) {
printf ("Cell Color : '%s' : (Fontcol, %d)\n",
cell_name (cell->col->pos, cell->row->pos),
cell_name (col, row),
xf->pat_foregnd_col);
}
#endif
......@@ -1087,8 +1087,22 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
if (xf->fill_pattern_idx == 0)
back_index = 0;
back = ms_excel_palette_get (sheet->wb->palette, back_index, fore);
g_return_if_fail (back && fore);
cell_set_color_from_style (cell, fore, back);
mstyle_set_color (mstyle, MSTYLE_COLOR_FORE, fore);
style_color_ref (fore);
mstyle_set_color (mstyle, MSTYLE_COLOR_BACK, back);
style_color_ref (back);
range.start.col = col;
range.start.row = row;
range.end = range.start;
sheet_style_attach (sheet->gnum_sheet, range, mstyle);
style_optimize (sheet, col, row);
}
static StyleBorderType
......@@ -1112,17 +1126,17 @@ biff_xf_map_border (int b)
case 7: /* Hair */
return BORDER_HAIR;
case 8: /* Medium Dashed */
return BORDER_MEDIUM;
return BORDER_MEDIUM_DASH;
case 9: /* Dash Dot */
return BORDER_THIN;
return BORDER_DASH_DOT;
case 10: /* Medium Dash Dot */
return BORDER_THIN;
return BORDER_MEDIUM_DASH_DOT;
case 11: /* Dash Dot Dot */
return BORDER_HAIR;
return BORDER_DASH_DOT_DOT;
case 12: /* Medium Dash Dot Dot */
return BORDER_THIN;
return BORDER_MEDIUM_DASH_DOT_DOT;
case 13: /* Slanted Dash Dot*/
return BORDER_HAIR;
return BORDER_SLANTED_DASH_DOT;
}
printf ("Unknown border style %d\n", b);
return BORDER_NONE;
......@@ -1381,15 +1395,17 @@ static void
ms_excel_sheet_insert (ExcelSheet *sheet, int xfidx,
int col, int row, const char *text)
{
Cell *cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
Cell *cell;
ms_excel_set_xf (sheet, col, row, xfidx);
cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
/* NB. cell_set_text _certainly_ strdups *text */
if (text)
cell_set_text_simple (cell, text);
else
cell_set_text_simple (cell, "");
ms_excel_set_cell_xf (sheet, cell, xfidx);
}
/* Shared formula support functions */
......@@ -1498,10 +1514,16 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
guint16 const xf_index = EX_GETXF (q);
guint16 const col = EX_GETCOL (q);
guint16 const row = EX_GETROW (q);
Cell *cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
Cell *cell;
ExprTree *expr;
Value *val = NULL;
/* Set format */
ms_excel_set_xf (sheet, col, row, xf_index);
/* Then fetch Cell */
cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0)
printf ("Formula in %s%d;\n", col_name(col), row+1);
......@@ -1655,9 +1677,6 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
/* Set value */
cell->value = val;
/* Set format */
ms_excel_set_cell_xf (sheet, cell, xf_index);
}
BiffSharedFormula *
......@@ -1687,6 +1706,11 @@ ms_excel_sheet_new (ExcelWorkbook *wb, const char *name)
g_hash_table_new ((GHashFunc)biff_shared_formula_hash,
(GCompareFunc)biff_shared_formula_equal);
ans->style_optimize.start.col = 0;
ans->style_optimize.start.row = 0;
ans->style_optimize.end.col = 0;
ans->style_optimize.end.row = 0;
return ans;
}
......@@ -1698,9 +1722,18 @@ ms_excel_sheet_insert_val (ExcelSheet *sheet, int xfidx,
g_return_if_fail (v);
g_return_if_fail (sheet);
ms_excel_set_xf (sheet, col, row, xfidx);
cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
cell_set_value_simple (cell, v);
ms_excel_set_cell_xf (sheet, cell, xfidx);
}
static void
ms_excel_sheet_insert_blank (ExcelSheet *sheet, int xfidx,
int col, int row)
{
g_return_if_fail (sheet);
ms_excel_set_xf (sheet, col, row, xfidx);
}
static void
......@@ -2089,8 +2122,7 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet)
if (ms_excel_read_debug > 0)
printf ("Blank in %s%d xf = 0x%x;\n", col_name(col), row+1, xf);
#endif
ms_excel_sheet_insert_val (sheet, xf, col, row,
value_new_empty());
ms_excel_sheet_insert_blank (sheet, xf, col, row);
break;
}
......@@ -2117,10 +2149,9 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet)
}
for (i = lastcol; i >= firstcol ; --i) {
ptr -= 2;
ms_excel_sheet_insert_val (sheet,
ms_excel_sheet_insert_blank (sheet,
MS_OLE_GET_GUINT16 (ptr),
i, row,
value_new_empty());
i, row);
}
break;
}
......@@ -2499,6 +2530,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
printf ("Serious error detaching sheet '%s'\n",
sheet->gnum_sheet->name);
}
style_optimize (sheet, -1, -1);
return TRUE;
case BIFF_OBJ: /* See: ms-obj.c and S59DAD.HTM */
......
......@@ -19,6 +19,7 @@ typedef struct _ExcelSheet
eBiff_version ver;
GHashTable *shared_formulae;
GList *obj_queue;
Range style_optimize;
} ExcelSheet;
typedef struct _BiffBoundsheetData
......@@ -67,7 +68,6 @@ typedef struct _BiffFontData
int script; /* sub = -1, none = 0, super = 1 */
eBiffFontUnderline underline;
char *fontname;
StyleFont *style_font;
} BiffFontData;
typedef struct _BiffExternSheetData {
......
......@@ -6,6 +6,7 @@
*/
#include <config.h>
#include <math.h>
#include <glib.h>
#include "utils.h"
#include "func.h"
#include "sheet.h"
......
......@@ -169,9 +169,12 @@ gnumeric_cell (FunctionEvalInfo *ei, Value **argv)
} else if (!g_strcasecmp (info_type, "format")) {
Cell *cell = sheet_cell_get (ei->pos.sheet, ref.col, ref.row);
if (cell && CELL_IS_FORMAT_SET (cell))
return translate_cell_format (cell->style->format);
else
if (cell && CELL_IS_FORMAT_SET (cell)) {
Style *style = cell_get_style (cell);
Value *val = translate_cell_format (style->format);
style_unref (style);
return val;
} else
return value_new_string ("G");
} else if (!g_strcasecmp (info_type, "prefix")) {
/* Text value corresponding to the "label prefix" of the cell.
......
......@@ -7,6 +7,7 @@
*/
#include <config.h>
#include <glib.h>
#include "numbers.h"
#include "utils.h"
#include "func.h"
......
1999-10-20 Michael Meeks <mmeeks@gnu.org>
* roff.c (write_wb_roff): kill leak.
* latex.c (html_write_wb_latex, html_write_wb_latex2e): kill leaks.
* epsf.c (epsf_write_cell): kill leak.
* html.c (html_write_cell32): ditto.
1999-10-19 Michael Meeks <mmeeks@gnu.org>
* html.c (html_cell_bold, html_cell_italic, html_read): Update.
1999-10-03 Jody Goldberg <jgoldberg@home.com>
* html.c (html_write_cell32, html_write_cell40) :
Bug #2512. Emit a </TD> after a <TD>.
Use cell_get_horizontal_align to correctly handle
the case of a 'General' format.
1999-10-07 Michael Meeks <mmeeks@gnu.org>
* html.c (html_cell_bold): Update to new style api.
(html_cell_italic, html_read): ditto.
1999-09-28 Michael Meeks <michael@nuclecu.unam.mx>
* html.c (html_write_cell32): Update style api.
(html_cell_bold, html_read, html_write_cell40): ditto.
* latex.c (html_write_wb_latex2e, html_write_wb_latex):
ditto.
* roff.c (write_wb_roff): ditto.
* epsf.c (epsf_write_cell): ditto.
1999-10-03 Jody Goldberg <jgoldberg@home.com>
* html.c (html_write_cell32, html_write_cell40) :
......
......@@ -49,7 +49,7 @@ epsf_write_cell (FILE *fp, Cell *cell, float x, float y)
if (!cell) { /* empty cell */
return;
} else {
style = cell->style;
style = cell_get_style (cell);
if (!style) {
/* is this case posible? */
return;
......@@ -111,6 +111,7 @@ epsf_write_cell (FILE *fp, Cell *cell, float x, float y)
ps_text_left (fp, cell->text->str, x+2, y+2 + (font_size/3));
ps_write_raw (fp, "\n");
}
style_unref (style);
}
}
......
......@@ -65,14 +65,16 @@ html_write_cell32 (FILE *fp, Cell *cell)
Style *style;
unsigned char r, g, b;
fprintf (fp, "\t<TD>");
if (cell != NULL) { /* empty cell */
style = cell->style;
if (!cell) { /* empty cell */
fprintf (fp, "\t<TD>");
} else {
style = cell_get_style (cell);
if (!style) {
/* is this case posible? */
html_fprintf (fp, cell->text->str);
} else {
switch (cell_get_horizontal_align (cell)) {
switch (cell_get_horizontal_align (cell, style->halign)) {
case HALIGN_RIGHT :
fprintf (fp, " align=right");
break;
......@@ -113,6 +115,7 @@ html_write_cell32 (FILE *fp, Cell *cell)
if (r != 0 || g != 0 || b != 0)
fprintf (fp, "</FONT>");
}
style_unref (style);
}
fprintf (fp, "</TD>\n");
}
......@@ -126,14 +129,16 @@ html_write_cell40 (FILE *fp, Cell *cell)
Style *style;
unsigned char r, g, b;
fprintf (fp, "\t<TD>");
if (cell != NULL) {
style = cell->style;
if (!cell) { /* empty cell */
fprintf (fp, "\t<TD>");
} else {
style = cell_get_style (cell);
if (!style) {
/* is this case posible? */
html_fprintf (fp, cell->text->str);
} else {
switch (cell_get_horizontal_align (cell)) {
switch (cell_get_horizontal_align (cell, style->halign)) {
case HALIGN_RIGHT :
fprintf (fp, " halign=right");
break;
......@@ -353,22 +358,15 @@ html_get_string (char *s, int *flags)
static void
html_cell_bold (Cell *cell)
{
Style *style;
StyleFont *sf, *cf;
MStyle *mstyle;
if (!cell)
return;
style = cell->style;
if (!style)
return;
cf = style->font;
if (!cf)
return;
sf = style_font_new_simple (cf->font_name, cf->size, cf->scale,
1, cf->is_italic);
if (sf) {
cell_set_font_from_style (cell, sf);