[gnumeric] Fix import export of line type in scatter plots. [#605043]



commit 798e12600274cd5d3d21ba4f15d183582e998432
Author: Jean Brefort <jean brefort normalesup org>
Date:   Mon Dec 21 22:21:29 2009 +0100

    Fix import export of line type in scatter plots. [#605043]

 NEWS                     |    3 +++
 plugins/excel/ChangeLog  |    5 +++++
 plugins/excel/ms-chart.c |   45 ++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 50 insertions(+), 3 deletions(-)
---
diff --git a/NEWS b/NEWS
index b722d50..ec8c5df 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ Gnumeric 1.9.18
 Andreas:
 	* Add paste special flip horizontally and vertically [#393367]
 
+Jean
+	* Fix import export of line type in scatter plots. [#605043]
+
 --------------------------------------------------------------------------
 Gnumeric 1.9.17
 
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 282f593..dfed1ee 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2009-12-21  Jean Brefort  <jean brefort normalesup org>
+
+	* ms-chart.c (lineformat), (chart_write_LINEFORMAT): fix import export
+	of line type in scatter plots. [#605043]
+
 2009-12-15  Morten Welinder <terra gnome org>
 
 	* Release 1.9.17
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index 1a4cd2d..a63fb39 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -1357,7 +1357,45 @@ BC_R(lineformat)(XLChartHandler const *handle,
 	d (0, g_printerr ("Lines have a %s pattern.\n",
 		       ms_line_pattern [pattern]););
 
-	s->style->line.dash_type = ms_escher_xl_to_line_type (pattern);
+	switch (pattern) {
+	default: 
+	case 0:
+		s->style->line.dash_type = GO_LINE_SOLID;
+		break;	
+	case 1:
+		s->style->line.dash_type = GO_LINE_DASH;
+		break;	
+	case 2:
+		s->style->line.dash_type = GO_LINE_DOT;
+		break;	
+	case 3:
+		s->style->line.dash_type = GO_LINE_DASH_DOT;
+		break;	
+	case 4:
+		s->style->line.dash_type = GO_LINE_DASH_DOT_DOT;
+		break;	
+	case 5:
+		s->style->line.dash_type = GO_LINE_NONE;
+		break;
+/* we don't really support the other styles, although GOStyle would allow that now */
+#if 0
+	case 6:
+		s->style->line.dash_type = GO_LINE_SOLID;
+		s->style->line.pattern = GO_PATTERN_GREY25; /* or 75? */
+		s->style->line.fore = GO_COLOR_WHITE;
+		break;	
+	case 7:
+		s->style->line.dash_type = GO_LINE_SOLID;
+		s->style->line.pattern = GO_PATTERN_GREY50;
+		s->style->line.fore = GO_COLOR_WHITE;
+		break;	
+	case 8:
+		s->style->line.dash_type = GO_LINE_SOLID;
+		s->style->line.pattern = GO_PATTERN_GREY75; /* or 25? */
+		s->style->line.fore = GO_COLOR_WHITE;
+		break;
+#endif
+	}
 
 	if (BC_R(ver)(s) >= MS_BIFF_V8 && s->currentSeries != NULL) {
 		guint16 const fore = GSF_LE_GET_GUINT16 (q->data + 10);
@@ -3976,8 +4014,9 @@ chart_write_LINEFORMAT (XLChartWriteState *s, GOStyleLine const *lstyle,
 			w = 1;	/* medium */
 		else
 			w = 2;	/* wide */
-		if (lstyle->auto_color)
-			flags |= 9;	/* docs only mention 1, but there is an 8 in there too */
+		/* seems that excel understand auto as solid, so if pattern is not solid
+		   do not set the auto flag, see #605043 */
+		flags |= (lstyle->auto_color && pat > 0)? 9: 8;	/* docs only mention 1, but there is an 8 in there too */
 	} else {
 		color_index = chart_write_color (s, data, 0);
 		if (clear_lines_for_null) {



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