Commit dff7363f authored by Jody Goldberg's avatar Jody Goldberg

Added VALUE_ERROR, VALUE_BOOLEAN

Improved ROW, COLUMN, COUNTBLANK, ISBLANK, ISERROR functions.
Added some images for the graph wizard.
parent 5acc8b99
1999-07-25 Jody Goldberg <jgoldberg@home.com>
* plugins/guile/plugin.c,
plugins/python/python.c
src/{Makefile.am, cell.[ch], collect.[ch], eval.c, expr-name.c,
expr.[ch], fn-database.c, fn-date.c, fn-eng.c, fn-financial.c,
fn-information.c, fn-logical.c, fn-lookup.c, fn-math.c,
fn-misc.c, fn-sheet.c, fn-stat.c, fn-string.c, format.c,
func.[ch], sheet-object-container.c, sheet.[ch]}
: Add VALUE_ERROR, VALUE_BOOLEAN, Change many signatures to return
Value for errors.
* icons/chart_*.png : Add Some images in preparation for re-enabling
the graph wizard.
* src/expr.c (eval_funcall) : When a single row or column is passed to
a function expecting a single value, take the intersection of the
evaluation position and the range.
(cell_ref_get_abs_col, cell_ref_get_abs_row) : New functions.
* src/value.[ch] : New files with Value support routines split out from
expr.[ch]
1999-07-26 Michael Meeks <michael@edenproject.org>
* src/corba-sheet.c (fill_corba_value): Remove redundant Sheet *
......
......@@ -9,6 +9,12 @@ Michael:
* Initial stab at Lotus 123: 'wk1', 'wks' import.
* Added GUI for Names.
Jody:
* Enable Array formulas.
* Add VALUE_BOOLEAN, VALUE_ERROR.
* Work on functions : ROW, COLUMN, ISLOGICAL, ISERR, ISBLANK, DATEVALUE
* Support implict intersection 'feature' of XL.
--------------------------------------------------------------------------
Gnumeric 0.31
......
1999-07-25 Jody Goldberg <jgoldberg@home.com>
* plugins/guile/plugin.c,
plugins/python/python.c
src/{Makefile.am, cell.[ch], collect.[ch], eval.c, expr-name.c,
expr.[ch], fn-database.c, fn-date.c, fn-eng.c, fn-financial.c,
fn-information.c, fn-logical.c, fn-lookup.c, fn-math.c,
fn-misc.c, fn-sheet.c, fn-stat.c, fn-string.c, format.c,
func.[ch], sheet-object-container.c, sheet.[ch]}
: Add VALUE_ERROR, VALUE_BOOLEAN, Change many signatures to return
Value for errors.
* icons/chart_*.png : Add Some images in preparation for re-enabling
the graph wizard.
* src/expr.c (eval_funcall) : When a single row or column is passed to
a function expecting a single value, take the intersection of the
evaluation position and the range.
(cell_ref_get_abs_col, cell_ref_get_abs_row) : New functions.
* src/value.[ch] : New files with Value support routines split out from
expr.[ch]
1999-07-26 Michael Meeks <michael@edenproject.org>
* src/corba-sheet.c (fill_corba_value): Remove redundant Sheet *
......
......@@ -4,6 +4,79 @@ icons_DATA = \
orient-horizontal.png \
orient-vertical.png \
right-down.png \
down-right.png
down-right.png \
chart_area_1_1.png \
chart_area_1_2.png \
chart_area_1_3.png \
chart_area_2_1.png \
chart_area_2_2.png \
chart_area_2_3.png \
chart_bar_1_1.png \
chart_bar_1_2.png \
chart_bar_1_3.png \
chart_bar_2_1_.png \
chart_bar_2_2_.png \
chart_bar_2_3_.png \
chart_bubble_1_1.png \
chart_bubble_1_2.png \
chart_column_1_1.png \
chart_column_1_2.png \
chart_column_1_3.png \
chart_column_2_1.png \
chart_column_2_2.png \
chart_column_2_3.png \
chart_column_3_1.png \
chart_cone.xpm_1_1.png \
chart_cone.xpm_1_2.png \
chart_cone.xpm_1_3.png \
chart_cone.xpm_2_1.png \
chart_cone.xpm_2_2.png \
chart_cone.xpm_2_3.png \
chart_cone.xpm_3_1.png \
chart_cylinder_1_1.png \
chart_cylinder_1_2.png \
chart_cylinder_1_3.png \
chart_cylinder_2_1.png \
chart_cylinder_2_2.png \
chart_cylinder_2_3.png \
chart_cylinder_3_1.png \
chart_doghnut_1_1.png \
chart_doghnut_2_1.png \
chart_line_1_1.png \
chart_line_1_2.png \
chart_line_1_3.png \
chart_line_2_1.png \
chart_line_2_2.png \
chart_line_2_3.png \
chart_line_3_1.png \
chart_pie_1_1.png \
chart_pie_1_2.png \
chart_pie_1_3.png \
chart_pie_2_1.png \
chart_pie_2_2.png \
chart_pie_2_3.png \
chart_pyramid_1_1.png \
chart_pyramid_1_2.png \
chart_pyramid_1_3.png \
chart_pyramid_2_1.png \
chart_pyramid_2_2.png \
chart_pyramid_2_3.png \
chart_pyramid_3_1.png \
chart_radar_1_1.png \
chart_radar_1_2.png \
chart_radar_1_3.png \
chart_scatter_1_1.png \
chart_scatter_2_1.png \
chart_scatter_2_2.png \
chart_scatter_3_1.png \
chart_scatter_3_2.png \
chart_stock_1_1.png \
chart_stock_1_2.png \
chart_stock_2_1.png \
chart_stock_2_2.png \
chart_surface_1_1.png \
chart_surface_1_2.png \
chart_surface_2_1.png \
chart_surface_2_2.png
EXTRA_DIST = $(icons_DATA)
1999-07-26 Jody Goldberg <jgoldberg@home.com>
* ms-chart.c (BC_R(chartline)) : More state checking.
(BC_R(legend)) : Implement.
(BC_R(series)) : Store series in chart objects.
(ms_excel_biff_dimensions) :
* ms-obj.c : Closer ties with ms-escher.c.
* ms-formula-read.c : Changes for VALUE_ERROR. COUNTBLANK
takes 1 argument.
1999-07-26 Michael Meeks <michael@edenproject.org>
* ms-summary.c (ms_summary_read): Update to ms_ole_summary_close.
......
This diff is collapsed.
......@@ -8,7 +8,7 @@
* Jody Goldberg (jgoldberg@home.com)
**/
#include <ms-excel-read.h>
#include "ms-excel-read.h"
/* Reads charts */
extern void ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb,
......@@ -17,4 +17,7 @@ extern void ms_excel_chart (BiffQuery *q, ExcelWorkbook *wb,
/* 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);
extern void ms_excel_biff_dimensions (BiffQuery *q, ExcelWorkbook *wb);
#endif /* GNUMERIC_MS_CHART_H */
......@@ -12,6 +12,7 @@
#include "escher-types.h"
#include "biff-types.h"
#include "ms-excel-read.h"
#include "ms-obj.h"
#include <stdio.h>
......@@ -513,7 +514,7 @@ read_DgContainer (ESH_HEADER *h) /* See S59FE7.HTM */
**/
static void
ms_escher_read (guint8 *data, gint32 length)
ms_escher_read (guint8 *data, gint32 length, BiffQuery *q, ExcelWorkbook *wb)
{
ESH_HEADER *h = esh_header_new (data, length);
while (esh_header_next(h)) {
......@@ -524,6 +525,17 @@ ms_escher_read (guint8 *data, gint32 length)
case Selection: break;
case OPT: OPT_new (h); break;
case ClientTextbox:
{
if (h->length_left != 0)
g_warning ("EXCEL : expected ClientTextBox to be last element (%d != 0)", h->length_left);
else
printf ("Expect a TXO\n");
/* The calling function will read the TXO */
}
default:
printf ("Unknown Dissstr Header: type 0x%x, inst 0x%x ver 0x%x len 0x%x\n",
h->type, h->instance, h->ver, h->length);
......@@ -534,7 +546,7 @@ ms_escher_read (guint8 *data, gint32 length)
}
void
ms_escher_hack_get_drawing (const BiffQuery *q)
ms_escher_hack_get_drawing (BiffQuery *q, ExcelWorkbook *wb)
{
/* Convert the query to a sort of streeam */
guint8 *data;
......@@ -547,7 +559,7 @@ ms_escher_hack_get_drawing (const BiffQuery *q)
biff_to_flat_data (q, &data, &len);
printf ("{ Escher\n");
ms_escher_read (data, len);
ms_escher_read (data, len, q, wb);
printf ("}; /* Escher */\n");
g_free (data);
......
......@@ -7,8 +7,8 @@
* Author:
* Michael Meeks (michael@imaginator.com)
**/
#include "ms-biff.h"
#include "ms-excel-read.h"
extern void ms_escher_hack_get_drawing (const BiffQuery *q);
extern void ms_escher_hack_get_drawing (BiffQuery *q, ExcelWorkbook *wb);
#endif /* GNUMERIC_MS_OFFICE_ESCHER_H */
......@@ -10,6 +10,7 @@
**/
#include "excel.h"
#include "ms-biff.h"
/* Pass this a BiffQuery * */
#define EX_GETROW(p) (MS_OLE_GET_GUINT16(p->data + 0))
......
......@@ -10,6 +10,7 @@
#include "ms-excel-read.h"
#include "ms-obj.h"
#include "ms-chart.h"
#include "gnumeric-chart.h"
#include "ms-escher.h"
#include "utils.h" /* for cell_name */
......@@ -187,10 +188,10 @@ biff_get_text (guint8 const *pos, guint32 length, guint32 *byte_length)
return ans;
}
const char *
char const *
biff_get_error_text (const guint8 err)
{
char *buf;
char const *buf;
switch (err)
{
case 0: buf = gnumeric_err_NULL; break;
......@@ -1454,13 +1455,13 @@ ms_excel_read_formula (BiffQuery *q, ExcelSheet *sheet)
case 2 : /* Error */
{
EvalPosition ep;
guint8 const v = MS_OLE_GET_GUINT8 (q->data+8);
char const *const err_str =
biff_get_error_text (v);
/* FIXME FIXME FIXME : how to mark this as
* an ERROR ? */
val = value_new_string (err_str);
/* FIXME FIXME FIXME : Init ep */
val = value_new_error (&ep, err_str);
}
break;
......@@ -1689,7 +1690,7 @@ ms_excel_workbook_new (eBiff_version ver)
ans->excel_sheets = 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->charts = 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 ();
......@@ -1758,8 +1759,13 @@ 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);
if (wb->charts != NULL)
{
for (lp=0;lp<wb->charts->len;lp++)
gnumeric_chart_destroy (g_ptr_array_index(wb->charts, lp));
g_ptr_array_free (wb->charts, TRUE);
wb->charts = NULL;
}
g_hash_table_foreach_remove (wb->font_data,
(GHRFunc)biff_font_data_destroy,
......@@ -2293,7 +2299,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
case BIFF_MS_O_DRAWING:
case BIFF_MS_O_DRAWING_GROUP:
case BIFF_MS_O_DRAWING_SELECTION:
ms_escher_hack_get_drawing (q);
ms_escher_hack_get_drawing (q, wb);
break;
case BIFF_NOTE: /* See: S59DAB.HTM */
......@@ -2360,7 +2366,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
MS_OLE_GET_GUINT8(q->data),
NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 2) {
printf ("Header '%s'\n", str);
}
#endif
......@@ -2377,7 +2383,7 @@ ms_excel_read_sheet (ExcelSheet *sheet, BiffQuery *q, ExcelWorkbook *wb)
MS_OLE_GET_GUINT8(q->data),
NULL);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
if (ms_excel_read_debug > 2) {
printf ("Footer '%s'\n", str);
}
#endif
......@@ -2682,9 +2688,20 @@ ms_excel_read_workbook (MsOle *file)
}
} else if (ver->type == eBiffTChart)
ms_excel_chart (q, wb, ver);
else if (ver->type == eBiffTVBModule)
printf ("VB Module.\n");
else
else if (ver->type == eBiffTVBModule ||
ver->type == eBiffTMacrosheet) {
/* Skip contents of Module, or MacroSheet */
if (ver->type != eBiffTMacrosheet)
printf ("VB Module.\n");
else
printf ("XLM Macrosheet.\n");
while (ms_biff_query_next (q) &&
q->opcode != BIFF_EOF)
;
if (q->opcode != BIFF_EOF)
g_warning ("EXCEL : file format error. Missing BIFF_EOF");
} else
printf ("Unknown BOF (%x)\n",ver->type);
}
break;
......@@ -2845,8 +2862,7 @@ ms_excel_read_workbook (MsOle *file)
/* This seems to appear within a workbook */
/* MW: And on Excel seems to drive the display
of currency amounts. */
guint16 codepage = MS_OLE_GET_GUINT16 (q->data);
guint16 const codepage = MS_OLE_GET_GUINT16 (q->data);
#ifndef NO_DEBUG_EXCEL
if (ms_excel_read_debug > 0) {
switch(codepage)
......@@ -2864,6 +2880,10 @@ ms_excel_read_workbook (MsOle *file)
case 0x04e4 :
puts("CodePage = ANSI (Microsoft Windows)");
break;
case 0x04b0 :
/* FIXME FIXME : This is a guess */
puts("CodePage = Auto");
break;
default :
printf("CodePage = UNKNOWN(%hx)\n",
codepage);
......@@ -2954,7 +2974,7 @@ ms_excel_read_workbook (MsOle *file)
case BIFF_MS_O_DRAWING:
case BIFF_MS_O_DRAWING_GROUP:
case BIFF_MS_O_DRAWING_SELECTION:
ms_escher_hack_get_drawing (q);
ms_escher_hack_get_drawing (q, wb);
break;
default:
......
......@@ -96,10 +96,7 @@ typedef struct _ExcelWorkbook
int global_string_max;
eBiff_version ver;
struct
{
GPtrArray *series;
} chart;
GPtrArray *charts;
/**
* Gnumeric parallel workbook
......
......@@ -412,7 +412,7 @@ FormulaFuncData formula_func_data[FORMULA_FUNC_DATA_LEN] =
/* 344 */ { "SUBTOTAL", -1 },
/* 345 */ { "SUMIF", -1 }, /* Actual range is optional */
/* 346 */ { "COUNTIF", 2 },
/* 347 */ { "COUNTBLANK", -1 },
/* 347 */ { "COUNTBLANK", 1 },
/* 348 */ { "SCENARIOGET", -2 },
/* 349 */ { "OPTIONSLISTSGET", -2 },
/* 350 */ { "ISPMT", 1 },
......@@ -632,7 +632,7 @@ make_inter_sheet_ref_v7 (ExcelWorkbook *wb, guint16 extn_idx,
static Value *
unknownFunctionHandler (FunctionEvalInfo *ei, GList *expr_node_list)
{
return function_error (ei, gnumeric_err_NAME);
return value_new_error (&ei->pos, gnumeric_err_NAME);
}
static Symbol *
......@@ -947,7 +947,7 @@ ms_excel_parse_formula (ExcelWorkbook *wb, ExcelSheet *sheet, guint8 const *mem,
guint32 const cols=MS_OLE_GET_GUINT8(array_data)+1;
guint32 const rows=MS_OLE_GET_GUINT16(array_data+1)+1;
guint16 lpx,lpy;
Value *v = value_array_new (cols, rows);
Value *v = value_new_array (cols, rows);
ptg_length = 7;
#ifndef NO_DEBUG_EXCEL
......
......@@ -8,6 +8,8 @@
#include "ms-obj.h"
#include "ms-chart.h"
#include "ms-escher.h"
#include "utils.h"
extern int ms_excel_read_debug;
......@@ -134,20 +136,31 @@ ms_obj_read_text_impl (BiffQuery *q, ExcelWorkbook * wb)
printf ("}; /* TextObject */\n");
}
}
static void
void
ms_obj_read_text (BiffQuery *q, ExcelWorkbook * wb, int const id)
{
/* next record must be a DRAWING followed by a TXO */
/* next record must be a DRAWING */
g_return_if_fail (ms_biff_query_next (q));
g_return_if_fail (q->opcode == BIFF_MS_O_DRAWING);
ms_escher_hack_get_drawing (q, wb);
if (ms_excel_read_debug > 0)
dump (q->data, q->length);
/* and finally a TXO */
/* then a TXO, CONTINUE, CONTINUE */
g_return_if_fail (ms_biff_query_next (q));
g_return_if_fail (q->opcode == BIFF_TXO);
ms_obj_read_text_impl (q, wb);
#if 0
/* FIXME : Most but not all have a trailing Drawing */
/* finally another DRAWING */
g_return_if_fail (ms_biff_query_next (q));
if (q->opcode != BIFF_MS_O_DRAWING)
printf ("Expected MS_O_DRAWING found 0x%x\n", q->opcode);
else
ms_escher_hack_get_drawing (q);
#endif
}
static void
......@@ -194,72 +207,77 @@ ms_obj_read_biff8_obj (BiffQuery *q, ExcelWorkbook * wb)
break;
case GR_MACRO :
ms_obj_dump (data+4, len, "MacroObject");
ms_obj_dump (data, len, "MacroObject");
break;
case GR_COMMAND_BUTTON :
ms_obj_dump (data+4, len, "CommandButton");
ms_obj_dump (data, len, "CommandButton");
break;
case GR_GROUP_BUTTON :
ms_obj_dump (data+4, len, "GroupButton");
ms_obj_dump (data, len, "GroupButton");
break;
case GR_CLIPBOARD_FORMAT:
ms_obj_dump (data+4, len, "ClipboardFmt");
ms_obj_dump (data, len, "ClipboardFmt");
break;
case GR_PICTURE_OPTIONS:
ms_obj_dump (data+4, len, "PictOpt");
ms_obj_dump (data, len, "PictOpt");
break;
case GR_PICTURE_FORMULA:
ms_obj_dump (data+4, len, "PictFormula");
ms_obj_dump (data, len, "PictFormula");
break;
case GR_CHECKBOX_LINK :
ms_obj_dump (data+4, len, "CheckboxLink");
ms_obj_dump (data, len, "CheckboxLink");
break;
case GR_RADIO_BUTTON :
ms_obj_dump (data+4, len, "RadioButton");
ms_obj_dump (data, len, "RadioButton");
break;
case GR_SCROLLBAR