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> 1999-09-30 Miguel de Icaza <miguel@gnu.org>
* New ChangeLog file. * New ChangeLog file.
......
...@@ -17,6 +17,7 @@ GRAPH_CORBA_GENERATED = \ ...@@ -17,6 +17,7 @@ GRAPH_CORBA_GENERATED = \
Graph.h Graph.h
graph_SOURCES = \ graph_SOURCES = \
$(GRAPH_CORBA_GENERATED)\
graph.c \ graph.c \
graph.h \ graph.h \
graph-vector.c \ graph-vector.c \
...@@ -37,21 +38,19 @@ graph_SOURCES = \ ...@@ -37,21 +38,19 @@ graph_SOURCES = \
layout-view.h \ layout-view.h \
main.c \ main.c \
vector.c \ vector.c \
vector.h \ vector.h
$(GRAPH_CORBA_GENERATED)
graph_LDADD = \ graph_LDADD = \
$(EXTRA_GNOME_LIBS) \ $(EXTRA_GNOME_LIBS) \
$(INTLLIBS) $(INTLLIBS)
BUILT_SOURCES = $(GRAPH_CORBA_GENERATED) $(GRAPH_CORBA_GENERATED): Graph.idl $(top_srcdir)/src/Gnumeric-value.idl $(top_srcdir)/src/Gnumeric.idl
$(GRAPH_CORBA_GENERATED): my_graph_idl
my_graph_idl: 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 orbit-idl -I`$(GNOME_CONFIG) --datadir`/idl -I$(srcdir) -I$(top_srcdir) $(srcdir)/Graph.idl
touch my_graph_idl touch my_graph_idl
CLEANFILES = my_graph_idl idldir = $(datadir)/idl
idl_DATA = Graph.idl
MYHACKAROUNDAUTOMAKE=$(shell echo $(GNUMERIC_CORBA_GENERATED)) MYHACKAROUNDAUTOMAKE=$(shell echo $(GNUMERIC_CORBA_GENERATED))
EXTRA_DIST = $(idl_DATA) $(MYHACKAROUNDAUTOMAKE) graph.gnorba
\ No newline at end of file
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
* ms-formula-read.c (ms_excel_parse_formula): Fix for non-shared * ms-formula-read.c (ms_excel_parse_formula): Fix for non-shared
references to cells below row 256. 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> 1999-10-08 Jody Goldberg <jgoldberg@home.com>
...@@ -29,6 +39,70 @@ ...@@ -29,6 +39,70 @@
* boot.c (excel_probe) : Only free the MsOle object if it * boot.c (excel_probe) : Only free the MsOle object if it
was created successfully. 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> 1999-10-02 Jody Goldberg <jgoldberg@home.com>
* *.c : Ensure that we include config.h first. * *.c : Ensure that we include config.h first.
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "ms-escher.h" #include "ms-escher.h"
#include "print-info.h" #include "print-info.h"
#include "selection.h" #include "selection.h"
#include "border.h"
#include "utils.h" /* for cell_name */ #include "utils.h" /* for cell_name */
/* #define NO_DEBUG_EXCEL */ /* #define NO_DEBUG_EXCEL */
...@@ -41,33 +42,15 @@ static ExcelSheet *ms_excel_sheet_new (ExcelWorkbook *wb, ...@@ -41,33 +42,15 @@ static ExcelSheet *ms_excel_sheet_new (ExcelWorkbook *wb,
static void ms_excel_workbook_attach (ExcelWorkbook *wb, static void ms_excel_workbook_attach (ExcelWorkbook *wb,
ExcelSheet *ans); ExcelSheet *ans);
/*static guint16 #define STYLE_TOP (MSTYLE_BORDER_TOP - MSTYLE_BORDER_TOP)
ms_bug_get_padding (const BiffQuery *q, guint16 opcode) #define STYLE_BOTTOM (MSTYLE_BORDER_BOTTOM - MSTYLE_BORDER_TOP)
{ #define STYLE_LEFT (MSTYLE_BORDER_LEFT - MSTYLE_BORDER_TOP)
guint8 ls_op = (opcode & 0x00ff); #define STYLE_RIGHT (MSTYLE_BORDER_RIGHT - MSTYLE_BORDER_TOP)
guint ans=0; #define STYLE_DIAGONAL (MSTYLE_BORDER_DIAGONAL - MSTYLE_BORDER_TOP)
#define STYLE_REV_DIAGONAL (MSTYLE_BORDER_REV_DIAGONAL - MSTYLE_BORDER_TOP)
switch (ls_op) /* TODO : enable diagonal */
{ #define STYLE_ORIENT_MAX 4
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;
}*/
void void
ms_excel_unexpected_biff (BiffQuery *q, char const *const state) ms_excel_unexpected_biff (BiffQuery *q, char const *const state)
...@@ -96,13 +79,13 @@ biff_guint32_hash (const guint32 *d) ...@@ -96,13 +79,13 @@ biff_guint32_hash (const guint32 *d)
static gint static gint
biff_guint16_equal (const guint16 *a, const guint16 *b) biff_guint16_equal (const guint16 *a, const guint16 *b)
{ {
if (*a==*b) return 1; if (*a == *b) return 1;
return 0; return 0;
} }
static gint static gint
biff_guint32_equal (const guint32 *a, const guint32 *b) biff_guint32_equal (const guint32 *a, const guint32 *b)
{ {
if (*a==*b) return 1; if (*a == *b) return 1;
return 0; return 0;
} }
...@@ -259,7 +242,7 @@ biff_get_error_text (const guint8 err) ...@@ -259,7 +242,7 @@ biff_get_error_text (const guint8 err)
switch (err) switch (err)
{ {
case 0: buf = gnumeric_err_NULL; break; 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 15: buf = gnumeric_err_VALUE; break;
case 23: buf = gnumeric_err_REF; break; case 23: buf = gnumeric_err_REF; break;
case 29: buf = gnumeric_err_NAME; break; case 29: buf = gnumeric_err_NAME; break;
...@@ -455,27 +438,6 @@ biff_boundsheet_data_destroy (gpointer key, BiffBoundsheetData *d, gpointer user ...@@ -455,27 +438,6 @@ biff_boundsheet_data_destroy (gpointer key, BiffBoundsheetData *d, gpointer user
return 1; 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_ * NB. 'fount' is the correct, and original _English_
**/ **/
...@@ -534,8 +496,6 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q) ...@@ -534,8 +496,6 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q)
fd->fontname, fd->height / 20, fd->color_idx); fd->fontname, fd->height / 20, fd->color_idx);
} }
#endif #endif
fd->style_font = biff_font_data_get_style_font (fd);
fd->index = g_hash_table_size (wb->font_data); fd->index = g_hash_table_size (wb->font_data);
if (fd->index >= 4) /* Wierd: for backwards compatibility */ if (fd->index >= 4) /* Wierd: for backwards compatibility */
fd->index++; fd->index++;
...@@ -546,8 +506,6 @@ static gboolean ...@@ -546,8 +506,6 @@ static gboolean
biff_font_data_destroy (gpointer key, BiffFontData *fd, gpointer userdata) biff_font_data_destroy (gpointer key, BiffFontData *fd, gpointer userdata)
{ {
g_free (fd->fontname); g_free (fd->fontname);
if (fd->style_font)
style_font_unref (fd->style_font);
g_free (fd); g_free (fd);
return 1; return 1;
} }
...@@ -992,16 +950,18 @@ ms_excel_get_font (ExcelSheet *sheet, guint16 font_idx) ...@@ -992,16 +950,18 @@ ms_excel_get_font (ExcelSheet *sheet, guint16 font_idx)
} }
static StyleColor * 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); BiffFontData const * fd = ms_excel_get_font (sheet, xf->font_idx);
if (fd == NULL) if (fd == NULL)
return NULL; return NULL;
if (fd->style_font) mstyle_set_font_name (mstyle, fd->fontname);
cell_set_font_from_style (cell, fd->style_font); mstyle_set_font_size (mstyle, fd->height / 20.0);
else mstyle_set_font_bold (mstyle, fd->boldness >= 0x2bc);
printf ("Duff StyleFont\n"); mstyle_set_font_italic (mstyle, fd->italic);
return ms_excel_palette_get (sheet->wb->palette, fd->color_idx, NULL); 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) ...@@ -1022,38 +982,78 @@ ms_excel_get_xf (ExcelSheet *sheet, int const xfidx)
} }
static void 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); BiffXFData const *xf = ms_excel_get_xf (sheet, xfidx);
StyleColor *fore, *back, *basefore; StyleColor *fore, *back, *basefore;
int back_index; int back_index;
MStyle *mstyle;
Range range;
g_return_if_fail (xf); g_return_if_fail (xf);
g_return_if_fail (cell->value);
/* mstyle = mstyle_new ();
* Well set it up then ! FIXME: hack ! mstyle_set_align_v (mstyle, xf->valign);
*/ mstyle_set_align_h (mstyle, xf->halign);
cell_set_alignment (cell, xf->halign, xf->valign, ORIENT_HORIZ, mstyle_set_fit_in_cell (mstyle, xf->wrap);
xf->wrap);
basefore = ms_excel_set_cell_font (sheet, cell, xf); basefore = ms_excel_get_stylefont (sheet, xf, mstyle);
if (sheet->wb->palette) { if (sheet->wb->palette) {
int lp; int i;
StyleColor *tmp[4]; for (i = 0; i < STYLE_ORIENT_MAX; i++) {
for (lp=0;lp<4;lp++) MStyleBorder *border;
tmp[lp] = ms_excel_palette_get (sheet->wb->palette, border = border_fetch (xf->border_type [i],
xf->border_color[lp], ms_excel_palette_get (sheet->wb->palette,
NULL); xf->border_color[i],
cell_set_border (cell, xf->border_type, tmp); NULL),
MSTYLE_BORDER_TOP + i);
if (border)
mstyle_set_border (mstyle, MSTYLE_BORDER_TOP + i, border);
}
} }
if (xf->style_format) 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 #ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 0) { if (ms_excel_color_debug > 0) {
printf ("%s : Pattern = %d\n", printf ("%s : Pattern = %d\n",
cell_name (cell->col->pos, cell->row->pos), cell_name (col, row),
xf->fill_pattern_idx); xf->fill_pattern_idx);
} }
#endif #endif
...@@ -1062,7 +1062,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx) ...@@ -1062,7 +1062,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
#ifndef NO_DEBUG_EXCEL #ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 2) { if (ms_excel_color_debug > 2) {
printf ("Cell Color : '%s' : (%d, %d)\n", 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); xf->pat_foregnd_col, xf->pat_backgnd_col);
} }
#endif #endif
...@@ -1073,7 +1073,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx) ...@@ -1073,7 +1073,7 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
#ifndef NO_DEBUG_EXCEL #ifndef NO_DEBUG_EXCEL
if (ms_excel_color_debug > 2) { if (ms_excel_color_debug > 2) {
printf ("Cell Color : '%s' : (Fontcol, %d)\n", printf ("Cell Color : '%s' : (Fontcol, %d)\n",
cell_name (cell->col->pos, cell->row->pos), cell_name (col, row),
xf->pat_foregnd_col); xf->pat_foregnd_col);
} }
#endif #endif
...@@ -1087,8 +1087,22 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx) ...@@ -1087,8 +1087,22 @@ ms_excel_set_cell_xf (ExcelSheet *sheet, Cell *cell, guint16 xfidx)
if (xf->fill_pattern_idx == 0) if (xf->fill_pattern_idx == 0)
back_index = 0; back_index = 0;
back = ms_excel_palette_get (sheet->wb->palette, back_index, fore); back = ms_excel_palette_get (sheet->wb->palette, back_index, fore);
g_return_if_fail (back && 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 static StyleBorderType
...@@ -1112,17 +1126,17 @@ biff_xf_map_border (int b) ...@@ -1112,17 +1126,17 @@ biff_xf_map_border (int b)
case 7: /* Hair */ case 7: /* Hair */
return BORDER_HAIR; return BORDER_HAIR;
case 8: /* Medium Dashed */ case 8: /* Medium Dashed */
return BORDER_MEDIUM; return BORDER_MEDIUM_DASH;
case 9: /* Dash Dot */ case 9: /* Dash Dot */
return BORDER_THIN; return BORDER_DASH_DOT;
case 10: /* Medium Dash Dot */ case 10: /* Medium Dash Dot */
return BORDER_THIN; return BORDER_MEDIUM_DASH_DOT;
case 11: /* Dash Dot Dot */ case 11: /* Dash Dot Dot */
return BORDER_HAIR; return BORDER_DASH_DOT_DOT;
case 12: /* Medium Dash Dot Dot */ case 12: /* Medium Dash Dot Dot */
return BORDER_THIN; return BORDER_MEDIUM_DASH_DOT_DOT;
case 13: /* Slanted Dash Dot*/ case 13: /* Slanted Dash Dot*/
return BORDER_HAIR; return BORDER_SLANTED_DASH_DOT;
} }
printf ("Unknown border style %d\n", b); printf ("Unknown border style %d\n", b);
return BORDER_NONE; return BORDER_NONE;
...@@ -1381,15 +1395,17 @@ static void ...@@ -1381,15 +1395,17 @@ static void
ms_excel_sheet_insert (ExcelSheet *sheet, int xfidx, ms_excel_sheet_insert (ExcelSheet *sheet, int xfidx,
int col, int row, const char *text) 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 */ /* NB. cell_set_text _certainly_ strdups *text */
if (text) if (text)
cell_set_text_simple (cell, text); cell_set_text_simple (cell, text);
else else
cell_set_text_simple (cell, ""); cell_set_text_simple (cell, "");
ms_excel_set_cell_xf (sheet, cell, xfidx);
} }
/* Shared formula support functions */ /* Shared formula support functions */
...@@ -1498,10 +1514,16 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet) ...@@ -1498,10 +1514,16 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
guint16 const xf_index = EX_GETXF (q); guint16 const xf_index = EX_GETXF (q);
guint16 const col = EX_GETCOL (q); guint16 const col = EX_GETCOL (q);
guint16 const row = EX_GETROW (q); guint16 const row = EX_GETROW (q);
Cell *cell = sheet_cell_fetch (sheet->gnum_sheet, col, row); Cell *cell;
ExprTree *expr; ExprTree *expr;
Value *val = NULL; 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 #ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) if (ms_excel_read_debug > 0)
printf ("Formula in %s%d;\n", col_name(col), row+1); printf ("Formula in %s%d;\n", col_name(col), row+1);
...@@ -1655,9 +1677,6 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet) ...@@ -1655,9 +1677,6 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
/* Set value */ /* Set value */
cell->value = val; cell->value = val;
/* Set format */
ms_excel_set_cell_xf (sheet, cell, xf_index);
} }
BiffSharedFormula * BiffSharedFormula *
...@@ -1687,6 +1706,11 @@ ms_excel_sheet_new (ExcelWorkbook *wb, const char *name) ...@@ -1687,6 +1706,11 @@ ms_excel_sheet_new (ExcelWorkbook *wb, const char *name)
g_hash_table_new ((GHashFunc)biff_shared_formula_hash, g_hash_table_new ((GHashFunc)biff_shared_formula_hash,
(GCompareFunc)biff_shared_formula_equal); (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; return ans;
} }
...@@ -1698,9 +1722,18 @@ ms_excel_sheet_insert_val (ExcelSheet *sheet, int xfidx, ...@@ -1698,9 +1722,18 @@ ms_excel_sheet_insert_val (ExcelSheet *sheet, int xfidx,
g_return_if_fail (v); g_return_if_fail (v);
g_return_if_fail (sheet); g_return_if_fail (sheet);
ms_excel_set_xf (sheet, col, row, xfidx);
cell = sheet_cell_fetch (sheet->gnum_sheet, col, row); cell = sheet_cell_fetch (sheet->gnum_sheet, col, row);
cell_set_value_simple (cell, v); 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 static void
...@@ -2089,8 +2122,7 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet) ...@@ -2089,8 +2122,7 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet)
if (ms_excel_read_debug > 0) if (ms_excel_read_debug > 0)
printf ("Blank in %s%d xf = 0x%x;\n", col_name(col), row+1, xf); printf ("Blank in %s%d xf = 0x%x;\n", col_name(col), row+1, xf);
#endif #endif
ms_excel_sheet_insert_val (sheet, xf, col, row, ms_excel_sheet_insert_blank (sheet, xf, col, row);
value_new_empty());
break; break;
} }
...@@ -2117,10 +2149,9 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet) ...@@ -2117,10 +2149,9 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet)
} }
for (i = lastcol; i >= firstcol ; --i) { for (i = lastcol; i >= firstcol ; --i) {
ptr -= 2; ptr -= 2;
ms_excel_sheet_insert_val (sheet, ms_excel_sheet_insert_blank (sheet,
MS_OLE_GET_GUINT16 (ptr), MS_OLE_GET_GUINT16 (ptr),
i, row, i, row);
value_new_empty());
} }
break; break;
} }
...@@ -2499,6 +2530,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb) ...@@ -2499,6 +2530,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
printf ("Serious error detaching sheet '%s'\n", printf ("Serious error detaching sheet '%s'\n",
sheet->gnum_sheet->name); sheet->gnum_sheet->name);
} }
style_optimize (sheet, -1, -1);
return TRUE; return TRUE;
case BIFF_OBJ: /* See: ms-obj.c and S59DAD.HTM */ case BIFF_OBJ: /* See: ms-obj.c and S59DAD.HTM */
......
...@@ -19,6 +19,7 @@ typedef struct _ExcelSheet ...@@ -19,6 +19,7 @@ typedef struct _ExcelSheet
eBiff_version ver; eBiff_version ver;
GHashTable *shared_formulae; GHashTable *shared_formulae;
GList *obj_queue; GList *obj_queue;
Range style_optimize;
} ExcelSheet; } ExcelSheet;
typedef struct _BiffBoundsheetData typedef struct _BiffBoundsheetData
...@@ -67,7 +68,6 @@ typedef struct _BiffFontData ...@@ -67,7 +68,6 @@ typedef struct _BiffFontData
int script; /* sub = -1, none = 0, super = 1 */ int script; /* sub = -1, none = 0, super = 1 */
eBiffFontUnderline underline; eBiffFontUnderline underline;
char *fontname; char *fontname;
StyleFont *style_font;
} BiffFontData; } BiffFontData;
typedef struct _BiffExternSheetData {