Commit 0f28b58e authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

Save and restore sheet preference flags.

This has demonstrated that the MVC code has not extented to these flags yet.

2001-02-17  Jody Goldberg <jgoldberg@home.com>

	* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
	(xml_sheet_read) : Restore them.
parent 51d90dcd
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
(xml_sheet_read) : Restore them.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_clear_undo) : reset the selection to queue a
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
(xml_sheet_read) : Restore them.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_clear_undo) : reset the selection to queue a
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
(xml_sheet_read) : Restore them.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_clear_undo) : reset the selection to queue a
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
(xml_sheet_read) : Restore them.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_clear_undo) : reset the selection to queue a
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/xml-io.c (xml_sheet_write) : Store some flags about the sheet.
(xml_sheet_read) : Restore them.
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* src/commands.c (cmd_clear_undo) : reset the selection to queue a
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseSheet) : Support the new sheet attributes.
2001-02-16 Jody Goldberg <jgoldberg@home.com>
* Release 0.62
......
......@@ -504,6 +504,26 @@ xml2_parse_attr_elem (XML2ParseState *state)
}
static void
xml2ParseSheet (XML2ParseState *state, CHAR const **attrs)
{
int tmp;
for (; attrs[0] && attrs[1] ; attrs += 2)
if (xml2ParseAttrInt (attrs, "DisplayFormulas", &tmp))
state->sheet->display_formulas = tmp;
else if (xml2ParseAttrInt (attrs, "DisplayZero", &tmp))
state->sheet->display_zero = tmp;
else if (xml2ParseAttrInt (attrs, "ShowGrid", &tmp))
state->sheet->show_grid = tmp;
else if (xml2ParseAttrInt (attrs, "ShowColHeader", &tmp))
state->sheet->show_col_header = tmp;
else if (xml2ParseAttrInt (attrs, "ShowRowHeader", &tmp))
state->sheet->show_row_header = tmp;
else
xml2UnknownAttr (state, attrs, "Sheet");
}
static void
xml2ParseSheetName (XML2ParseState *state)
{
......@@ -1129,6 +1149,7 @@ xml2StartElement (XML2ParseState *state, CHAR const *name, CHAR const **attrs)
case STATE_WB_SHEETS :
if (xml2SwitchState (state, name, STATE_SHEET)) {
xml2ParseSheet (state, attrs);
} else
xml2UnknownState (state, name);
break;
......
2001-02-17 Jody Goldberg <jgoldberg@home.com>
* xml2.c (xml2ParseSheet) : Support the new sheet attributes.
2001-02-16 Jody Goldberg <jgoldberg@home.com>
* Release 0.62
......
......@@ -504,6 +504,26 @@ xml2_parse_attr_elem (XML2ParseState *state)
}
static void
xml2ParseSheet (XML2ParseState *state, CHAR const **attrs)
{
int tmp;
for (; attrs[0] && attrs[1] ; attrs += 2)
if (xml2ParseAttrInt (attrs, "DisplayFormulas", &tmp))
state->sheet->display_formulas = tmp;
else if (xml2ParseAttrInt (attrs, "DisplayZero", &tmp))
state->sheet->display_zero = tmp;
else if (xml2ParseAttrInt (attrs, "ShowGrid", &tmp))
state->sheet->show_grid = tmp;
else if (xml2ParseAttrInt (attrs, "ShowColHeader", &tmp))
state->sheet->show_col_header = tmp;
else if (xml2ParseAttrInt (attrs, "ShowRowHeader", &tmp))
state->sheet->show_row_header = tmp;
else
xml2UnknownAttr (state, attrs, "Sheet");
}
static void
xml2ParseSheetName (XML2ParseState *state)
{
......@@ -1129,6 +1149,7 @@ xml2StartElement (XML2ParseState *state, CHAR const *name, CHAR const **attrs)
case STATE_WB_SHEETS :
if (xml2SwitchState (state, name, STATE_SHEET)) {
xml2ParseSheet (state, attrs);
} else
xml2UnknownState (state, name);
break;
......
......@@ -532,7 +532,7 @@ xml_read_selection_info (XmlParseContext *ctxt, Sheet *sheet, xmlNodePtr tree)
}
static void
xml_write_selection_info (XmlParseContext *ctxt, Sheet *sheet, xmlNodePtr tree)
xml_write_selection_info (XmlParseContext *ctxt, Sheet const *sheet, xmlNodePtr tree)
{
GList *ptr, *copy;
tree = xmlNewChild (tree, ctxt->ns, "Selections", NULL);
......@@ -2178,7 +2178,7 @@ xml_read_solver (Sheet *sheet, XmlParseContext *ctxt, xmlNodePtr tree,
}
static xmlNodePtr
xml_write_solver (XmlParseContext *ctxt, SolverParameters *param)
xml_write_solver (XmlParseContext *ctxt, SolverParameters const *param)
{
xmlNodePtr cur;
xmlNodePtr constr;
......@@ -2270,7 +2270,7 @@ copy_hash_table_to_ptr_array (gpointer key, gpointer value, gpointer user_data)
* Create an XML subtree of doc equivalent to the given Sheet.
*/
static xmlNodePtr
xml_sheet_write (XmlParseContext *ctxt, Sheet *sheet)
xml_sheet_write (XmlParseContext *ctxt, Sheet const *sheet)
{
xmlNodePtr cur;
xmlNsPtr gmr;
......@@ -2290,10 +2290,22 @@ xml_sheet_write (XmlParseContext *ctxt, Sheet *sheet)
if (cur == NULL)
return NULL;
if (ctxt->ns == NULL) {
gmr = xmlNewNs (cur, "http://www.gnome.org/gnumeric/", "gmr");
xmlSetNs (cur, gmr);
ctxt->ns = gmr;
gmr = xmlNewNs (cur, "http://www.gnome.org/gnumeric/", "gmr");
xmlSetNs (cur, gmr);
ctxt->ns = gmr;
}
e_xml_set_bool_prop_by_name (cur, "DisplayFormulas",
sheet->display_formulas);
e_xml_set_bool_prop_by_name (cur, "DisplayZero",
sheet->display_zero);
e_xml_set_bool_prop_by_name (cur, "ShowGrid",
sheet->show_grid);
e_xml_set_bool_prop_by_name (cur, "ShowColHeader",
sheet->show_col_header);
e_xml_set_bool_prop_by_name (cur, "ShowRowHeader",
sheet->show_row_header);
tstr = xmlEncodeEntitiesReentrant (ctxt->doc, sheet->name_unquoted);
xmlNewChild (cur, ctxt->ns, "Name", tstr);
if (tstr) xmlFree (tstr); {
......@@ -2670,6 +2682,7 @@ xml_sheet_read (XmlParseContext *ctxt, xmlNodePtr tree)
Sheet *ret = NULL;
double zoom_factor;
char *val;
int tmp;
if (strcmp (tree->name, "Sheet")){
fprintf (stderr,
......@@ -2696,6 +2709,17 @@ xml_sheet_read (XmlParseContext *ctxt, xmlNodePtr tree)
ctxt->sheet = ret;
ret->display_formulas = e_xml_get_bool_prop_by_name_with_default (tree,
"DisplayFormulas", FALSE);
ret->display_zero = e_xml_get_bool_prop_by_name_with_default (tree,
"DisplayZero", TRUE);
ret->show_grid = e_xml_get_bool_prop_by_name_with_default (tree,
"ShowGrid", TRUE);
ret->show_col_header = e_xml_get_bool_prop_by_name_with_default (tree,
"ShowColHeader", TRUE);
ret->show_row_header = e_xml_get_bool_prop_by_name_with_default (tree,
"ShowRowHeader", TRUE);
xml_get_value_int (tree, "MaxCol", &ret->cols.max_used);
xml_get_value_int (tree, "MaxRow", &ret->rows.max_used);
xml_get_value_double (tree, "Zoom", &zoom_factor);
......
......@@ -504,6 +504,26 @@ xml2_parse_attr_elem (XML2ParseState *state)
}
static void
xml2ParseSheet (XML2ParseState *state, CHAR const **attrs)
{
int tmp;
for (; attrs[0] && attrs[1] ; attrs += 2)
if (xml2ParseAttrInt (attrs, "DisplayFormulas", &tmp))
state->sheet->display_formulas = tmp;
else if (xml2ParseAttrInt (attrs, "DisplayZero", &tmp))
state->sheet->display_zero = tmp;
else if (xml2ParseAttrInt (attrs, "ShowGrid", &tmp))
state->sheet->show_grid = tmp;
else if (xml2ParseAttrInt (attrs, "ShowColHeader", &tmp))
state->sheet->show_col_header = tmp;
else if (xml2ParseAttrInt (attrs, "ShowRowHeader", &tmp))
state->sheet->show_row_header = tmp;
else
xml2UnknownAttr (state, attrs, "Sheet");
}
static void
xml2ParseSheetName (XML2ParseState *state)
{
......@@ -1129,6 +1149,7 @@ xml2StartElement (XML2ParseState *state, CHAR const *name, CHAR const **attrs)
case STATE_WB_SHEETS :
if (xml2SwitchState (state, name, STATE_SHEET)) {
xml2ParseSheet (state, attrs);
} else
xml2UnknownState (state, name);
break;
......
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