[gnumeric] Fix ODF import/export of marker fill and outline colours.



commit 4da7c952d973dbb9b67fddc0b44d6a7beccf00bc
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Sun Feb 8 12:47:04 2015 -0700

    Fix ODF import/export of marker fill and outline colours.
    
    2015-02-08  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_apply_style_props): handle marker-fill-colour,
        gnm-auto-marker-outline-colour & gnm-auto-marker-fill-colour
        (od_style_prop_chart): read the above
        * openoffice-write.c (odf_write_gog_style_graphic): write the above

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    7 +++++
 plugins/openoffice/openoffice-read.c  |   40 +++++++++++++++++++++++++++++++-
 plugins/openoffice/openoffice-write.c |    9 +++++++
 4 files changed, 55 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index d764735..9be5703 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ Andreas:
        * ODF import/export the z-index for line objects.
        * Fix ODF import of stroke colours of sheet objects.
        * Fix ODF import/export of fill colour and type. [#744051]
+       * Fix ODF import/export of marker fill and outline colours.
 
 Morten:
        * Initial xlsx import of sheet widgets.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index c2eb4d5..8ca0fba 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-08  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_apply_style_props): handle marker-fill-colour,
+       gnm-auto-marker-outline-colour & gnm-auto-marker-fill-colour
+       (od_style_prop_chart): read the above
+       * openoffice-write.c (odf_write_gog_style_graphic): write the above
+
 2015-02-07  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-write.c (odf_write_axis_position): Gnumeric uses a default crossing
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 49b1d95..f279a69 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -830,10 +830,15 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
        gboolean lines_value = !in_chart_context;
        gboolean gnm_auto_color_value_set = FALSE;
        gboolean gnm_auto_color_value = FALSE;
+       gboolean gnm_auto_marker_outline_color_value_set = FALSE;
+       gboolean gnm_auto_marker_outline_color_value = FALSE;
+       gboolean gnm_auto_marker_fill_color_value_set = FALSE;
+       gboolean gnm_auto_marker_fill_color_value = FALSE;
        gboolean gnm_auto_dash_set = FALSE;
        gboolean gnm_auto_width_set = FALSE;
        char const *stroke_dash = NULL;
        char const *marker_outline_colour = NULL;
+       char const *marker_fill_colour = NULL;
 
        style->line.auto_dash = TRUE;
 
