[gnumeric] Improve chart roundtrip through ODF. [#728197]



commit 806fc6f4d46811539e7775be832a36c0186ad689
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri Apr 18 00:45:37 2014 -0600

    Improve chart roundtrip through ODF. [#728197]
    
    2014-04-18  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_apply_style_props): set default
        (od_style_prop_chart): handle interpolation-skip-invalid
        * openoffice-write.c (odf_write_interpolation_attribute):
        write interpolation-skip-invalid
        (odf_write_gog_style_chart): write interpolations for GogLineSeries

 plugins/openoffice/ChangeLog          |    8 ++++++++
 plugins/openoffice/openoffice-read.c  |    9 ++++++++-
 plugins/openoffice/openoffice-write.c |   19 ++++++++++++++++---
 3 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index c8d47ed..5950663 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,11 @@
+2014-04-18  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_apply_style_props): set default
+       (od_style_prop_chart): handle interpolation-skip-invalid
+       * openoffice-write.c (odf_write_interpolation_attribute):
+       write interpolation-skip-invalid
+       (odf_write_gog_style_chart): write interpolations for GogLineSeries
+
 2014-04-17  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (odf_apply_style_props): read both
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index b7a2f9f..66310b0 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -936,6 +936,9 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
                style->line.dash_type = GO_LINE_NONE;
        } else if (stroke_width > 0)
                style->line.width = stroke_width;
+       else
+               style->line.width = 0;
+               
 
        switch (fill_type) {
        case OO_FILL_TYPE_HATCH:
@@ -6903,7 +6906,11 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                        (style->plot_props,
                                         oo_prop_new_string
                                         ("interpolation", interpolation));
-               } else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
+               } else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "interpolation-skip-invalid", &btmp))
+                       style->plot_props = g_slist_prepend
+                               (style->plot_props,
+                                oo_prop_new_bool ("interpolation-skip-invalid", btmp));
+               else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
                                               OO_NS_DRAW, "stroke")) {
                        draw_stroke = !attr_eq (attrs[1], "none");
                        draw_stroke_set = TRUE;
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index c383bdd..a19e6ee 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -6469,9 +6469,11 @@ odf_write_interpolation_attribute (GnmOOExport *state,
                                   GogObject const *series)
 {
        gchar *interpolation = NULL;
+       gboolean skip_invalid = TRUE;
 
-       g_object_get (G_OBJECT (series), "interpolation",
-                     &interpolation, NULL);
+       g_object_get (G_OBJECT (series),
+                     "interpolation", &interpolation, 
+                     NULL);
 
        if (interpolation != NULL) {
                if (0 == strcmp (interpolation, "linear"))
@@ -6496,6 +6498,17 @@ odf_write_interpolation_attribute (GnmOOExport *state,
                                (state->xml, CHART "interpolation", "none");
        }
 
+       if (state->with_extension) {
+               GObjectClass *klass = G_OBJECT_GET_CLASS (G_OBJECT (series));
+               if (NULL != g_object_class_find_property (klass, "interpolation-skip-invalid")) {
+                       g_object_get (G_OBJECT (series),
+                                     "interpolation-skip-invalid", &skip_invalid,
+                                     NULL);
+                       if (!skip_invalid)
+                               odf_add_bool (state->xml, GNMSTYLE "interpolation-skip-invalid", FALSE);
+               }
+       }
+
        g_free (interpolation);
 }
 
@@ -7207,7 +7220,6 @@ odf_write_gog_style_chart (GnmOOExport *state, GOStyle const *style, GogObject c
                odf_add_bool (state->xml, CHART "link-data-style-to-source", fmt == NULL);
        }
 
-
        func = g_hash_table_lookup (state->chart_props_hash, type);
        if (func != NULL)
                func (state, style, obj);
@@ -8025,6 +8037,7 @@ odf_fill_chart_props_hash (GnmOOExport *state)
                {"GogExpSmooth", odf_write_exp_smooth_reg},
                {"GogPieSeriesElement", odf_write_pie_point},
                {"GogXYSeries", odf_write_interpolation_attribute},
+               {"GogLineSeries", odf_write_interpolation_attribute},
        };
 
        for (i = 0 ; i < (int)G_N_ELEMENTS (props) ; i++)


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