[gnumeric] xls: export combos and buttons too.



commit eb3c0b37589ce9e31783baf1a8d25a7ea8cfe8a1
Author: Morten Welinder <terra gnome org>
Date:   Tue Oct 13 18:45:19 2009 -0400

    xls: export combos and buttons too.

 NEWS                           |    2 ++
 plugins/excel/ms-excel-write.c |   19 +++++++++++++++++--
 plugins/excel/ms-obj.c         |    9 +++++++++
 plugins/excel/ms-obj.h         |    3 +++
 4 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/NEWS b/NEWS
index 8c7c20a..76caa8c 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,8 @@ Morten:
 	* Add xls export of spin buttons.  [Part of #597035]
 	* Add xls export of scroll bars.  [Part of #597035]
 	* Add xls export of list widgets.  [Part of #597035]
+	* Add xls export of combo widgets.  [Part of #597035]
+	* Add xls export of button widgets.  [Part of #597035]
 
 --------------------------------------------------------------------------
 Gnumeric 1.9.14
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index 98ca0a4..c2421bb 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -4344,6 +4344,14 @@ excel_write_textbox_or_widget_v8 (ExcelWriteSheet *esheet,
 		shape = 0xc9;
 		type = 0x12;
 		flags = 0x2011;
+	} else if (GNM_IS_SOW_BUTTON (so)) {
+		shape = 0xc9;
+		type = 0x07;
+		flags = 0x0011;
+	} else if (GNM_IS_SOW_COMBO (so)) {
+		shape = 0xc9;
+		type = 0x14;
+		flags = 0x2011;
 	} else {
 		g_assert_not_reached ();
 		return 0;
@@ -4420,6 +4428,10 @@ excel_write_textbox_or_widget_v8 (ExcelWriteSheet *esheet,
 	ms_objv8_write_common (bp, esheet->cur_obj, type, flags);
 
 	switch (type) {
+	case 0x07: {
+		ms_objv8_write_button (bp, esheet, macro_nexpr);
+		break;
+	}
 	case 0x0b: {
 		GnmExprTop const *link = sheet_widget_checkbox_get_link (so);
 		ms_objv8_write_checkbox (bp,
@@ -4466,7 +4478,8 @@ excel_write_textbox_or_widget_v8 (ExcelWriteSheet *esheet,
 		if (link) gnm_expr_top_unref (link);
 		break;
 	}
-	case 0x12: {
+	case 0x12:
+	case 0x14: {
 		GnmExprTop const *res_link =
 			sheet_widget_list_base_get_result_link (so);
 		GnmExprTop const *data_link =
@@ -5431,7 +5444,9 @@ excel_sheet_new (ExcelWriteState *ewb, Sheet *sheet,
 			   GNM_IS_SOW_RADIO_BUTTON (so) ||
 			   GNM_IS_SOW_SPINBUTTON (so) ||
 			   GNM_IS_SOW_SCROLLBAR (so) ||
-			   GNM_IS_SOW_LIST (so)) {
+			   GNM_IS_SOW_LIST (so) ||
+			   GNM_IS_SOW_BUTTON (so) ||
+			   GNM_IS_SOW_COMBO (so)) {
 			esheet->widgets =
 				g_slist_prepend (esheet->widgets, so);
 			g_hash_table_insert (esheet->widget_macroname,
diff --git a/plugins/excel/ms-obj.c b/plugins/excel/ms-obj.c
index 8626a8b..5a1746a 100644
--- a/plugins/excel/ms-obj.c
+++ b/plugins/excel/ms-obj.c
@@ -1676,3 +1676,12 @@ ms_objv8_write_list (BiffPut *bp,
 				  (guint16)adj->upper - 1,
 				  (guint16)adj->value);
 }
+
+void
+ms_objv8_write_button (BiffPut *bp,
+		       ExcelWriteSheet *esheet,
+		       GnmNamedExpr *macro_nexpr)
+{
+	if (0 && macro_nexpr)
+		ms_objv8_write_macro_ref (bp, esheet, macro_nexpr);
+}
diff --git a/plugins/excel/ms-obj.h b/plugins/excel/ms-obj.h
index 1d0efa7..579170e 100644
--- a/plugins/excel/ms-obj.h
+++ b/plugins/excel/ms-obj.h
@@ -180,6 +180,9 @@ void ms_objv8_write_list (BiffPut *bp,
 			  GnmExprTop const *res_texpr,
 			  GnmExprTop const *data_texpr,
 			  GnmNamedExpr *macro_nexpr);
+void ms_objv8_write_button (BiffPut *bp,
+			    ExcelWriteSheet *esheet,
+			    GnmNamedExpr *macro_nexpr);
 
 
 #endif /* GNM_MS_OBJ_H */



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