[gnumeric] Import style information attached to grids from ODF. part of [#671461]



commit 4d6082d73afe616c648e0685fb5b050cd7bf5af4
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Mon Mar 12 00:04:34 2012 -0600

    Import style information attached to grids from ODF. part of [#671461]
    
    2012-03-12  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-write.c (oo_chart_grid): use style name

 NEWS                                 |    1 +
 plugins/openoffice/ChangeLog         |    4 ++++
 plugins/openoffice/openoffice-read.c |   19 +++++++++++++++++--
 3 files changed, 22 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index a1ff5d9..ffb03bd 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
 	interpolation. [#671508]
 	* Handle unusual styles created in xls import. [#671745]
 	* Do not show an icon for the range entry in the search dialog. [#671494]
+	* Import style information attached to grids from ODF. part of [#671461]
 
 Jean:
 	* Fixed crash with sheet object. [#671617]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 3a79d4f..d08830a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,7 @@
+2012-03-12  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-write.c (oo_chart_grid): use style name
+
 2012-03-10  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* openoffice-write.c (odf_write_style_cell_properties): allow for
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index c583a24..78274da 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -8256,16 +8256,31 @@ static void
 oo_chart_grid (GsfXMLIn *xin, xmlChar const **attrs)
 {
 	OOParseState *state = (OOParseState *)xin->user_state;
+	gchar const *style_name = NULL;
+	GogObject   *grid = NULL;
 
 	if (state->chart.axis == NULL)
 		return;
 	for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
 		if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_CHART, "class")) {
 			if (attr_eq (attrs[1], "major"))
-				gog_object_add_by_name (state->chart.axis, "MajorGrid", NULL);
+				grid = gog_object_add_by_name (state->chart.axis, "MajorGrid", NULL);
 			else if (attr_eq (attrs[1], "minor"))
-				gog_object_add_by_name (state->chart.axis, "MinorGrid", NULL);
+				grid = gog_object_add_by_name (state->chart.axis, "MinorGrid", NULL);
+		} else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_CHART, "style-name"))
+			style_name = CXML2C (attrs[1]);
+	
+	if (grid != NULL && style_name != NULL) {
+		GOStyle *style = NULL;
+		g_object_get (G_OBJECT (grid), "style", &style, NULL);
+		
+		if (style) {
+			OOChartStyle *chart_style = g_hash_table_lookup
+				(state->chart.graph_styles, style_name);
+			odf_apply_style_props (xin, chart_style->style_props, style);
+			g_object_unref (style);
 		}
+	}	
 }
 
 static void



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