[gnumeric] Export/import tick label rotation angle. [#629675]



commit b2492030749db0060d55f6766cbc14cd36a8778b
Author: Jean Brefort <jean brefort normalesup org>
Date:   Wed Sep 15 12:03:35 2010 +0200

    Export/import tick label rotation angle. [#629675]

 NEWS                     |    3 +++
 plugins/excel/ChangeLog  |    5 +++++
 plugins/excel/ms-chart.c |   27 ++++++++++++++++++++++-----
 3 files changed, 30 insertions(+), 5 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3a53f3f..956a304 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Andreas:
 	* Import/export all sheet objects from and to ODF files.
 	* Fix reformatting of cells on expression entry. [#629303]
 
+Jean
+	* Export/import tick label rotation angle. [#629675]
+
 --------------------------------------------------------------------------
 Gnumeric 1.10.10
 
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 2b5931c..047ce1e 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-15  Jean Brefort  <jean brefort normalesup org>
+
+	* ms-chart.c (tick), (chart_write_axis): export/import tick label rotation
+	angle. [#629675]
+
 2010-09-04  Morten Welinder <terra gnome org>
 
 	* Release 1.10.10
diff --git a/plugins/excel/ms-chart.c b/plugins/excel/ms-chart.c
index 52fbb1c..a7ca8f1 100644
--- a/plugins/excel/ms-chart.c
+++ b/plugins/excel/ms-chart.c
@@ -2266,6 +2266,16 @@ BC_R(tick)(XLChartHandler const *handle,
 		break;
 	}
 
+	if ((!(flags & 0x20)) && BC_R(ver)(s) >= MS_BIFF_V8) {
+		guint16 trot = GSF_LE_GET_GUINT16 (q->data+28);
+		if (trot <= 0x5a)
+			s->style->text_layout.angle = trot;
+		else if (trot <= 0xb4)
+			s->style->text_layout.angle = 90 - (int) trot;
+		else
+			; // FIXME: not supported for now
+	}
+	
 	d (1, {
 	switch (major) {
 	case 0: g_printerr ("no major tick;\n"); break;
@@ -4991,14 +5001,21 @@ chart_write_axis (XLChartWriteState *s, GogAxis const *axis,
 		flags = (style->font.color == GO_COLOR_BLACK)? 0x03: 0x02;
 		if (style->text_layout.auto_angle)
 			flags |= 0x20;
-		else if (style->text_layout.angle < -45)
-			flags |= 0x0C;
-		else if (style->text_layout.angle > 45)
-			flags |= 0x08;
+		else if (s->bp->version < MS_BIFF_V8) {
+			if (style->text_layout.angle < -45)
+				flags |= 0x0C;
+			else if (style->text_layout.angle > 45)
+				flags |= 0x08;
+		}
 		GSF_LE_SET_GUINT16 (data+24, flags);
 		if (s->bp->version >= MS_BIFF_V8) {
 			GSF_LE_SET_GUINT16 (data+26, tick_color_index);
-			GSF_LE_SET_GUINT16 (data+28, 0);
+			if (style->text_layout.auto_angle)
+				GSF_LE_SET_GUINT16 (data+28, 0);
+			else if (style->text_layout.angle >= 0)
+				GSF_LE_SET_GUINT16 (data+28, (int) style->text_layout.angle);
+			else
+				GSF_LE_SET_GUINT16 (data+28, 90 - (int) style->text_layout.angle);
 		}
 		ms_biff_put_commit (s->bp);
 		font = excel_font_from_go_font (&s->ewb->base, style->font.font);



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