[gnumeric] Read OOo's way of indicating rotated axes labels.



commit b1d17b8c4efaac25d2e4b54a849ceab494a47e17
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Sep 15 16:39:04 2010 -0600

    Read OOo's way of indicating rotated axes labels.
    
    2010-09-15  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (od_style_prop_chart): add
    	   OO_NS_STYLE "rotation-angle"
    	* openoffice-write.c (odf_write_axis_categories): new
    	(odf_write_axis): call odf_write_axis_categories
    	(odf_write_generic_axis): ditto
    	(odf_write_axis_ring): deleted, use odf_write_generic_axis

 plugins/openoffice/ChangeLog          |    9 ++++
 plugins/openoffice/openoffice-read.c  |   12 +++++-
 plugins/openoffice/openoffice-write.c |   66 +++++++++++++++-----------------
 3 files changed, 51 insertions(+), 36 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 76c31d3..b6112dd 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,14 @@
 2010-09-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* openoffice-read.c (od_style_prop_chart): add 
+	   OO_NS_STYLE "rotation-angle"
+	* openoffice-write.c (odf_write_axis_categories): new
+	(odf_write_axis): call odf_write_axis_categories
+	(odf_write_generic_axis): ditto
+	(odf_write_axis_ring): deleted, use odf_write_generic_axis
+
+2010-09-15  Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* openoffice-read.c (oo_chart_axis): apply style info to gostyle
 
 2010-09-15  Morten Welinder  <terra gnome org>
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 63f0f9f..9d3ccca 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -4296,10 +4296,19 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
 			style->style_props = g_slist_prepend
 				(style->style_props,
 				 oo_prop_new_int ("gnm-pattern", tmp));
-		else if (oo_attr_angle (xin, attrs, OO_NS_STYLE, "text-rotation-angle", &tmp)) {
+		else if (oo_attr_angle (xin, attrs, OO_NS_STYLE, 
+					"text-rotation-angle", &tmp)) {
 			style->style_props = g_slist_prepend
 				(style->style_props,
 				 oo_prop_new_int ("text-rotation-angle", tmp));
+		} else if (oo_attr_angle (xin, attrs, OO_NS_STYLE, 
+					  "rotation-angle", &tmp)) {
+			style->style_props = g_slist_prepend
+				(style->style_props,
+				 oo_prop_new_int ("text-rotation-angle", tmp));
+			style->plot_props = g_slist_prepend
+				(style->plot_props,
+				 oo_prop_new_int ("rotation-angle", tmp));
 		} else if (NULL != oo_attr_distance (xin, attrs, OO_NS_FO, "font-size", &ftmp))
 			style->style_props = g_slist_prepend
 				(style->style_props,
@@ -7320,6 +7329,7 @@ static GsfXMLInNode const opendoc_content_dtd [] =
 		  GSF_XML_IN_NODE (CHART_AXIS, CHART_GRID, OO_NS_CHART, "grid", GSF_XML_NO_CONTENT, &oo_chart_grid, NULL),
 		  GSF_XML_IN_NODE (CHART_AXIS, CHART_AXIS_CAT,   OO_NS_CHART, "categories", GSF_XML_NO_CONTENT, &od_chart_axis_categories, NULL),
 		  GSF_XML_IN_NODE (CHART_AXIS, CHART_TITLE, OO_NS_CHART, "title", GSF_XML_NO_CONTENT, NULL, NULL),				/* 2nd Def */
+	        GSF_XML_IN_NODE (CHART_PLOT_AREA, CHART_OOO_COORDINATE_REGION, OO_NS_CHART_OOO, "coordinate-region", GSF_XML_NO_CONTENT, NULL, NULL),
 
 	    GSF_XML_IN_NODE (SPREADSHEET, TABLE, OO_NS_TABLE, "table", GSF_XML_NO_CONTENT, &oo_table_start, &oo_table_end),
 	      GSF_XML_IN_NODE (TABLE, FORMS, OO_NS_OFFICE, "forms", GSF_XML_NO_CONTENT, NULL, NULL),
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 8e0d156..9cb6570 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -5581,6 +5581,30 @@ odf_write_gog_styles (GogObject const *obj, GnmOOExport *state)
 }
 
 static void
+odf_write_axis_categories (GnmOOExport *state, GSList const *series)
+{
+	if (series != NULL && series->data != NULL) {
+		GOData const *cat = gog_dataset_get_dim (GOG_DATASET (series->data), GOG_MS_DIM_LABELS);
+		if (NULL != cat) {		
+			GnmExprTop const *texpr = gnm_go_data_get_expr (cat);
+			if (NULL != texpr) {
+				char *cra;
+				GnmParsePos pp;
+				parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0,0 );
+				cra = gnm_expr_top_as_string (texpr, &pp, state->conv);
+
+				gsf_xml_out_start_element (state->xml, CHART "categories");
+				gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address", 
+						      odf_strip_brackets (cra));
+				gsf_xml_out_end_element (state->xml); /* </chart:categories> */
+
+				g_free (cra);
+			}
+		}
+	}
+}
+
+static void
 odf_write_axis (GnmOOExport *state, GogObject const *chart, char const *axis_role, 
 		char const *style_label,
 		char const *dimension, odf_chart_type_t gtype, GSList const *series)
