Commit 6434a050 authored by Andreas J. Guelzow 's avatar Andreas J. Guelzow

Fix conditional number format import from ODF. [#672489]

2012-03-21  Andreas J. Guelzow <aguelzow@pyrshep.ca>

	* openoffice-read.c (odf_number_style_end): skip the condition
	for the second part if we skipped it for the first and it is the
	default
parent 73ffb2e1
......@@ -10,6 +10,7 @@ Andreas:
* Import/Export style information attached to grids from/to ODF.
Part of [#671461]
* Improve annotation import from ODF.
* Fix conditional number format import from ODF. [#672489]
Jean:
* Fixed crash with sheet object. [#671617]
......
2012-03-21 Andreas J. Guelzow <aguelzow@pyrshep.ca>
* openoffice-read.c (odf_number_style_end): skip the condition
for the second part if we skipped it for the first and it is the
default
2012-03-20 Morten Welinder <terra@gnome.org>
* openoffice-read.c (openoffice_file_open): Don't refer to
......
......@@ -4494,6 +4494,7 @@ odf_number_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
GSList *lc, *lf;
char *accum;
int parts = 0;
gboolean default_condition = FALSE;
accum = g_string_free (state->cur_format.accum, FALSE);
if (strlen (accum) == 0) {
......@@ -4513,6 +4514,8 @@ odf_number_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
g_string_append_printf
(state->cur_format.accum,
(*(cond+1) == '=') ? "[>=%s]" : "[>%s]", val);
else
default_condition = TRUE;
fmt = g_hash_table_lookup (state->formats, lf->data);
if (fmt != NULL)
g_string_append (state->cur_format.accum, go_format_as_XL (fmt));
......@@ -4598,12 +4601,16 @@ odf_number_style_end (GsfXMLIn *xin, G_GNUC_UNUSED GsfXMLBlob *blob)
if (cond != NULL && *cond == '<' && *(cond + 1) != '>') {
GOFormat const *fmt;
char *val = cond + strcspn (cond, "0123456789.");
float val_d = strtod (val, NULL);
if (parts > 0)
g_string_append_c (state->cur_format.accum, ';');
if ((*(cond+1) != '=') || (strtod (val, NULL) != 0.))
g_string_append_printf
(state->cur_format.accum,
(*(cond+1) == '=') ? "[<=%s]" : "[<%s]", val);
if ((*(cond+1) != '=') || (val_d != 0.)) {
if (!(parts == 1 && default_condition && (*(cond+1) != '=')) &&
val_d == 0.)
g_string_append_printf
(state->cur_format.accum,
(*(cond+1) == '=') ? "[<=%s]" : "[<%s]", val);
}
fmt = g_hash_table_lookup (state->formats, lf->data);
if (fmt != NULL)
g_string_append (state->cur_format.accum,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment