Commit 0e5ab273 authored by Jody Goldberg's avatar Jody Goldberg

- Some basic support for objects before Biff8 so that we catch

  charts.
- Improve a few warning messages.
parent 3334b714
1999-08-02 Jody Goldberg <jgoldberg@home.com>
* ms-obj.c (ms_obj_read_pre_biff8_obj) : New function to catch
charts.
(ms_obj_read_obj) : Use ms_obj_read_pre_biff8_obj.
* ms-excel-read.c (ms_excel_read_cell) : Catch use of chart
records when we expect a cell.
(ms_excel_read_formula) : Clarify error message.
* ms-chart.c (ms_excel_biff_dimensions) : Don't print unless
we're debugging.
* ms-obj.c (ms_obj_read_biff8_obj) : Don't print checkbox link
unless we're debugging.
1999-07-30 Jody Goldberg <jgoldberg@home.com>
* ms-excel-read.c (ms_excel_read_error) : Delete
......
......@@ -308,9 +308,23 @@ BC_R(attachedlabel)(ExcelChartHandler const *handle,
gboolean const show_label_prercent = (flags&0x04) ? TRUE : FALSE;
gboolean const smooth_line = (flags&0x08) ? TRUE : FALSE;
gboolean const show_label = (flags&0x10) ? TRUE : FALSE;
if (show_value)
puts ("Show Value");
if (show_percent)
puts ("Show as Percentage");
if (show_label_prercent)
puts ("Show as Label Percentage");
if (smooth_line)
puts ("Smooth line");
if (show_label)
puts ("Show the label");
if (s->ver >= eBiffV8)
{
gboolean const show_bubble_size = (flags&0x20) ? TRUE : FALSE;
if (show_bubble_size)
puts ("Show bubble size");
}
return FALSE;
}
......@@ -468,6 +482,10 @@ BC_R(bar)(ExcelChartHandler const *handle,
else
printf ("Overlayed values\n");
printf ("Space between bars = %d %% of width\n",
space_between_bar);
printf ("Space between categories = %d %% of width\n",
space_between_categories);
if (s->ver >= eBiffV8)
{
gboolean const has_shadow = (flags & 0x04) ? TRUE : FALSE;
......@@ -1872,9 +1890,10 @@ ms_excel_biff_dimensions (BiffQuery *q, ExcelWorkbook *wb)
last_col = MS_OLE_GET_GUINT16 (q->data+6);
}
printf ("Dimension = %s%d:%s%d\n",
col_name(first_col), first_row+1,
col_name(last_col), last_row+1);
if (ms_excel_chart_debug > 0)
printf ("Dimension = %s%d:%s%d\n",
col_name(first_col), first_row+1,
col_name(last_col), last_row+1);
}
void
......
......@@ -1480,8 +1480,14 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
*/
ExprTree *expr;
Value *val = NULL;
if (q->length < 22 ||
q->length < 22 + MS_OLE_GET_GUINT16 (q->data+20)) {
if (q->length < 22) {
printf ("FIXME: serious formula error: "
"invalid FORMULA (0x%x) record with length %d (should >= 22)\n",
q->opcode, q->length);
cell_set_text (cell, "Formula error");
return;
}
if (q->length < (22 + MS_OLE_GET_GUINT16 (q->data+20))) {
printf ("FIXME: serious formula error: "
"supposed length 0x%x, real len 0x%x\n",
MS_OLE_GET_GUINT16 (q->data+20), q->length);
......@@ -2328,6 +2334,11 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
printf ("Opcode : 0x%x\n", q->opcode);
}
#endif
if (q->ms_op == 0x10) {
puts ("EXCEL : How are we seeing chart records in a sheet ?");
continue;
}
switch (q->ls_op) {
case BIFF_EOF:
if (q->streamPos == blankSheetPos || sheet->blank) {
......
......@@ -174,6 +174,52 @@ ms_obj_dump (guint8 const * const data, int const len, char const * const name)
printf ("}; /* %s */\n", name);
}
static void
ms_obj_read_pre_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
{
static char const * const obj_types[] = {
"Group", "Line", "Rectangle", "Oval", "Arc", "Chart", "Text",
"Button", "Picture", "Polygon", "Checkbox", "OptionButton",
"Edit box", "Label", "Dialog frame", "Spinner", "Listbox",
"Group box", "Dropdown"
};
#if 0
guint32 const numObjects = MS_OLE_GET_GUINT32(q->data);
guint16 const flags = MS_OLE_GET_GUINT32(q->data+8);
#endif
guint16 tmp = MS_OLE_GET_GUINT32(q->data+4);
guint16 const obj_id = MS_OLE_GET_GUINT32(q->data+6);
guint16 const left_col = MS_OLE_GET_GUINT32(q->data+10);
guint16 const top_row = MS_OLE_GET_GUINT32(q->data+14);
guint16 const right_col = MS_OLE_GET_GUINT32(q->data+18);
guint16 const bottom_row = MS_OLE_GET_GUINT32(q->data+22);
/* As 1/1024 of cell width */
guint16 const left_offset = MS_OLE_GET_GUINT32(q->data+12);
guint16 const top_offset = MS_OLE_GET_GUINT32(q->data+16);
guint16 const right_offset = MS_OLE_GET_GUINT32(q->data+20);
guint16 const bottom_offset = MS_OLE_GET_GUINT32(q->data+24);
if (tmp >= (sizeof(obj_types)/sizeof(char const * const))) {
printf ("EXCEL : invalid object type %d\n", tmp);
return;
}
if (ms_excel_read_debug > 0) {
printf ("EXCEL : Found %s @ (%s%d + %f %%, %f %%):(%s%d + %f %%, %f %%)\n",
obj_types[tmp],
col_name(left_col), top_row+1,
left_offset/1024., top_offset/1024.,
col_name(right_col), bottom_row+1,
right_offset/1024., bottom_offset/1024.);
}
if (tmp == 0x5)
ms_excel_read_chart (q, wb, obj_id);
}
static void
ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
{
......@@ -274,7 +320,8 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
{
guint16 const row = MS_OLE_GET_GUINT16(data+11);
guint16 const col = MS_OLE_GET_GUINT16(data+13) &0x3fff;
printf ("%s%d\n", col_name(col), row+1);
if (ms_excel_read_debug > 0)
printf ("Checkbox linked to : %s%d\n", col_name(col), row+1);
ms_obj_dump (data, len, "CheckBoxFmla");
break;
}
......@@ -352,5 +399,5 @@ ms_obj_read_obj (BiffQuery *q, ExcelWorkbook * wb)
if (wb->ver >= eBiffV8)
ms_obj_read_biff8_obj (q, wb);
else
printf ("Only Biff8 Objects are supporting currently\n");
ms_obj_read_pre_biff8_obj (q, wb);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment