format.h 2.04 KB
Newer Older
1 2
#ifndef GNUMERIC_FORMAT_H
#define GNUMERIC_FORMAT_H
3

Jody Goldberg's avatar
Jody Goldberg committed
4
#include "gnumeric.h"
5 6 7 8 9 10 11 12 13 14 15 16 17 18
#include <sys/types.h>
#include <regex.h>

struct _StyleFormat {
	int    ref_count;
	char  *format;
        GSList *entries;  /* Of type StyleFormatEntry. */
	char        *regexp_str;
	GByteArray  *match_tags;
	regex_t     regexp;
};

char	      *style_format_delocalize  (char const *descriptor_string);
StyleFormat   *style_format_new_XL	(char const *descriptor_string,
19 20 21
					 gboolean delocalize);
char   	      *style_format_as_XL	(StyleFormat const *fmt,
					 gboolean localized);
22
char   	      *style_format_str_as_XL	(char const *descriptor_string,
23
					 gboolean localized);
Jody Goldberg's avatar
Jody Goldberg committed
24 25 26 27

void           style_format_ref		(StyleFormat *sf);
void           style_format_unref	(StyleFormat *sf);
gboolean       style_format_is_general	(StyleFormat const *sf);
28
gboolean       style_format_is_text	(StyleFormat const *sf);
29

30
void   format_destroy (StyleFormat *format);
31
char  *format_value   (StyleFormat *format, Value const *value, StyleColor **color,
32
		       float col_width);
33

34 35
void   format_color_init     (void);
void   format_color_shutdown (void);
36

Jody Goldberg's avatar
Jody Goldberg committed
37 38 39
char  *format_add_decimal      (StyleFormat const *fmt);
char  *format_remove_decimal   (StyleFormat const *fmt);

40 41 42 43 44 45 46 47 48 49 50 51
typedef struct {
	int  right_optional, right_spaces, right_req, right_allowed;
	int  left_spaces, left_req;
	gboolean rendered;
	gboolean negative;
	gboolean decimal_separator_seen;
	gboolean supress_minus;
	gboolean group_thousands;
	gboolean has_fraction;
} format_info_t;
void render_number (GString *result, gdouble number, format_info_t const *info);

Jody Goldberg's avatar
Jody Goldberg committed
52
/* Locale support routines */
53
char const *gnumeric_setlocale      (int category, char const *val);
54
char const *format_get_currency     (gboolean *precedes, gboolean *space_sep);
55 56 57 58 59
gboolean    format_month_before_day (void);
char        format_get_arg_sep      (void);
char        format_get_col_sep      (void);
char        format_get_thousand     (void);
char        format_get_decimal      (void);
60

Jody Goldberg's avatar
Jody Goldberg committed
61 62
void number_format_init (void);
void number_format_shutdown (void);
63

64
#endif /* GNUMERIC_FORMAT_H */