Commit 0a8474ca authored by Michael Meeks's avatar Michael Meeks

Clean out a load of old, crufty style; clean to Gtk like style.

parent 75990566
2000-06-05 Michael Meeks <michael@helixcode.com>
s/eBiff_version/MsBiffVersion/g;
s/eBiffV([0-9]*)/MS_BIFF_V\1/g;
s/eBiffVUnknown/MS_BIFF_V_UNKNOWN/g;
s/eBiff_filetype/MsBiffFileType/g;
s/eBiffT/MS_BIFF_TYPE_/g;
s/eBiff_hidden/MsBiffHidden/g;
s/eBiffHVisible/MS_BIFF_H_VISIBLE/g;
s/eBiffHHidden/MS_BIFF_H_HIDDEN/g;
s/eBiffHVeryHidden/MS_BIFF_H_VERY_HIDDEN/g;
s/eBiff_locked/MsBiffLocked/g;
s/eBiffLLocked/MS_BIFF_L_LOCKED/g;
s/eBiffLUnlocked/MS_BIFF_L_UNLOCKED/g;
s/eBiff_xftype/MsBiffXfType/g;
s/eBiffXStyle/MS_BIFF_X_STYLE/g;
s/eBiffXCell/MS_BIFF_X_CELL/g;
s/eBiff_format/MsBiffFormat/g;
s/eBiffFMS/MS_BIFF_F_MS/g;
s/eBiffFLotus/MS_BIFF_F_LOTUS/g;
s/eBiff_eastern/MsBiffEastern/g;
s/eBiffEContext/MS_BIFF_E_CONTEXT/g;
s/eBiffEleftToRight/MS_BIFF_E_LEFT_TO_RIGHT/g;
s/eBiffErightToLeft/MS_BIFF_E_RIGHT_TO_LEFT/g;
s/eBiffFontUnderline/MsBiffFontUnderline/g;
s/eBiffFUNone/MS_BIFF_F_U_NONE/g;
s/eBiffFUSingleAcc/MS_BIFF_F_U_SINGLE_ACC/g;
s/eBiffFUDoubleAcc/MS_BIFF_F_U_DOUBLE_ACC/g;
s/eBiffFUSingle/MS_BIFF_F_U_SINGLE/g;
s/eBiffFUDouble/MS_BIFF_F_U_DOUBLE/g;
s/eBiffFontScript/MsBiffFontScript/g;
s/eBiffFSNone/MS_BIFF_F_S_NONE/g;
s/eBiffFSSub/MS_BIFF_F_S_SUB/g;
s/eBiffFSSuper/MS_BIFF_F_S_SUPER/g;
s/eBiffHAlign/MsBiffHAlign/g;
s/eBiffHAGeneral/MS_BIFF_H_A_GENERAL/g;
s/eBiffHALeft/MS_BIFF_H_A_LEFT/g;
s/eBiffHACenter/MS_BIFF_H_A_CENTER/g;
s/eBiffHARight/MS_BIFF_H_A_RIGHT/g;
s/eBiffHAFill/MS_BIFF_H_A_FILL/g;
s/eBiffHAJustify/MS_BIFF_H_A_JUSTIFTY/g;
s/eBuffHACenterAcrossSelection/MS_BIFF_H_A_CENTER_ACROSS_SELECTION/g;
s/eBiffVAlign/MsBiffVAlign/g;
s/eBiffVATop/MS_BIFF_V_A_TOP/g;
s/eBiffVACenter/MS_BIFF_V_A_CENTER/g;
s/eBiffVABottom/MS_BIFF_V_A_BOTTOM/g;
s/eBiffVAJustify/MS_BIFF_V_A_JUSTIFY/g;
s/eBiffOrient/MsBiffOrient/g;
s/eBiffOHoriz/MS_BIFF_O_HORIZ/g;
s/eBiffOVertHorizText/MS_BIFF_O_VERT_HORIZ/g;
s/eBiffOVertVertText/MS_BIFF_O_VERT_VERT/g;
s/eBiffOVertVertText2/MS_BIFF_O_VERT_VERT2/g;
s/eBiffDifferences/MsBiffDifferences/g;
s/eBiffDFormatbit/MS_BIFF_D_FORMAT_BIT/g;
s/eBiffDFontbit/MS_BIFF_D_FONT_BIT/g;
s/eBiffDAlignbit/MS_BIFF_D_ALIGN_BIT/g;
s/eBiffDBorderbit/MS_BIFF_D_BORDER_BIT/g;
s/eBiffDFillbit/MS_BIFF_D_FILL_BIT/g;
s/eBiffDLockbit/MS_BIFF_D_LOCK_BIT/g;
s/BIFF_BOF_DATA/MsBiffBofData/g;
s/eBiffMaxRows/MsBiffMaxRows/g;
s/eBiffMaxRowsV7/MS_BIFF_MAX_ROWS_V7/g;
s/eBiffMaxRowsV8/MS_BIFF_MAX_ROWS_V8/g;
2000-06-05 Michael Meeks <michael@helixcode.com>
* ms-excel-read.c (sst_bound_check): Update so we can't miss
......
......@@ -108,7 +108,7 @@ excel_load (CommandContext *context, Workbook *wb, const char *filename)
*/
static int
excel_save (CommandContext *context, Workbook *wb, const char *filename,
eBiff_version ver)
MsBiffVersion ver)
{
MsOle *f;
int ans;
......@@ -156,13 +156,13 @@ excel_save (CommandContext *context, Workbook *wb, const char *filename,
static int
excel_save_98 (CommandContext *context, Workbook *wb, const char *filename)
{
return excel_save (context, wb, filename, eBiffV8);
return excel_save (context, wb, filename, MS_BIFF_V8);
}
static int
excel_save_95 (CommandContext *context, Workbook *wb, const char *filename)
{
return excel_save (context, wb, filename, eBiffV7);
return excel_save (context, wb, filename, MS_BIFF_V7);
}
void
......
......@@ -18,12 +18,13 @@
typedef gboolean (*MsExcelReadGbFn) (CommandContext *context, Workbook *wb, MsOle *f);
extern MsExcelReadGbFn ms_excel_read_gb;
typedef enum _eBiff_version { eBiffV2=2, eBiffV3=3,
eBiffV4=4,
eBiffV5=5, /* Excel 5.0 */
eBiffV7=7, /* Excel 95 */
eBiffV8=8, /* Excel 97 */
eBiffVUnknown=0} eBiff_version ;
typedef enum { MS_BIFF_V2 = 2,
MS_BIFF_V3 = 3,
MS_BIFF_V4 = 4,
MS_BIFF_V5 = 5, /* Excel 5.0 */
MS_BIFF_V7 = 7, /* Excel 95 */
MS_BIFF_V8 = 8, /* Excel 97 */
MS_BIFF_V_UNKNOWN = 0} MsBiffVersion ;
extern int ms_excel_read_workbook (CommandContext *context,
Workbook *wb, MsOle *file);
......@@ -35,9 +36,9 @@ extern int ms_excel_read_workbook (CommandContext *context,
* ExcelWorksheet in ms-excel-read.h.
*/
extern int ms_excel_check_write (CommandContext *context, void **state,
Workbook *wb, eBiff_version ver);
Workbook *wb, MsBiffVersion ver);
extern int ms_excel_write_workbook (CommandContext *context, MsOle *file,
void *state, eBiff_version ver);
void *state, MsBiffVersion ver);
/* We need to use these for both read and write */
typedef struct {
......
......@@ -26,7 +26,7 @@ extern int ms_excel_chart_debug;
typedef struct
{
int depth;
eBiff_version ver;
MsBiffVersion ver;
guint32 prev_opcode;
ExcelWorkbook *wb;
......@@ -257,7 +257,7 @@ BC_R(area)(ExcelChartHandler const *handle,
else
printf ("Overlayed values\n");
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
gboolean const has_shadow = (flags & 0x04) ? TRUE : FALSE;
if (has_shadow)
......@@ -288,7 +288,7 @@ BC_R(areaformat)(ExcelChartHandler const *handle,
gboolean const swap_color_for_negative = flags & 0x02;
#endif
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
guint16 const fore_index = MS_OLE_GET_GUINT16 (q->data+12);
guint16 const back_index = MS_OLE_GET_GUINT16 (q->data+14);
......@@ -332,7 +332,7 @@ BC_R(attachedlabel)(ExcelChartHandler const *handle,
if (show_label)
puts ("Show the label");
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
gboolean const show_bubble_size = (flags&0x20) ? TRUE : FALSE;
if (show_bubble_size)
......@@ -498,7 +498,7 @@ BC_R(bar)(ExcelChartHandler const *handle,
space_between_bar);
printf ("Space between categories = %d %% of width\n",
space_between_categories);
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
gboolean const has_shadow = (flags & 0x04) ? TRUE : FALSE;
if (has_shadow)
......@@ -1049,7 +1049,7 @@ BC_R(lineformat)(ExcelChartHandler const *handle,
auto_format = (flags & 0x01) ? TRUE : FALSE;
draw_ticks = (flags & 0x04) ? TRUE : FALSE;
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
guint16 const color_index = MS_OLE_GET_GUINT16 (q->data+10);
......@@ -1114,7 +1114,7 @@ BC_R(markerformat)(ExcelChartHandler const *handle,
if (no_fore)
printf ("Transparent interior\n");
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
/* What are these for ?
* We already have the colors ?
......@@ -1438,7 +1438,7 @@ BC_R(series_impl)(ExcelChartState *s, BiffQuery *q, ExcelChartSeries * ser)
ser->value.count,
ms_chart_series[ser->value.type]);
if ((ser->has_bubbles = (s->ver >= eBiffV8)))
if ((ser->has_bubbles = (s->ver >= MS_BIFF_V8)))
{
tmp = MS_OLE_GET_GUINT16 (q->data+8);
g_return_val_if_fail (tmp < MS_CHART_SERIES_MAX, TRUE);
......@@ -1584,7 +1584,7 @@ BC_R(shtprops)(ExcelChartHandler const *handle,
blanks = tmp;
puts (ms_chart_blank[blanks]);
if (s->ver >= eBiffV8)
if (s->ver >= MS_BIFF_V8)
{
ignore_pos_record = (flags&0x10) ? TRUE : FALSE;
}
......@@ -1892,7 +1892,7 @@ ms_excel_biff_dimensions (BiffQuery *q, ExcelWorkbook *wb)
if (q->opcode != 0x200)
return;
if (wb->ver >= eBiffV8)
if (wb->ver >= MS_BIFF_V8)
{
first_row = MS_OLE_GET_GUINT32 (q->data);
last_row = MS_OLE_GET_GUINT32 (q->data+4);
......@@ -1913,7 +1913,7 @@ ms_excel_biff_dimensions (BiffQuery *q, ExcelWorkbook *wb)
}
void
ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, BIFF_BOF_DATA *bof)
ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, MsBiffBofData *bof)
{
int const num_handler = sizeof(chart_biff_handler) /
sizeof(ExcelChartHandler *);
......@@ -1924,7 +1924,7 @@ ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, BIFF_BOF_DATA *bof)
/* Register the handlers if this is the 1sttime through */
BC(register_handlers)();
g_return_if_fail (bof->type == eBiffTChart);
g_return_if_fail (bof->type == MS_BIFF_TYPE_Chart);
state.ver = bof->version;
state.depth = 0;
state.prev_opcode = 0xdead; /* Invalid */
......@@ -2024,12 +2024,12 @@ ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, BIFF_BOF_DATA *bof)
void
ms_excel_read_chart (BiffQuery *q, ExcelWorkbook *wb)
{
BIFF_BOF_DATA *bof;
MsBiffBofData *bof;
/* 1st record must be a valid BOF record */
g_return_if_fail (ms_biff_query_next (q));
bof = ms_biff_bof_data_new (q);
if (bof->version != eBiffVUnknown)
if (bof->version != MS_BIFF_V_UNKNOWN)
ms_excel_chart (q, wb, bof);
ms_biff_bof_data_destroy (bof);
}
......@@ -14,7 +14,7 @@
/* Reads charts */
extern void ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb,
BIFF_BOF_DATA *bof);
MsBiffBofData *bof);
/* A wrapper which reads and checks the BOF record then calls ms_excel_chart */
extern void ms_excel_read_chart (BiffQuery *q, ExcelWorkbook *wb);
......
......@@ -26,74 +26,76 @@
#define EX_SETSTRLEN(p,d) (MS_OLE_SET_GUINT16(p + 6, d))
/* Version info types as found in various Biff records */
typedef enum _eBiff_filetype { eBiffTWorkbook=0, eBiffTVBModule=1, eBiffTWorksheet=2,
eBiffTChart=3, eBiffTMacrosheet=4, eBiffTWorkspace=5,
eBiffTUnknown=6 } eBiff_filetype ;
typedef enum { MS_BIFF_TYPE_Workbook=0, MS_BIFF_TYPE_VBModule=1, MS_BIFF_TYPE_Worksheet=2,
MS_BIFF_TYPE_Chart=3, MS_BIFF_TYPE_Macrosheet=4, MS_BIFF_TYPE_Workspace=5,
MS_BIFF_TYPE_Unknown=6 } MsBiffFileType ;
/* Cell / XF types */
typedef enum _eBiff_hidden { eBiffHVisible=0, eBiffHHidden=1,
eBiffHVeryHidden=2 } eBiff_hidden ;
typedef enum _eBiff_locked { eBiffLLocked=1, eBiffLUnlocked=0 } eBiff_locked ;
typedef enum _eBiff_xftype { eBiffXStyle=0, eBiffXCell=1 } eBiff_xftype ;
typedef enum _eBiff_format { eBiffFMS=0, eBiffFLotus=1 } eBiff_format ;
typedef enum _eBiff_eastern { eBiffEContext=0, eBiffEleftToRight=1,
eBiffErightToLeft=2 } eBiff_eastern ;
typedef enum _eBiffFontUnderline
{
eBiffFUNone=1, eBiffFUSingle=2, eBiffFUDouble=3,
eBiffFUSingleAcc=4, eBiffFUDoubleAcc=5
} eBiffFontUnderline ;
typedef enum _eBiffFontScript { eBiffFSNone, eBiffFSSub, eBiffFSSuper } eBiffFontScript ;
typedef enum _eBiffHAlign { /* Horizontal alignment */
eBiffHAGeneral = 0,
eBiffHALeft = 1,
eBiffHACenter = 2,
eBiffHARight = 3,
eBiffHAFill = 4,
eBiffHAJustify = 5,
eBuffHACenterAcrossSelection = 6
} eBiffHAlign;
typedef enum _eBiffVAlign { /* Vertical alignment */
eBiffVATop = 0,
eBiffVACenter = 1,
eBiffVABottom = 2,
eBiffVAJustify = 3
} eBiffVAlign;
typedef enum _eBiffOrient { /* Text orientation */
eBiffOHoriz = 0,
eBiffOVertHorizText = 1,
eBiffOVertVertText = 2,
eBiffOVertVertText2 = 3
} eBiffOrient;
typedef enum _eBiffDifferences { /* Differences to parent styles */
eBiffDFormatbit = 10,
eBiffDFontbit = 11,
eBiffDAlignbit = 12,
eBiffDBorderbit = 13,
eBiffDFillbit = 14,
eBiffDLockbit = 15
} eBiffDifferences;
typedef struct _BIFF_BOF_DATA
typedef enum { MS_BIFF_H_VISIBLE=0, MS_BIFF_H_HIDDEN=1,
MS_BIFF_H_VERY_HIDDEN=2 } MsBiffHidden ;
typedef enum { MS_BIFF_L_LOCKED=1, MS_BIFF_L_UNLOCKED=0 } MsBiffLocked ;
typedef enum { MS_BIFF_X_STYLE=0, MS_BIFF_X_CELL=1 } MsBiffXfType ;
typedef enum { MS_BIFF_F_MS=0, MS_BIFF_F_LOTUS=1 } MsBiffFormat ;
typedef enum { MS_BIFF_E_CONTEXT=0, MS_BIFF_E_LEFT_TO_RIGHT=1,
MS_BIFF_E_RIGHT_TO_LEFT=2 } MsBiffEastern ;
typedef enum {
MS_BIFF_F_U_NONE = 1,
MS_BIFF_F_U_SINGLE = 2,
MS_BIFF_F_U_DOUBLE = 3,
MS_BIFF_F_U_SINGLE_ACC = 4,
MS_BIFF_F_U_DOUBLE_ACC = 5
} MsBiffFontUnderline ;
typedef enum { MS_BIFF_F_S_NONE, MS_BIFF_F_S_SUB, MS_BIFF_F_S_SUPER } MsBiffFontScript ;
typedef enum { /* Horizontal alignment */
MS_BIFF_H_A_GENERAL = 0,
MS_BIFF_H_A_LEFT = 1,
MS_BIFF_H_A_CENTER = 2,
MS_BIFF_H_A_RIGHT = 3,
MS_BIFF_H_A_FILL = 4,
MS_BIFF_H_A_JUSTIFTY = 5,
MS_BIFF_H_A_CENTER_ACROSS_SELECTION = 6
} MsBiffHAlign;
typedef enum { /* Vertical alignment */
MS_BIFF_V_A_TOP = 0,
MS_BIFF_V_A_CENTER = 1,
MS_BIFF_V_A_BOTTOM = 2,
MS_BIFF_V_A_JUSTIFY = 3
} MsBiffVAlign;
typedef enum { /* Text orientation */
MS_BIFF_O_HORIZ = 0,
MS_BIFF_O_VERT_HORIZ = 1,
MS_BIFF_O_VERT_VERT = 2,
MS_BIFF_O_VERT_VERT2 = 3
} MsBiffOrient;
typedef enum { /* Differences to parent styles */
MS_BIFF_D_FORMAT_BIT = 10,
MS_BIFF_D_FONT_BIT = 11,
MS_BIFF_D_ALIGN_BIT = 12,
MS_BIFF_D_BORDER_BIT = 13,
MS_BIFF_D_FILL_BIT = 14,
MS_BIFF_D_LOCK_BIT = 15
} MsBiffDifferences;
typedef struct
{
eBiff_version version ;
eBiff_filetype type ;
} BIFF_BOF_DATA ;
MsBiffVersion version ;
MsBiffFileType type ;
} MsBiffBofData ;
typedef enum {
eBiffMaxRowsV7 = 16384,
eBiffMaxRowsV8 = 65536
} eBiffMaxRows;
MsBiffMaxRowsV7 = 16384,
MsBiffMaxRowsV8 = 65536
} MsBiffMaxRows;
extern BIFF_BOF_DATA *new_ms_biff_bof_data (BiffQuery *pos) ;
extern void free_ms_biff_bof_data (BIFF_BOF_DATA *data) ;
extern MsBiffBofData *new_ms_biff_bof_data (BiffQuery *pos) ;
extern void free_ms_biff_bof_data (MsBiffBofData *data) ;
#include "biff-types.h"
......
......@@ -303,7 +303,7 @@ sst_bound_check (BiffQuery *q, guint32 offset)
* of the string, which may also be split over continues.
*/
static guint32
get_string (char **output, BiffQuery *q, guint32 offset, eBiff_version ver)
get_string (char **output, BiffQuery *q, guint32 offset, MsBiffVersion ver)
{
guint32 new_offset;
guint32 total_len;
......@@ -374,7 +374,7 @@ get_string (char **output, BiffQuery *q, guint32 offset, eBiff_version ver)
}
static void
read_sst (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
read_sst (ExcelWorkbook *wb, BiffQuery *q, MsBiffVersion ver)
{
guint32 offset;
int k;
......@@ -428,10 +428,10 @@ biff_get_error_text (const guint8 err)
/**
* See S59D5D.HTM
**/
BIFF_BOF_DATA *
MsBiffBofData *
ms_biff_bof_data_new (BiffQuery *q)
{
BIFF_BOF_DATA *ans = g_new (BIFF_BOF_DATA, 1);
MsBiffBofData *ans = g_new (MsBiffBofData, 1);
if ((q->opcode & 0xff) == BIFF_BOF &&
(q->length >= 4)) {
......@@ -440,13 +440,13 @@ ms_biff_bof_data_new (BiffQuery *q)
*/
switch (q->opcode >> 8) {
case 0:
ans->version = eBiffV2;
ans->version = MS_BIFF_V2;
break;
case 2:
ans->version = eBiffV3;
ans->version = MS_BIFF_V3;
break;
case 4:
ans->version = eBiffV4;
ans->version = MS_BIFF_V4;
break;
case 8: /*
* More complicated
......@@ -461,45 +461,45 @@ ms_biff_bof_data_new (BiffQuery *q)
#endif
switch (MS_OLE_GET_GUINT16 (q->data)) {
case 0x0600:
ans->version = eBiffV8;
ans->version = MS_BIFF_V8;
break;
case 0x500:
ans->version = eBiffV7; /*
ans->version = MS_BIFF_V7; /*
* OR ebiff7 : FIXME ? !
*/
break;
default:
printf ("Unknown BIFF sub-number in BOF %x\n", q->opcode);
ans->version = eBiffVUnknown;
ans->version = MS_BIFF_V_UNKNOWN;
}
}
break;
default:
printf ("Unknown BIFF number in BOF %x\n", q->opcode);
ans->version = eBiffVUnknown;
ans->version = MS_BIFF_V_UNKNOWN;
printf ("Biff version %d\n", ans->version);
}
switch (MS_OLE_GET_GUINT16 (q->data + 2)) {
case 0x0005:
ans->type = eBiffTWorkbook;
ans->type = MS_BIFF_TYPE_Workbook;
break;
case 0x0006:
ans->type = eBiffTVBModule;
ans->type = MS_BIFF_TYPE_VBModule;
break;
case 0x0010:
ans->type = eBiffTWorksheet;
ans->type = MS_BIFF_TYPE_Worksheet;
break;
case 0x0020:
ans->type = eBiffTChart;
ans->type = MS_BIFF_TYPE_Chart;
break;
case 0x0040:
ans->type = eBiffTMacrosheet;
ans->type = MS_BIFF_TYPE_Macrosheet;
break;
case 0x0100:
ans->type = eBiffTWorkspace;
ans->type = MS_BIFF_TYPE_Workspace;
break;
default:
ans->type = eBiffTUnknown;
ans->type = MS_BIFF_TYPE_Unknown;
printf ("Unknown BIFF type in BOF %x\n", MS_OLE_GET_GUINT16 (q->data + 2));
break;
}
......@@ -514,15 +514,15 @@ ms_biff_bof_data_new (BiffQuery *q)
#endif
} else {
printf ("Not a BOF !\n");
ans->version = eBiffVUnknown;
ans->type = eBiffTUnknown;
ans->version = MS_BIFF_V_UNKNOWN;
ans->type = MS_BIFF_TYPE_Unknown;
}
return ans;
}
void
ms_biff_bof_data_destroy (BIFF_BOF_DATA *data)
ms_biff_bof_data_destroy (MsBiffBofData *data)
{
g_free (data);
}
......@@ -531,53 +531,53 @@ ms_biff_bof_data_destroy (BIFF_BOF_DATA *data)
* See S59D61.HTM
**/
static void
biff_boundsheet_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
biff_boundsheet_data_new (ExcelWorkbook *wb, BiffQuery *q, MsBiffVersion ver)
{
BiffBoundsheetData *ans = g_new (BiffBoundsheetData, 1);
if (ver != eBiffV5 && /*
if (ver != MS_BIFF_V5 && /*
* Testing seems to indicate that Biff5 is compatibile with Biff7 here.
*/
ver != eBiffV7 &&
ver != eBiffV8) {
ver != MS_BIFF_V7 &&
ver != MS_BIFF_V8) {
printf ("Unknown BIFF Boundsheet spec. Assuming same as Biff7 FIXME\n");
ver = eBiffV7;
ver = MS_BIFF_V7;
}
ans->streamStartPos = MS_OLE_GET_GUINT32 (q->data);
switch (MS_OLE_GET_GUINT8 (q->data + 4)) {
case 0:
ans->type = eBiffTWorksheet;
ans->type = MS_BIFF_TYPE_Worksheet;
break;
case 1:
ans->type = eBiffTMacrosheet;
ans->type = MS_BIFF_TYPE_Macrosheet;
break;
case 2:
ans->type = eBiffTChart;
ans->type = MS_BIFF_TYPE_Chart;
break;
case 6:
ans->type = eBiffTVBModule;
ans->type = MS_BIFF_TYPE_VBModule;
break;
default:
printf ("Unknown sheet type : %d\n", MS_OLE_GET_GUINT8 (q->data + 4));
ans->type = eBiffTUnknown;
ans->type = MS_BIFF_TYPE_Unknown;
break;
}
switch ((MS_OLE_GET_GUINT8 (q->data + 5)) & 0x3) {
case 00:
ans->hidden = eBiffHVisible;
ans->hidden = MS_BIFF_H_VISIBLE;
break;
case 01:
ans->hidden = eBiffHHidden;
ans->hidden = MS_BIFF_H_HIDDEN;
break;
case 02:
ans->hidden = eBiffHVeryHidden;
ans->hidden = MS_BIFF_H_VERY_HIDDEN;
break;
default:
printf ("Unknown sheet hiddenness %d\n", (MS_OLE_GET_GUINT8 (q->data + 4)) & 0x3);
ans->hidden = eBiffHVisible;
ans->hidden = MS_BIFF_H_VISIBLE;
break;
}
if (ver == eBiffV8) {
if (ver == MS_BIFF_V8) {
int slen = MS_OLE_GET_GUINT16 (q->data + 6);
ans->name = biff_get_text (q->data + 8, slen, NULL);
} else {
......@@ -628,13 +628,13 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q)
data = MS_OLE_GET_GUINT16 (q->data + 8);
switch (data) {
case 0:
fd->script = eBiffFSNone;
fd->script = MS_BIFF_F_S_NONE;
break;
case 1:
fd->script = eBiffFSSuper;
fd->script = MS_BIFF_F_S_SUPER;
break;
case 2:
fd->script = eBiffFSSub;
fd->script = MS_BIFF_F_S_SUB;
break;
default:
printf ("Unknown script %d\n", data);
......@@ -644,19 +644,19 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q)
data1 = MS_OLE_GET_GUINT8 (q->data + 10);
switch (data1) {
case 0:
fd->underline = eBiffFUNone;
fd->underline = MS_BIFF_F_U_NONE;
break;
case 1:
fd->underline = eBiffFUSingle;
fd->underline = MS_BIFF_F_U_SINGLE;
break;
case 2:
fd->underline = eBiffFUDouble;
fd->underline = MS_BIFF_F_U_DOUBLE;
break;
case 0x21:
fd->underline = eBiffFUSingleAcc;
fd->underline = MS_BIFF_F_U_SINGLE_ACC;
break;
case 0x22:
fd->underline = eBiffFUDoubleAcc;
fd->underline = MS_BIFF_F_U_DOUBLE_ACC;
break;
}
fd->fontname = biff_get_text (q->data + 15,
......@@ -1136,7 +1136,7 @@ ms_excel_get_xf (ExcelSheet *sheet, int const xfidx)
g_return_val_if_fail (xf, NULL);
/* FIXME : What is the difference between cell & style formats ?? */
/* g_return_val_if_fail (xf->xftype == eBiffXCell, NULL); */
/* g_return_val_if_fail (xf->xftype == MS_BIFF_X_CELL, NULL); */
return xf;
}
......@@ -1260,17 +1260,17 @@ ms_excel_get_style_from_xf (ExcelSheet *sheet, guint16 xfidx)
mstyle_set_font_italic (mstyle, fd->italic);
mstyle_set_font_strike (mstyle, fd->struck_out);
switch (fd->underline) {
case eBiffFUSingle :
case eBiffFUSingleAcc :
case MS_BIFF_F_U_SINGLE :
case MS_BIFF_F_U_SINGLE_ACC :
underline = UNDERLINE_SINGLE;
break;
case eBiffFUDouble :
case eBiffFUDoubleAcc :
case MS_BIFF_F_U_DOUBLE :
case MS_BIFF_F_U_DOUBLE_ACC :
underline = UNDERLINE_DOUBLE;
break;
case eBiffFUNone :
case MS_BIFF_F_U_NONE :
default :
underline = UNDERLINE_NONE;
}
......@@ -1572,7 +1572,7 @@ excel_map_pattern_index_from_excel (int const i)
* Parse the BIFF XF Data structure into a nice form, see S59E1E.HTM
**/
static void
biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, MsBiffVersion ver)
{
BiffXFData *xf = g_new (BiffXFData, 1);
guint32 data, subdata;
......@@ -1583,13 +1583,13 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
? biff_format_data_lookup (wb, xf->format_idx) : NULL;
data = MS_OLE_GET_GUINT16 (q->data + 4);
xf->locked = (data & 0x0001) ? eBiffLLocked : eBiffLUnlocked;
xf->hidden = (data & 0x0002) ? eBiffHHidden : eBiffHVisible;
xf->xftype = (data & 0x0004) ? eBiffXStyle : eBiffXCell;
xf->format = (data & 0x0008) ? eBiffFLotus : eBiffFMS;
xf->locked = (data & 0x0001) ? MS_BIFF_L_LOCKED : MS_BIFF_L_UNLOCKED;
xf->hidden = (data & 0x0002) ? MS_BIFF_H_HIDDEN : MS_BIFF_H_VISIBLE;
xf->xftype = (data & 0x0004) ? MS_BIFF_X_STYLE : MS_BIFF_X_CELL;
xf->format = (data & 0x0008) ? MS_BIFF_F_LOTUS : MS_BIFF_F_MS;
xf->parentstyle = (data & 0xfff0) >> 4;
if (xf->xftype == eBiffXCell && xf->parentstyle != 0) {
if (xf->xftype == MS_BIFF_X_CELL && xf->parentstyle != 0) {
/* TODO Add support for parent styles
* XL implements a simple for of inheritance with styles.
* If a style's parent changes a value and the child has not
......@@ -1655,7 +1655,7 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
/*
* FIXME: ignored bit 0x0080