gnm-format.h 2.37 KB
Newer Older
1 2 3
/* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef _GNM_FORMAT_H_
# define _GNM_FORMAT_H_
4 5

#include "gnumeric.h"
6
#include <goffice/goffice.h>
Morten Welinder's avatar
Morten Welinder committed
7
#include <pango/pango.h>
8

9 10
G_BEGIN_DECLS

11
char  *format_value	    (GOFormat const *format,
12
			     GnmValue const *value,
13 14
			     int col_width,
			     GODateConventions const *date_conv);
Morten Welinder's avatar
Morten Welinder committed
15

Morten Welinder's avatar
Morten Welinder committed
16 17 18
GOFormatNumberError format_value_gstring (GString *result,
					  GOFormat const *format,
					  GnmValue const *value,
19
					  int col_width,
Morten Welinder's avatar
Morten Welinder committed
20
					  GODateConventions const *date_conv);
21 22 23 24 25
GOFormatNumberError format_value_layout (PangoLayout *result,
					 GOFormat const *format,
					 GnmValue const *value,
					 int col_width,
					 GODateConventions const *date_conv);
Morten Welinder's avatar
Morten Welinder committed
26 27 28 29 30 31 32 33

GOFormatNumberError gnm_format_layout    (PangoLayout *result,
					  GOFontMetrics *metrics,
					  GOFormat const *format,
					  GnmValue const *value,
					  int col_width,
					  GODateConventions const *date_conv,
					  gboolean unicode_minus);
34

Morten Welinder's avatar
Morten Welinder committed
35 36 37
GOFormat const * gnm_format_specialize (GOFormat const *fmt,
					GnmValue const *value);

Morten Welinder's avatar
Morten Welinder committed
38 39
int gnm_format_is_date_for_value (GOFormat const *fmt,
				  GnmValue const *value);
40 41
int gnm_format_is_time_for_value (GOFormat const *fmt,
				  GnmValue const *value);
Morten Welinder's avatar
Morten Welinder committed
42

43 44
int gnm_format_month_before_day (GOFormat const *fmt,
				 GnmValue const *value);
Morten Welinder's avatar
Morten Welinder committed
45

46 47
char *gnm_format_frob_slashes (const char *s);

48 49
GOFormat *gnm_format_for_date_editing (GnmCell const *cell);

Morten Welinder's avatar
Morten Welinder committed
50 51
gboolean gnm_format_has_hour (GOFormat const *fmt,
			      GnmValue const *value);
52

53 54 55 56 57 58 59 60
typedef enum {
	GNM_FORMAT_IMPORT_NULL_INVALID,
	GNM_FORMAT_IMPORT_PATCHUP_INCOMPLETE
} GnmFormatImportFlags;

GOFormat *gnm_format_import (const char *fmt,
			     GnmFormatImportFlags flags);

61 62 63 64 65 66 67 68
/*
 * http://www.unicode.org/charts/PDF/U0080.pdf
 * http://www.unicode.org/charts/PDF/U2000.pdf
 * http://www.unicode.org/charts/PDF/U20A0.pdf
 * http://www.unicode.org/charts/PDF/U2200.pdf
 */
#define UNICODE_LOGICAL_NOT_C 0x00AC
#define UNICODE_ZERO_WIDTH_SPACE_C 0X200B
69
#define UNICODE_ZERO_WIDTH_SPACE_C_UTF8_LENGTH 3
70 71 72 73 74 75 76 77 78
#define UNICODE_EURO_SIGN_C 0x20AC
#define UNICODE_MINUS_SIGN_C 0x2212
#define UNICODE_DIVISION_SLASH_C 0x2215
#define UNICODE_LOGICAL_AND_C 0x2227
#define UNICODE_LOGICAL_OR_C 0x2228
#define UNICODE_NOT_EQUAL_TO_C 0x2260
#define UNICODE_LESS_THAN_OR_EQUAL_TO_C 0x2264
#define UNICODE_GREATER_THAN_OR_EQUAL_TO_C 0x2265

79 80 81
G_END_DECLS

#endif /* _GNM_FORMAT_H_ */