[gnumeric] ODF import/export marker outline colour.



commit fc9fae3c7ee4ada40cbfd1ac41cdde805bc8a221
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Wed Jan 28 14:07:46 2015 -0700

    ODF import/export marker outline colour.
    
    2015-01-28  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_apply_style_props): handle marker outline colour
        (od_style_prop_chart): read marker outline colour
        * openoffice-write.c (odf_write_gog_style_graphic): write marker outline
        colour as extension.
    
    2015-01-28  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * t6516-graph.pl: also test roundtrip of marker outline colour
        through ODF

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    7 +++++++
 plugins/openoffice/openoffice-read.c  |   21 ++++++++++++++++++++-
 plugins/openoffice/openoffice-write.c |    5 +++++
 test/ChangeLog                        |    5 +++++
 test/t6516-graph.pl                   |    4 ----
 6 files changed, 38 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 668ac4a..f1f7a0b 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ Andreas:
        * ODF import/export chart axis min and max formulae.
        * Fix ODF export of single cell ranges in graphs. [#743619]
        * ODF import/export series fill types. [#743613]
+       * ODF import/export marker outline colour.
 
 Morten:
        * xlsx chart import: fix font family name.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 3461cbf..68daa6b 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,12 @@
 2015-01-28  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (odf_apply_style_props): handle marker outline colour
+       (od_style_prop_chart): read marker outline colour
+       * openoffice-write.c (odf_write_gog_style_graphic): write marker outline
+       colour as extension.
+
+2015-01-28  Andreas J. Guelzow <aguelzow pyrshep ca>
+
        * openoffice-write.c (odf_write_fill_type): new
        (odf_write_gog_style_chart): connect odf_write_fill_type
        * openoffice-read.c (od_style_prop_chart): read gnm:fill-type
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 1f573fb..4152a4a 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -807,6 +807,7 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
        gboolean gnm_auto_dash_set = FALSE;
        gboolean gnm_auto_width_set = FALSE;
        char const *stroke_dash = NULL;
+       char const *marker_outline_colour = NULL;
 
        style->line.auto_dash = TRUE;
 
@@ -859,6 +860,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
                                style->line.pattern = GO_PATTERN_SOLID;
                                stroke_colour_set = TRUE;
                        }
+               } else if (0 == strcmp (prop->name, "marker-outline-colour")) {
+                       marker_outline_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")) {
@@ -1116,7 +1119,17 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
                        /* Inherit line colour.  */
                        go_marker_set_fill_color (m, style->line.color);
                        style->marker.auto_fill_color = gnm_auto_color_value;
-                       go_marker_set_outline_color (m, style->line.color);
+                       if (marker_outline_colour == NULL)
+                               go_marker_set_outline_color (m, style->line.color);
+                       else {
+                               GOColor color;
+                               GdkRGBA rgba;
+                               if (gdk_rgba_parse (&rgba, marker_outline_colour)) {
+                                       go_color_from_gdk_rgba (&rgba, &color);
+                                       go_marker_set_outline_color (m, color);
+                               } else
+                                       go_marker_set_outline_color (m, style->line.color);
+                       }
                        style->marker.auto_outline_color = gnm_auto_color_value;
                }
 
@@ -7126,6 +7139,12 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                (style->style_props,
                                 oo_prop_new_string ("stroke-color",
                                                     CXML2C(attrs[1])));
+               } else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]),
+                                              OO_GNUM_NS_EXT, "marker-outline-colour")) {
+                       style->style_props = g_slist_prepend
+                               (style->style_props,
+                                oo_prop_new_string ("marker-outline-colour",
+                                                    CXML2C(attrs[1])));
                } else if (NULL != oo_attr_distance (xin, attrs, OO_NS_SVG,
                                                     "stroke-width", &ftmp))
                        style->style_props = g_slist_prepend
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 199abb1..e27994d 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7342,6 +7342,11 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style, gboolean
                        char *s = odf_go_color_to_string (color);
                        gsf_xml_out_add_cstr (state->xml, SVG "stroke-color", s);
                        g_free (s);
+                       if (state->with_extension) {
+                               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);
+                       }
                } else if (state->with_extension)
                        odf_add_bool (state->xml, GNMSTYLE "auto-color", TRUE);
        } else {
diff --git a/test/ChangeLog b/test/ChangeLog
index 3838ba4..20911af 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2015-01-28  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * t6516-graph.pl: also test roundtrip of marker outline colour
+       through ODF
+
 2015-01-23  Morten Welinder <terra gnome org>
 
        * Release 1.12.19
diff --git a/test/t6516-graph.pl b/test/t6516-graph.pl
index ff6ba52..8b0ae24 100755
--- a/test/t6516-graph.pl
+++ b/test/t6516-graph.pl
@@ -16,15 +16,11 @@ if (&subtest ("gnumeric")) {
                     'ext' => "gnm");
 }
 
-# ods doesn't have outline colour, so copy the fill colour.
-my $ods_outline_filter = "$PERL -p -e 'if (/\\bmarker\\b.*fill-color=\"([A-Z0-9:]+)\"/) { my \$col = \$1; 
s{\\b(outline-color)=\"[A-Z0-9:]+\"}{\$1=\"\$col\"}; }'";
-
 if (&subtest ("ods")) {
     &message ("Check graph ods roundtrip.");
     &test_roundtrip ($file,
                     'format' => 'Gnumeric_OpenCalc:odf',
                     'ext' => "ods",
-                    'filter1' => $ods_outline_filter,
                     'filter2' => 'std:drop_generator',
                     'ignore_failure' => 1);
 }


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