[gnumeric] xls: add more flags for widget export.



commit 616951757d52cc0f0784d883eb1220a33ef492d2
Author: Morten Welinder <terra gnome org>
Date:   Thu Oct 8 20:19:06 2009 -0400

    xls: add more flags for widget export.

 plugins/excel/ms-escher.c      |   15 ++++++++-------
 plugins/excel/ms-escher.h      |    5 +++++
 plugins/excel/ms-excel-write.c |   22 +++++++++++++++++-----
 3 files changed, 30 insertions(+), 12 deletions(-)
---
diff --git a/plugins/excel/ms-escher.c b/plugins/excel/ms-escher.c
index 15b5abf..c89eb59 100644
--- a/plugins/excel/ms-escher.c
+++ b/plugins/excel/ms-escher.c
@@ -1258,11 +1258,11 @@ static MSEscherBoolOptTable const group_bools[] = {
 static void
 ms_escher_read_OPT_bools (MSEscherHeader *h,
 			  MSEscherBoolOptTable const *bools, unsigned n_bools,
-			  guint const pid, guint32 const val)
+			  guint pid, guint32 const val)
 {
-	guint32 mask = 0x10000;
-	guint32 bit  = 0x00001;
-	unsigned i = n_bools;
+	unsigned i;
+	guint32 mask = 0x10000 << (n_bools - 1);
+	guint32 bit  = 0x00001 << (n_bools - 1);
 
 	g_return_if_fail (n_bools > 0);
 	g_return_if_fail (bools[n_bools-1].pid == pid);
@@ -1270,7 +1270,8 @@ ms_escher_read_OPT_bools (MSEscherHeader *h,
 	d (2, printf ("Set of Bools %d-%d = 0x%08x;\n{\n",
 		      bools[0].pid, bools[n_bools-1].pid, val););
 
-	for (; i-- > 0 ; mask <<= 1, bit <<= 1) {
+	pid -= (n_bools - 1);
+	for (i = 0; i < n_bools; i++, mask >>= 1, bit >>= 1, pid++) {
 		gboolean set_val = ((val & bit) == bit);
 		gboolean def_val = bools[i].default_val;
 		const MSObjAttrID aid = bools[i].id;
@@ -1278,8 +1279,8 @@ ms_escher_read_OPT_bools (MSEscherHeader *h,
 		if (!(val & mask))	/* the value is set */
 			continue;
 
-		d (0, printf ("bool %s = %s; /* def: %s; gnm: %d */\n",
-			      bools[i].name,
+		d (0, printf ("bool %s(%d) = %s; /* def: %s; gnm: %d */\n",
+			      bools[i].name, pid,
 			      set_val ? "true" : "false",
 			      def_val ? "true" : "false",
 			      aid););
diff --git a/plugins/excel/ms-escher.h b/plugins/excel/ms-escher.h
index fbe934e..cb5db12 100644
--- a/plugins/excel/ms-escher.h
+++ b/plugins/excel/ms-escher.h
@@ -18,11 +18,15 @@
 #include <sheet-object.h>
 
 enum {
+	MSEP_LOCKROTATION        = 0x0077,
 	MSEP_TXID                = 0x0080,
 	MSEP_WRAPTEXT            = 0x0085,
+	MSEP_TXDIR               = 0x008b,
 	MSEP_SELECTTEXT          = 0x00bb,
 	MSEP_AUTOTEXTMARGIN      = 0x00bc,
 	MSEP_SHAPEPATH           = 0x0144,
+	MSEP_SHADOWOK            = 0x017a,
+	MSEP_LINEOK              = 0x017c,
 	MSEP_FILLOK              = 0x017f,
 	MSEP_FILLCOLOR           = 0x0181,
 	MSEP_FILLED              = 0x01bb,
@@ -31,6 +35,7 @@ enum {
 	MSEP_LINEWIDTH           = 0x01cb,
 	MSEP_LINEENDARROWHEAD    = 0x01d1,
 	MSEP_ARROWHEADSOK        = 0x01fb,
+	MSEP_LINE                = 0x01fc,
 	MSEP_NAME                = 0x0380,
 	MSEP_ISBUTTON            = 0x03bc
 };
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 7457a91..ac5ecf4 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4338,19 +4338,29 @@ excel_write_textbox_v8 (ExcelWriteSheet *esheet, SheetObject *so)
 
 	optmark = ms_escher_opt_start (escher);
 	extra = g_string_new (NULL);
+	if (is_button)
+		ms_escher_opt_add_bool (escher, optmark,
+					MSEP_LOCKROTATION, TRUE);
+	ms_escher_opt_add_simple (escher, optmark,
+				  MSEP_TXID, 0x00c600a0);
 	ms_escher_opt_add_simple (escher, optmark,
-				  MSEP_TXID, 0x00c600a0); /* Txid */
+				  MSEP_WRAPTEXT, 1);
 	ms_escher_opt_add_simple (escher, optmark,
-				  MSEP_WRAPTEXT, 1); /* wrap_text_at_margin */
+				  MSEP_TXDIR, 2);
 	ms_escher_opt_add_bool (escher, optmark, MSEP_SELECTTEXT, TRUE);
-	if (is_button)
+	if (is_button) {
 		ms_escher_opt_add_bool (escher, optmark, MSEP_AUTOTEXTMARGIN, FALSE);
+		ms_escher_opt_add_bool (escher, optmark, MSEP_SHADOWOK, TRUE);
+		ms_escher_opt_add_bool (escher, optmark, MSEP_LINEOK, TRUE);
+		ms_escher_opt_add_bool (escher, optmark, MSEP_FILLOK, TRUE);
+	}
 	ms_escher_opt_add_color (escher, optmark, MSEP_FILLCOLOR,
 				 style == NULL || style->fill.auto_back
 				 ? GO_COLOR_WHITE
 				 : style->fill.pattern.back);
-	ms_escher_opt_add_simple (escher, optmark,
-				  0x01bf, 0x00010000); /* fNoFillHitTest */
+	if (is_button)
+		ms_escher_opt_add_bool (escher, optmark, MSEP_FILLED, FALSE);
+	ms_escher_opt_add_bool (escher, optmark, MSEP_NOFILLHITTEST, TRUE);
 	ms_escher_opt_add_color (escher, optmark, MSEP_LINECOLOR,
 				 style == NULL || style->line.auto_color
 				 ? GO_COLOR_BLACK
@@ -4359,6 +4369,8 @@ excel_write_textbox_v8 (ExcelWriteSheet *esheet, SheetObject *so)
 		gint32 w = CLAMP (12700 * style->line.width, 0, G_MAXINT32);
 		ms_escher_opt_add_simple (escher, optmark, MSEP_LINEWIDTH, w);
 	}
+	if (is_button)
+		ms_escher_opt_add_bool (escher, optmark, MSEP_LINE, FALSE);
 	if (name)
 		ms_escher_opt_add_str_wchar (escher, optmark, extra,
 					     MSEP_NAME, name);



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