[gnumeric] Fix export of input-message only validations. [#705384]
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Fix export of input-message only validations. [#705384]
- Date: Sat, 3 Aug 2013 08:36:15 +0000 (UTC)
commit ab425ff46e3fce292f1f9104c122b08afe34d21f
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sat Aug 3 02:35:10 2013 -0600
Fix export of input-message only validations. [#705384]
2013-08-03 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-write.c (odf_write_style_cell_properties): write
input messages as part of the validations
(odf_write_empty_cell): correctly write the name of an input-message
only validation.
(odf_validation_general_attributes): don't write the name here
(odf_print_spreadsheet_content_validations): write the correct name
NEWS | 1 +
plugins/openoffice/ChangeLog | 9 +++++++++
plugins/openoffice/openoffice-write.c | 27 ++++++++++++---------------
3 files changed, 22 insertions(+), 15 deletions(-)
---
diff --git a/NEWS b/NEWS
index 81116a9..0991139 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Andreas:
* Fix ODF import of charts with series consisting of multiple ranges. [#704742]
* Fix ODF export of charts with series consisting of multiple ranges.
* Implement input message editing. [Part of #705310]
+ * Fix export of input-message only validations. [#705384]
Jean:
* Fix text wrap inside sheet objects. [#704417]
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 5e9b473..2c1261a 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,3 +1,12 @@
+2013-08-03 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * openoffice-write.c (odf_write_style_cell_properties): write
+ input messages as part of the validations
+ (odf_write_empty_cell): correctly write the name of an input-message
+ only validation.
+ (odf_validation_general_attributes): don't write the name here
+ (odf_print_spreadsheet_content_validations): write the correct name
+
2013-08-01 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_validation_t): add fields
diff --git a/plugins/openoffice/openoffice-write.c b/plugins/openoffice/openoffice-write.c
index 2db0154..6e83c00 100644
--- a/plugins/openoffice/openoffice-write.c
+++ b/plugins/openoffice/openoffice-write.c
@@ -1287,17 +1287,6 @@ odf_write_style_cell_properties (GnmOOExport *state, GnmStyle const *style)
/* Only interpreted in a default style. */
gsf_xml_out_add_int (state->xml, STYLE "decimal-places", 13);
-/* Input Messages */
- if (gnm_style_is_element_set (style, MSTYLE_INPUT_MSG) && state->with_extension) {
- GnmInputMsg *msg = gnm_style_get_input_msg (style);
- if (msg != NULL) {
- gsf_xml_out_add_cstr (state->xml, GNMSTYLE "input-title",
- gnm_input_msg_get_title (msg));
-
- gsf_xml_out_add_cstr (state->xml, GNMSTYLE "input-msg",
- gnm_input_msg_get_msg (msg)); }
- }
-
/* Horizontal Alignment */
if (gnm_style_is_element_set (style, MSTYLE_ALIGN_H)) {
GnmHAlign align = gnm_style_get_align_h (style);
@@ -3245,6 +3234,7 @@ odf_write_empty_cell (GnmOOExport *state, int num, GnmStyle const *style, GSList
if (style != NULL) {
char const * name = odf_find_style (state, style);
GnmValidation const *val = gnm_style_get_validation (style);
+ GnmInputMsg *im;
if (name != NULL)
gsf_xml_out_add_cstr (state->xml,
TABLE "style-name", name);
@@ -3253,6 +3243,11 @@ odf_write_empty_cell (GnmOOExport *state, int num, GnmStyle const *style, GSList
gsf_xml_out_add_cstr (state->xml,
TABLE "content-validation-name", vname);
g_free (vname);
+ } else if (NULL != (im = gnm_style_get_input_msg (style))) {
+ char *vname = g_strdup_printf ("VAL-%p", im);
+ gsf_xml_out_add_cstr (state->xml,
+ TABLE "content-validation-name", vname);
+ g_free (vname);
}
}
@@ -4256,10 +4251,6 @@ odf_write_autofilter (GnmOOExport *state, GnmFilter const *filter)
static void
odf_validation_general_attributes (GnmOOExport *state, GnmValidation const *val)
{
- char *name = g_strdup_printf ("VAL-%p", val);
-
- gsf_xml_out_add_cstr (state->xml, TABLE "name", name);
- g_free (name);
odf_add_bool (state->xml, TABLE "allow-empty-cell", val->allow_blank);
gsf_xml_out_add_cstr (state->xml, TABLE "display-list",
val->use_dropdown ? "unsorted" : "none");
@@ -4463,6 +4454,7 @@ odf_print_spreadsheet_content_validations (GnmOOExport *state)
GnmInputMsg const *msg = gnm_style_get_input_msg (sr->style);
GnmParsePos pp;
char const *message_type = NULL;
+ char *name;
if (val == NULL && msg == NULL) {
g_warning ("Encountered NULL validation with NULL message!");
@@ -4476,6 +4468,11 @@ odf_print_spreadsheet_content_validations (GnmOOExport *state)
}
gsf_xml_out_start_element (state->xml,
TABLE "content-validation");
+
+ name = g_strdup_printf ("VAL-%p", val ? (gpointer) val : (gpointer) msg);
+ gsf_xml_out_add_cstr (state->xml, TABLE "name", name);
+ g_free (name);
+
if (val) {
odf_validation_general_attributes (state, val);
odf_validation_base_cell_address (state, sheet, sr, &pp);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]