[gnumeric] Fix ODF import/export of fonts in charts. [#744632]



commit d839ca715f5693b04fba3c8b41846b88c71304c3
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Mon Feb 16 23:42:54 2015 -0700

    Fix ODF import/export of fonts in charts. [#744632]
    
    2015-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
        * openoffice-read.c (odf_apply_style_props): handle auto-font
        (od_style_prop_chart): read auto-font
        * openoffice-write.c (odf_write_gog_style_text): write auto-font

 NEWS                                  |    1 +
 plugins/openoffice/ChangeLog          |    6 ++++++
 plugins/openoffice/openoffice-read.c  |   11 +++++++++++
 plugins/openoffice/openoffice-write.c |    5 ++++-
 4 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 2d6292a..c9cf5ac 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ Andreas:
        * Fix ODF export of serieslines styles.
        * Fix ODF import/export of axes label visibility. [#743788]
        * ODF import/export additional axislines.
+       * Fix ODF import/export of fonts in charts. [#744632]
 
 Morten:
        * Initial xlsx import of sheet widgets.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 7ce0572..20830e0 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,9 @@
+2015-02-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+       * openoffice-read.c (odf_apply_style_props): handle auto-font
+       (od_style_prop_chart): read auto-font
+       * openoffice-write.c (odf_write_gog_style_text): write auto-font
+
 2015-02-10  Andreas J. Guelzow <aguelzow pyrshep ca>
 
        * openoffice-read.c (oo_prop_list_apply_to_axisline): new
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 125cf9b..a00adcd 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -839,6 +839,8 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
        char const *stroke_dash = NULL;
        char const *marker_outline_colour = NULL;
        char const *marker_fill_colour = NULL;
+       gboolean gnm_auto_font_set = FALSE;
+       gboolean gnm_auto_font = FALSE;
 
        style->line.auto_dash = TRUE;
 
@@ -995,11 +997,16 @@ odf_apply_style_props (GsfXMLIn *xin, GSList *props, GOStyle *style, gboolean in
                        style->fill.image.type = g_value_get_int (&prop->value);
                else if (0 == strcmp (prop->name, "gnm-auto-type"))
                        style->fill.auto_type = g_value_get_boolean (&prop->value);
+               else if (0 == strcmp (prop->name, "gnm-auto-font")) {
+                       gnm_auto_font_set = TRUE;
+                       gnm_auto_font = g_value_get_boolean (&prop->value);
+               } 
        }
        if (desc_changed)
                go_style_set_font_desc  (style, desc);
        else
                pango_font_description_free (desc);
+       style->font.auto_font = gnm_auto_font_set ? gnm_auto_font : !desc_changed;
 
        /*
         * Stroke colour is tricky: if we have lines, that is what it
@@ -7360,6 +7367,10 @@ od_style_prop_chart (GsfXMLIn *xin, xmlChar const **attrs)
                                (style->style_props,
                                 oo_prop_new_string ("font-family",
                                                     CXML2C(attrs[1])));
+               else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "auto-font",
+                                      &btmp))
+                       style->style_props = g_slist_prepend (style->style_props,
+                               oo_prop_new_bool ("gnm-auto-font", btmp));
                else if (oo_attr_int_range (xin, attrs, OO_GNUM_NS_EXT,
                                              "font-stretch-pango", &tmp,
                                              0, PANGO_STRETCH_ULTRA_EXPANDED))
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index a9bb0ae..6cc99c8 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1447,7 +1447,6 @@ odf_write_style_text_properties (GnmOOExport *state, GnmStyle const *style)
                gsf_xml_out_add_cstr (state->xml, FOSTYLE "font-family",
                                      gnm_style_get_font_name (style));
 
-
        gsf_xml_out_end_element (state->xml); /* </style:text-properties> */
 }
 
@@ -7666,6 +7665,10 @@ odf_write_gog_style_text (GnmOOExport *state, GOStyle const *style)
                if ((mask & PANGO_FONT_MASK_GRAVITY) && state->with_extension)
                        gsf_xml_out_add_int (state->xml, GNMSTYLE "font-gravity-pango",
                                             pango_font_description_get_gravity (desc));
+
+               if (state->with_extension)
+                       odf_add_bool (state->xml, GNMSTYLE "auto-font",
+                                     style->font.auto_font);
        }
 }
 


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