[gnumeric] xls: write more radiobutton objects.



commit 975d084f15961372c3850af6da393ecb99f75ece
Author: Morten Welinder <terra gnome org>
Date:   Sun Oct 11 19:11:11 2009 -0400

    xls: write more radiobutton objects.

 plugins/excel/ChangeLog        |   10 ++++++++++
 plugins/excel/ms-escher.c      |    6 ++----
 plugins/excel/ms-escher.h      |    2 +-
 plugins/excel/ms-excel-write.c |    6 ++++--
 plugins/excel/ms-obj.c         |   12 ++++++++++++
 plugins/excel/ms-obj.h         |    2 ++
 6 files changed, 31 insertions(+), 7 deletions(-)
---
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index 7e4b15e..315421d 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,3 +1,13 @@
+2009-10-11  Morten Welinder  <terra gnome org>
+
+	* ms-excel-write.c (excel_write_textbox_v8): Call
+	ms_objv8_write_radiobutton_data when appropriate.
+
+	* ms-obj.c (ms_objv8_write_radiobutton_data): New function.
+
+	* ms-escher.c (ms_escher_clientdata): Drop argument that turned
+	out to be not useful.
+
 2009-10-11  Morten Welinder <terra gnome org>
 
 	* Release 1.9.14
diff --git a/plugins/excel/ms-escher.c b/plugins/excel/ms-escher.c
index c89eb59..7c823d9 100644
--- a/plugins/excel/ms-escher.c
+++ b/plugins/excel/ms-escher.c
@@ -2335,11 +2335,9 @@ ms_escher_clientanchor (GString *buf, SheetObjectAnchor const *anchor)
 }
 
 void
-ms_escher_clientdata (GString *buf, gpointer data, gsize len)
+ms_escher_clientdata (GString *buf)
 {
 	guint8 tmp[8] = { 0, 0, 0x11, 0xf0, 0xde, 0xad, 0xbe, 0xef };
-	GSF_LE_SET_GUINT32 (tmp + 4, len);
+	GSF_LE_SET_GUINT32 (tmp + 4, 0);
 	g_string_append_len (buf, tmp, sizeof tmp);
-	if (len > 0)
-		g_string_append_len (buf, data, len);
 }
diff --git a/plugins/excel/ms-escher.h b/plugins/excel/ms-escher.h
index cb5db12..dff1409 100644
--- a/plugins/excel/ms-escher.h
+++ b/plugins/excel/ms-escher.h
@@ -77,7 +77,7 @@ void ms_escher_opt_end (GString *buf, gsize marker);
 
 void ms_escher_clientanchor (GString *buf, SheetObjectAnchor const *anchor);
 
-void ms_escher_clientdata (GString *buf, gpointer data, gsize len);
+void ms_escher_clientdata (GString *buf);
 
 /******************************************************/
 
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index f2174b5..7957633 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4386,7 +4386,7 @@ excel_write_textbox_v8 (ExcelWriteSheet *esheet, SheetObject *so)
 
 	ms_escher_clientanchor (escher, &anchor);
 
-	ms_escher_clientdata (escher, NULL, 0);
+	ms_escher_clientdata (escher);
 
 	/* At this point we're still missing the textbox below.  */
 
@@ -4424,6 +4424,8 @@ excel_write_textbox_v8 (ExcelWriteSheet *esheet, SheetObject *so)
 			gnm_expr_top_unref (texpr);
 		}
 		ms_objv8_write_checkbox_data (bp, checkbox_active);
+		if (type == 12)
+			ms_objv8_write_radiobutton_data (bp, 0, TRUE);
 	}
 
 	ms_biff_put_var_write (bp, zero, 4);
@@ -4502,7 +4504,7 @@ excel_write_line_v8 (ExcelWriteSheet *esheet, SheetObject *so)
 
 	ms_escher_clientanchor (escher, sheet_object_get_anchor (so));
 
-	ms_escher_clientdata (escher, NULL, 0);
+	ms_escher_clientdata (escher);
 
 	ms_escher_spcontainer_end (escher, spmark);
 
diff --git a/plugins/excel/ms-obj.c b/plugins/excel/ms-obj.c
index 990c69f..868b068 100644
--- a/plugins/excel/ms-obj.c
+++ b/plugins/excel/ms-obj.c
@@ -1481,3 +1481,15 @@ ms_objv8_write_radiobutton (BiffPut *bp)
 	GSF_LE_SET_GUINT16 (rb + 8, 0);  /* ignore */
 	ms_biff_put_var_write (bp, rb, sizeof rb);
 }
+
+void
+ms_objv8_write_radiobutton_data (BiffPut *bp, guint16 nobj, gboolean first)
+{
+	char rb[8];
+
+	GSF_LE_SET_GUINT16 (rb, GR_RADIO_BUTTON_DATA);
+	GSF_LE_SET_GUINT16 (rb + 2, sizeof (rb) - 4);
+	GSF_LE_SET_GUINT16 (rb + 4, nobj);
+	GSF_LE_SET_GUINT16 (rb + 6, !!first);
+	ms_biff_put_var_write (bp, rb, sizeof rb);
+}
diff --git a/plugins/excel/ms-obj.h b/plugins/excel/ms-obj.h
index bf73c73..ec25dd3 100644
--- a/plugins/excel/ms-obj.h
+++ b/plugins/excel/ms-obj.h
@@ -162,5 +162,7 @@ void ms_objv8_write_macro_fmla    (BiffPut *bp,
 				   ExcelWriteSheet *esheet,
 				   GnmExprTop const *texpr);
 void ms_objv8_write_radiobutton (BiffPut *bp);
+void ms_objv8_write_radiobutton_data (BiffPut *bp,
+				      guint16 nobj, gboolean first);
 
 #endif /* GNM_MS_OBJ_H */



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