[gnumeric] Import/export surface plots to/from ODF



commit 748c9cafb50923ff40a68a5931f5478738ba91bd
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Jul 27 08:58:11 2009 -0600

    Import/export surface plots to/from ODF
    
    2009-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* openoffice-read.c (OO_PLOT_SURF): rename to OO_PLOT_CONTOUR throughout
    	(OO_PLOT_XYZ_SURFACE): new
    	(OO_PLOT_SURFACE): new
    	(oo_plot_area): handle OO_PLOT_XYZ_SURFACE and OO_PLOT_SURFACE
    	(oo_plot_series): ditto
    	(oo_series_domain): ditto
    	(oo_chart): ditto
    	* openoffice-write.c (ODF_GNM_SURF): new
    	(ODF_XYZ_GNM_SURF): new
    	(odf_write_plot): handle ODF_GNM_SURF and ODF_XYZ_GNM_SURF

 plugins/openoffice/ChangeLog          |   13 +++++++++++++
 plugins/openoffice/openoffice-read.c  |   22 ++++++++++++++++------
 plugins/openoffice/openoffice-write.c |   18 ++++++++++++++++++
 3 files changed, 47 insertions(+), 6 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index eeba0ce..80de6c0 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,16 @@
+2009-07-27 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* openoffice-read.c (OO_PLOT_SURF): rename to OO_PLOT_CONTOUR throughout
+	(OO_PLOT_XYZ_SURFACE): new
+	(OO_PLOT_SURFACE): new
+	(oo_plot_area): handle OO_PLOT_XYZ_SURFACE and OO_PLOT_SURFACE
+	(oo_plot_series): ditto
+	(oo_series_domain): ditto
+	(oo_chart): ditto
+	* openoffice-write.c (ODF_GNM_SURF): new
+	(ODF_XYZ_GNM_SURF): new
+	(odf_write_plot): handle ODF_GNM_SURF and ODF_XYZ_GNM_SURF
+
 2009-07-23 Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* openoffice-read.c (gog_series_map_dim_by_name): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index e55fa14..26c326a 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -120,12 +120,14 @@ typedef enum {
 	OO_PLOT_RING,
 	OO_PLOT_SCATTER,
 	OO_PLOT_STOCK,
-	OO_PLOT_SURF,
+	OO_PLOT_CONTOUR,
 	OO_PLOT_BUBBLE,
 	OO_PLOT_GANTT,
 	OO_PLOT_POLAR,
 	OO_PLOT_XYZ_CONTOUR,
 	OO_PLOT_SCATTER_COLOUR,
+	OO_PLOT_XYZ_SURFACE,
+	OO_PLOT_SURFACE,
 	OO_PLOT_UNKNOWN
 } OOPlotType;
 
@@ -3305,6 +3307,7 @@ oo_chart_axis (GsfXMLIn *xin, xmlChar const **attrs)
 	static OOEnum const types[] = {
 		{ "x",	GOG_AXIS_X },
 		{ "y",	GOG_AXIS_Y },
+		{ "z",	GOG_AXIS_Z },
 		{ NULL,	0 },
 	};
 	GSList	*axes;
@@ -3511,11 +3514,13 @@ oo_plot_area (GsfXMLIn *xin, xmlChar const **attrs)
 	case OO_PLOT_RING:	type = "GogRingPlot";	break;
 	case OO_PLOT_SCATTER:	type = "GogXYPlot";	break;
 	case OO_PLOT_STOCK:	type = "GogMinMaxPlot";	break;  /* This is not quite right! */
-	case OO_PLOT_SURF:	type = "GogContourPlot"; break;
+	case OO_PLOT_CONTOUR:	type = "GogContourPlot"; break;
 	case OO_PLOT_BUBBLE:	type = "GogBubblePlot"; break;
 	case OO_PLOT_GANTT:	type = "GogDropBarPlot"; break;
 	case OO_PLOT_POLAR:	type = "GogPolarPlot"; break;
 	case OO_PLOT_XYZ_CONTOUR: type = "GogXYZContourPlot"; break;
+	case OO_PLOT_XYZ_SURFACE: type = "GogXYZSurfacePlot"; break;
+	case OO_PLOT_SURFACE: type = "GogSurfacePlot"; break;
 	case OO_PLOT_SCATTER_COLOUR: type = "GogXYColorPlot";	break;
 	default: return;
 	}
@@ -3598,7 +3603,8 @@ oo_plot_series (GsfXMLIn *xin, xmlChar const **attrs)
 				state->chart.stock_series = g_slist_append (state->chart.stock_series, 
 									    g_strdup (attrs[1]));
 		break;
