[goffice] GOFormat: take odf version as argument.



commit cdd69f8756912b1cc0334465667aaf248dc47de3
Author: Morten Welinder <terra gnome org>
Date:   Tue Mar 20 20:06:24 2012 -0400

    GOFormat: take odf version as argument.

 ChangeLog                 |    4 ++++
 goffice/utils/go-format.c |   37 +++++++++++++++----------------------
 goffice/utils/go-format.h |    1 +
 3 files changed, 20 insertions(+), 22 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ea93a2e..4049946 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2012-03-20  Morten Welinder  <terra gnome org>
 
+	* goffice/utils/go-format.c (go_format_output_to_odf): Take extra
+	odf_version argument.
+	(go_format_output_fraction_to_odf): Ditto.  Caller changed.
+
 	* goffice/utils/go-pixbuf.c (go_pixbuf_save): Survive lack of
 	image data.
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index d105382..ec049ce 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -7541,6 +7541,7 @@ go_format_output_date_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 static void
 go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 				  char const *name,
+				  int odf_version,
 				  gboolean with_extension)
 {
 	char const *xl = go_format_as_XL (fmt);
@@ -7575,17 +7576,13 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 				gsf_xml_out_add_int (xout, NUMBER "min-denominator-digits", 3);
 				if (int_digits >= 0)
 					gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", int_digits);
-				else
-#ifdef HAVE_GET_GSF_ODF_VERSION
-					if (get_gsf_odf_version () < 102)
-#endif
-						{
-							gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", 0);
-							if (with_extension)
-								gsf_xml_out_add_cstr_unchecked
-									(xout, GNMSTYLE "no-integer-part", "true");
+				else if (odf_version < 102) {
+					gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", 0);
+					if (with_extension)
+						gsf_xml_out_add_cstr_unchecked
+							(xout, GNMSTYLE "no-integer-part", "true");
 
-						}
+				}
 				/* In ODF1.2, absence of NUMBER "min-integer-digits" means not to show an       */
 				/* integer part. In ODF 1.1 we used a foreign element: gnm:no-integer-part=true */
 				gsf_xml_out_add_int (xout, NUMBER "min-numerator-digits", 1);
@@ -7660,17 +7657,12 @@ go_format_output_fraction_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 
 			if (int_digits >= 0)
 				gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", int_digits);
-			else
-#ifdef HAVE_GET_GSF_ODF_VERSION
-				if (get_gsf_odf_version () < 102)
-#endif
-					{
-						gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", 0);
-						if (with_extension)
-							gsf_xml_out_add_cstr_unchecked
-								(xout, GNMSTYLE "no-integer-part", "true");
-
-					}
+			else if (odf_version < 102) {
+				gsf_xml_out_add_int (xout, NUMBER "min-integer-digits", 0);
+				if (with_extension)
+					gsf_xml_out_add_cstr_unchecked
+						(xout, GNMSTYLE "no-integer-part", "true");
+			}
 			/* In ODF1.2, absence of NUMBER "min-integer-digits" means not to show an       */
 			/* integer part. In ODF 1.1 we used a foreign element: gnm:no-integer-part=true */
 			gsf_xml_out_add_int (xout, NUMBER "min-numerator-digits",
@@ -8357,6 +8349,7 @@ go_format_output_general_to_odf (GsfXMLOut *xout, char const *name, int cond_par
 gboolean
 go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 			 int cond_part, char const *name,
+			 int odf_version,
 			 gboolean with_extension)
 {
 	gboolean pp = TRUE, result = TRUE;
@@ -8402,7 +8395,7 @@ go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 		go_format_output_date_to_odf (xout, act_fmt, name, family, with_extension);
 		break;
 	case GO_FORMAT_FRACTION:
-		go_format_output_fraction_to_odf (xout, act_fmt, name, with_extension);
+		go_format_output_fraction_to_odf (xout, act_fmt, name, odf_version, with_extension);
 		break;
 	case GO_FORMAT_TEXT:
 		go_format_output_text_to_odf (xout, act_fmt, name, with_extension);
diff --git a/goffice/utils/go-format.h b/goffice/utils/go-format.h
index 8ae07ae..3dd44ee 100644
--- a/goffice/utils/go-format.h
+++ b/goffice/utils/go-format.h
@@ -259,6 +259,7 @@ GOFormat *go_format_toggle_1000sep	(GOFormat const *fmt);
 char *go_format_odf_style_map (GOFormat const *fmt, int cond_part);
 gboolean go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt,
 				  int cond_part, char const *name,
+				  int odf_version,
 				  gboolean with_extension);
 void go_format_foreach (GHFunc func, gpointer user_data);
 



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