[gnumeric] xlsx: avoid lines between points when we see ln::noFill



commit 1eb20e0ba1f8dff243205ae0b6010d9d61686292
Author: Morten Welinder <terra gnome org>
Date:   Sat Jan 17 19:51:58 2015 -0500

    xlsx: avoid lines between points when we see ln::noFill

 NEWS                              |    2 +-
 plugins/excel/ChangeLog           |    2 +
 plugins/excel/xlsx-read-drawing.c |   59 +++++++++++++-----------------------
 3 files changed, 24 insertions(+), 39 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3fc8e29..295e3a1 100644
--- a/NEWS
+++ b/NEWS
@@ -25,7 +25,7 @@ Morten:
        * Fix ADDRESS problem.
        * Fix sheet-filter problem with errors.  [#742601]
        * Improve error handling for .gnumeric a bit.
-       * Improve xlsx graph import: line colour; marker size; marker color.
+       * Improve xlsx graph import: line colour; marker size; marker color; no lines.
        * Improve xlsx graph export: line style; bar/col direction; marker shape;
          marker size; marker color; axis label; chart title.
        * Improve xlsx export: default col widths; schema validity.
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index d47cf32..616faed 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -2,6 +2,8 @@
 
        * xlsx-read-drawing.c (xlsx_chart_bar_overlap)
        (xlsx_chart_bar_gap): Fix reading percentages.
+       (xlsx_chart_no_fill): Handle noFill when used to avoid lines
+       between data points.
 
        * xlsx-write-drawing.c (xlsx_write_axis): Factor this out from
        xlsx_write_one_plot.  Write axis label.
diff --git a/plugins/excel/xlsx-read-drawing.c b/plugins/excel/xlsx-read-drawing.c
index a753e7a..876f65f 100644
--- a/plugins/excel/xlsx-read-drawing.c
+++ b/plugins/excel/xlsx-read-drawing.c
@@ -797,47 +797,26 @@ xlsx_chart_xy (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
 static void
 xlsx_scatter_style (GsfXMLIn *xin, xmlChar const **attrs)
 {
+       enum { SCATTER_LINES = 1, SCATTER_MARKERS = 2, SCATTER_SPLINES = 4 };
        static const EnumVal styles[] = {
-               {"line",        0},
-               {"lineMarker",  1},
-               {"marker",      2},
-               {"markers",     2}, /* We used to write this erroneously */
-               {"none",        3},
-               {"smooth",      4},
-               {"smoothMarker", 5}
+               {"line",        SCATTER_LINES },
+               {"lineMarker",  SCATTER_LINES | SCATTER_MARKERS },
+               {"marker",      SCATTER_MARKERS },
+               {"markers",     SCATTER_MARKERS }, /* We used to write this erroneously */
+               {"none",        0 },
+               {"smooth",      SCATTER_SPLINES },
+               {"smoothMarker", SCATTER_SPLINES | SCATTER_MARKERS }
        };
        XLSXReadState *state = (XLSXReadState *)xin->user_state;
        int style;
 
-       if (simple_enum (xin, attrs, styles, &style))
-               switch (style) {
-               case 0:
-                       g_object_set (G_OBJECT (state->plot),
-                                     "default-style-has-markers", FALSE,
-                                     NULL);
-                       break;
-               case 2:
-                       g_object_set (G_OBJECT (state->plot),
-                                     "default-style-has-lines", FALSE,
-                                     NULL);
-                       break;
-               case 3:
-                       g_object_set (G_OBJECT (state->plot),
-                                     "default-style-has-markers", FALSE,
-                                     "default-style-has-lines", FALSE,
-                                     NULL);
-                       break;
-               case 4:
-                       g_object_set (G_OBJECT (state->plot),
-                                     "use-splines", TRUE,
-                                     "default-style-has-markers", FALSE, NULL);
-                       break;
-               case 5:
-                       g_object_set (G_OBJECT (state->plot),
-                                     "use-splines", TRUE,
-                                     NULL);
-                       break;
-               }
+       if (simple_enum (xin, attrs, styles, &style)) {
+               g_object_set (G_OBJECT (state->plot),
+                             "default-style-has-markers", (style & SCATTER_MARKERS) != 0,
+                             "default-style-has-lines", (style & SCATTER_LINES) != 0,
+                             "use-splines", (style & SCATTER_SPLINES) != 0,
+                             NULL);
+       }
 }
 
 static void
@@ -1275,7 +1254,10 @@ xlsx_chart_no_fill (GsfXMLIn *xin, G_GNUC_UNUSED xmlChar const **attrs)
        if (NULL != state->marker)
                ;
        else if (NULL != state->cur_style) {
-               if (!(state->sp_type & GO_STYLE_LINE)) {
+               if (state->sp_type & GO_STYLE_LINE) {
+                       state->cur_style->line.dash_type = GO_LINE_NONE;
+                       state->cur_style->line.auto_dash = FALSE;
+               } else {
                        state->cur_style->fill.type = GO_STYLE_FILL_NONE;
                        state->cur_style->fill.auto_type = FALSE;
                }
@@ -1543,6 +1525,7 @@ xlsx_chart_marker_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
                state->marker = NULL;
                state->gocolor = NULL;
                state->color_setter = NULL;
+               state->color_data = NULL;
        }
 }
 
@@ -1678,7 +1661,7 @@ GSF_XML_IN_NODE_FULL (START, CHART_SPACE, XL_NS_CHART, "chartSpace", GSF_XML_NO_
         GSF_XML_IN_NODE (FILL_PATT_FG, COLOR_RGB, XL_NS_DRAW, "srgbClr", GSF_XML_NO_CONTENT, NULL, NULL),    
  /* 2nd Def */
 
     GSF_XML_IN_NODE (SHAPE_PR, SHAPE_PR_LN, XL_NS_DRAW, "ln", GSF_XML_NO_CONTENT, &xlsx_style_line_start, 
&xlsx_style_line_end),
-      GSF_XML_IN_NODE (SHAPE_PR_LN, LN_NOFILL, XL_NS_DRAW, "noFill", GSF_XML_NO_CONTENT, NULL, NULL),
+      GSF_XML_IN_NODE (SHAPE_PR_LN, LN_NOFILL, XL_NS_DRAW, "noFill", GSF_XML_NO_CONTENT, 
&xlsx_chart_no_fill, NULL),
       GSF_XML_IN_NODE (SHAPE_PR_LN, LN_DASH, XL_NS_DRAW, "prstDash", GSF_XML_NO_CONTENT, NULL, NULL),        
  /* 2nd Def */
       GSF_XML_IN_NODE (SHAPE_PR_LN, FILL_SOLID, XL_NS_DRAW, "solidFill", GSF_XML_NO_CONTENT, NULL, NULL),    
  /* 2nd Def */
       GSF_XML_IN_NODE (SHAPE_PR_LN, FILL_PATT, XL_NS_DRAW, "pattFill", GSF_XML_NO_CONTENT, NULL, NULL),      
  /* 2nd Def */


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