[gnumeric] Improve contour plot export/import to/from ODF. [#788728]



commit 3b8c89c64128f4bb83eafd8b2f0dff474929cd7b
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue Oct 10 19:33:38 2017 -0600

    Improve contour plot export/import to/from ODF. [#788728]
    
    2017-10-10  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (oo_color_scaleo): new
        (opendoc_content_dtd): connect the above
        * openoffice-write.c (odf_write_plot): write color-scale

 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-read.c  |    8 ++++++++
 plugins/openoffice/openoffice-write.c |    5 +++++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 0c2a2d5..ec6f08b 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,11 @@
 2017-10-10  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (oo_color_scaleo): new
+       (opendoc_content_dtd): connect the above
+       * openoffice-write.c (odf_write_plot): write color-scale
+
+2017-10-10  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-read.c (oo_chart_axis): handle PSEUDO_3D axis and colormap
        (oo_chart): read theme name
        * openoffice-write.c (odf_write_axis_full): write color map for PSEUDO_3D axis
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 3f2074d..d5beb1e 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -9997,6 +9997,13 @@ oo_chart (GsfXMLIn *xin, xmlChar const **attrs)
 }
 
 static void
+oo_color_scale (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
+{
+       OOParseState *state = (OOParseState *)xin->user_state;
+       gog_object_add_by_name ((GogObject *)state->chart.chart, "Color-Scale", NULL);
+}
+
+static void
 oo_legend (GsfXMLIn *xin, xmlChar const **attrs)
 {
        static OOEnum const positions [] = {
@@ -12235,6 +12242,7 @@ static GsfXMLInNode const opendoc_content_dtd [] =
              GSF_XML_IN_NODE (CHART_CHART, CHART_LEGEND, OO_NS_CHART, "legend", GSF_XML_NO_CONTENT, 
&oo_legend, NULL),
                GSF_XML_IN_NODE (CHART_LEGEND, CHART_LEGEND_TITLE, OO_GNUM_NS_EXT, "title", 
GSF_XML_NO_CONTENT, &oo_chart_title, &oo_chart_title_end),
                  GSF_XML_IN_NODE (CHART_LEGEND_TITLE, TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_2ND, NULL, 
NULL),
+             GSF_XML_IN_NODE (CHART_CHART, CHART_COLOR_SCALE, OO_GNUM_NS_EXT, "color-scale", 
GSF_XML_NO_CONTENT, &oo_color_scale, NULL),
              GSF_XML_IN_NODE (CHART_CHART, CHART_PLOT_AREA, OO_NS_CHART, "plot-area", GSF_XML_NO_CONTENT, 
&oo_plot_area, &oo_plot_area_end),
                GSF_XML_IN_NODE (CHART_PLOT_AREA, CHART_SERIES, OO_NS_CHART, "series", GSF_XML_NO_CONTENT, 
&oo_plot_series, &oo_plot_series_end),
                  GSF_XML_IN_NODE (CHART_SERIES, SERIES_DOMAIN, OO_NS_CHART, "domain", GSF_XML_NO_CONTENT, 
&oo_series_domain, NULL),
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index f33754f..1094a80 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -8051,6 +8051,7 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
        GSList const *series, *l;
        GogObject const *wall = gog_object_get_child_by_name (chart, "Backplane");
        GogObject const *legend = gog_object_get_child_by_name (chart, "Legend");
+       GogObject const *color_scale = gog_object_get_child_by_name (chart, "Color-Scale");
        GogObjectRole const *trole = gog_object_find_role_by_name (graph, "Title");
        GSList *titles = gog_object_get_children (graph, trole);
        GogObjectRole const *trole2 = gog_object_find_role_by_name (chart, "Title");
@@ -8432,6 +8433,10 @@ odf_write_plot (GnmOOExport *state, SheetObject *so, GogObject const *graph,
                g_free (name);
        }
        gsf_xml_out_end_element (state->xml); /* </chart:plot_area> */
+
+       if (color_scale != NULL && state->with_extension)
+               gsf_xml_out_simple_element (state->xml, GNMSTYLE "color-scale", NULL);
+
        gsf_xml_out_end_element (state->xml); /* </chart:chart> */
        gsf_xml_out_end_element (state->xml); /* </office:chart> */
        gsf_xml_out_end_element (state->xml); /* </office:body> */


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