[gnumeric] Write and read error-display and comment-placement



commit fda1cc17b0addd4a0bc50a290e7c1fb632926fc5
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jul 27 13:22:49 2011 -0600

    Write and read error-display and comment-placement
    
    2011-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* src/xml-sax-read.c (xml_sax_print_comments): new
    	(xml_sax_print_errors): new
    	(gnumeric_1_0_dtd): connect the above
    	* src/xml-sax-write.c (xml_write_print_info): write comment placement
    	and error display

 ChangeLog           |    8 ++++++++
 src/xml-sax-read.c  |   35 ++++++++++++++++++++++++++++++++++-
 src/xml-sax-write.c |   37 +++++++++++++++++++++++++++++++++++++
 3 files changed, 79 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f5c804a..a3becee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2011-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* src/xml-sax-read.c (xml_sax_print_comments): new
+	(xml_sax_print_errors): new
+	(gnumeric_1_0_dtd): connect the above
+	* src/xml-sax-write.c (xml_write_print_info): write comment placement
+	and error display
+
+2011-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/print.c (compute_sheet_pages): account for column width change
 	when formulae are shown.
 
diff --git a/src/xml-sax-read.c b/src/xml-sax-read.c
index c1668eb..24327e6 100644
--- a/src/xml-sax-read.c
+++ b/src/xml-sax-read.c
@@ -2707,6 +2707,38 @@ xml_sax_print_order (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 		(strcmp (xin->content->str, "r_then_d") == 0);
 }
 
+static void
+xml_sax_print_comments (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+	XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
+
+	xml_sax_must_have_sheet (state);
+
+	if (strcmp (xin->content->str, "in_place") == 0)
+		state->sheet->print_info->comment_placement = PRINT_COMMENTS_IN_PLACE;
+	else if (strcmp (xin->content->str, "at_end") == 0)
+		state->sheet->print_info->comment_placement = PRINT_COMMENTS_AT_END;
+	else
+		state->sheet->print_info->comment_placement = PRINT_COMMENTS_NONE;
+}
+
+static void
+xml_sax_print_errors (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
+{
+	XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
+
+	xml_sax_must_have_sheet (state);
+
+	if (strcmp (xin->content->str, "as_blank") == 0)
+		state->sheet->print_info->error_display = PRINT_ERRORS_AS_BLANK;
+	else if (strcmp (xin->content->str, "as_dashes") == 0)
+		state->sheet->print_info->error_display = PRINT_ERRORS_AS_DASHES;
+	else if (strcmp (xin->content->str, "as_na") == 0)
+		state->sheet->print_info->error_display = PRINT_ERRORS_AS_NA;
+	else
+		state->sheet->print_info->error_display = PRINT_ERRORS_AS_DISPLAYED;
+}
+
 
 static void
 xml_sax_orientation (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
@@ -2895,7 +2927,8 @@ GSF_XML_IN_NODE_FULL (START, WB, GNM, "Workbook", GSF_XML_NO_CONTENT, TRUE, TRUE
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_PRINT_RANGE, GNM, "print_range",GSF_XML_NO_CONTENT, &xml_sax_print_print_range, NULL),
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_MONO,	    GNM, "monochrome",	GSF_XML_NO_CONTENT, &xml_sax_monochrome, NULL),
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_AS_DRAFT,   GNM, "draft",	GSF_XML_NO_CONTENT, NULL, NULL),
-	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_COMMENTS,   GNM, "comments",	GSF_XML_NO_CONTENT, NULL, NULL),
+	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_COMMENTS,   GNM, "comments",	GSF_XML_CONTENT, NULL, &xml_sax_print_comments),
+	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_ERRORS,   GNM, "errors",	GSF_XML_CONTENT, NULL, &xml_sax_print_errors),
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_TITLES,	    GNM, "titles",	GSF_XML_NO_CONTENT, &xml_sax_print_titles, NULL),
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_REPEAT_TOP, GNM, "repeat_top",	GSF_XML_NO_CONTENT, &xml_sax_repeat_top, NULL),
 	GSF_XML_IN_NODE (SHEET_PRINTINFO, PRINT_REPEAT_LEFT,GNM, "repeat_left",	GSF_XML_NO_CONTENT, &xml_sax_repeat_left, NULL),
diff --git a/src/xml-sax-write.c b/src/xml-sax-write.c
index b16a9fb..bef73f4 100644
--- a/src/xml-sax-write.c
+++ b/src/xml-sax-write.c
@@ -416,6 +416,43 @@ xml_write_print_info (GnmOutputXML *state, PrintInformation *pi)
 		xml_write_breaks (state, pi->page_breaks.v);
 	if (NULL != pi->page_breaks.h)
 		xml_write_breaks (state, pi->page_breaks.h);
+
+	switch (pi->comment_placement) {
+	case PRINT_COMMENTS_IN_PLACE:
+		gsf_xml_out_simple_element (state->output, GNM "comments", 
+					    "in_place");
+		break;
+	case PRINT_COMMENTS_AT_END:
+		gsf_xml_out_simple_element (state->output, GNM "comments", 
+					    "at_end");
+		break;
+	case PRINT_COMMENTS_NONE:
+	default:
+		gsf_xml_out_simple_element (state->output, GNM "comments", 
+					    "none");
+		break;
+	}
+
+	switch (pi->error_display) {
+	case PRINT_ERRORS_AS_BLANK:
+		gsf_xml_out_simple_element (state->output, GNM "errors", 
+					    "as_blank");
+		break;
+	case PRINT_ERRORS_AS_DASHES:
+		gsf_xml_out_simple_element (state->output, GNM "errors", 
+					    "as_dashes");
+		break;
+	case PRINT_ERRORS_AS_NA:
+		gsf_xml_out_simple_element (state->output, GNM "errors", 
+					    "as_na");
+		break;
+	case PRINT_ERRORS_AS_DISPLAYED:
+	default:
+		gsf_xml_out_simple_element (state->output, GNM "errors", 
+					    "as_displayed");
+		break;
+	}
+
 	gsf_xml_out_end_element (state->output);
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]