Commit 53e85a51 authored by Jody Goldberg's avatar Jody Goldberg Committed by Jody Goldberg

new. Manual enum handling for performance. (xml_write_print_info) : use it

2007-11-24  Jody Goldberg <jody@gnome.org>

	* src/xml-sax-write.c (xml_write_breaks) : new.  Manual enum handling
	  for performance.
	(xml_write_print_info) : use it here.

	* src/xml-sax-read.c (xml_sax_attr_enum) : Use class_ref/class_unref
	  to force the enum to complete.
	(xml_sax_page_break) : new with manual enum handling for performance.
	(xml_sax_page_breaks_begin) : new.
	(xml_sax_page_breaks_end) : new.

svn path=/trunk/; revision=16201
parent 0f8bbdb7
......@@ -450,25 +450,27 @@ Architecture Changes
17) Explicit Page Breaks
17.1) Store them in PrintInfo (DONE)
17.2) I/O
17.2.1) Gnumeric
17.2.1.1) Extend XSD
17.2.1.2) SAX Export {partial}
17.2.1.3) SAX Import
17.2.2.4) DOM Import
17.2.3) XLS
17.2.3.1) Import (DONE)
17.2.3.2) Export (DONE)
17.2.3.2.1) pre-Biff8 (DONE)
17.2.3.2.2) Biff8 (DONE)
17.2.3.3) figure out the semantics of XL's min/max
17.2.4) MOOX (DONE)
17.2.4.1) Import (DONE)
17.2.4.2) Export (DONE)
17.2.5) ODF
17.3) I/O
17.3.1) Gnumeric (DONE)
17.3.1.1) Extend XSD (DONE)
17.3.1.2) SAX Export (DONE)
17.3.1.3) SAX Import (DONE)
17.3.1.4) DOM Import (DONE)
17.3.2) XL (DONE)
17.3.2.1) XLS (DONE)
17.3.2.1.1) Import (DONE)
17.3.3.2.2) Export (DONE)
17.3.3.2.2.1) pre-Biff8 (DONE)
17.3.3.2.2.2) Biff8 (DONE)
17.3.2.2) MOOX (DONE)
17.3.2.2.1) Import (DONE)
17.3.2.2.2) Export (DONE)
17.3.3) ODF
17.2.5.1) Import (DONE)
17.2.5.2) Export
17.2.6) Lotus ?
17.2.5.2) Export {merge breaks and styles}
17.3.4) Lotus ?
17.3.5) Applix ?
2) stf {Andreas/Morten}
2.1) UTF-8 cleanliness (DONE)
2.2) User specifiable character encoding (DONE)
......
2007-11-24 Jody Goldberg <jody@gnome.org>
* src/xml-sax-write.c (xml_write_breaks) : new. Manual enum handling
for performance.
(xml_write_print_info) : use it here.
* src/xml-sax-read.c (xml_sax_attr_enum) : Use class_ref/class_unref
to force the enum to complete.
(xml_sax_page_break) : new with manual enum handling for performance.
(xml_sax_page_breaks_begin) : new.
(xml_sax_page_breaks_end) : new.
2007-11-20 Morten Welinder <terra@gnome.org>
* src/sheet.c (sheet_insert_cols, sheet_insert_rows,
......
......@@ -7,6 +7,7 @@ Andreas:
Jody:
* OFFSET use size of input range. [#497294]
* Finish .gnumeric i/o support for explicit page breaks.
Morten:
* Fix crash in dependency code for named expressions. [#498347]
......
This diff is collapsed.
......@@ -3533,7 +3533,7 @@ GSF_XML_IN_NODE_FULL (START, SHEET, XL_NS_SS, "worksheet", GSF_XML_NO_CONTENT, F
GSF_XML_IN_NODE (SHEET, PRINT_HEADER_FOOTER, XL_NS_SS, "headerFooter", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE_FULL (SHEET, ROW_BREAKS, XL_NS_SS, "rowBreaks", GSF_XML_NO_CONTENT,
FALSE, FALSE, &xlsx_CT_PageBreaks_begin, &xlsx_CT_PageBreaks_end, 0),
FALSE, FALSE, &xlsx_CT_PageBreaks_begin, &xlsx_CT_PageBreaks_end, 1),
GSF_XML_IN_NODE (ROW_BREAKS, CT_PageBreak, XL_NS_SS, "brk", GSF_XML_NO_CONTENT, &xlsx_CT_PageBreak, NULL),
GSF_XML_IN_NODE_FULL (SHEET, COL_BREAKS, XL_NS_SS, "colBreaks", GSF_XML_NO_CONTENT,
FALSE, FALSE, &xlsx_CT_PageBreaks_begin, &xlsx_CT_PageBreaks_end, 0),
......
2007-11-24 Jody Goldberg <jody@gnome.org>
* openoffice-read.c (oo_col_start) : swap sense of 'is_vert' for
explicit page breaks.
(oo_row_start) : ditto.
2007-11-19 Jody Goldberg <jody@gnome.org>
* Release 1.7.90
......
......@@ -630,7 +630,7 @@ oo_append_page_break (OOParseState *state, int pos, gboolean is_vert)
static void
oo_col_row_style_apply_breaks (OOParseState *state, OOColRowStyle *cr_style,
int pos, gboolean is_vert)
int pos, gboolean is_vert)
{
/* AUTO seems to denote the possibility, of a break, rather than an
* actual break, ignore it*/
......@@ -681,7 +681,7 @@ oo_col_start (GsfXMLIn *xin, xmlChar const **attrs)
if (col_info->size_pts > 0.)
sheet_col_set_size_pts (state->pos.sheet, i,
col_info->size_pts, col_info->manual);
oo_col_row_style_apply_breaks (state, col_info, i, TRUE);
oo_col_row_style_apply_breaks (state, col_info, i, FALSE);
}
col_info->col_count += repeat_count;
}
......@@ -735,7 +735,7 @@ oo_row_start (GsfXMLIn *xin, xmlChar const **attrs)
if (row_info->size_pts > 0.)
sheet_row_set_size_pts (state->pos.sheet, i,
row_info->size_pts, row_info->manual);
oo_col_row_style_apply_breaks (state, row_info, i, FALSE);
oo_col_row_style_apply_breaks (state, row_info, i, TRUE);
}
row_info->row_count += repeat_count;
}
......
......@@ -1223,3 +1223,21 @@ gnm_page_breaks_append_break (GnmPageBreaks *breaks,
return TRUE;
}
/**
* gnm_page_break_type_from_str
* @str :
*
**/
GnmPageBreakType
gnm_page_break_type_from_str (char const *str)
{
if (0 == g_ascii_strcasecmp (str, "manual"))
return GNM_PAGE_BREAK_MANUAL;
if (0 == g_ascii_strcasecmp (str, "auto"))
return GNM_PAGE_BREAK_AUTO;
if (0 == g_ascii_strcasecmp (str, "data-slice"))
return GNM_PAGE_BREAK_DATA_SLICE;
return GNM_PAGE_BREAK_AUTO;
}
......@@ -28,6 +28,7 @@ typedef enum {
GNM_PAGE_BREAK_AUTO,
GNM_PAGE_BREAK_DATA_SLICE
} GnmPageBreakType;
GnmPageBreakType gnm_page_break_type_from_str (char const *str);
typedef struct {
int pos; /* break before this 0 based position */
......
......@@ -570,6 +570,34 @@ xml_read_print_repeat_range (XmlParseContext *ctxt, xmlNodePtr tree,
}
}
static void
xml_read_breaks (XmlParseContext *ctxt, xmlNodePtr tree, gboolean is_vert)
{
GnmPageBreaks *page_breaks;
int pos, count = 0;
xmlChar *type_str;
GnmPageBreakType type;
xml_node_get_int (tree, "count", &count);
page_breaks = gnm_page_breaks_new (count, is_vert);
for (tree = tree->xmlChildrenNode; tree != NULL ; tree = tree->next)
if (!xmlIsBlankNode (tree) &&
0 == strcmp (tree->name, "break") &&
xml_node_get_int (tree, "pos", &pos) &&
pos >= 0) {
if (NULL != (type_str = xml_node_get_cstr (tree, "type")))
type = gnm_page_break_type_from_str (CXML2C (type_str));
else
type = GNM_PAGE_BREAK_AUTO;
/* drops invalid positions */
gnm_page_breaks_append_break (page_breaks, pos, type);
}
print_info_set_breaks (ctxt->sheet->print_info, page_breaks);
}
static void
xml_read_print_info (XmlParseContext *ctxt, xmlNodePtr tree)
{
......@@ -685,6 +713,11 @@ xml_read_print_info (XmlParseContext *ctxt, xmlNodePtr tree)
print_info_set_paper (pi, paper);
xmlFree (paper);
}
if ((child = e_xml_get_child_by_name (tree, CC2XML ("vPageBreaks"))))
xml_read_breaks (ctxt, child, TRUE);
if ((child = e_xml_get_child_by_name (tree, CC2XML ("hPageBreaks"))))
xml_read_breaks (ctxt, child, FALSE);
}
static char const *
......
......@@ -157,6 +157,8 @@ gnm_xml_attr_int (xmlChar const * const *attrs, char const *name, int *res)
return TRUE;
}
/* NOT SUITABLE FOR HIGH VOLUME VALUES
* Checking both name and nick gets expensive */
static gboolean
xml_sax_attr_enum (xmlChar const * const *attrs,
char const *name,
......@@ -174,10 +176,11 @@ xml_sax_attr_enum (xmlChar const * const *attrs,
if (strcmp (CXML2C (attrs[0]), name))
return FALSE;
eclass = G_ENUM_CLASS (g_type_class_peek (etype));
eclass = G_ENUM_CLASS (g_type_class_ref (etype));
ev = g_enum_get_value_by_name (eclass, CXML2C (attrs[1]));
if (!ev) ev = g_enum_get_value_by_nick (eclass, CXML2C (attrs[1]));
g_type_class_unref (eclass);
if (!ev && gnm_xml_attr_int (attrs, name, &i))
/* Check that the value is valid. */
ev = g_enum_get_value (eclass, i);
......@@ -762,21 +765,17 @@ xml_sax_page_break (GsfXMLIn *xin, xmlChar const **attrs)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
GnmPageBreakType type = GNM_PAGE_BREAK_AUTO;
gboolean tmp;
int pos;
int pos = -1;
if (NULL == state->page_breaks)
return;
pos = 0;
for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
if (gnm_xml_attr_int (attrs, "pos", &pos)) ;
else if (xml_sax_attr_bool (attrs, "manual", &tmp)) { if (tmp) type = GNM_PAGE_BREAK_MANUAL; }
#if 0 /* Ignored */
else if (gnm_xml_attr_int (attrs, "first", &first)) ;
else if (gnm_xml_attr_int (attrs, "last", &last)) ;
#endif
if (gnm_xml_attr_int (attrs, "pos", &pos)) ;
else if (!strcmp (CXML2C (attrs[0]), "type"))
type = gnm_page_break_type_from_str (CXML2C (attrs[1]));
/* drops invalid positions */
gnm_page_breaks_append_break (state->page_breaks, pos, type);
}
......@@ -1229,7 +1228,7 @@ xml_sax_style_region_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
}
static void
xml_sax_styleregion_start (GsfXMLIn *xin, xmlChar const **attrs)
xml_sax_style_start (GsfXMLIn *xin, xmlChar const **attrs)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
......@@ -1283,7 +1282,7 @@ xml_sax_styleregion_start (GsfXMLIn *xin, xmlChar const **attrs)
}
static void
xml_sax_styleregion_font (GsfXMLIn *xin, xmlChar const **attrs)
xml_sax_style_font (GsfXMLIn *xin, xmlChar const **attrs)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
......@@ -1362,7 +1361,7 @@ style_font_read_from_x11 (GnmStyle *mstyle, char const *fontname)
}
static void
xml_sax_styleregion_font_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
xml_sax_style_font_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
......@@ -1587,7 +1586,7 @@ xml_sax_input_msg (GsfXMLIn *xin, xmlChar const **attrs)
}
static void
xml_sax_style_region_borders (GsfXMLIn *xin, xmlChar const **attrs)
xml_sax_style_border (GsfXMLIn *xin, xmlChar const **attrs)
{
XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
......@@ -2307,15 +2306,13 @@ GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, FALS
GSF_XML_IN_NODE_FULL (PRINT_MARGINS, PRINT_MARGIN_RIGHT, GNM, "right", GSF_XML_CONTENT, FALSE, FALSE, &xml_sax_print_margins, NULL, 3),
GSF_XML_IN_NODE_FULL (PRINT_MARGINS, PRINT_MARGIN_HEADER, GNM, "header",GSF_XML_CONTENT, FALSE, FALSE, &xml_sax_print_margins, NULL, 4),
GSF_XML_IN_NODE_FULL (PRINT_MARGINS, PRINT_MARGIN_FOOTER, GNM, "footer",GSF_XML_CONTENT, FALSE, FALSE, &xml_sax_print_margins, NULL, 5),
GSF_XML_IN_NODE (SHEET_PRINTINFO, V_BREAKS, GNM, "vBreaks", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (SHEET_PRINTINFO, H_BREAKS, GNM, "hBreaks", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE_FULL (SHEET_PRINTINFO, V_PAGE_BREAKS, GNM, "vPageBreaks", GSF_XML_NO_CONTENT,
FALSE, FALSE, &xml_sax_page_breaks_begin, &xml_sax_page_breaks_end, 0),
GSF_XML_IN_NODE (V_PAGE_BREAKS, PAGE_BREAK, GNM, "brk", GSF_XML_NO_CONTENT, &xml_sax_page_break, NULL),
FALSE, FALSE, &xml_sax_page_breaks_begin, &xml_sax_page_breaks_end, 1),
GSF_XML_IN_NODE (V_PAGE_BREAKS, PAGE_BREAK, GNM, "break", GSF_XML_NO_CONTENT, &xml_sax_page_break, NULL),
GSF_XML_IN_NODE_FULL (SHEET_PRINTINFO, H_PAGE_BREAKS, GNM, "hPageBreaks", GSF_XML_NO_CONTENT,
FALSE, FALSE, &xml_sax_page_breaks_begin, &xml_sax_page_breaks_end, 0),
GSF_XML_IN_NODE (H_PAGE_BREAKS, PAGE_BREAK, GNM, "brk", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (H_PAGE_BREAKS, PAGE_BREAK, GNM, "break", GSF_XML_NO_CONTENT, NULL, NULL), /* 2nd Def */
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_SCALE, GNM, "Scale", GSF_XML_CONTENT, &xml_sax_print_scale, NULL),
GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_VCENTER, GNM, "vcenter", GSF_XML_CONTENT, &xml_sax_print_vcenter, NULL),
......@@ -2337,21 +2334,21 @@ GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, FALS
GSF_XML_IN_NODE (SHEET, SHEET_STYLES, GNM, "Styles", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE (SHEET_STYLES, STYLE_REGION, GNM, "StyleRegion", GSF_XML_NO_CONTENT, &xml_sax_style_region_start, &xml_sax_style_region_end),
GSF_XML_IN_NODE (STYLE_REGION, STYLE_STYLE, GNM, "Style", GSF_XML_NO_CONTENT, &xml_sax_styleregion_start, NULL),
GSF_XML_IN_NODE (STYLE_STYLE, STYLE_FONT, GNM, "Font", GSF_XML_CONTENT, &xml_sax_styleregion_font, &xml_sax_styleregion_font_end),
GSF_XML_IN_NODE (STYLE_REGION, STYLE_STYLE, GNM, "Style", GSF_XML_NO_CONTENT, &xml_sax_style_start, NULL),
GSF_XML_IN_NODE (STYLE_STYLE, STYLE_FONT, GNM, "Font", GSF_XML_CONTENT, &xml_sax_style_font, &xml_sax_style_font_end),
GSF_XML_IN_NODE (STYLE_STYLE, STYLE_BORDER, GNM, "StyleBorder", GSF_XML_NO_CONTENT, NULL, NULL),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_TOP, GNM, "Top",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_TOP),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_TOP),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_BOTTOM, GNM, "Bottom",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_BOTTOM),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_BOTTOM),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_LEFT, GNM, "Left",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_LEFT),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_LEFT),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_RIGHT, GNM, "Right",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_RIGHT),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_RIGHT),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_DIAG, GNM, "Diagonal",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_DIAGONAL),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_DIAGONAL),
GSF_XML_IN_NODE_FULL (STYLE_BORDER, BORDER_REV_DIAG,GNM, "Rev-Diagonal",
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_region_borders, NULL, MSTYLE_BORDER_REV_DIAGONAL),
GSF_XML_NO_CONTENT, FALSE, FALSE, &xml_sax_style_border, NULL, MSTYLE_BORDER_REV_DIAGONAL),
GSF_XML_IN_NODE (STYLE_STYLE, STYLE_VALIDATION, GNM, "Validation", GSF_XML_NO_CONTENT, &xml_sax_validation, &xml_sax_validation_end),
GSF_XML_IN_NODE_FULL (STYLE_VALIDATION, STYLE_VALIDATION_EXPR0, GNM, "Expression0",
......@@ -2566,6 +2563,7 @@ gnm_xml_file_open (GOFileOpener const *fo, IOContext *io_context,
state.expr_map = g_hash_table_new (g_direct_hash, g_direct_equal);
state.delayed_names = NULL;
state.so = NULL;
state.page_breaks = NULL;
g_object_ref (input);
input = maybe_gunzip (input);
......
......@@ -248,6 +248,31 @@ xml_write_print_hf (GnmOutputXML *state, char const *name,
gsf_xml_out_end_element (state->output);
}
static void
xml_write_breaks (GnmOutputXML *state, GnmPageBreaks *breaks)
{
GArray const *details = breaks->details;
GnmPageBreak const *binfo;
unsigned i;
gsf_xml_out_start_element (state->output,
(breaks->is_vert) ? GNM "vPageBreaks" : GNM "hPageBreaks");
gsf_xml_out_add_int (state->output, "count", details->len);
for (i = 0 ; i < details->len ; i++) {
binfo = &g_array_index (details, GnmPageBreak, i);
gsf_xml_out_start_element (state->output, GNM "break");
gsf_xml_out_add_int (state->output, "pos", binfo->pos);
if (binfo->type == GNM_PAGE_BREAK_MANUAL)
gsf_xml_out_add_cstr_unchecked (state->output, "type", "manual");
else if (binfo->type == GNM_PAGE_BREAK_DATA_SLICE)
gsf_xml_out_add_cstr_unchecked (state->output, "type", "data-slice");
gsf_xml_out_end_element (state->output); /* </break> */
}
gsf_xml_out_end_element (state->output);
}
static void
xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
{
......@@ -348,11 +373,16 @@ xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
gsf_xml_out_simple_element (state->output, GNM "paper", paper_name);
g_free (paper_name);
if (NULL != pi->page_breaks.v)
xml_write_breaks (state, pi->page_breaks.v);
if (NULL != pi->page_breaks.h)
xml_write_breaks (state, pi->page_breaks.h);
gsf_xml_out_end_element (state->output);
}
static void
xml_write_gnmstyle (GnmOutputXML *state, GnmStyle const *style)
xml_write_style (GnmOutputXML *state, GnmStyle const *style)
{
static char const *border_names[] = {
GNM "Top",
......@@ -367,9 +397,12 @@ xml_write_gnmstyle (GnmOutputXML *state, GnmStyle const *style)
GnmInputMsg const *im;
GnmStyleConditions const *sc;
GnmStyleCond const *cond;
GnmBorder const *border;
GnmStyleBorderType t;
GnmParsePos pp;
char *tmp;
unsigned i;
gboolean started;
gsf_xml_out_start_element (state->output, GNM "Style");
......@@ -515,35 +548,31 @@ xml_write_gnmstyle (GnmOutputXML *state, GnmStyle const *style)
gsf_xml_out_simple_element (state->output, GNM "Expression1", tmp);
g_free (tmp);
}
xml_write_gnmstyle (state, cond->overlay);
xml_write_style (state, cond->overlay);
gsf_xml_out_end_element (state->output); /* </Condition> */
}
}
started = FALSE;
for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_DIAGONAL; i++)
if (gnm_style_is_element_set (style, i) &&
NULL != (border = gnm_style_get_border (style, i)) &&
GNM_STYLE_BORDER_NONE != (t = border->line_type)) {
GnmColor const *col = border->color;
i = MSTYLE_BORDER_TOP;
while (i <= MSTYLE_BORDER_DIAGONAL
&& !gnm_style_is_element_set (style, i)
&& NULL == gnm_style_get_border (style, i))
i++;
if (i <= MSTYLE_BORDER_DIAGONAL) {
gsf_xml_out_start_element (state->output, GNM "StyleBorder");
for (i = MSTYLE_BORDER_TOP; i <= MSTYLE_BORDER_DIAGONAL; i++) {
GnmBorder const *border;
if (gnm_style_is_element_set (style, i) &&
NULL != (border = gnm_style_get_border (style, i))) {
GnmStyleBorderType t = border->line_type;
GnmColor *col = border->color;
gsf_xml_out_start_element (state->output,
border_names [i - MSTYLE_BORDER_TOP]);
gsf_xml_out_add_int (state->output, "Style", t);
if (t != GNM_STYLE_BORDER_NONE)
gnm_xml_out_add_color (state->output, "Color", col);
gsf_xml_out_end_element (state->output);
if (!started) {
gsf_xml_out_start_element (state->output, GNM "StyleBorder");
started = TRUE;
}
gsf_xml_out_start_element (state->output,
border_names [i - MSTYLE_BORDER_TOP]);
gsf_xml_out_add_int (state->output, "Style", t);
gnm_xml_out_add_color (state->output, "Color", col);
gsf_xml_out_end_element (state->output);
}
if (started)
gsf_xml_out_end_element (state->output);
}
gsf_xml_out_end_element (state->output);
}
......@@ -554,7 +583,7 @@ xml_write_style_region (GnmOutputXML *state, GnmStyleRegion const *region)
gsf_xml_out_start_element (state->output, GNM "StyleRegion");
xml_out_add_range (state->output, &region->range);
if (region->style != NULL)
xml_write_gnmstyle (state, region->style);
xml_write_style (state, region->style);
gsf_xml_out_end_element (state->output);
}
......@@ -1234,12 +1263,20 @@ gnm_xml_file_save (GOFileSaver const *fs, IOContext *io_context,
locale = gnm_push_C_locale ();
gsf_xml_out_start_element (state.output, GNM "Workbook");
/* backwards compat, must be first */
gsf_xml_out_add_cstr_unchecked (state.output, "xmlns:gnm",
"http://www.gnumeric.org/v10.dtd");
#if 0 /* seems to break meta data */
/* default namespace added for 1.8 */
gsf_xml_out_add_cstr_unchecked (state.output, "xmlns",
"http://www.gnumeric.org/v10.dtd");
#endif
gsf_xml_out_add_cstr_unchecked (state.output, "xmlns:xsi",
"http://www.w3.org/2001/XMLSchema-instance");
gsf_xml_out_add_cstr_unchecked (state.output, "xsi:schemaLocation",
"http://www.gnumeric.org/v8.xsd");
"http://www.gnumeric.org/v9.xsd");
xml_write_version (&state);
xml_write_attributes (&state);
......@@ -1316,8 +1353,13 @@ gnm_cellregion_to_xml (GnmCellRegion const *cr)
locale = gnm_push_C_locale ();
gsf_xml_out_start_element (state.state.output, GNM "ClipboardRange");
/* backwards compat, must be first */
gsf_xml_out_add_cstr_unchecked (state.state.output, "xmlns:gnm",
"http://www.gnumeric.org/v10.dtd");
/* default namespace added for 1.8 */
gsf_xml_out_add_cstr_unchecked (state.state.output, "xmlns",
"http://www.gnumeric.org/v10.dtd");
gsf_xml_out_add_int (state.state.output, "Cols", cr->cols);
gsf_xml_out_add_int (state.state.output, "Rows", cr->rows);
......
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