[gnumeric] Some more number formatting improvements to ODF import/export.
- From: Andreas J. Guelzow <guelzow src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] Some more number formatting improvements to ODF import/export.
- Date: Sun, 4 Sep 2011 21:39:03 +0000 (UTC)
commit a212efc51cd2f9001ed807c6764eb1988eae4495
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date: Sun Sep 4 15:38:19 2011 -0600
Some more number formatting improvements to ODF import/export.
2011-09-04 Andreas J. Guelzow <aguelzow pyrshep ca>
* developer/odf-foreign.txt: update
2011-09-04 Andreas J. Guelzow <aguelzow pyrshep ca>
* openoffice-read.c (odf_fraction): read pi-fraction foreign
element
NEWS | 1 +
doc/ChangeLog | 4 ++++
doc/developer/odf-foreign.txt | 2 ++
plugins/openoffice/ChangeLog | 5 +++++
plugins/openoffice/openoffice-read.c | 12 ++++++++----
5 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/NEWS b/NEWS
index abb0fc2..b2a1666 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Andreas:
* Enable markup selection in scientific format selector.
* Be compatible wih the changed LibreOffice ODF documents with tab colours.
* Persist selection and edit positions through ODF files. [#657506]
+ * Some more number formatting improvements to ODF import/export.
Jean:
* Make things build against gtk+-3.0.
diff --git a/doc/ChangeLog b/doc/ChangeLog
index 1b4fa58..86040b5 100644
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,7 @@
+2011-09-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
+ * developer/odf-foreign.txt: update
+
2011-08-15 Andreas J. Guelzow <aguelzow pyrshep ca>
* make-func-list.pl: change prefix for function refs, fixes [#656545]
diff --git a/doc/developer/odf-foreign.txt b/doc/developer/odf-foreign.txt
index da137f4..303d60b 100644
--- a/doc/developer/odf-foreign.txt
+++ b/doc/developer/odf-foreign.txt
@@ -45,6 +45,8 @@ Part 3: In any ODF files:
1) Elements and attributes added by goffice:
+gnm:display-factor="pi" is an attribute to number:fraction indicating a pi-fraction (ie. a fraction written as a multiple of pi)
+
gnm:format-magic
An attribute to <number:time-style> and <number:date-style> to specify Gnumeric's magic number for the style. The magic number is stored as an integer. When ever we set this attribute we also set the number:source attribute to language. On import we only use this magic number if the number:source attribute is still set to language, since otherwise somebody will have edited the format.
diff --git a/plugins/openoffice/ChangeLog b/plugins/openoffice/ChangeLog
index 9c91ad9..013aaac 100644
--- a/plugins/openoffice/ChangeLog
+++ b/plugins/openoffice/ChangeLog
@@ -1,5 +1,10 @@
2011-09-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+ * openoffice-read.c (odf_fraction): read pi-fraction foreign
+ element
+
+2011-09-04 Andreas J. Guelzow <aguelzow pyrshep ca>
+
* openoffice-read.c (oo_attr_percent_or_distance): new
(oo_dash): use oo_attr_percent_or_distance
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 73d9f45..77ecd60 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -3970,13 +3970,13 @@ odf_fraction (GsfXMLIn *xin, xmlChar const **attrs)
gboolean grouping = FALSE;
gboolean no_int_part = FALSE;
gboolean denominator_fixed = FALSE;
+ gboolean pi_scale = FALSE;
int denominator = 0;
int min_d_digits = 0;
int max_d_digits = 3;
int min_i_digits = -1;
int min_n_digits = 0;
-
if (state->cur_format.accum == NULL)
return;
@@ -3995,8 +3995,10 @@ odf_fraction (GsfXMLIn *xin, xmlChar const **attrs)
;
else if (oo_attr_bool (xin, attrs, OO_GNUM_NS_EXT, "no-integer-part", &no_int_part)) {}
else if (oo_attr_int_range (xin, attrs, OO_NS_NUMBER,
- "min-numerator-digits", &min_n_digits, 0, 30))
- ;
+ "min-numerator-digits", &min_n_digits, 0, 30)) {}
+ else if (gsf_xml_in_namecmp (xin, CXML2C (attrs[0]), OO_GNUM_NS_EXT, "display-factor") &&
+ attr_eq (attrs[1], "pi"))
+ pi_scale = TRUE;
if (!no_int_part && (state->ver_odf < 1.2 || min_i_digits >= 0)) {
g_string_append_c (state->cur_format.accum, '#');
@@ -4004,8 +4006,10 @@ odf_fraction (GsfXMLIn *xin, xmlChar const **attrs)
min_i_digits > 0 ? min_i_digits : 0);
g_string_append_c (state->cur_format.accum, ' ');
}
- g_string_append_c (state->cur_format.accum, '?');
+ odf_go_string_append_c_n (state->cur_format.accum, '?', max_d_digits - min_n_digits);
odf_go_string_append_c_n (state->cur_format.accum, '0', min_n_digits);
+ if (pi_scale)
+ g_string_append (state->cur_format.accum, " pi");
g_string_append_c (state->cur_format.accum, '/');
if (denominator_fixed) {
int denom = denominator;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]