[goffice] Add some ODF GOFormat output utilities



commit 72039d19db82eb98b893fe13008e862325a93cc4
Author: Andreas J. Guelzow <aguelzow pyrshep ca>
Date:   Tue May 26 15:47:58 2009 -0600

    Add some ODF GOFormat output utilities
    
    2009-05-26  Andreas J. Guelzow  <aguelzow pyrshep ca>
    
    	* goffice/utils/go-format.c (go_format_odf_style_map): new
    	(go_format_output_to_odf): new
    	* goffice/utils/go-format.h (go_format_odf_style_map): new
    	(go_format_output_to_odf): new
---
 ChangeLog                 |    7 ++++++
 NEWS                      |    3 ++
 goffice/utils/go-format.c |   53 +++++++++++++++++++++++++++++++++++++++++++++
 goffice/utils/go-format.h |   11 +++++++++
 4 files changed, 74 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 576cc7f..193baa1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-05-26  Andreas J. Guelzow  <aguelzow pyrshep ca>
+
+	* goffice/utils/go-format.c (go_format_odf_style_map): new
+	(go_format_output_to_odf): new
+	* goffice/utils/go-format.h (go_format_odf_style_map): new
+	(go_format_output_to_odf): new
+	
 2009-05-23  Morten Welinder <terra gnome org>
 
 	* Release 0.7.7
diff --git a/NEWS b/NEWS
index f2dcdc3..528e7d3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.7.8:
 
+Andreas:
+	* Add some odf GOFormat output utilities.	
+
 --------------------------------------------------------------------------
 goffice 0.7.7:
 
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 506fe43..7ad8b10 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -4903,3 +4903,56 @@ go_format_default_accounting (void)
 	return default_accounting_fmt;
 }
 #endif
+
+
+/********************* GOFormat ODF Support ***********************/
+
+#ifdef DEFINE_COMMON
+char *
+go_format_odf_style_map (GOFormat const **conditional_format, GOFormat const *fmt, int i)
+{
+	char const *format_string = NULL;
+
+	g_return_val_if_fail (fmt != NULL, NULL);
+	g_return_val_if_fail (fmt->typ == GO_FMT_COND, NULL);
+
+	if (i >= fmt->u.cond.n)
+		return NULL;
+
+	if (conditional_format != NULL)
+		*conditional_format = fmt->u.cond.conditions[i].fmt;
+
+	switch (fmt->u.cond.conditions[i].op) {
+	case GO_FMT_COND_EQ:
+		format_string = "value()=%f";
+		break;
+	case GO_FMT_COND_NE:
+		format_string = "value()!=%f";
+		break;
+	case GO_FMT_COND_LT:
+		format_string = "value()<%f";
+		break;
+	case GO_FMT_COND_LE:
+		format_string = "value()<=%f";
+		break;
+	case GO_FMT_COND_GT:
+		format_string = "value()>%f";
+		break;
+	case GO_FMT_COND_GE:
+		format_string = "value()>=%f";
+		break;
+	default:
+		return NULL;
+	}
+	return g_strdup_printf (format_string, fmt->u.cond.conditions[i].val);
+	
+}
+#endif
+
+#ifdef DEFINE_COMMON
+gboolean
+go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt, char const *name)
+{
+	return FALSE;
+}
+#endif
diff --git a/goffice/utils/go-format.h b/goffice/utils/go-format.h
index 9e3bfc3..4dad871 100644
--- a/goffice/utils/go-format.h
+++ b/goffice/utils/go-format.h
@@ -27,6 +27,7 @@
 #include <pango/pango-attributes.h>
 #include <pango/pango-layout.h>
 #include <glib.h>
+#include <gsf/gsf-libxml.h>
 
 #include <glib-object.h>
 
@@ -172,6 +173,16 @@ GOFormat *go_format_inc_precision	(GOFormat const *fmt);
 GOFormat *go_format_dec_precision	(GOFormat const *fmt);
 GOFormat *go_format_toggle_1000sep	(GOFormat const *fmt);
 
+/******************* GOFormat ODF Support ********************************/
+
+char *go_format_odf_style_map (GOFormat const **conditional_format, 
+			       GOFormat const *fmt, int i);
+gboolean go_format_output_to_odf (GsfXMLOut *xout, GOFormat const *fmt, 
+				  char const *name);
+
+
+/*************************************************************************/
+
 typedef struct {
 	gchar const *symbol;
 	gchar const *description;



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