Commit 7a889dfc authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Do not write Useless 'Style' attribute. - Make Rows/Cols attributes of the


2000-08-18  Jody Goldberg <jgoldberg@home.com>

	* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
	  'Style' attribute.
	- Make Rows/Cols attributes of the Cell not the Content
	- When storing Values store the value type, the parse format (if
	  available) and the value as a plain string (eg $100.00 == 100)

	* src/value.c (value_new_from_string) : New function.

	* src/number-match.c (format_create_regexp) : Be more careful when
	  handling decimals and thousands seperators.  This sucks, but it
	  sucks less than before.

	* src/formats.c (format_currency) : typo.

2000-08-17  Jody Goldberg <jgoldberg@home.com>

	* src/xml-io.c (xml_check_version) : New function.
	(xml_probe) : Use it here.
	(gnumeric_xml_read_workbook) : And here.
parent 76dab008
......@@ -4,8 +4,6 @@ and longer term bugs.
Release Critical
----------------
- expressions -> strings loose the format used to parse values.
- saving the entered_text then parsing in locale C on restore is broken.
- We should save per block maximums.
- Changing the size of all rows/cols creates big xml files, and slows
calculations to a crawl
......@@ -18,6 +16,8 @@ Long term breakage
correctly.
- The max row/col canvas scroll size is still hard coded.
- Copy sheet, and insert new sheet both append to the end of the sheet list
rather than insereting before the current sheet.
- Increase/Decrease precision toolbar buttons should look at the displayed
precision for the edit cell and assign the changed value to the entire
selection. Not individually adjusting each non-blank cell's precision.
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_write_cell_and_position) : Do not write Useless
'Style' attribute.
- Make Rows/Cols attributes of the Cell not the Content
- When storing Values store the value type, the parse format (if
available) and the value as a plain string (eg $100.00 == 100)
* src/value.c (value_new_from_string) : New function.
* src/number-match.c (format_create_regexp) : Be more careful when
handling decimals and thousands seperators. This sucks, but it
sucks less than before.
* src/formats.c (format_currency) : typo.
2000-08-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_check_version) : New function.
(xml_probe) : Use it here.
(gnumeric_xml_read_workbook) : And here.
* src/print-info.c (print_info_copy) : Leak less.
* src/clipboard.c (paste_cell) : Set the pos rather than the row/col
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseCellContent) : Update to newer DTD.
2000-08-09 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml_cell_set_array_expr) : Use builtin Cell::pos rather than
......
......@@ -335,6 +335,8 @@ struct _XML2ParseState
int cell_row, cell_col;
int expr_id, array_rows, array_cols;
ValueType value_type;
char const *value_fmt;
GString *content;
......@@ -739,7 +741,9 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
{
int row = -1, col = -1;
int rows = -1, cols = -1;
int dummy, expr_id = -1;
int value_type = -1;
char const *value_fmt = NULL;
int expr_id = -1;
g_return_if_fail (state->cell_row == -1);
g_return_if_fail (state->cell_col == -1);
......@@ -752,9 +756,11 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
else if (xml2ParseAttrInt (attrs, "Row", &row)) ;
else if (xml2ParseAttrInt (attrs, "Cols", &cols)) ;
else if (xml2ParseAttrInt (attrs, "Rows", &rows)) ;
else if (xml2ParseAttrInt (attrs, "Style", &dummy)) ;
else if (xml2ParseAttrInt (attrs, "ExprID", &expr_id)) {
} else
else if (xml2ParseAttrInt (attrs, "ExprID", &expr_id)) ;
else if (xml2ParseAttrInt (attrs, "ValueType", &value_type)) ;
else if (!strcmp (attrs[0], "ValueFormat"))
value_fmt = attrs[1];
else
xml2UnknownAttr (state, attrs, "Cell");
}
......@@ -773,6 +779,8 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
state->cell_row = row;
state->cell_col = col;
state->expr_id = expr_id;
state->value_type = value_type;
state->value_fmt = value_fmt;
}
/**
......@@ -863,6 +871,8 @@ xml2ParseCellContent (XML2ParseState *state)
int const array_cols = state->array_cols;
int const array_rows = state->array_rows;
int const expr_id = state->expr_id;
ValueType const value_type = state->value_type;
char const *value_fmt =state->value_fmt;
gpointer const id = GINT_TO_POINTER (expr_id);
gpointer expr = NULL;
......@@ -870,6 +880,8 @@ xml2ParseCellContent (XML2ParseState *state)
state->cell_row = state->cell_col = -1;
state->array_rows = state->array_cols = -1;
state->expr_id = -1;
state->value_type = 0;
state->value_fmt = NULL;
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
......@@ -894,8 +906,13 @@ xml2ParseCellContent (XML2ParseState *state)
xml_cell_set_array_expr (cell, content+1,
array_cols, array_rows);
} else if (xml_not_used_old_array_spec (cell, content))
cell_set_text (cell, content);
} else if (xml_not_used_old_array_spec (cell, content)) {
if (value_type != 0) {
Value *v = value_new_from_string (value_type, content);
cell_set_value (cell, v, style_format_new (value_fmt));
} else
cell_set_text (cell, content);
}
if (expr_id > 0) {
if (expr == NULL) {
......@@ -1318,6 +1335,8 @@ xml2StartDocument (XML2ParseState *state)
state->cell_row = state->cell_col = -1;
state->array_rows = state->array_cols = -1;
state->expr_id = -1;
state->value_type = 0;
state->value_fmt = NULL;
state->expr_map = g_hash_table_new (g_direct_hash, g_direct_equal);
}
......
2000-08-18 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseCellContent) : Update to newer DTD.
2000-08-09 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml_cell_set_array_expr) : Use builtin Cell::pos rather than
......
......@@ -335,6 +335,8 @@ struct _XML2ParseState
int cell_row, cell_col;
int expr_id, array_rows, array_cols;
ValueType value_type;
char const *value_fmt;
GString *content;
......@@ -739,7 +741,9 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
{
int row = -1, col = -1;
int rows = -1, cols = -1;
int dummy, expr_id = -1;
int value_type = -1;
char const *value_fmt = NULL;
int expr_id = -1;
g_return_if_fail (state->cell_row == -1);
g_return_if_fail (state->cell_col == -1);
......@@ -752,9 +756,11 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
else if (xml2ParseAttrInt (attrs, "Row", &row)) ;
else if (xml2ParseAttrInt (attrs, "Cols", &cols)) ;
else if (xml2ParseAttrInt (attrs, "Rows", &rows)) ;
else if (xml2ParseAttrInt (attrs, "Style", &dummy)) ;
else if (xml2ParseAttrInt (attrs, "ExprID", &expr_id)) {
} else
else if (xml2ParseAttrInt (attrs, "ExprID", &expr_id)) ;
else if (xml2ParseAttrInt (attrs, "ValueType", &value_type)) ;
else if (!strcmp (attrs[0], "ValueFormat"))
value_fmt = attrs[1];
else
xml2UnknownAttr (state, attrs, "Cell");
}
......@@ -773,6 +779,8 @@ xml2ParseCell (XML2ParseState *state, CHAR const **attrs)
state->cell_row = row;
state->cell_col = col;
state->expr_id = expr_id;
state->value_type = value_type;
state->value_fmt = value_fmt;
}
/**
......@@ -863,6 +871,8 @@ xml2ParseCellContent (XML2ParseState *state)
int const array_cols = state->array_cols;
int const array_rows = state->array_rows;
int const expr_id = state->expr_id;
ValueType const value_type = state->value_type;
char const *value_fmt =state->value_fmt;
gpointer const id = GINT_TO_POINTER (expr_id);
gpointer expr = NULL;
......@@ -870,6 +880,8 @@ xml2ParseCellContent (XML2ParseState *state)
state->cell_row = state->cell_col = -1;
state->array_rows = state->array_cols = -1;
state->expr_id = -1;
state->value_type = 0;
state->value_fmt = NULL;
g_return_if_fail (col >= 0);
g_return_if_fail (row >= 0);
......@@ -894,8 +906,13 @@ xml2ParseCellContent (XML2ParseState *state)
xml_cell_set_array_expr (cell, content+1,
array_cols, array_rows);
} else if (xml_not_used_old_array_spec (cell, content))
cell_set_text (cell, content);
} else if (xml_not_used_old_array_spec (cell, content)) {
if (value_type != 0) {
Value *v = value_new_from_string (value_type, content);
cell_set_value (cell, v, style_format_new (value_fmt));
} else
cell_set_text (cell, content);
}
if (expr_id > 0) {
if (expr == NULL) {
......@@ -1318,6 +1335,8 @@ xml2StartDocument (XML2ParseState *state)
state->cell_row = state->cell_col = -1;
state->array_rows = state->array_cols = -1;
state->expr_id = -1;
state->value_type = 0;
state->value_fmt = NULL;
state->expr_map = g_hash_table_new (g_direct_hash, g_direct_equal);
}
......
......@@ -371,11 +371,10 @@ cell_assign_value (Cell *cell, Value *v, StyleFormat *opt_fmt)
* WARNING : This is an internal routine that does not queue redraws,
* does not auto-resize, and does not calculate spans.
*
* FIXME FIXME FIXME : The current format code only checks against
* the list of canned formats. Therefore the rendered string
* MAY NOT BE PARSEABLE!! if the user has assigned a non-std format.
* We need to imporove the parser to handle all formats that exist within
* the workbook.
* FIXME FIXME FIXME : The current format code only checks against the list of
* canned formats. Therefore the rendered string MAY NOT BE PARSEABLE!! if the
* user has assigned a non-std format. We need to improve the parser to handle
* all formats that exist within the workbook.
*
* NOTE : This DOES check for array partitioning.
*/
......
......@@ -35,7 +35,7 @@ cell_format_numbers [] = {
static char const * const
cell_format_currency [] = {
N_("$#,##0;"),
N_("$#,##0"),
N_("$#,##0_);($#,##0)"),
N_("$#,##0_);[Red]($#,##0)"),
N_("$#,##0.00"),
......
......@@ -107,7 +107,7 @@ format_create_regexp (const unsigned char *format, GByteArray **dest)
switch (*format){
case '_':
if (format[1]) {
g_string_append_c (regexp, ' ');
g_string_append (regexp, "[ ]?");
format++;
}
break;
......@@ -174,20 +174,43 @@ format_create_regexp (const unsigned char *format, GByteArray **dest)
g_string_append_c (regexp, *format);
break;
case '#': case '0': case '.': case '+': case '?':
case '#': case '0': case '.': case '+': case '?': {
gboolean include_sep = FALSE, include_decimal = FALSE;
while (*format == '#' || *format == '0' || *format == '.' ||
*format == '-' || *format == 'E' || *format == 'e' ||
*format == '+' || *format == '?' || *format == ',')
*format == '+' || *format == '?' || *format == ',') {
if (*format == *thousands_sep)
include_sep = TRUE;
else if (*format == *decimal)
include_decimal = TRUE;
format++;
}
format--;
g_string_append (regexp, "(([-+]?[0-9\\");
g_string_append_c (regexp, *thousands_sep);
g_string_append (regexp, "]+)?(\\");
g_string_append_c (regexp, *decimal);
g_string_append (regexp, "?[0-9]*)?([Ee][-+][0-9]+)?)");
if (include_sep) {
/* Not strictly correct.
* There should be a limit of 1-3 digits.
* However, that creates problems when
* There are formats like
* $#,##0.00
* but not
* $###0.00
* as a result $1000 would not be recognized.
*/
g_string_append (regexp, "([-+]?[0-9]+(\\");
g_string_append_c (regexp, *thousands_sep);
g_string_append (regexp, "[0-9]{3})*)");
} else
g_string_append (regexp, "([-+]?[0-9]*)");
if (include_decimal) {
g_string_append (regexp, "?\\");
g_string_append_c (regexp, *decimal);
g_string_append (regexp, "[0-9]+([Ee][-+][0-9]+)?");
}
append_type (MATCH_NUMBER);
break;
}
case 'h':
case 'H':
......@@ -941,6 +964,9 @@ format_match (const char *text, StyleFormat **format)
gboolean b;
format_parse_t *fp = l->data;
#if 0
printf ("test: %s \'%s\'\n", fp->format_str, fp->regexp_str);
#endif
if (regexec (&fp->regexp, text, NM, mp, 0) == REG_NOMATCH)
continue;
......
......@@ -15,6 +15,7 @@
#include "parse-util.h"
#include "style.h"
#include <stdlib.h>
#include <errno.h>
Value *
value_new_empty (void)
......@@ -212,6 +213,54 @@ value_new_array_empty (guint cols, guint rows)
return (Value *)v;
}
Value *
value_new_from_string (ValueType t, const char *str)
{
switch (t) {
case VALUE_EMPTY:
return value_new_empty ();
case VALUE_BOOLEAN:
/* Is it a boolean */
if (0 == g_strcasecmp (str, _("TRUE")))
return value_new_bool (TRUE);
if (0 == g_strcasecmp (str, _("FALSE")))
return value_new_bool (FALSE);
return NULL;
case VALUE_INTEGER:
{
char *end;
long l = strtol (str, &end, 10);
if (*end == '\0' && errno != ERANGE)
return value_new_int ((int)l);
return NULL;
}
case VALUE_FLOAT:
{
char *end;
double d = strtod (str, &end);
if (*end == '\0' && errno != ERANGE)
return value_new_float ((float_t)d);
return NULL;
}
case VALUE_ERROR:
return value_new_error (NULL, str);
case VALUE_STRING:
return value_new_string (str);
/* Should not happend */
case VALUE_ARRAY:
case VALUE_CELLRANGE:
default:
g_warning ("value_new_from_string problem\n");
return NULL;
}
}
void
value_release (Value *value)
{
......
......@@ -9,7 +9,11 @@
#include "position.h"
typedef enum {
/* Use magic values to act as a signature */
/* Use magic values to act as a signature
* DO NOT CHANGE THESE NUMBERS
* As of version 0.57 they are using as keys
* in the xml
*/
VALUE_EMPTY = 10,
VALUE_BOOLEAN = 20, /* Keep bool < int < float */
VALUE_INTEGER = 30,
......@@ -82,6 +86,7 @@ Value *value_new_int (int i);
Value *value_new_float (float_t f);
Value *value_new_error (EvalPos const *pos, char const *mesg);
Value *value_new_error_str (EvalPos const *pos, String *mesg);
Value *value_new_error_err (EvalPos const *pos, ValueErr const *err);
Value *value_new_string (const char *str);
Value *value_new_string_str (String *str);
Value *value_new_cellrange_unsafe (const CellRef *a, const CellRef *b);
......@@ -91,6 +96,7 @@ Value *value_new_cellrange_r (Sheet *sheet, const Range *r);
Value *value_new_array (guint cols, guint rows);
Value *value_new_array_empty (guint cols, guint rows);
Value *value_new_array_non_init (guint cols, guint rows);
Value *value_new_from_string (ValueType t, const char *str);
void value_release (Value *value);
void value_dump (Value const *value);
......
......@@ -4,6 +4,7 @@
* Authors:
* Daniel Veillard <Daniel.Veillard@w3.org>
* Miguel de Icaza <miguel@gnu.org>
* Jody Goldberg <jgoldberg@home.com>
*/
#include <config.h>
......@@ -39,6 +40,14 @@
/*
* A parsing context.
*/
typedef enum
{
GNUM_XML_V1,
GNUM_XML_V2,
GNUM_XML_V3, /* >= 0.52 */
GNUM_XML_V4, /* >= 0.57 */
} GnumericXMLVersion;
struct _XmlParseContext {
xmlDocPtr doc; /* Xml document */
xmlNsPtr ns; /* Main name space */
......@@ -54,6 +63,7 @@ struct _XmlParseContext {
XmlSheetObjectWriteFn write_fn;
XmlSheetObjectReadFn read_fn;
gpointer user_data;
GnumericXMLVersion version;
};
XmlParseContext *
......@@ -1882,7 +1892,6 @@ xml_write_cell_and_position (XmlParseContext *ctxt, Cell *cell, int col, int row
cur = xmlNewDocNode (ctxt->doc, ctxt->ns, "Cell", NULL);
xml_set_value_int (cur, "Col", col);
xml_set_value_int (cur, "Row", row);
xml_set_value_int (cur, "Style", 0); /* Backwards compatible */
text = cell_get_comment(cell);
if (text) {
......@@ -1911,18 +1920,38 @@ xml_write_cell_and_position (XmlParseContext *ctxt, Cell *cell, int col, int row
}
if (write_contents) {
text = cell_get_entered_text (cell);
if (cell_has_expr (cell)) {
char *tmp;
ParsePos pp;
tmp = expr_tree_as_string (cell->u.expression,
parse_pos_init_cell (&pp, cell));
text = g_strconcat ("=", tmp, NULL);
g_free (tmp);
} else {
text = value_get_as_string (cell->value);
}
tstr = xmlEncodeEntitiesReentrant (ctxt->doc, text);
child = xmlNewChild (cur, ctxt->ns, "Content", tstr);
if (tstr)
xmlFree (tstr);
g_free (text);
if (!cell_has_expr (cell)) {
xml_set_value_int (cur, "ValueType",
cell->value->type);
if (cell->format)
xmlSetProp (cur, "ValueFormat",
cell->format->format);
}
}
/* As of version 0.53 we save the size of the array as attributes */
/* As of version 0.57 the attributes are in the Cell not the Content */
if (ar != NULL) {
xml_set_value_int (child, "Rows", ar->rows);
xml_set_value_int (child, "Cols", ar->cols);
xml_set_value_int (cur, "Rows", ar->rows);
xml_set_value_int (cur, "Cols", ar->cols);
}
return cur;
......@@ -2021,7 +2050,7 @@ static Cell *
xml_read_cell (XmlParseContext *ctxt, xmlNodePtr tree)
{
Cell *ret;
xmlNodePtr childs;
xmlNodePtr child;
int col, row;
int array_cols, array_rows, shared_expr_index = -1;
char *content = NULL;
......@@ -2030,6 +2059,9 @@ xml_read_cell (XmlParseContext *ctxt, xmlNodePtr tree)
gboolean style_read = FALSE;
gboolean is_post_52_array = FALSE;
gboolean is_new_cell;
gboolean is_value = FALSE;
ValueType value_type = VALUE_EMPTY; /* Make compiler shut up */
StyleFormat *value_fmt = NULL;
if (strcmp (tree->name, "Cell")) {
fprintf (stderr,
......@@ -2047,63 +2079,85 @@ xml_read_cell (XmlParseContext *ctxt, xmlNodePtr tree)
if (ret == NULL)
return NULL;
/*
* This style code is a gross anachronism that slugs performance
* in the common case this data won't exist. In the long term all
* files will make the 0.41 - 0.42 transition and this can go.
* Newer file format includes an index pointer to the Style
* Old format includes the Style online
*/
if (xml_get_value_int (tree, "Style", &style_idx)) {
MStyle *mstyle;
if (ctxt->version < GNUM_XML_V3) {
/*
* This style code is a gross anachronism that slugs performance
* in the common case this data won't exist. In the long term all
* files will make the 0.41 - 0.42 transition and this can go.
* Newer file format includes an index pointer to the Style
* Old format includes the Style online
*/
if (xml_get_value_int (tree, "Style", &style_idx)) {
MStyle *mstyle;
style_read = TRUE;
mstyle = g_hash_table_lookup (ctxt->style_table,
GINT_TO_POINTER (style_idx));
if (mstyle) {
mstyle_ref (mstyle);
sheet_style_attach_single (ctxt->sheet, col, row,
mstyle);
} /* else reading a newer version with style_idx == 0 */
}
} else {
/* Is this a post 0.52 shared expression */
if (!xml_get_value_int (tree, "ExprID", &shared_expr_index))
shared_expr_index = -1;
style_read = TRUE;
mstyle = g_hash_table_lookup (ctxt->style_table,
GINT_TO_POINTER (style_idx));
if (mstyle) {
mstyle_ref (mstyle);
sheet_style_attach_single (ctxt->sheet, col, row,
mstyle);
} /* else reading a newer version with style_idx == 0 */
/* Is this a post 0.57 formatted value */
if (ctxt->version >= GNUM_XML_V4) {
int tmp;
is_post_52_array =
xml_get_value_int (tree, "Rows", &array_rows) &&
xml_get_value_int (tree, "Cols", &array_cols);
if (xml_get_value_int (tree, "ValueType", &tmp)) {
char *fmt;
value_type = tmp;
is_value = TRUE;
fmt = xml_value_get (tree, "ValueFormat");
if (fmt != NULL) {
value_fmt = style_format_new (fmt);
g_free (fmt);
}
}
}
}
/* Is this a post 0.52 shared expression */
if (!xml_get_value_int (tree, "ExprID", &shared_expr_index))
shared_expr_index = -1;
childs = tree->childs;
while (childs != NULL) {
child = tree->childs;
while (child != NULL) {
/*
* This style code is a gross anachronism that slugs performance
* in the common case this data won't exist. In the long term all
* files will make the 0.41 - 0.42 transition and this can go.
* This is even older backwards compatibility than 0.41 - 0.42
*/