[gnumeric] xlsx: read font colour during import.



commit 162572892325487e80a9f3f8e46c1eb70d638d23
Author: Morten Welinder <terra gnome org>
Date:   Sun Apr 20 16:19:49 2014 -0400

    xlsx: read font colour during import.
    
    We used to treat it as background colour.  Not good.  Note, that this is
    a bit of monkey-see-monkey-do code.

 plugins/excel/ChangeLog           |    7 +++++++
 plugins/excel/xlsx-read-drawing.c |   15 ++++++++++-----
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 6e8bc92..53371cb 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,10 @@
+2014-04-20  Morten Welinder  <terra gnome org>
+
+       * xlsx-read-drawing.c (xlsx_chart_solid_fill): When we see a
+       GO_STYLE_FONT marker, solidFill refers to font colour.
+       (xlsx_chart_text_start): Set sp_type flag GO_STYLE_FONT.
+       (xlsx_chart_text): Clear flag.
+
 2014-04-19  Morten Welinder  <terra gnome org>
 
        * xlsx-read-drawing.c: Constify simple_enum tables and make sure
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 567d9f4..4006c41 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -70,6 +70,7 @@ xlsx_chart_text_start (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
        if (!GOG_IS_LABEL (state->cur_obj) && IS_SHEET_OBJECT_GRAPH (state->so) && NULL == state->series) { 
/* Hmm, why? */
                GogObject *label = gog_object_add_by_name (state->cur_obj,
                        (state->cur_obj == (GogObject *)state->chart) ? "Title" : "Label", NULL);
+               state->sp_type |= GO_STYLE_FONT;
                g_object_set (G_OBJECT (label), "allow-wrap", TRUE, "justification", "center", NULL);
                xlsx_chart_push_obj (state, label);
        }
@@ -120,6 +121,7 @@ xlsx_chart_text (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
        }
        g_free (state->chart_tx);
        state->chart_tx = NULL;
+       state->sp_type &= ~GO_STYLE_FONT;
 }
 
 static void
@@ -1257,16 +1259,19 @@ xlsx_chart_solid_fill (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
                        state->color_data = state->marker;
                }
        } else if ((NULL != state->cur_style) && (state->gocolor == NULL)) {
-               if (!(state->sp_type & GO_STYLE_LINE)) {
+               if (state->sp_type & GO_STYLE_LINE) {
+                       state->cur_style->line.dash_type = GO_LINE_SOLID;
+                       state->gocolor = &state->cur_style->line.color;
+                       state->auto_color = &state->cur_style->line.auto_color;
+               } else if (state->sp_type & GO_STYLE_FONT) {
+                       state->gocolor = &state->cur_style->font.color;
+                       state->auto_color = &state->cur_style->font.auto_color;
+               } else {
                        state->cur_style->fill.type = GO_STYLE_FILL_PATTERN;
                        state->cur_style->fill.auto_type = FALSE;
                        state->cur_style->fill.pattern.pattern = GO_PATTERN_FOREGROUND_SOLID;
                        state->gocolor = &state->cur_style->fill.pattern.fore;
                        state->auto_color = &state->cur_style->fill.auto_fore;
-               } else {
-                       state->cur_style->line.dash_type = GO_LINE_SOLID;
-                       state->gocolor = &state->cur_style->line.color;
-                       state->auto_color = &state->cur_style->line.auto_color;
                }
        }
 }


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