@@ -888,11 +893,19 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
                        }
                } else if (0 == strcmp (prop->name, "marker-outline-colour")) {
                        marker_outline_colour = g_value_get_string (&prop->value);
+               } else if (0 == strcmp (prop->name, "marker-fill-colour")) {
+                       marker_fill_colour = g_value_get_string (&prop->value);
                } else if (0 == strcmp (prop->name, "lines")) {
                        lines_value = g_value_get_boolean (&prop->value);
                } else if (0 == strcmp (prop->name, "gnm-auto-color")) {
                        gnm_auto_color_value_set = TRUE;
                        gnm_auto_color_value = g_value_get_boolean (&prop->value);
+               } else if (0 == strcmp (prop->name, "gnm-auto-marker-outline-colour")) {
+                       gnm_auto_marker_outline_color_value_set = TRUE;
+                       gnm_auto_marker_outline_color_value = g_value_get_boolean (&prop->value);
+               } else if (0 == strcmp (prop->name, "gnm-auto-marker-fill-colour")) {
+                       gnm_auto_marker_fill_color_value_set = TRUE;
+                       gnm_auto_marker_fill_color_value = g_value_get_boolean (&prop->value);
                } else if (0 == strcmp (prop->name, "color")) {
                        GdkRGBA rgba;
                        gchar const *color = g_value_get_string (&prop->value);
@@ -1146,7 +1159,17 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
                if (symbol_type != OO_SYMBOL_TYPE_NONE) {
                        /* Inherit line colour.  */
                        go_marker_set_fill_color (m, style->line.color);
-                       style->marker.auto_fill_color = gnm_auto_color_value;
+                       if (marker_fill_colour != NULL) {
+                               GOColor color;
+                               GdkRGBA rgba;
+                               if (gdk_rgba_parse (&rgba, marker_fill_colour)) {
+                                       go_color_from_gdk_rgba (&rgba, &color);
+                                       go_marker_set_fill_color (m, color);
+                               }
+                       }
+                       go_marker_set_fill_color (m, style->line.color);
+                       style->marker.auto_fill_color = gnm_auto_marker_fill_color_value_set ?
+                               gnm_auto_marker_fill_color_value : gnm_auto_color_value;
                        if (marker_outline_colour == NULL)
                                go_marker_set_outline_color (m, style->line.color);
                        else {
@@ -1158,7 +1181,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
                                } else
                                        go_marker_set_outline_color (m, style->line.color);
                        }
-                       style->marker.auto_outline_color = gnm_auto_color_value;
+                       style->marker.auto_outline_color = gnm_auto_marker_outline_color_value_set ?
+                               gnm_auto_marker_outline_color_value : gnm_auto_color_value;
                }
 
                if (symbol_height >= 0. || symbol_width >= 0.) {
@@ -7209,6 +7233,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                (style->style_props,
                                 oo_prop_new_string ("marker-outline-colour",
                                                     CXML2C(attrs[1])));
+               } else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
+                                              OO_GNUM_NS_EXT, "marker-fill-colour")) {
+                       style->style_props = g_slist_prepend
+                               (style->style_props,
+                                oo_prop_new_string ("marker-fill-colour",
+                                                    CXML2C(attrs[1])));
                } else if (NULL != oo_attr_distance (xin, attrs, OO_NS_SVG,
                                                     "stroke-width", &ftmp))
                        style->style_props = g_slist_prepend
@@ -7416,9 +7446,15 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                (style->other_props,
                                 oo_prop_new_string
                                 ("border", CXML2C(attrs[1])));
+               else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-marker-outline-colour", &btmp))
+                       style->style_props = g_slist_prepend (style->style_props,
+                               oo_prop_new_bool ("gnm-auto-marker-outline-colour", btmp));
                else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-color", &btmp))
                        style->style_props = g_slist_prepend (style->style_props,
                                oo_prop_new_bool ("gnm-auto-color", btmp));
+               else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-marker-fill-colour", &btmp))
+                       style->style_props = g_slist_prepend (style->style_props,
+                               oo_prop_new_bool ("gnm-auto-marker-fill-colour", btmp));
                else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-dash", &btmp))
                        style->style_props = g_slist_prepend (style->style_props,
                                oo_prop_new_bool ("gnm-auto-dash", btmp));
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 5ead120..fbd998d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7527,9 +7527,18 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style, gboolean
                                s = odf_go_color_to_string (go_marker_get_outline_color (style->marker.mark));
                                gsf_xml_out_add_cstr (state->xml, GNMSTYLE "marker-outline-colour", s);
                                g_free (s);
+                               s = odf_go_color_to_string (go_marker_get_fill_color (style->marker.mark));
+                               gsf_xml_out_add_cstr (state->xml, GNMSTYLE "marker-fill-colour", s);
+                               g_free (s);                             
                        }
                } else if (state->with_extension)
                        odf_add_bool (state->xml, GNMSTYLE "auto-color", TRUE);
+               if (state->with_extension && (style->interesting_fields & GO_STYLE_MARKER)) {
+                       odf_add_bool (state->xml, GNMSTYLE "auto-marker-outline-colour", 
+                                     style->marker.auto_outline_color);
+                       odf_add_bool (state->xml, GNMSTYLE "auto-marker-fill-colour", 
+                                     style->marker.auto_fill_color);
+               }
        } else {
                gsf_xml_out_add_cstr (state->xml, DRAW "stroke", "none");
        }


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