-	case OO_PLOT_SURF:
+	case OO_PLOT_SURFACE:
+	case OO_PLOT_CONTOUR:
 		state->chart.series = gog_plot_new_series (state->chart.plot);
 		for (; attrs != NULL && attrs[0] && attrs[1] ; attrs += 2)
 			if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_CHART, "values-cell-range-address")) {
@@ -3650,7 +3656,7 @@ oo_plot_series_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
 	
 	switch (state->chart.plot_type) {
 	case OO_PLOT_STOCK:
-	case OO_PLOT_SURF:
+	case OO_PLOT_CONTOUR:
 		break;
 	case OO_PLOT_GANTT:
 		if ((state->chart.series_count % 2) != 0)
@@ -3683,9 +3689,11 @@ oo_series_domain (GsfXMLIn *xin, xmlChar const **attrs)
 		dim = (state->chart.domain_count == 0) ? GOG_MS_DIM_VALUES : GOG_MS_DIM_CATEGORIES;
 		break;
 	case OO_PLOT_XYZ_CONTOUR:
+	case OO_PLOT_XYZ_SURFACE:
+	case OO_PLOT_SURFACE:
 		name = (state->chart.domain_count == 0) ? "Y" : "X";
 		break;
-	case OO_PLOT_SURF:
+	case OO_PLOT_CONTOUR:
 		dim = (state->chart.domain_count == 0) ? -1 : GOG_MS_DIM_CATEGORIES;
 		break;
 	default:
@@ -3720,9 +3728,11 @@ oo_chart (GsfXMLIn *xin, xmlChar const **attrs)
 		{ "chart:stock",	OO_PLOT_STOCK },
 		{ "chart:bubble",	OO_PLOT_BUBBLE },
 		{ "chart:gantt",	OO_PLOT_GANTT },
-		{ "chart:surface",	OO_PLOT_SURF },
+		{ "chart:surface",	OO_PLOT_CONTOUR },
 		{ "gnm:polar",  	OO_PLOT_POLAR },
 		{ "gnm:xyz-contour", 	OO_PLOT_XYZ_CONTOUR },
+		{ "gnm:xyz-surface", 	OO_PLOT_XYZ_SURFACE },
+		{ "gnm:surface", 	OO_PLOT_SURFACE },
 		{ "gnm:scatter-color", 	OO_PLOT_SCATTER_COLOUR },
 		{ NULL,	0 },
 	};
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 6186a4e..b711a11 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -3169,7 +3169,9 @@ typedef enum {
 	ODF_RING,
 	ODF_SCATTER,
 	ODF_SURF,
+	ODF_GNM_SURF,
 	ODF_XYZ_SURF,
+	ODF_XYZ_GNM_SURF,
 	ODF_BUBBLE,
 	ODF_SCATTER_COLOUR,
 	ODF_POLAR
@@ -3515,6 +3517,14 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		gtype = ODF_XYZ_SURF;
 		odf_plot_type = "gnm:xyz-contour";
 		pad = 20.;
+	} else if (0 == strcmp (plot_type, "GogXYZSurfacePlot")) {
+		gtype = ODF_XYZ_GNM_SURF;
+		odf_plot_type = "gnm:xyz-surface";
+		pad = 20.;
+	} else if (0 == strcmp (plot_type, "GogSurfacePlot")) {
+		gtype = ODF_GNM_SURF;
+		odf_plot_type = "gnm:surface";
+		pad = 20.;
 	} else if (0 == strcmp (plot_type, "GogBubblePlot")) {
 		gtype = ODF_BUBBLE;
 		odf_plot_type = "chart:bubble";
@@ -3545,6 +3555,10 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		odf_write_axis_style (state, chart, "Y-Axis", horizontal ? "xaxis" : "yaxis", gtype);
 		odf_write_axis_style (state, chart, "X-Axis", horizontal ? "yaxis" : "xaxis", gtype);
 		break;
+	case ODF_GNM_SURF:
+	case ODF_XYZ_GNM_SURF:
+		odf_write_axis_style (state, chart, "Z-Axis", "zaxis", gtype);
+		/* no break */
 	default:
 		odf_write_axis_style (state, chart, "Y-Axis", "yaxis", gtype);
 		odf_write_axis_style (state, chart, "X-Axis", "xaxis", gtype);
@@ -3657,6 +3671,10 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *chart, Gog
 		odf_write_axis (state, chart, "Circular-Axis", "xaxis", "x", gtype);
 		odf_write_series (state, series);
 		break;
+	case ODF_GNM_SURF:
+	case ODF_XYZ_GNM_SURF:
+		odf_write_axis (state, chart, "Z-Axis", "zaxis", "z", gtype);		
+		/* no break */
 	case ODF_SCATTER_COLOUR:
 	case ODF_BUBBLE:
 	case ODF_SURF:



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