[gnumeric] ods: improve roundtrip for graph line widths.



commit b2362669411d369529dd60b6d89aa06cdb5bf70b
Author: Morten Welinder <terra gnome org>
Date:   Mon May 12 19:32:20 2014 -0400

    ods: improve roundtrip for graph line widths.

 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-read.c  |   11 ++++++++++-
 plugins/openoffice/openoffice-write.c |   12 +++++++++---
 3 files changed, 25 insertions(+), 4 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 37445e9..81b5af8 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2014-05-12  Morten Welinder  <terra gnome org>
+
+       * openoffice-write.c (odf_write_gog_style_graphic): Improve
+       gostyle::auto-width roundtrip.
+       * openoffice-read.c (odf_apply_style_props): Ditto.
+
 2014-05-11  Morten Welinder  <terra gnome org>
 
        * openoffice-write.c (odf_add_pt): Use sufficient precision to
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index d23bb59..c94bb29 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -804,6 +804,7 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
        gboolean gnm_auto_color_value_set = FALSE;
        gboolean gnm_auto_color_value = FALSE;
        gboolean gnm_auto_dash_set = FALSE;
+       gboolean gnm_auto_width_set = FALSE;
        char const *stroke_dash = NULL;
 
        style->line.auto_dash = TRUE;
@@ -945,7 +946,10 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
                        stroke_width = g_value_get_double (&prop->value);
                else if (0 == strcmp (prop->name, "gnm-stroke-width"))
                        gnm_stroke_width = g_value_get_double (&prop->value);
-               else if (0 == strcmp (prop->name, "repeat"))
+               else if (0 == strcmp (prop->name, "gnm-auto-width")) {
+                       gnm_auto_width_set = TRUE;
+                       style->line.auto_width = g_value_get_boolean (&prop->value);
+               } else if (0 == strcmp (prop->name, "repeat"))
                        style->fill.image.type = g_value_get_int (&prop->value);
        }
        if (desc_changed)
@@ -967,6 +971,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style)
                style->line.width = stroke_width;
        else
                style->line.width = 0;
+       if (!gnm_auto_width_set)
+               style->line.auto_width = FALSE;
 
        if (stroke_dash != NULL && !line_is_not_dash)
                style->line.dash_type = odf_match_dash_type (state, stroke_dash);
@@ -7221,6 +7227,9 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                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));
+               else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-width", &btmp))
+                       style->style_props = g_slist_prepend (style->style_props,
+                               oo_prop_new_bool ("gnm-auto-width", btmp));
        }
 
        if ((stacked_set && !overlap_set) ||
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index df82686..23a7edd 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7167,10 +7167,13 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style, gboolean
                }
        }
 
-       if (go_style_is_line_visible (style)) {
+       if (style->interesting_fields & (GO_STYLE_LINE | GO_STYLE_OUTLINE)) {
                GOLineDashType dash_type = style->line.dash_type;
 
-               if (dash_type == GO_LINE_SOLID)
+               if (!go_style_is_line_visible (style))
+                       gsf_xml_out_add_cstr (state->xml,
+                                             DRAW "stroke", "none");
+               else if (dash_type == GO_LINE_SOLID)
                        gsf_xml_out_add_cstr (state->xml,
                                              DRAW "stroke", "solid");
                else {
@@ -7185,7 +7188,10 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style, gboolean
                }
                if (style->line.auto_dash && state->with_extension)
                        odf_add_bool (state->xml, GNMSTYLE "auto-dash", TRUE);
-               if (style->line.width == 0.0) {
+
+               if (style->line.auto_width && state->with_extension)
+                       odf_add_bool (state->xml, GNMSTYLE "auto-width", TRUE);
+               else if (style->line.width == 0.0) {
                        odf_add_pt (state->xml, SVG "stroke-width", 1.);
                        if (state->with_extension)
                                odf_add_pt (state->xml, GNMSTYLE "stroke-width", 0.);


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