Commit d7f2d3b1 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

new. (excel_read_str_name) : split from here. (excel_read_EXTERNNAME) :


2004-04-17  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (excel_read_str_name) : new.
	(excel_read_str_name) : split from here.
	(excel_read_EXTERNNAME) : used here too.

	* ms-excel-read.c (excel_read_XF_OLD) : differentiate biff2 vs biff3
	  and biff4.

2004-04-15  Jody Goldberg <jody@gnome.org>

	* ms-chart.c (ms_excel_read_chart_BOF) : ignore the version in the BOF
	  it lies.  Use the container's version.

	* ms-excel-read.c (excel_read_NAME) : rework to handle unicode
	  suffixes and to some general cleanup.

2004-04-14  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c (excel_read_DEF_ROW_HEIGHT) : handle biff2
	(excel_read_WINDOW2) : ditto.
	(excel_read_EXTERNSHEET_v7) : be smarter about handling the buggy
	  files from 1.0.7 that exported quoted sheet names.

2004-04-12  Jody Goldberg <jody@gnome.org>

	* ms-excel-read.c : Use GO_UNIT in place of inches_to_points.
parent 6e037160
......@@ -7,6 +7,8 @@ Christian Neumair:
Jody:
* Edit and display rich text in cells (no persistence yet)
* Make the last dependency above gtk optional to enable a win32 build
* Major re-org of xls string import to handle rich text
* Improve xls import of old < xl95 variants
Morten:
* Fix crash related to database functions (#138600). [backported]
......
2004-04-17 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (excel_read_str_name) : new.
(excel_read_str_name) : split from here.
(excel_read_EXTERNNAME) : used here too.
* ms-excel-read.c (excel_read_XF_OLD) : differentiate biff2 vs biff3
and biff4.
2004-04-15 Jody Goldberg <jody@gnome.org>
* ms-chart.c (ms_excel_read_chart_BOF) : ignore the version in the BOF
it lies. Use the container's version.
* ms-excel-read.c (excel_read_NAME) : rework to handle unicode
suffixes and to some general cleanup.
2004-04-14 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c (excel_read_DEF_ROW_HEIGHT) : handle biff2
(excel_read_WINDOW2) : ditto.
(excel_read_EXTERNSHEET_v7) : be smarter about handling the buggy
files from 1.0.7 that exported quoted sheet names.
2004-04-12 Jody Goldberg <jody@gnome.org>
* ms-excel-read.c : Use GO_UNIT in place of inches_to_points.
......
......@@ -83,6 +83,8 @@
#define BIFF_PANE 0x41 /* 0, NOT 10 */
#define BIFF_CODEPAGE 0x42 /* DUPLICATE 42 */
#define BIFF_XF_OLD 0x43 /* What is this ?, NOT 10 */
#define BIFF_XF_INDEX 0x44 /* 0 */
#define BIFF_FONT_COLOR 0x45 /* 0 */
#define BIFF_PLS 0x4d /* 0 */
#define BIFF_DCON 0x50 /* 0, NOT 10 */
#define BIFF_DCONREF 0x51 /* 0, NOT 10 */
......
......@@ -1398,7 +1398,7 @@ BC_R(seriestext)(XLChartHandler const *handle,
if (slen == 0)
return FALSE;
str = biff_get_text (q->data + 3, slen, NULL);
str = biff_get_text (q->data + 3, slen, NULL, s->container.ver);
d (2, fputs (str, stderr););
/* A quick heuristic */
......@@ -2077,7 +2077,7 @@ ms_excel_read_chart (BiffQuery *q, MSContainer *container, MsBiffVersion ver,
guint16 col = GSF_LE_GET_GUINT16 (q->data + 2);
guint16 xf = GSF_LE_GET_GUINT16 (q->data + 4);
guint16 len = GSF_LE_GET_GUINT16 (q->data + 6);
char *label = biff_get_text (q->data + 8, len, NULL);
char *label = biff_get_text (q->data + 8, len, NULL, ver);
d (10, {fputs (label, stderr);
fprintf (stderr, "hmm, what are these values for a chart ???\n"
"row = %d, col = %d, xf = %d\n", row, col, xf);});
......@@ -2164,8 +2164,12 @@ ms_excel_read_chart_BOF (BiffQuery *q, MSContainer *container, SheetObject *sog)
g_return_val_if_fail (bof != NULL, TRUE);
g_return_val_if_fail (bof->type == MS_BIFF_TYPE_Chart, TRUE);
if (bof->version != MS_BIFF_V_UNKNOWN)
res = ms_excel_read_chart (q, container, bof->version, sog);
/* NOTE : _Ignore_ the verison in the BOF, it lies!
* XP saving as 95 will mark the book as biff7
* but sheets and charts are marked as biff8, even though they are not
* using unicode */
res = ms_excel_read_chart (q, container, container->ver, sog);
ms_biff_bof_data_destroy (bof);
return res;
}
......
......@@ -14,12 +14,6 @@
#include "excel.h"
#include "ms-biff.h"
/* Pass this a BiffQuery * */
#define EX_GETROW(p) (GSF_LE_GET_GUINT16(p->data + 0))
#define EX_GETCOL(p) (GSF_LE_GET_GUINT16(p->data + 2))
#define EX_GETXF(p) (GSF_LE_GET_GUINT16(p->data + 4))
#define EX_GETSTRLEN(p) (GSF_LE_GET_GUINT16(p->data + 6))
#define EX_SETROW(p,d) (GSF_LE_SET_GUINT16(p + 0, d))
#define EX_SETCOL(p,d) (GSF_LE_SET_GUINT16(p + 2, d))
#define EX_SETXF(p,d) (GSF_LE_SET_GUINT16(p + 4, d))
......
This diff is collapsed.
......@@ -42,6 +42,7 @@ typedef struct {
gboolean freeze_panes;
unsigned active_pane;
GnmFilter *filter;
int biff2_prev_xf_index;
} ExcelReadSheet;
typedef struct {
......@@ -77,7 +78,7 @@ typedef struct {
int *green;
int *blue;
int length;
GnmColor **gnum_cols;
GnmColor **gnm_colors;
} ExcelPalette;
typedef struct {
......@@ -108,7 +109,7 @@ struct _ExcelWorkbook {
GPtrArray *boundsheet_sheet_by_index;
GPtrArray *XF_cell_records;
GHashTable *font_data;
GHashTable *format_data; /* leave as a hash */
GHashTable *format_table; /* leave as a hash */
struct {
GArray *supbook;
GArray *externsheet;
......@@ -117,14 +118,13 @@ struct _ExcelWorkbook {
char **global_strings;
guint32 global_string_max;
gboolean is_gnumeric_1_0_x;
ExprTreeSharer *expr_sharer;
Workbook *gnum_wb;
};
char *biff_get_text (guint8 const *ptr, guint32 length, guint32 *byte_length);
char *biff_get_text (guint8 const *ptr, guint32 length, guint32 *byte_length,
MsBiffVersion const ver);
GnmValue *biff_get_error (GnmEvalPos const *pos, guint8 const err);
Sheet *excel_externsheet_v7 (MSContainer const *container, gint16 i);
......
......@@ -409,11 +409,6 @@ ExcelFuncDesc const excel_func_desc [] = {
int excel_func_desc_size = G_N_ELEMENTS (excel_func_desc);
static GnmExpr const *
expr_tree_string (char const *str)
{
return gnm_expr_new_constant (value_new_string (str));
}
static GnmExpr const *
expr_tree_error (ExcelReadSheet const *esheet, int col, int row,
char const *msg, char const *str)
......@@ -815,6 +810,7 @@ excel_parse_formula (MSContainer const *container,
GnmExprList *stack = NULL;
gboolean error = FALSE;
gboolean external = FALSE;
int ptg_length, ptg, ptgbase;
if (array_element != NULL)
*array_element = FALSE;
......@@ -831,9 +827,9 @@ excel_parse_formula (MSContainer const *container,
#endif
while (len_left > 0 && !error) {
int ptg_length = 0;
int ptg = GSF_LE_GET_GUINT8 (cur-1);
int ptgbase = ((ptg & 0x40) ? (ptg | 0x20): ptg) & 0x3F;
ptg_length = 0;
ptg = GSF_LE_GET_GUINT8 (cur-1);
ptgbase = ((ptg & 0x40) ? (ptg | 0x20): ptg) & 0x3F;
if (ptg > FORMULA_PTG_MAX)
break;
d (2, {
......@@ -989,7 +985,7 @@ excel_parse_formula (MSContainer const *container,
#endif
tr = w ? excel_parse_formula (container, esheet, fn_col, fn_row,
cur+ptg_length, w, shared, NULL)
: expr_tree_string ("");
: gnm_expr_new_constant (value_new_string (""));
parse_list_push (&stack, tr);
ptg_length += w;
} else if (grbit & 0x04) { /* AttrChoose 'optimised' my foot. */
......@@ -1098,31 +1094,27 @@ excel_parse_formula (MSContainer const *container,
break;
}
case FORMULA_PTG_STR: {
char *str = NULL;
int len;
if (ver >= MS_BIFF_V8) {
len = GSF_LE_GET_GUINT8 (cur);
if (len <= len_left) {
str = biff_get_text (cur+1, len, &len);
ptg_length = 1 + len;
/* biff_get_text misses the 1 byte header for empty strings */
if (len == 0)
ptg_length++;
}
char *str;
int len = GSF_LE_GET_GUINT8 (cur);
if (len <= len_left) {
str = biff_get_text (cur+1, len, &len, ver);
ptg_length = 1 + len;
} else {
str = NULL;
#if 0
fprintf (stderr, "v8+ PTG_STR '%s'\n", str);
/* we can not flag this because some versions of gnumeric
* produced invalid output where "" was stored as
* PTG_STR with no length **/
g_warning ("invalid string of len %d, larger than remaining space %d",
len, len_left);
#endif
} else {
len = GSF_LE_GET_GUINT8 (cur);
if (len <= len_left) {
str = biff_get_text (cur+1, len, &len);
ptg_length = 1 + len;
}
}
if (str != NULL) {
d (2, fprintf (stderr, " -> '%s'\n", str););
parse_list_push_raw (&stack, value_new_string (str));
g_free (str);
parse_list_push_raw (&stack, value_new_string_nocopy (str));
} else {
d (2, fprintf (stderr, " -> \'\'\n"););
parse_list_push_raw (&stack, value_new_string (""));
......@@ -1279,15 +1271,12 @@ excel_parse_formula (MSContainer const *container,
if (ver >= MS_BIFF_V8) {
str = biff_get_text (array_data + 3,
GSF_LE_GET_GUINT16 (array_data+1),
&len);
&len, ver);
elem_len = len + 3;
/* biff_get_text misses the 1 byte header for empty strings */
if (len == 0)
elem_len++;
} else {
str = biff_get_text (array_data + 2,
GSF_LE_GET_GUINT8 (array_data+1),
&len);
&len, ver);
elem_len = len + 2;
}
......
......@@ -22,19 +22,19 @@ struct _GnmParsePos {
#define eval_sheet(a,b) (((a) != NULL) ? (a) : (b))
/* Initialization routines for Evaluation Positions */
GnmEvalPos *eval_pos_init (GnmEvalPos *ep, Sheet *s, GnmCellPos const *pos);
GnmEvalPos *eval_pos_init_dep (GnmEvalPos *ep, GnmDependent const *dep);
GnmEvalPos *eval_pos_init_cell (GnmEvalPos *ep, GnmCell const *cell);
GnmEvalPos *eval_pos_init_sheet (GnmEvalPos *ep, Sheet *sheet);
GnmEvalPos *eval_pos_init (GnmEvalPos *ep, Sheet *s, GnmCellPos const *pos);
GnmEvalPos *eval_pos_init_dep (GnmEvalPos *ep, GnmDependent const *dep);
GnmEvalPos *eval_pos_init_cell (GnmEvalPos *ep, GnmCell const *cell);
GnmEvalPos *eval_pos_init_sheet (GnmEvalPos *ep, Sheet *sheet);
/* Initialization routines for Parse Positions */
GnmParsePos *parse_pos_init (GnmParsePos *pp, Workbook *wb,
Sheet *sheet, int col, int row);
GnmParsePos *parse_pos_init_dep (GnmParsePos *pp, GnmDependent const *dep);
Sheet *sheet, int col, int row);
GnmParsePos *parse_pos_init_dep (GnmParsePos *pp, GnmDependent const *dep);
GnmParsePos *parse_pos_init_cell (GnmParsePos *pp, GnmCell const *cell);
GnmParsePos *parse_pos_init_evalpos (GnmParsePos *pp, GnmEvalPos const *pos);
GnmParsePos *parse_pos_init_editpos (GnmParsePos *pp, SheetView const *sv);
GnmParsePos *parse_pos_init_sheet (GnmParsePos *pp, Sheet *sheet);
GnmParsePos *parse_pos_init_sheet (GnmParsePos *pp, Sheet *sheet);
/*****************************************************************************/
......
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