Commit 1fe993a0 authored by Jody Goldberg's avatar Jody Goldberg

More work on charts objects and drawings.

parent 8bee3b3b
1999-07-08 Jody Goldberg <jgoldberg@home.com>
* libole2/ms-ole.[ch] (dump) : constify.
* ms-chart.[ch] : Prepare to handle Charts not associated with a sheet.
Add more record types, improve debug messages. Begin connection
to 'escher' stuff for gelframes. Stubs for real chart SERIES objects.
Support for Text Objects.
* ms-excel-read.c : Ditto. Include cleanups.
Some debug level rationalization.
(ms_excel_externname) : Combine Biff7&8 use biff_get_text.
* ms-escher.[ch] : Start looking at this to parse the CHART_GELFRAME
record. Clear out the massive accumulation of includes.
* ms-excel-biff.h : Include cleanups.
* ms-obj.[ch] : Include cleanups.
Versioned the object record parsing (Currently only Biff8).
(ms_obj_read_biff8_obj) : New function with more error checking.
(ms_obj_read_text_object) : New function to read text objects.
* ole.c : Print biff types in hex to match documentation.
1999-07-09 Michael Meeks <michael@edenproject.org>
* ms-excel-read.c: Major warning cleaning offensive.
......
......@@ -1358,7 +1358,7 @@ ms_ole_destroy (MsOle *f)
}
void
dump (guint8 *ptr, guint32 len)
dump (guint8 const *ptr, guint32 len)
{
guint32 lp,lp2;
guint32 off;
......
......@@ -123,7 +123,7 @@ extern MsOleStream *ms_ole_stream_open (MsOleDirectory *d, char mode) ;
extern MsOleStream *ms_ole_stream_copy (MsOleStream *);
extern void ms_ole_stream_close (MsOleStream *) ;
extern void dump (guint8 *ptr, guint32 len) ;
extern void dump (guint8 const *ptr, guint32 len) ;
extern void ms_ole_debug (MsOle *, int magic);
#endif
......
#include "excel.h"
#include "ms-chart.h"
#include "ms-formula-read.h"
#include "ms-excel-read.h"
#include "ms-escher.h"
#include <stdio.h>
......@@ -49,7 +51,7 @@ BC_R(color)(guint8 const *data, char *type)
guint16 const g = (rgb >> 8) & 0xff;
guint16 const b = (rgb >> 16) & 0xff;
printf("%s Color %x%x%x\n", type, r, g, b);
printf("%s Color %02x%02x%02x\n", type, r, g, b);
return style_color_new ((r<<8)|r, (g<<8)|g, (b<<8)|b);
}
......@@ -60,14 +62,11 @@ static gboolean
BC_R(3dbarshape)(ExcelChartHandler const *handle,
ExcelChartState *s, BiffQuery *q)
{
#if GUESS_GUESS
/* All the charts I've seen have this record with value 0x0000
*its probably an enum of sorts.
*/
guint16 const type = BIFF_GET_GUINT16 (q->data);
#endif
puts ("Undocumented biff 3dbarshape\n");
dump_biff(q);
printf ("shape %d\n", type);
return FALSE;
}
......@@ -98,6 +97,8 @@ BC_R(3d)(ExcelChartHandler const *handle,
gboolean const auto_scale = (flags&0x04) ? TRUE :FALSE;
gboolean const walls_2d = (flags&0x20) ? TRUE :FALSE;
g_return_val_if_fail (zero == 0, FALSE); /* just warn for now */
printf ("Rot = %hu\n", rotation);
printf ("Elev = %hu\n", elevation);
printf ("Dist = %hu\n", distance);
......@@ -501,14 +502,17 @@ static gboolean
BC_R(chart)(ExcelChartHandler const *handle,
ExcelChartState *s, BiffQuery *q)
{
/* TODO TODO TODO : How is fixed point represented */
/* TODO TODO TODO : Why are all charts listed as starting at 0,0 ?? */
/* 2 bytes fraction 2 bytes integer, only integer form is known */
gint32 const x_pos = BIFF_GET_GUINT16 (q->data + 2);
gint32 const y_pos = BIFF_GET_GUINT16 (q->data + 6);
gint32 const x_size = BIFF_GET_GUINT16 (q->data + 10);
gint32 const y_size = BIFF_GET_GUINT16 (q->data + 14);
printf("Chart @ %hd, %hd is %hdx%hd\n", x_pos, y_pos, x_size, y_size);
/* Fixed point 2 bytes fraction 2 bytes integer */
gint32 const x_pos_fixed = BIFF_GET_GUINT16 (q->data + 2);
gint32 const y_pos_fixed = BIFF_GET_GUINT16 (q->data + 6);
gint32 const x_size_fixed = BIFF_GET_GUINT16 (q->data + 10);
gint32 const y_size_fixed = BIFF_GET_GUINT16 (q->data + 14);
double const x_pos = x_pos_fixed / 65535.;
double const y_pos = y_pos_fixed / 65535.;
double const x_size = x_size_fixed / 65535.;
double const y_size = y_size_fixed / 65535.;
printf("Chart @ %g, %g is %g x %g\n", x_pos, y_pos, x_size, y_size);
return FALSE;
}
......@@ -529,6 +533,10 @@ BC_R(chartformat)(ExcelChartHandler const *handle,
guint16 const flags = BIFF_GET_GUINT16 (q->data+16);
guint16 const z_order = BIFF_GET_GUINT16 (q->data+18);
gboolean const vary_color = (flags&0x01) ? TRUE : FALSE;
printf ("Z value = %uh\n", z_order);
if (vary_color)
printf ("Vary color of every data point\n");
return FALSE;
}
......@@ -642,17 +650,15 @@ BC_R(defaulttext)(ExcelChartHandler const *handle,
ExcelChartState *s, BiffQuery *q)
{
guint16 const tmp = BIFF_GET_GUINT16 (q->data);
s->defaulttext_applicability = -1;
printf ("applicability = %hd\n", tmp);
/*
*0 == 'show labels' label
*1 == Value and percentage data label
*2 == All text in chart
*3 == Undocumented ??
* 0 == 'show labels' label
* 1 == Value and percentage data label
* 2 == All text in chart
* 3 == Undocumented ??
*/
g_return_val_if_fail (tmp <= 3, TRUE);
s->defaulttext_applicability = tmp;
return FALSE;
}
......@@ -756,16 +762,13 @@ static gboolean
BC_R(gelframe)(ExcelChartHandler const *handle,
ExcelChartState *s, BiffQuery *q)
{
ms_escher_hack_get_drawing (q);
return FALSE;
}
static gboolean
BC_W(gelframe)(ExcelChartHandler const *handle,
GuppiChartState *s, BiffPut *os)
{
/* TODO TODO : From MS Office Drawing
*Has something to do with gradient fills
*patterns & textures
*/
return FALSE;
}
......@@ -775,6 +778,10 @@ static gboolean
BC_R(ifmt)(ExcelChartHandler const *handle,
ExcelChartState *s, BiffQuery *q)
{
guint16 const fmt_index = BIFF_GET_GUINT16 (q->data);
StyleFormat * fmt = biff_format_data_lookup (s->wb, fmt_index);
printf ("Format = '%s';\n", fmt->format);
return FALSE;
}
......@@ -894,6 +901,9 @@ BC_R(lineformat)(ExcelChartHandler const *handle,
if (s->ver >= eBiffV8)
{
guint16 const color_index = BIFF_GET_GUINT16 (q->data+10);
/* Ignore result for now */
ms_excel_palette_get (s->wb->palette, color_index, NULL);
}
return FALSE;
}
......@@ -973,7 +983,6 @@ BC_R(objectlink)(ExcelChartHandler const *handle,
guint16 const link_type = BIFF_GET_GUINT16 (q->data);
guint16 const series_num = BIFF_GET_GUINT16 (q->data+2);
guint16 const pt_num = BIFF_GET_GUINT16 (q->data+2);
char *str;
switch (link_type)
{
......@@ -1241,6 +1250,12 @@ BC_R(series)(ExcelChartHandler const *handle,
int const bubble_type = map_series_types(q, 10, "Bubbles");
guint16 const num_bubble = BIFF_GET_GUINT16 (q->data+12);
}
/* FIXME Make a structure */
if (s->wb->chart.series == NULL)
s->wb->chart.series = g_ptr_array_new ();
g_ptr_array_add (s->wb->chart.series, NULL);
printf ("SERIES = %d\n", s->wb->chart.series->len);
return FALSE;
}
......@@ -1277,6 +1292,8 @@ BC_R(seriestext)(ExcelChartHandler const *handle,
int const slen = BIFF_GET_GUINT8 (q->data + 2);
char *text = biff_get_text (q->data + 3, slen, NULL);
puts (text);
g_return_val_if_fail (id == 0, FALSE);
return FALSE;
}
......@@ -1343,6 +1360,7 @@ static char const *const ms_chart_blank[] = {
gboolean const only_plot_visible_cells = (flags&0x02) ? TRUE : FALSE;
gboolean const dont_size_with_window = (flags&0x04) ? TRUE : FALSE;
gboolean const has_pos_record = (flags&0x08) ? TRUE : FALSE;
gboolean ignore_pos_record = FALSE;
MS_CHART_BLANK blanks;
g_return_val_if_fail (tmp < MS_CHART_BLANK_MAX, TRUE);
......@@ -1351,10 +1369,18 @@ static char const *const ms_chart_blank[] = {
if (s->ver >= eBiffV8)
{
gboolean const ignore_pos_record = (flags&0x10) ? TRUE : FALSE;
ignore_pos_record = (flags&0x10) ? TRUE : FALSE;
}
printf ("%sesize chart with window.\n",
dont_size_with_window ? "Don't r": "R");
if (has_pos_record && !ignore_pos_record)
printf ("There should be a POS record around here soon\n");
if (manual_format);
printf ("Manually formated");
if (only_plot_visible_cells);
printf ("Only plot visible (to who??) cells\n");
return FALSE;
}
......@@ -1639,8 +1665,8 @@ BC(register_handler)(ExcelChartHandler const *const handle)
}
static void
ms_excel_chart (BIFF_BOF_DATA*bof, ExcelWorkbook *wb, BiffQuery *q)
void
ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb, BIFF_BOF_DATA *bof)
{
int const num_handler = sizeof(chart_biff_handler) /
sizeof(ExcelChartHandler *);
......@@ -1648,6 +1674,9 @@ ms_excel_chart (BIFF_BOF_DATA*bof, ExcelWorkbook *wb, BiffQuery *q)
gboolean done = FALSE;
ExcelChartState state;
/* Register the handlers if this is the 1sttime through */
BC(register_handlers)();
g_return_if_fail (bof->type == eBiffTChart);
state.ver = bof->version;
state.depth = 0;
......@@ -1737,15 +1766,14 @@ ms_excel_chart (BIFF_BOF_DATA*bof, ExcelWorkbook *wb, BiffQuery *q)
}
void
ms_excel_read_chart (ExcelWorkbook *wb, BiffQuery *q)
ms_excel_read_chart (BiffQuery *q, ExcelWorkbook *wb, int obj_id)
{
BIFF_BOF_DATA *bof;
BC(register_handlers)();
/* 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)
ms_excel_chart (bof, wb, q);
ms_excel_chart (q, wb, bof);
ms_biff_bof_data_destroy (bof);
}
......@@ -10,6 +10,11 @@
#include <ms-excel-read.h>
extern void ms_excel_read_chart (ExcelWorkbook * wb, BiffQuery * q);
/* Reads charts */
extern void ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb,
BIFF_BOF_DATA *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, int id);
#endif /* GNUMERIC_MS_CHART_H */
......@@ -3,45 +3,23 @@
*
* Author:
* Michael Meeks (michael@imaginator.com)
* Jody Goldberg (jgolbdger@home.com)
*
* See S59FD6.HTM for an overview...
**/
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <assert.h>
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "gnome-xml/tree.h"
#include "gnome-xml/parser.h"
#include "gnumeric-sheet.h"
#include "format.h"
#include "color.h"
#include "sheet-object.h"
#include "style.h"
#include "excel.h"
#include "ms-ole.h"
#include "ms-biff.h"
#include "ms-formula-read.h"
#include "ms-excel-biff.h"
#include "ms-obj.h"
#include "ms-escher.h"
#include "escher-types.h"
#include "biff-types.h"
#include "ms-excel-read.h"
#define ESH_BITMAP_DUMP 0
#define ESH_OPT_DUMP 0
#define ESH_HEADER_DEBUG 3
#include <stdio.h>
/**
#define ESH_BITMAP_DUMP 0
#define ESH_OPT_DUMP 0
#define ESH_HEADER_DEBUG 3
/*
* NB. SP = ShaPe
* GR = GRoup
*
......@@ -139,11 +117,8 @@ biff_to_flat_data (const BiffQuery *q, guint8 **data, guint32 *length)
*length+=nq->length;
ms_biff_query_next(nq);
cnt++;
} while (nq->opcode == BIFF_CONTINUE ||
nq->opcode == BIFF_MS_O_DRAWING ||
nq->opcode == BIFF_MS_O_DRAWING_GROUP);
} while (nq->opcode == BIFF_CONTINUE);
printf ("MERGING %d continues\n", cnt);
(*data) = g_malloc (*length);
ptr=(*data);
nq = ms_biff_query_copy (q);
......@@ -151,9 +126,7 @@ biff_to_flat_data (const BiffQuery *q, guint8 **data, guint32 *length)
memcpy (ptr, nq->data, nq->length);
ptr+=nq->length;
ms_biff_query_next(nq);
} while (nq->opcode == BIFF_CONTINUE ||
nq->opcode == BIFF_MS_O_DRAWING ||
nq->opcode == BIFF_MS_O_DRAWING_GROUP);
} while (nq->opcode == BIFF_CONTINUE);
}
typedef struct {
......@@ -298,7 +271,7 @@ BSE_new (ESH_HEADER *h) /* S59FE3.HTM */
fbse->ref_count = BIFF_GET_GUINT32(data+24);
fbse->delay_off = BIFF_GET_GUINT32(data+28);
tmp = BIFF_GET_GUINT8(data+32);
if (tmp==1)
if (tmp==1)
fbse->usage = eUsageTexture;
else
fbse->usage = eUsageDefault;
......@@ -336,7 +309,7 @@ BSE_new (ESH_HEADER *h) /* S59FE3.HTM */
data+=25; /* Another header ! */
data_len-=25;
write_file ("test", data, fbse->size, fbse->stored_type);
} else
} else
printf ("FIXME: unhandled type 0x%x\n",
fbse->stored_type);
......@@ -422,12 +395,15 @@ read_DggContainer (ESH_HEADER *h)
printf ("Dgg:\n");
Dgg_new (c);
break;
case OPT:
OPT_new (c);
break;
case BStoreContainer:
BStoreContainer_new (c);
break;
default:
printf ("Unknown DGGC Header: type 0x%x, inst 0x%x ver 0x%x len 0x%x\n",
c->type, c->instance, c->ver, c->length);
......@@ -437,7 +413,7 @@ read_DggContainer (ESH_HEADER *h)
}
/**
* A Shape ... it contains details about it self generaly,
* A Shape ... it contains details about it self generally,
* only one real shape in inside the container though.
**/
static void
......@@ -537,16 +513,16 @@ read_DgContainer (ESH_HEADER *h) /* See S59FE7.HTM */
**/
static void
disseminate_stream (guint8 *data, gint32 length)
ms_escher_read (guint8 *data, gint32 length)
{
ESH_HEADER *h = esh_header_new (data, length);
while (esh_header_next(h)) {
switch (h->type) {
case DggContainer:
read_DggContainer (h);
case DggContainer: read_DggContainer (h);
break;
case DgContainer: read_DgContainer (h);
break;
case DgContainer:
read_DgContainer (h);
case OPT: OPT_new (h);
break;
default:
printf ("Unknown Dissstr Header: type 0x%x, inst 0x%x ver 0x%x len 0x%x\n",
......@@ -554,28 +530,25 @@ disseminate_stream (guint8 *data, gint32 length)
break;
}
}
esh_header_destroy (h);
esh_header_destroy (h);
}
/**
* FIXME: See S59FDA.HTM / S59FDB.HTM
* essentialy the MsOleStream needs to be sub-classed by excel, and
* forced to store its data inside BIFF records inside the excel stream.
* For now we'll assume the data is small and doesn't have any CONTINUE
* records !!!.
**/
void
ms_escher_hack_get_drawing (const BiffQuery *q)
{
/* Convert the query to a sort of streeam */
guint8 *data;
guint32 len;
printf ("------ Start Escher -------\n");
biff_to_flat_data (q, &data, &len);
/* Only support during debugging for now */
if (ms_excel_read_debug <= 0)
return;
disseminate_stream (data, len);
biff_to_flat_data (q, &data, &len);
printf ("------ End Escher -------\n");
printf ("{ Escher\n");
ms_escher_read (data, len);
printf ("}; /* Escher */\n");
g_free (data);
}
#ifndef GNUMERIC_MS_OFFICE_ESCHER_H
#define GNUMERIC_MS_OFFICE_ESCHER_H
/**
* ms-escher.h: MS Office drawing layer support
*
* Author:
* Michael Meeks (michael@imaginator.com)
**/
#include "ms-biff.h"
void ms_escher_hack_get_drawing (const BiffQuery *q);
extern void ms_escher_hack_get_drawing (const BiffQuery *q);
#endif /* GNUMERIC_MS_OFFICE_ESCHER_H */
#ifndef GNUMERIC_EXCEL_BIFF_H
#define GNUMERIC_EXCEL_BIFF_H
/**
* ms-excel-biff.h: MS Excel BIFF header for Gnumeric
* contains data about the Excel BIFF records
......@@ -5,8 +8,8 @@
* Author:
* Michael Meeks (michael@imaginator.com)
**/
#ifndef GNUMERIC_EXCEL_BIFF_H
#define GNUMERIC_EXCEL_BIFF_H
#include "excel.h"
/* Pass this a BiffQuery * */
#define EX_GETROW(p) (BIFF_GET_GUINT16(p->data + 0))
......
......@@ -3,45 +3,34 @@
*
* Author:
* Michael Meeks (michael@imaginator.com)
* Jody Goldberh (jgoldberg@home.com)
**/
#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <config.h>
#include <stdio.h>
#include <ctype.h>
#include <gnome.h>
#include "gnumeric.h"
#include "gnumeric-util.h"
#include "gnome-xml/tree.h"
#include "gnome-xml/parser.h"
#include "gnumeric-sheet.h"
#include "format.h"
#include "color.h"
#include "sheet-object.h"
#include "style.h"
#include "main.h"
#include "utils.h"
#include "excel.h"
#include "ms-formula-read.h"
#include "ms-excel-read.h"
#include "ms-obj.h"
#include "ms-chart.h"
#include "ms-escher.h"
#include "utils.h" /* for cell_name */
/* This many styles are reserved */
#define XF_MAGIC_OFFSET (16 + 4)
/* #define NO_DEBUG_EXCEL */
/* Used in src/main.c to toggle debug messages on & off */
/*
* As a convention
* 0 = quiet, no experimental features.
* 1 = enable experimental features
* >1 increasing levels of detail.
*/
int ms_excel_read_debug = 0;
int ms_excel_formula_debug = 0;
int ms_excel_color_debug = 0;
int ms_excel_chart_debug = 0;
extern int gnumeric_debugging;
/* Forward references */
static ExcelSheet *ms_excel_sheet_new (ExcelWorkbook *wb,
......@@ -100,8 +89,9 @@ biff_string_get_flags (guint8 *ptr,
header = BIFF_GET_GUINT8(ptr);
/* I assume that this header is backwards compatible with raw ASCII */
if (((header & 0xf0) == 0) &&
((header & 0x02) == 0)) { /* Its a proper Unicode header grbit byte */
/* Its a proper Unicode header grbit byte */
if (((header & 0xf2) == 0)) {
*word_chars = (header & 0x1) != 0;
*extended = (header & 0x4) != 0;
*rich = (header & 0x8) != 0;
......@@ -471,7 +461,7 @@ biff_font_data_new (ExcelWorkbook *wb, BiffQuery *q)
BIFF_GET_GUINT8 (q->data + 14), NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 1) {
printf ("Insert font '%s' size %d pts color %d\n",
fd->fontname, fd->height / 20, fd->color_idx);
}
......@@ -533,7 +523,7 @@ char *excel_builtin_formats[EXCEL_BUILTIN_FORMAT_LEN] = {
/* 0x31 */ "@"
};
static StyleFormat *
StyleFormat *
biff_format_data_lookup (ExcelWorkbook *wb, guint16 idx)
{
char *ans = NULL;
......@@ -636,7 +626,7 @@ biff_name_data_get_name (ExcelSheet *sheet, guint16 idx)
printf ("Error: '%s' on name '%s'\n", duff,
bnd->name);
#ifndef NO_DEBUG_EXCEL
else if (ms_excel_read_debug > 0) {
else if (ms_excel_read_debug > 1) {
EvalPosition ep;
printf ("Parsed name : '%s' = '%s'\n", bnd->name,
tree?expr_decode_tree (tree, eval_pos_init (
......@@ -770,7 +760,7 @@ ms_excel_palette_new (BiffQuery *q)
return pal;
}
static StyleColor *
StyleColor *
ms_excel_palette_get (ExcelPalette *pal, guint idx, StyleColor *contrast)
{
g_assert (NULL != pal);
......@@ -1290,7 +1280,7 @@ biff_xf_data_new (ExcelWorkbook *wb, BiffQuery *q, eBiff_version ver)
g_ptr_array_add (wb->XF_style_records, xf);
}
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 2) {
printf ("XF : Fore %d, Back %d\n",
xf->pat_foregnd_col, xf->pat_backgnd_col);
}
......@@ -1386,7 +1376,7 @@ ms_excel_formula_shared (BiffQuery *q, ExcelSheet *sheet, Cell *cell)
sf->data_len = data_len;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>0) {
if (ms_excel_read_debug > 1) {
printf ("Shared formula, extent %s:%s\n",
cell_name(array_col_first, array_row_first),
cell_name(array_col_last, array_row_last));
......@@ -1684,6 +1674,7 @@ ms_excel_workbook_new (eBiff_version ver)
ans->XF_style_records = g_ptr_array_new ();
ans->XF_cell_records = g_ptr_array_new ();
ans->name_data = g_ptr_array_new ();
ans->chart.series = NULL; /* Init if/when its needed */
ans->format_data = g_hash_table_new ((GHashFunc)biff_guint16_hash,
(GCompareFunc)biff_guint16_equal);
ans->palette = ms_excel_default_palette ();
......@@ -1756,6 +1747,9 @@ ms_excel_workbook_destroy (ExcelWorkbook *wb)
biff_name_data_destroy (g_ptr_array_index (wb->name_data, lp));
g_ptr_array_free (wb->name_data, TRUE);
if (wb->chart.series != NULL)
g_ptr_array_free (wb->chart.series, TRUE);
g_hash_table_foreach_remove (wb->font_data,
(GHRFunc)biff_font_data_destroy,
wb);
......@@ -1881,7 +1875,7 @@ ms_excel_read_name (BiffQuery *q, ExcelSheet *sheet)
status_txt = biff_get_text (ptr, status_txt_len, NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 1) {
printf ("Name record : '%s', '%s', '%s', '%s', '%s'\n",
name ? name : "(null)",
menu_txt ? menu_txt : "(null)",
......@@ -1929,21 +1923,12 @@ ms_excel_externname (BiffQuery *q,
char *externname;
guint8 *defn;
guint16 defnlen;
if (sheet->ver >= eBiffV8) {
guint8 const namelen = BIFF_GET_GUINT8(q->data+6);
defn = q->data + 8 + namelen; /* 1 byte for flags */
defnlen = BIFF_GET_GUINT16(defn);
defn += 2;
externname = biff_get_text (q->data+7, namelen, NULL);
} else if (sheet->ver >= eBiffV7) {
/* Not unicode */
guint8 const namelen = BIFF_GET_GUINT8(q->data+6);
defn = q->data + 7 + namelen;
if (sheet->ver >= eBiffV7) {
guint32 namelen = BIFF_GET_GUINT8(q->data+6);
externname = biff_get_text (q->data+7, namelen, &namelen);
defn = q->data+7 + namelen;
defnlen = BIFF_GET_GUINT16(defn);
defn += 2;
externname = g_new(char, namelen+1);
strncpy (externname, q->data+7, namelen);
externname[namelen] = '\0';
} else { /* Ancient Papyrus spec. */
static guint8 data[] = { 0x1c, 0x17 }; /* Error : REF */
defn = data;
......@@ -2048,7 +2033,7 @@ ms_excel_read_cell (BiffQuery *q, ExcelSheet *sheet)
outlining = (options & 0x0700) >> 8;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>0 ) {
if (ms_excel_read_debug > 1) {
if (BIFF_GET_GUINT8(q->data+10) != 0)
printf ("Odd Colinfo\n");
printf ("Column Formatting from col %d to %d of width "
......@@ -2180,7 +2165,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
guint32 blankSheetPos = q->streamPos + q->length + 4;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>0) {
if (ms_excel_read_debug > 1) {
printf ("----------------- '%s' -------------\n",
sheet->gnum_sheet->name);
}
......@@ -2188,7 +2173,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
while (ms_biff_query_next (q)) {
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>5) {
if (ms_excel_read_debug > 5) {
printf ("Opcode : 0x%x\n", q->opcode);
}
#endif
......@@ -2196,7 +2181,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
case BIFF_EOF:
if (q->streamPos == blankSheetPos || sheet->blank) {
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>0) {
if (ms_excel_read_debug > 1) {
printf ("Blank sheet\n");
}
#endif
......@@ -2257,10 +2242,13 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
#endif
break;
}
case BIFF_MS_O_DRAWING: /* FIXME: See: ms-escher.c and S59DA4.HTM */
if (gnumeric_debugging>0)
ms_escher_hack_get_drawing (q);
case BIFF_MS_O_DRAWING:
case BIFF_MS_O_DRAWING_GROUP:
case BIFF_MS_O_DRAWING_SELECTION:
ms_escher_hack_get_drawing (q);
break;
case BIFF_NOTE: /* See: S59DAB.HTM */
{
guint16 row = EX_GETROW(q);
......@@ -2276,7 +2264,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
printf ("FIXME: Error in options\n");
hidden = (options&0x2)==0;
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>0) {
if (ms_excel_read_debug > 1) {
printf ("Comment at %d,%d id %d options"
" 0x%x hidden %d by '%s'\n",
col, row, obj_id, options,
......@@ -2287,7 +2275,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
guint16 author_len = BIFF_GET_GUINT16(q->data+4);
char *text=biff_get_text(q->data+6, author_len, NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug>1) {
if (ms_excel_read_debug > 1) {
printf ("Comment at %d,%d '%s'\n",
col, row, text);
}
......@@ -2373,7 +2361,6 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
break;
case BIFF_CODENAME :
case BIFF_TXO :