gnumeric r16731 - in trunk: . src



Author: jbrefort
Date: Sun Aug  3 10:08:51 2008
New Revision: 16731
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16731&view=rev

Log:
2008-08-03  Jean Brefort  <jean brefort normalesup org>

	* src/xml-sax-read.c: (xml_sax_go_doc), (gnm_xml_file_open):
	save images used as background in charts. [#348780]
	* src/xml-sax-write.c: (gnm_xml_file_save),
	(gnm_cellregion_to_xml): load images used as background in charts.



Modified:
   trunk/ChangeLog
   trunk/src/xml-sax-read.c
   trunk/src/xml-sax-write.c

Modified: trunk/src/xml-sax-read.c
==============================================================================
--- trunk/src/xml-sax-read.c	(original)
+++ trunk/src/xml-sax-read.c	Sun Aug  3 10:08:51 2008
@@ -59,6 +59,7 @@
 #include "gutils.h"
 
 #include <goffice/app/io-context.h>
+#include <goffice/app/go-doc.h>
 #include <goffice/app/go-plugin.h>
 #include <goffice/app/error-info.h>
 #include <goffice/utils/go-glib-extras.h>
@@ -2299,6 +2300,13 @@
 	state->delayed_names = NULL;
 }
 
+static void
+xml_sax_go_doc (GsfXMLIn *xin, xmlChar const **attrs)
+{
+	XMLSaxParseState *state = (XMLSaxParseState *)xin->user_state;
+	go_doc_read (GO_DOC (state->wb), xin, attrs);
+}
+
 /****************************************************************************/
 
 #define GNM		0
@@ -2478,6 +2486,7 @@
   GSF_XML_IN_NODE (WB, WB_VIEW, GNM, "UIData", GSF_XML_NO_CONTENT, &xml_sax_wb_view, NULL),
   GSF_XML_IN_NODE (WB, WB_CALC, GNM, "Calculation", GSF_XML_NO_CONTENT, &xml_sax_calculation, NULL),
   GSF_XML_IN_NODE (WB, WB_DATE, GNM, "DateConvention", GSF_XML_CONTENT, NULL, &xml_sax_old_dateconvention),
+  GSF_XML_IN_NODE (WB, GODOC, -1, "GODoc", GSF_XML_NO_CONTENT, &xml_sax_go_doc, NULL),
   { NULL }
 };
 
@@ -2644,6 +2653,7 @@
 	g_object_ref (input);
 	input = maybe_gunzip (input);
 	input = maybe_convert (input, FALSE);
+	go_doc_init_read (GO_DOC (state.wb), input);
 	gsf_input_seek (input, 0, G_SEEK_SET);
 
 	io_progress_message (state.context, _("Reading file..."));
@@ -2653,6 +2663,7 @@
 	ok = gsf_xml_in_doc_parse (doc, input, &state);
 	handle_delayed_names (&state);
 	gnm_pop_C_locale (locale);
+	go_doc_end_read (GO_DOC (state.wb));
 
 	io_progress_unset (state.context);
 

Modified: trunk/src/xml-sax-write.c
==============================================================================
--- trunk/src/xml-sax-write.c	(original)
+++ trunk/src/xml-sax-write.c	Sun Aug  3 10:08:51 2008
@@ -57,6 +57,7 @@
 #include <tools/scenarios.h>
 #include <gnumeric-gconf.h>
 
+#include <goffice/app/go-doc.h>
 #include <goffice/app/file.h>
 #include <gsf/gsf-libxml.h>
 #include <gsf/gsf-output-gzip.h>
@@ -1269,6 +1270,7 @@
 	state.convs	= gnm_xml_io_conventions ();
 	state.expr_map  = g_hash_table_new (g_direct_hash, g_direct_equal);
 	state.cell_str  = g_string_new (NULL);
+	go_doc_init_write (GO_DOC (state.wb), state.output);
 
 	locale = gnm_push_C_locale ();
 
@@ -1297,6 +1299,7 @@
 	xml_write_sheets	    (&state);
 	xml_write_uidata	    (&state);
 	xml_write_calculation	    (&state);
+	go_doc_write (GO_DOC (state.wb), state.output);
 
 	gsf_xml_out_end_element (state.output); /* </Workbook> */
 
@@ -1347,6 +1350,7 @@
 	GSList       *ptr;
 	GsfOutput    *buf = gsf_output_memory_new ();
 	GnmLocale    *locale;
+	GODoc		 *doc = NULL;
 
 	g_return_val_if_fail (cr != NULL, NULL);
 	g_return_val_if_fail (IS_SHEET (cr->origin_sheet), NULL);
@@ -1360,6 +1364,11 @@
 	state.state.cell_str = g_string_new (NULL);
 
 	locale = gnm_push_C_locale ();
+	if (cr->origin_sheet) {
+		/* hoping this always occur */
+		doc = GO_DOC (cr->origin_sheet->workbook);
+		go_doc_init_write (doc, state.state.output);
+	}
 
 	gsf_xml_out_start_element (state.state.output, GNM "ClipboardRange");
 
@@ -1411,6 +1420,7 @@
 
 	xml_write_objects (&state.state, cr->objects);
 
+	go_doc_write (doc, state.state.output);
 	gsf_xml_out_end_element (state.state.output); /* </ClipboardRange> */
 
 	gnm_pop_C_locale (locale);



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