[gnumeric] Map xlsx: handle pseudo colours bg1 and bg2 better.



commit 8af7e4a2160e07d0cc49d75620c2a6420daf207b
Author: Morten Welinder <terra gnome org>
Date:   Tue Feb 14 20:11:19 2017 -0500

    Map xlsx: handle pseudo colours bg1 and bg2 better.
    
    We now map to lt1/dk1 and lt1/dk1 as appropriate instead of directly to
    a colour.

 plugins/excel/ChangeLog           |    8 +++++++-
 plugins/excel/xlsx-read-drawing.c |    1 +
 plugins/excel/xlsx-read.c         |   15 +++++++++------
 3 files changed, 17 insertions(+), 7 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index a0a0315..4d18e2e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -3,7 +3,13 @@
        * xlsx-read.c (themed_color_from_name): New function to handle
        alias colours tx1 and tx2.
        (themed_color): Use themed_color_from_name.
-       * xlsx-read-drawing.c (xlsx_draw_color_themed): Ditto.
+       (themed_color_from_name): Flip light/dark -- it refers to theme.
+       Map bg1 and bg2 too.
+       (xlsx_file_open): Have defaults for mapped colours.
+
+       * xlsx-read-drawing.c (xlsx_draw_color_themed): Use
+       themed_color_from_name.
+       (xlsx_chart_dtd): Add effectLst to grammar.
 
 2017-02-07  Morten Welinder  <terra gnome org>
 
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index 611e208..39dcb47 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -2391,6 +2391,7 @@ GSF_XML_IN_NODE_FULL (START, CHART_SPACE, XL_NS_CHART, "chartSpace", GSF_XML_NO_
         COLOR_MODIFIER_NODES(COLOR_RGB,0),
       GSF_XML_IN_NODE (FILL_SOLID, LN_DASH,       XL_NS_DRAW, "prstDash", GSF_XML_NO_CONTENT, 
&xlsx_draw_line_dash, NULL),
 
+    GSF_XML_IN_NODE (SHAPE_PR, SP_EFFECTLST, XL_NS_DRAW, "effectLst", GSF_XML_NO_CONTENT, NULL, NULL),
     GSF_XML_IN_NODE (SHAPE_PR, FILL_BLIP,      XL_NS_DRAW, "blipFill", GSF_XML_NO_CONTENT, NULL, NULL),
       GSF_XML_IN_NODE (FILL_BLIP, FILL_BLIP_BLIP,      XL_NS_DRAW, "blip", GSF_XML_NO_CONTENT, NULL, NULL),
       GSF_XML_IN_NODE (FILL_BLIP, FILL_BLIP_SRC,       XL_NS_DRAW, "srcRect", GSF_XML_NO_CONTENT, NULL, 
NULL),
diff --git a/plugins/excel/xlsx-read.c b/plugins/excel/xlsx-read.c
index 4bbd2e6..77b069d 100644
--- a/plugins/excel/xlsx-read.c
+++ b/plugins/excel/xlsx-read.c
@@ -975,14 +975,16 @@ static gboolean
 themed_color_from_name (XLSXReadState *state, const char *name, GOColor *color)
 {
        gpointer val;
-       gboolean dark = FALSE; // FIXME: from where?
+       gboolean dark = FALSE; // FIXME: refers to theme; from where?
        static const struct {
                const char *name;
-               const char *dark;
-               const char *light;
+               const char *dark;  // Color name when theme is dark
+               const char *light; // Color name when theme is light
        } aliases[] = {
-               { "tx1", "dk1", "lt1" },
-               { "tx2", "dk2", "lt2" }
+               { "tx1", "lt1", "dk1" },
+               { "tx2", "lt2", "dk2" },
+               { "bg1", "dk1", "lt1" },
+               { "bg2", "dk2", "lt2" }
        };
        unsigned ui;
 
@@ -5172,7 +5174,8 @@ xlsx_file_open (G_GNUC_UNUSED GOFileOpener const *fo, GOIOContext *context,
        state.theme_colors_by_name = g_hash_table_new_full (g_str_hash, g_str_equal,
                (GDestroyNotify)g_free, NULL);
        /* fill in some default colors (when theme is absent */
-       g_hash_table_replace (state.theme_colors_by_name, g_strdup ("bg1"), GUINT_TO_POINTER 
(GO_COLOR_WHITE));
+       g_hash_table_replace (state.theme_colors_by_name, g_strdup ("lt1"), GUINT_TO_POINTER 
(GO_COLOR_WHITE));
+       g_hash_table_replace (state.theme_colors_by_name, g_strdup ("dk1"), GUINT_TO_POINTER 
(GO_COLOR_BLACK));
        state.pivot.cache_by_id = g_hash_table_new_full (g_str_hash, g_str_equal,
                (GDestroyNotify)g_free, (GDestroyNotify) g_object_unref);
        state.zorder = g_hash_table_new (g_direct_hash, g_direct_equal);


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