Commit 4c5e47c7 authored by Michael Meeks's avatar Michael Meeks
Browse files

Fix 'ole'; 'cd' didn't work :-)

Implement more Excel 97 records on export.
parent 96b9b0c0
1999-09-23 Michael Meeks <michael@nuclecu.unam.mx>
* ole.c (enter_dir): Change logic.
1999-09-22 Michael Meeks <michael@nuclecu.unam.mx>
* ms-excel-write.c (write_bits): Fix TABID.
(write_sheet_tail): Add current selected sheet save & V8 WINDOW2
(write_bits): only save PANEs if we need to.
(write_fonts): always write 5 fonts instead of 4.
(write_xf): Add USESELFS.
(write_sheet): 0x200|INDEX.
(write_sheet_bools): remove -1 from sheet->maxy for V8.
* ole.c (do_biff_raw): Remove stream position to help 'diff'.
* ms-obj.c (ms_obj_realize): Turn off auto-sizing of images to
tango with improved sizing capable image components.
1999-09-23 Jody Goldberg <jgoldberg@home.com>
* ole.c (dump_vba) : Remove the escher code. The new version needs to
......
......@@ -2682,7 +2682,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
int top_vis_row, left_vis_col;
guint16 options;
if (q->length<6) {
if (q->length < 6) {
printf ("Duff window data");
break;
}
......
......@@ -334,9 +334,9 @@ write_bits (BiffPut *bp, ExcelWorkbook *wb, eBiff_version ver)
/* See: S59E09.HTM */
len = wb->sheets->len;
data = ms_biff_put_len_next (bp, BIFF_TABID, len);
for (lp = 0; lp < len; lp++) /* FIXME: ? */
MS_OLE_SET_GUINT16 (data + lp*2, lp);
data = ms_biff_put_len_next (bp, BIFF_TABID, len * 2);
for (lp = 0; lp < len; lp++)
MS_OLE_SET_GUINT16 (data + lp*2, lp + 1);
ms_biff_put_commit (bp);
}
/* See: S59D8A.HTM */
......@@ -373,7 +373,7 @@ write_bits (BiffPut *bp, ExcelWorkbook *wb, eBiff_version ver)
write_window1 (bp, ver);
if (ver >= eBiffV8) {
if (ver >= eBiffV8 && 0 /* if we have panes */) {
/* See: S59DCA.HTM */
data = ms_biff_put_len_next (bp, BIFF_PANE, 2);
MS_OLE_SET_GUINT16 (data, 0x0);
......@@ -552,7 +552,7 @@ write_fonts (BiffPut *bp, ExcelWorkbook *wb)
guint8 data[64];
int lp;
for (lp=0;lp<4;lp++) { /* FIXME: Magic minimum fonts */
for (lp = 0; lp < 5; lp++) { /* FIXME: Magic minimum fonts */
fonts->StyleFont_to_idx = g_hash_table_new (g_direct_hash,
g_direct_equal);
/* Kludge for now ... */
......@@ -731,15 +731,23 @@ write_xf (BiffPut *bp, ExcelWorkbook *wb)
xf->Style_to_idx = g_hash_table_new (g_direct_hash,
g_direct_equal);
/* Need at least 16 apparently */
for (lp=0;lp<21;lp++)
for (lp = 0; lp < 21; lp++)
write_xf_record (bp, NULL, wb->ver,lp);
/* See: S59DEA.HTM */
for (lp=0;lp<6;lp++) {
for (lp = 0; lp < 6; lp++) {
guint8 *data = ms_biff_put_len_next (bp, BIFF_STYLE, 4);
MS_OLE_SET_GUINT32 (data, style_magic[lp]); /* cop out */
ms_biff_put_commit (bp);
}
/* See: S59E14.HTM */
if (wb->ver >= eBiffV8) {
guint8 *data = ms_biff_put_len_next (bp, BIFF_USESELFS, 2);
MS_OLE_SET_GUINT16 (data, 0x1); /* we are language naturals */
ms_biff_put_commit (bp);
}
return xf;
}
......@@ -1202,7 +1210,7 @@ write_sheet_bools (BiffPut *bp, ExcelSheet *sheet)
if (ver >= eBiffV8) {
data = ms_biff_put_len_next (bp, BIFF_DIMENSIONS, 14);
MS_OLE_SET_GUINT32 (data + 0, 0);
MS_OLE_SET_GUINT32 (data + 4, sheet->maxy-1);
MS_OLE_SET_GUINT32 (data + 4, sheet->maxy);
MS_OLE_SET_GUINT16 (data + 8, 0);
MS_OLE_SET_GUINT16 (data + 10, sheet->maxx);
MS_OLE_SET_GUINT16 (data + 12, 0x0000);
......@@ -1224,15 +1232,36 @@ write_sheet_tail (BiffPut *bp, ExcelSheet *sheet)
eBiff_version ver = sheet->wb->ver;
write_window1 (bp, ver);
/* See: S59E18.HTM */
if (ver <= eBiffV7) {
/* See: S59E18.HTM */
guint16 options = 0x2b6; /* Arabic ? */
data = ms_biff_put_len_next (bp, BIFF_WINDOW2, 10);
MS_OLE_SET_GUINT32 (data + 0, 0x000006b6);
if (sheet->gnum_sheet ==
workbook_get_current_sheet (sheet->wb->gnum_wb))
options |= 0x400;
MS_OLE_SET_GUINT16 (data + 0, options);
MS_OLE_SET_GUINT16 (data + 2, 0x0);
MS_OLE_SET_GUINT32 (data + 4, 0x0);
MS_OLE_SET_GUINT16 (data + 8, 0x0);
ms_biff_put_commit (bp);
} else {
printf ("FIXME: need magic window2 numbers\n");
guint16 options = 0x2b6;
data = ms_biff_put_len_next (bp, BIFF_WINDOW2, 18);
if (sheet->gnum_sheet ==
workbook_get_current_sheet (sheet->wb->gnum_wb))
options |= 0x400;
MS_OLE_SET_GUINT16 (data + 0, options);
MS_OLE_SET_GUINT16 (data + 2, 0x0);
MS_OLE_SET_GUINT32 (data + 4, 0x0);
MS_OLE_SET_GUINT16 (data + 8, 0x0);
MS_OLE_SET_GUINT16 (data + 10, 0x1);
MS_OLE_SET_GUINT32 (data + 12, 0x0);
MS_OLE_SET_GUINT16 (data + 16, 0x0);
ms_biff_put_commit (bp);
}
if (ver >= eBiffV8) {
......@@ -1373,7 +1402,7 @@ write_sheet (BiffPut *bp, ExcelSheet *sheet)
g_error ("Sheet seems impossibly big");
if (sheet->wb->ver >= eBiffV8) {
guint8 *data = ms_biff_put_len_next (bp, BIFF_INDEX,
guint8 *data = ms_biff_put_len_next (bp, 0x200|BIFF_INDEX,
sheet->maxy*4 + 16);
index_off = bp->streamPos;
MS_OLE_SET_GUINT32 (data, 0);
......
......@@ -101,7 +101,7 @@ ms_obj_realize (MSObj *obj, ExcelWorkbook *wb, ExcelSheet *sheet)
anchor[0], anchor[1],
anchor[2], anchor[3],
blip->reproid);
if (!sheet_object_container_load (so, blip->stream, TRUE))
if (!sheet_object_container_load (so, blip->stream, FALSE))
g_warning ("Failed to load '%s' from stream",
blip->reproid);
#endif
......
......@@ -199,8 +199,7 @@ enter_dir (MsOle *ole)
g_free (newpath);
return;
}
if (s.type != MsOleStorageT &&
s.type != MsOleRootT) {
if (s.type == MsOleStreamT) {
printf ("Trying to enter a stream. (%d)\n", s.type);
g_free (newpath);
return;
......@@ -305,7 +304,10 @@ do_biff_raw (MsOle *ole)
buffer = g_new (guint8, 65550);
while (stream->read_copy (stream, data, 4)) {
guint32 len=MS_OLE_GET_GUINT16(data+2);
printf ("0x%4x Opcode 0x%3x : %15s, length 0x%x (=%d)\n", stream->position,
/* printf ("0x%4x Opcode 0x%3x : %15s, length 0x%x (=%d)\n", stream->position,
MS_OLE_GET_GUINT16(data), get_biff_opcode_name (MS_OLE_GET_GUINT16(data)),
len, len);*/
printf ("Opcode 0x%3x : %15s, length 0x%x (=%d)\n",
MS_OLE_GET_GUINT16(data), get_biff_opcode_name (MS_OLE_GET_GUINT16(data)),
len, len);
stream->read_copy (stream, buffer, len);
......
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