[gnumeric] xls: fix export of list validation.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] xls: fix export of list validation.
- Date: Tue, 22 Dec 2015 20:45:40 +0000 (UTC)
commit dfd10ef99c016fcaabde551dc8456883476fe395
Author: Morten Welinder <terra gnome org>
Date: Tue Dec 22 15:45:11 2015 -0500
xls: fix export of list validation.
NEWS | 1 +
plugins/excel/ChangeLog | 6 ++++++
plugins/excel/ms-excel-write.c | 7 ++++---
plugins/excel/ms-formula-write.c | 8 +++++++-
plugins/excel/ms-formula-write.h | 1 +
5 files changed, 19 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index 1268919..0b64578 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Morten:
* Fix bugs with merged cells. [#504004]
* Make builds more reproducible.
* Improve ssdiff for validation.
+ * Fix problem with xls export of list validation. [#557555]
--------------------------------------------------------------------------
Gnumeric 1.12.24
diff --git a/plugins/excel/ChangeLog b/plugins/excel/ChangeLog
index ce9243e..5fc0b08 100644
--- a/plugins/excel/ChangeLog
+++ b/plugins/excel/ChangeLog
@@ -1,5 +1,11 @@
2015-12-22 Morten Welinder <terra gnome org>
+ * ms-excel-write.c (excel_write_DV): Use a special formula context
+ for list validation.
+
+ * ms-formula-write.c (excel_write_formula): Handle said formula
+ context.
+
* ms-obj.h (MSObj): Rename field combo_in_autofilter to
auto_combo.
diff --git a/plugins/excel/ms-excel-write.c b/plugins/excel/ms-excel-write.c
index ac2c70e..2271bae 100644
--- a/plugins/excel/ms-excel-write.c
+++ b/plugins/excel/ms-excel-write.c
@@ -1476,6 +1476,7 @@ excel_write_DV (XLValInputPair const *vip, gpointer dummy, ExcelWriteSheet *eshe
guint8 data[8];
int col, row;
GnmRange const *r;
+ ExcelFuncContext context = EXCEL_CALLED_FROM_VALIDATION;
ms_biff_put_var_next (bp, BIFF_DV);
@@ -1485,7 +1486,7 @@ excel_write_DV (XLValInputPair const *vip, gpointer dummy, ExcelWriteSheet *eshe
case GNM_VALIDATION_TYPE_ANY: options = 0; break;
case GNM_VALIDATION_TYPE_AS_INT: options = 1; break;
case GNM_VALIDATION_TYPE_AS_NUMBER: options = 2; break;
- case GNM_VALIDATION_TYPE_IN_LIST: options = 3; break;
+ case GNM_VALIDATION_TYPE_IN_LIST: options = 3; context =
EXCEL_CALLED_FROM_VALIDATION_LIST; break;
case GNM_VALIDATION_TYPE_AS_DATE: options = 4; break;
case GNM_VALIDATION_TYPE_AS_TIME: options = 5; break;
case GNM_VALIDATION_TYPE_TEXT_LENGTH: options = 6; break;
@@ -1554,7 +1555,7 @@ excel_write_DV (XLValInputPair const *vip, gpointer dummy, ExcelWriteSheet *eshe
guint16 len = excel_write_formula (esheet->ewb,
vip->v->deps[0].texpr,
esheet->gnum_sheet, col, row,
- EXCEL_CALLED_FROM_VALIDATION);
+ context);
unsigned end_pos = bp->curpos;
ms_biff_put_var_seekto (bp, pos-4);
GSF_LE_SET_GUINT16 (data, len);
@@ -1570,7 +1571,7 @@ excel_write_DV (XLValInputPair const *vip, gpointer dummy, ExcelWriteSheet *eshe
guint16 len = excel_write_formula (esheet->ewb,
vip->v->deps[1].texpr,
esheet->gnum_sheet, col, row,
- EXCEL_CALLED_FROM_VALIDATION);
+ context);
unsigned end_pos = bp->curpos;
ms_biff_put_var_seekto (bp, pos-4);
GSF_LE_SET_GUINT16 (data, len);
diff --git a/plugins/excel/ms-formula-write.c b/plugins/excel/ms-formula-write.c
index b88c41a..0111b5b 100644
--- a/plugins/excel/ms-formula-write.c
+++ b/plugins/excel/ms-formula-write.c
@@ -1018,6 +1018,7 @@ excel_write_formula (ExcelWriteState *ewb, GnmExprTop const *texpr,
PolishData pd;
unsigned start;
guint32 len;
+ XLOpType target = XL_ROOT;
g_return_val_if_fail (ewb, 0);
g_return_val_if_fail (texpr, 0);
@@ -1047,6 +1048,11 @@ excel_write_formula (ExcelWriteState *ewb, GnmExprTop const *texpr,
pd.context = CTXT_NAME_OBJ;
pd.use_name_variant = TRUE;
break;
+ case EXCEL_CALLED_FROM_VALIDATION_LIST:
+ pd.context = CTXT_ARRAY;
+ pd.use_name_variant = TRUE;
+ target = XL_REF;
+ break;
case EXCEL_CALLED_FROM_CONDITION:
case EXCEL_CALLED_FROM_VALIDATION:
default:
@@ -1055,7 +1061,7 @@ excel_write_formula (ExcelWriteState *ewb, GnmExprTop const *texpr,
}
start = ewb->bp->curpos;
- write_node (&pd, texpr->expr, 0, XL_ROOT);
+ write_node (&pd, texpr->expr, 0, target);
len = ewb->bp->curpos - start;
write_arrays (&pd);
diff --git a/plugins/excel/ms-formula-write.h b/plugins/excel/ms-formula-write.h
index 847ed34..150e8e8 100644
--- a/plugins/excel/ms-formula-write.h
+++ b/plugins/excel/ms-formula-write.h
@@ -19,6 +19,7 @@ typedef enum {
EXCEL_CALLED_FROM_SHARED,
EXCEL_CALLED_FROM_CONDITION,
EXCEL_CALLED_FROM_VALIDATION,
+ EXCEL_CALLED_FROM_VALIDATION_LIST,
EXCEL_CALLED_FROM_NAME,
EXCEL_CALLED_FROM_OBJ
} ExcelFuncContext;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]