@@ -5597,53 +5621,25 @@ odf_write_axis (GnmOOExport *state, GogObject const *chart, char const *axis_rol
 		gsf_xml_out_add_cstr (state->xml, CHART "style-name", style_label);
 		odf_write_label (state, axis);
 		odf_write_axis_grid (state, axis);
+		odf_write_axis_categories (state, series);
 		gsf_xml_out_end_element (state->xml); /* </chart:axis> */
 	}
 }
 
 static void
-odf_write_generic_axis (GnmOOExport *state, GogObject const *chart, char const *axis_role, 
+odf_write_generic_axis (GnmOOExport *state, GogObject const *chart, 
+			char const *axis_role, 
 			char const *style_label,
-			char const *dimension, odf_chart_type_t gtype, GSList const *series)
+			char const *dimension, odf_chart_type_t gtype, 
+			GSList const *series)
 {
 	gsf_xml_out_start_element (state->xml, CHART "axis");
 	gsf_xml_out_add_cstr (state->xml, CHART "dimension", dimension);
 	gsf_xml_out_add_cstr (state->xml, CHART "style-name", style_label);
+	odf_write_axis_categories (state, series);
 	gsf_xml_out_end_element (state->xml); /* </chart:axis> */	
 }
 
-
-static void
-odf_write_axis_ring (GnmOOExport *state, GogObject const *chart, char const *axis_role, 
-		     char const *style_label,
-		     char const *dimension, odf_chart_type_t gtype, GSList const *series)
-{
-	GnmParsePos pp;
-	parse_pos_init (&pp, WORKBOOK (state->wb), NULL, 0,0 );
-
-	gsf_xml_out_start_element (state->xml, CHART "axis");
-	gsf_xml_out_add_cstr (state->xml, CHART "dimension", dimension);
-	gsf_xml_out_add_cstr (state->xml, CHART "style-name", style_label);
-	if (series != NULL && series->data != NULL) {
-		GOData const *cat = gog_dataset_get_dim (GOG_DATASET (series->data), GOG_MS_DIM_LABELS);
-		if (NULL != cat) {
-			GnmExprTop const *texpr = gnm_go_data_get_expr (cat);
-			if (NULL != texpr) {
-				char *cra = gnm_expr_top_as_string (texpr, &pp, state->conv);
-
-				gsf_xml_out_start_element (state->xml, CHART "categories");
-				gsf_xml_out_add_cstr (state->xml, TABLE "cell-range-address", 
-						      odf_strip_brackets (cra));
-				gsf_xml_out_end_element (state->xml); /* </chart:categories> */
-
-				g_free (cra);
-			}
-		}
-	}
-	gsf_xml_out_end_element (state->xml); /* </chart:axis> */
-}
-
-
 static void
 odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, GogObject const *plot)
 {
@@ -5738,7 +5734,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		{ "GogRingPlot", CHART "ring", ODF_RING,
 		  10., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
 		  odf_write_standard_series,
-		  odf_write_axis_ring, odf_write_generic_axis, NULL},
+		  odf_write_generic_axis, odf_write_generic_axis, NULL},
 		{ "GogXYPlot", CHART "scatter", ODF_SCATTER,
 		  20., "X-Axis", "Y-Axis", NULL, odf_write_standard_axes_styles,
 		  odf_write_standard_series, 



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