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



commit 031a2670850b6453e580ad4bfd0a5d5654186034
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Fri Apr 18 01:55:47 2014 -0600

    Improve chart roundtrip through ODF. [#728197]
    
    2014-04-18  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (od_style_prop_chart): read auto-type
        * openoffice-write.c (odf_write_gog_style_graphic): write auto-type

 plugins/openoffice/ChangeLog          |    5 ++
 plugins/openoffice/openoffice-read.c  |    4 +
 plugins/openoffice/openoffice-write.c |  122 +++++++++++++++++----------------
 3 files changed, 72 insertions(+), 59 deletions(-)
---
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 5950663..0ec43c0 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
 2014-04-18  Andreas J. Guelzow <aguelzow pyrshep ca>
 
+       * openoffice-read.c (od_style_prop_chart): read auto-type
+       * openoffice-write.c (odf_write_gog_style_graphic): write auto-type
+
+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):
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 66310b0..e1388a1 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -6963,6 +6963,10 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                (style->style_props,
                                 oo_prop_new_string ("fill",
                                                     CXML2C(attrs[1])));
+               else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-type", &btmp))
+                       style->style_props = g_slist_prepend
+                               (style->style_props,
+                                oo_prop_new_bool ("auto-type", btmp));
                else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_NS_DRAW, "fill-color"))
                        style->style_props = g_slist_prepend
                                (style->style_props,
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index a19e6ee..a548aaf 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -7036,67 +7036,71 @@ odf_write_gog_style_graphic (GnmOOExport *state, GOStyle const *style)
        if (style != NULL) {
                char *color = NULL;
 
-               switch (style->fill.type) {
-               case GO_STYLE_FILL_NONE:
-                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "none");
-                       break;
-               case GO_STYLE_FILL_PATTERN:
-                       if (style->fill.pattern.pattern == GO_PATTERN_SOLID) {
-                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
-                               if (!style->fill.auto_back) {
-                                       color = odf_go_color_to_string (style->fill.pattern.back);
-                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
-                                       odf_add_percent (state->xml, DRAW "opacity",
-                                                        odf_go_color_opacity (style->fill.pattern.back));
-                               }
-                       } else if (style->fill.pattern.pattern == GO_PATTERN_FOREGROUND_SOLID) {
-                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
-                               if (!style->fill.auto_fore) {
-                                       color = odf_go_color_to_string (style->fill.pattern.fore);
-                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
-                                       odf_add_percent (state->xml, DRAW "opacity",
-                                                        odf_go_color_opacity (style->fill.pattern.fore));
-                               }
-                       } else {
-                               gchar *hatch = odf_get_pattern_name (state, style);
-                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "hatch");
-                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-hatch-name",
-                                                     hatch);
-                               if (!style->fill.auto_back) {
-                                       color = odf_go_color_to_string (style->fill.pattern.back);
-                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
-                                       odf_add_percent (state->xml, DRAW "opacity",
-                                                        odf_go_color_opacity (style->fill.pattern.back));
+               if (state->with_extension && style->fill.auto_type) {
+                       odf_add_bool (state->xml, GNMSTYLE "auto-type", TRUE);
+               } else
+                       switch (style->fill.type) {
+                       case GO_STYLE_FILL_NONE:
+                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "none");
+                               break;
+                       case GO_STYLE_FILL_PATTERN:
+                               if (style->fill.pattern.pattern == GO_PATTERN_SOLID) {
+                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
+                                       if (!style->fill.auto_back) {
+                                               color = odf_go_color_to_string (style->fill.pattern.back);
+                                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+                                               odf_add_percent (state->xml, DRAW "opacity",
+                                                                odf_go_color_opacity 
(style->fill.pattern.back));
+                                       }
+                               } else if (style->fill.pattern.pattern == GO_PATTERN_FOREGROUND_SOLID) {
+                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "solid");
+                                       if (!style->fill.auto_fore) {
+                                               color = odf_go_color_to_string (style->fill.pattern.fore);
+                                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+                                               odf_add_percent (state->xml, DRAW "opacity",
+                                                                odf_go_color_opacity 
(style->fill.pattern.fore));
+                                       }
+                               } else {
+                                       gchar *hatch = odf_get_pattern_name (state, style);
+                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "hatch");
+                                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-hatch-name",
+                                                             hatch);
+                                       if (!style->fill.auto_back) {
+                                               color = odf_go_color_to_string (style->fill.pattern.back);
+                                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-color", color);
+                                               odf_add_percent (state->xml, DRAW "opacity",
+                                                                odf_go_color_opacity 
(style->fill.pattern.back));
+                                       }
+                                       g_free (hatch);
+                                       odf_add_bool (state->xml, DRAW "fill-hatch-solid", TRUE);
+                                       if (state->with_extension)
+                                               gsf_xml_out_add_int
+                                                       (state->xml,
+                                                        GNMSTYLE "pattern",
+                                                        style->fill.pattern.pattern);
                                }
-                               g_free (hatch);
-                               odf_add_bool (state->xml, DRAW "fill-hatch-solid", TRUE);
-                               if (state->with_extension)
-                                       gsf_xml_out_add_int
-                                               (state->xml,
-                                                GNMSTYLE "pattern",
-                                                style->fill.pattern.pattern);
+                               g_free (color);
+                               break;
+                       case GO_STYLE_FILL_GRADIENT: {
+                               gchar *grad = odf_get_gradient_name (state, style);
+                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "gradient");
+                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-gradient-name", grad);
+                               g_free (grad);
+                               break;
                        }
-                       g_free (color);
-                       break;
-               case GO_STYLE_FILL_GRADIENT: {
-                       gchar *grad = odf_get_gradient_name (state, style);
-                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "gradient");
-                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-gradient-name", grad);
-                       g_free (grad);
-                       break;
-               }
-               case GO_STYLE_FILL_IMAGE: {
-                       gchar *image = odf_get_image_name (state, style);
-                       gsf_xml_out_add_cstr (state->xml, DRAW "fill", "bitmap");
-                       gsf_xml_out_add_cstr (state->xml, DRAW "fill-image-name", image);
-                       g_free (image);
-                       if (style->fill.image.type < G_N_ELEMENTS (image_types))
-                               gsf_xml_out_add_cstr (state->xml, STYLE "repeat",
-                                                     image_types [style->fill.image.type]);
-                       else g_warning ("Unexpected GOImageType value");
-                       break;
-               }
-               }
+                       case GO_STYLE_FILL_IMAGE: {
+                               gchar *image = odf_get_image_name (state, style);
+                               gsf_xml_out_add_cstr (state->xml, DRAW "fill", "bitmap");
+                               gsf_xml_out_add_cstr (state->xml, DRAW "fill-image-name", image);
+                               g_free (image);
+                               if (style->fill.image.type < G_N_ELEMENTS (image_types))
+                                       gsf_xml_out_add_cstr (state->xml, STYLE "repeat",
+                                                             image_types [style->fill.image.type]);
+                               else g_warning ("Unexpected GOImageType value");
+                               break;
+                       }
+                       }
+
                if (go_style_is_line_visible (style)) {
                        GOLineDashType dash_type = style->line.dash_type;
 


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