Commit dda2d034 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

use gsf_xml_out_add_enum and xml_sax_attr_enum to write/read print_range fto/from .gnumeric files

2011-11-21 Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* src/print.c (gnm_print_range_get_type): new
	* src/print.h (gnm_print_range_get_type): new
	* src/xml-sax-read.c (xml_sax_print_print_range): use
	xml_sax_attr_enum
	* src/xml-sax-write.c (xml_write_print_info): use gsf_xml_out_add_enum
parent 735adff7
2011-11-21 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/print.c (gnm_print_range_get_type): new
* src/print.h (gnm_print_range_get_type): new
* src/xml-sax-read.c (xml_sax_print_print_range): use
xml_sax_attr_enum
* src/xml-sax-write.c (xml_write_print_info): use gsf_xml_out_add_enum
2011-11-20 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* src/print-info.h (gnm_print_comment_placement_get_type): new
......
......@@ -109,6 +109,32 @@ typedef struct {
gboolean gnm_print_debug = FALSE;
GType
gnm_print_range_get_type (void)
{
static GType etype = 0;
if (etype == 0) {
static GEnumValue const values[] = {
{ PRINT_SAVED_INFO, "GNM_PRINT_SAVED_INFO", "as-saved"},
{ PRINT_ACTIVE_SHEET, "GNM_PRINT_ACTIVE_SHEET", "active-sheet"},
{ PRINT_ALL_SHEETS, "GNM_PRINT_ALL_SHEETS", "all-sheets"},
{ PRINT_ALL_SHEETS_INCLUDING_HIDDEN, "GNM_PRINT_ALL_SHEETS_INCLUDING_HIDDEN",
"all-sheets-incl-hidden"},
{ PRINT_SHEET_RANGE, "GNM_PRINT_SHEET_RANGE", "sheet-range"},
{ PRINT_SHEET_SELECTION, "GNM_PRINT_SHEET_SELECTION", "sheet-selection"},
{ PRINT_IGNORE_PRINTAREA, "GNM_PRINT_IGNORE_PRINTAREA", "ignore-print-area"},
{ PRINT_SHEET_SELECTION_IGNORE_PRINTAREA,
"GNM_PRINT_SHEET_SELECTION_IGNORE_PRINTAREA",
"sheet-selection-ignore-printarea"},
{ 0, NULL, NULL }
};
etype = g_enum_register_static ("GnmPrintRange",
values);
}
return etype;
}
static PrintingInstance *
printing_instance_new (void)
{
......
......@@ -13,7 +13,12 @@ G_BEGIN_DECLS
#define GNUMERIC_PRINT_SETTING_PRINT_TO_SHEET_KEY "GnumericPrintToSheet"
#define GNUMERIC_PRINT_SETTING_IGNORE_PAGE_BREAKS_KEY "GnumericPrintIgnorePageBreaks"
typedef enum { /* These numbers are saved in .gnumeric files */
GType gnm_print_range_get_type (void);
#define GNM_PRINT_RANGE_TYPE (gnm_print_range_get_type ())
typedef enum { /* These numbers are saved in pre 1.11.x .gnumeric files */
/* In 1.11.x and later the names as defined in */
/* gnm_print_range_get_type are used */
PRINT_SAVED_INFO = -1,
PRINT_ACTIVE_SHEET = 0,
PRINT_ALL_SHEETS = 1,
......
......@@ -1055,7 +1055,8 @@ xml_sax_print_print_range (GsfXMLIn *xin, xmlChar const **attrs)
pi = state->sheet->print_info;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (gnm_xml_attr_int (attrs, "value", &val))
if (xml_sax_attr_enum (attrs, "value", GNM_PRINT_RANGE_TYPE,
&val))
print_info_set_printrange (pi, val);
}
......
......@@ -381,7 +381,9 @@ xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
gsf_xml_out_end_element (state->output);
gsf_xml_out_start_element (state->output, GNM "print_range");
gsf_xml_out_add_int (state->output, "value", print_info_get_printrange (pi));
gsf_xml_out_add_enum (state->output, "value",
GNM_PRINT_RANGE_TYPE,
print_info_get_printrange (pi) );
gsf_xml_out_end_element (state->output);
xml_write_print_repeat_range (state, GNM "repeat_top", pi->repeat_top);
......
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