| GOffice Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#define GO_SUBSCRIPT_RISE #define GO_SUBSCRIPT_SCALE #define GO_SUPERSCRIPT_RISE #define GO_SUPERSCRIPT_SCALE GOFormat; GOFormatCurrency; GOFormatDetails; enum GOFormatFamily; enum GOFormatMagic; int (*GOFormatMeasure) (const GString *str,PangoLayout *layout); enum GOFormatNumberError; gboolean go_format_allow_ee_markup (void); gboolean go_format_allow_pi_slash (void); gboolean go_format_allow_si (void); const char * go_format_as_XL (GOFormat const *fmt); GOFormat * go_format_dec_precision (GOFormat const *fmt); GOFormat * go_format_default_accounting (void); GOFormat * go_format_default_date (void); GOFormat * go_format_default_date_time (void); GOFormat * go_format_default_money (void); GOFormat * go_format_default_percentage (void); GOFormat * go_format_default_time (void); void go_format_details_finalize (GOFormatDetails *details); void go_format_details_free (GOFormatDetails *details); void go_format_details_init (GOFormatDetails *details,GOFormatFamily family); GOFormatDetails * go_format_details_new (GOFormatFamily family); GOFormat * go_format_empty (void); gboolean go_format_eq (GOFormat const *a,GOFormat const *b); void go_format_foreach (GHFunc func,gpointer user_data); GOFormat * go_format_general (void); void go_format_generate_number_str (GString *dst,int min_digits,int num_decimals,gboolean thousands_sep,gboolean negative_red,gboolean negative_paren,const char *prefix,const char *postfix); void go_format_generate_str (GString *dst,GOFormatDetails const *details); void go_format_get_details (GOFormat const *fmt,GOFormatDetails *dst,gboolean *exact); GOFormatFamily go_format_get_family (GOFormat const *fmt); GOFormatMagic go_format_get_magic (GOFormat const *fmt); const PangoAttrList * go_format_get_markup (GOFormat const *fmt); gboolean go_format_has_hour (GOFormat const *fmt); gboolean go_format_has_minute (GOFormat const *fmt); GOFormat * go_format_inc_precision (GOFormat const *fmt); int go_format_is_date (GOFormat const *fmt); gboolean go_format_is_general (GOFormat const *fmt); gboolean go_format_is_invalid (GOFormat const *fmt); gboolean go_format_is_markup (GOFormat const *fmt); gboolean go_format_is_simple (GOFormat const *fmt); gboolean go_format_is_text (GOFormat const *fmt); int go_format_is_time (GOFormat const *fmt); gboolean go_format_is_var_width (GOFormat const *fmt); GOFormatCurrency const * go_format_locale_currency (void); int go_format_measure_pango (const GString *str,PangoLayout *layout); int go_format_measure_strlen (const GString *str,PangoLayout *layout); int go_format_measure_zero (const GString *str,PangoLayout *layout); int go_format_month_before_day (GOFormat const *fmt); GOFormat * go_format_new_from_XL (char const *str); GOFormat * go_format_new_magic (GOFormatMagic m); GOFormat * go_format_new_markup (PangoAttrList *markup,gboolean add_ref); 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,gboolean with_extension); GOFormat * go_format_ref (GOFormat const *fmt); const GOFormat * go_format_specialize (GOFormat const *fmt,double val,char type,gboolean *inhibit_minus); const GOFormat * go_format_specializel (GOFormat const *fmt,long double val,char type,gboolean *inhibit_minus); char * go_format_str_delocalize (char const *str); char * go_format_str_localize (char const *str); GOFormat * go_format_toggle_1000sep (GOFormat const *fmt); void go_format_unref (GOFormat const *fmt); char * go_format_value (GOFormat const *fmt,double val); GOFormatNumberError go_format_value_gstring (PangoLayout *layout,GString *str,const GOFormatMeasure measure,const GOFontMetrics *metrics,GOFormat const *fmt,double val,char type,const char *sval,GOColor *go_color,int col_width,GODateConventions const *date_conv,gboolean unicode_minus); GOFormatNumberError go_format_value_gstringl (PangoLayout *layout,GString *str,const GOFormatMeasure measure,const GOFontMetrics *metrics,GOFormat const *fmt,long double val,char type,const char *sval,GOColor *go_color,int col_width,GODateConventions const *date_conv,gboolean unicode_minus); char * go_format_valuel (GOFormat const *fmt,long double val); void go_render_general (PangoLayout *layout,GString *str,GOFormatMeasure measure,const GOFontMetrics *metrics,double val,int col_width,gboolean unicode_minus,guint numeral_shape,guint custom_shape_flags); void go_render_generall (PangoLayout *layout,GString *str,GOFormatMeasure measure,const GOFontMetrics *metrics,long double val,int col_width,gboolean unicode_minus,guint numeral_shape,guint custom_shape_flags);
typedef struct {
gchar const *symbol;
gchar const *description;
gboolean precedes;
gboolean has_space;
} GOFormatCurrency;
typedef struct {
GOFormatFamily family;
GOFormatMagic magic;
/* NUMBER, SCIENTIFIC, CURRENCY, ACCOUNTING, FRACTION, PERCENTAGE: */
int min_digits;
int num_decimals;
/* NUMBER, CURRENCY, ACCOUNTING, PERCENTAGE: */
gboolean thousands_sep;
/* NUMBER, CURRENCY, ACCOUNTING, PERCENTAGE: */
gboolean negative_red;
gboolean negative_paren;
/* CURRENCY, ACCOUNTING: */
GOFormatCurrency const *currency;
/* CURRENCY: */
gboolean force_quoted;
/* SCIENTIFIC: */
int exponent_step;
int exponent_digits;
gboolean exponent_sign_forced;
gboolean use_markup;
gboolean simplify_mantissa;
gboolean append_SI;
gchar *appended_SI_unit;
int scale;
/* FRACTION: */
gboolean automatic_denominator;
gboolean split_fraction;
gboolean pi_scale;
int numerator_min_digits;
int denominator_min_digits;
int denominator_max_digits;
int denominator;
} GOFormatDetails;
GOFormatFamily |
GOFormatFamily. |
GOFormatMagic |
GOFormatMagic. |
| minimum digits number. | |
| decimals number. | |
| thousands separator. | |
| display negative number using red ink. | |
| uses parenthersis around negative numbers. | |
GOFormatCurrency const * |
GOFormatCurrency. |
| force quotes use. | |
| steps between allowed exponents in scientific notation. | |
| digits number in exponent. | |
| whether the sign in the exponent is always shown. | |
| whether to use a markup. | |
| simplify the mantissa. | |
| append an SI unit. | |
| the SI unit to append. | |
| scale. | |
| use an automatic denominator for fractions. | |
| split the fraction. | |
| use multiples of pi for fractions, e.g. 1/2*pi. | |
| minimum digits number for the numerator. | |
| minimum digits number for the denominator. | |
| minimum digits number for the denominator. | |
| fixed denominator. |
typedef enum {
GO_FORMAT_UNKNOWN = -1,
GO_FORMAT_GENERAL = 0,
GO_FORMAT_NUMBER = 1,
GO_FORMAT_CURRENCY = 2,
GO_FORMAT_ACCOUNTING = 3,
GO_FORMAT_DATE = 4,
GO_FORMAT_TIME = 5,
GO_FORMAT_PERCENTAGE = 6,
GO_FORMAT_FRACTION = 7,
GO_FORMAT_SCIENTIFIC = 8,
GO_FORMAT_TEXT = 9,
GO_FORMAT_SPECIAL = 10,
} GOFormatFamily;
| unknown ,should not occur. | |
| general. | |
| number. | |
| currency. | |
| accounting. | |
| date. | |
| tipe. | |
| percentage. | |
| fraction. | |
| scientific. | |
| text. | |
| custom. |
typedef enum {
GO_FORMAT_MAGIC_NONE = 0,
GO_FORMAT_MAGIC_LONG_DATE = 0xf800, /* Official */
GO_FORMAT_MAGIC_MEDIUM_DATE = 0xf8f1,
GO_FORMAT_MAGIC_SHORT_DATE = 0xf8f2,
GO_FORMAT_MAGIC_SHORT_DATETIME = 0xf8fa,
GO_FORMAT_MAGIC_LONG_TIME = 0xf400, /* Official */
GO_FORMAT_MAGIC_MEDIUM_TIME = 0xf4f1,
GO_FORMAT_MAGIC_SHORT_TIME = 0xf4f2
} GOFormatMagic;
| none. | |
| long date (Official). | |
| medium date. | |
| short date. | |
| short date with time. | |
| long time (Official). | |
| medium time. | |
| short time. |
typedef enum {
GO_FORMAT_NUMBER_OK = 0,
GO_FORMAT_NUMBER_INVALID_FORMAT,
GO_FORMAT_NUMBER_DATE_ERROR
} GOFormatNumberError;
const char * go_format_as_XL (GOFormat const *fmt);
|
a GOFormat |
Returns : |
the XL style format strint. |
GOFormat * go_format_dec_precision (GOFormat const *fmt);
Decreases the displayed precision for fmt by one digit.
|
GOFormat |
Returns : |
NULL if the new format would not change things |
void go_format_details_init (GOFormatDetails *details,GOFormatFamily family);
void go_format_foreach (GHFunc func,gpointer user_data);
Executes func for each registered GOFormat
|
function to execute for each known format. [scope call] |
|
user data for func
|
void go_format_generate_number_str (GString *dst,int min_digits,int num_decimals,gboolean thousands_sep,gboolean negative_red,gboolean negative_paren,const char *prefix,const char *postfix);
Generates a format string for a number format with the given
parameters and appends it to dst.
|
GString to append format string to. |
|
minimum number of digits before decimal separator. |
|
number of decimals |
|
if true, use a thousands separator. |
|
if true, make negative values red. |
|
if true, enclose negative values in parentheses. |
|
optional string to place before number part of the format |
|
optional string to place after number part of the format |
void go_format_generate_str (GString *dst,GOFormatDetails const *details);
void go_format_get_details (GOFormat const *fmt,GOFormatDetails *dst,gboolean *exact);
GOFormatMagic go_format_get_magic (GOFormat const *fmt);
|
Format to query |
Returns : |
a non-zero magic code for certain formats, such as system date. |
gboolean go_format_has_hour (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if format is a number format with an hour specifier FALSE otherwise. |
gboolean go_format_has_minute (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if format is a number format with a minute specifier FALSE otherwise. |
GOFormat * go_format_inc_precision (GOFormat const *fmt);
Increases the displayed precision for fmt by one digit.
|
GOFormat |
Returns : |
NULL if the new format would not change things |
int go_format_is_date (GOFormat const *fmt);
|
Format to query |
Returns : |
+2 if the format is a date format with time +1 if the format is any other date format. 0 if the format is not a date format. -1 if the format is inconsistent. |
gboolean go_format_is_general (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if the format is "General", possibly with condition, color, and/or locale. ("xGeneral" is thus not considered to be General for the purpose of this function.) Returns FALSE otherwise. |
gboolean go_format_is_invalid (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if, and if only, the format is invalid |
gboolean go_format_is_markup (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if the format is a markup format Returns FALSE otherwise. |
gboolean go_format_is_text (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if the format is a text format Returns FALSE otherwise. |
int go_format_is_time (GOFormat const *fmt);
|
Format to query |
Returns : |
+2 if the format is a time format with elapsed hour/minute/second +1 if the format is any other time format 0 if the format is not a time format -1 if the format is inconsistent. |
gboolean go_format_is_var_width (GOFormat const *fmt);
|
Format to query |
Returns : |
TRUE if the format is variable width, i.e., can stretch. Returns FALSE otherwise. |
int go_format_month_before_day (GOFormat const *fmt);
|
Format to query |
Returns : |
0, if format is a date format with day and month in that order 1, if format is a date format with month and day in that order, unless 2, if format is a date with year before month before day -1, otherwise. |
GOFormat * go_format_new_from_XL (char const *str);
|
XL descriptor in UTF-8 encoding. |
Returns : |
Looks up and potentially creates a GOFormat from the supplied string in XL format. |
GOFormat * go_format_new_markup (PangoAttrList *markup,gboolean add_ref);
If add_ref is FALSE absorb the reference to markup, otherwise add a
reference.
|
PangoAttrList |
|
boolean |
Returns : |
A new format. |
gboolean go_format_output_to_odf (GsfXMLOut *xout,GOFormat const *fmt,int cond_part,char const *name,gboolean with_extension);
GOFormat * go_format_ref (GOFormat const *fmt);
Adds a reference to a GOFormat.
|
a GOFormat |
Returns : |
gf |
const GOFormat * go_format_specialize (GOFormat const *fmt,double val,char type,gboolean *inhibit_minus);
const GOFormat * go_format_specializel (GOFormat const *fmt,long double val,char type,gboolean *inhibit_minus);
char * go_format_str_delocalize (char const *str);
De-localizes the given format string, i.e., changes locale's decimal separators to dots and performs other such transformations.
|
A *valid* localized format string |
Returns : |
a non-local format string, or NULL if the format was not valid. |
char * go_format_str_localize (char const *str);
Localizes the given format string, i.e., changes decimal dots to the locale's notion of that and performs other such transformations.
|
A *valid* format string |
Returns : |
a localized format string, or NULL if the format was not valid. |
void go_format_unref (GOFormat const *fmt);
Removes a reference to fmt, freeing when it goes to zero.
|
a GOFormat |
char * go_format_value (GOFormat const *fmt,double val);
Converts val into a string using format specified by fmt.
|
a GOFormat |
|
value to format |
Returns : |
a newly allocated string containing formated value. |
GOFormatNumberError go_format_value_gstring (PangoLayout *layout,GString *str,const GOFormatMeasure measure,const GOFontMetrics *metrics,GOFormat const *fmt,double val,char type,const char *sval,GOColor *go_color,int col_width,GODateConventions const *date_conv,gboolean unicode_minus);
Render a floating-point value into layout in such a way that the
layouting width does not needlessly exceed col_width. Optionally
use unicode minus instead of hyphen.
|
Optional PangoLayout, probably preseeded with font attribute. |
|
a GString to store (not append!) the resulting string in. |
|
Function to measure width of string/layout. [scope call] |
|
Font metrics corresponding to mesaure. |
|
GOFormat |
|
floating-point value. Must be finite. |
|
a format character |
|
a string to append to str after val
|
|
a color to rende |
|
intended max width of layout in pango units. -1 means no restriction. |
|
GODateConventions |
|
Use unicode minuses, not hyphens. |
Returns : |
a GOFormatNumberError |
GOFormatNumberError go_format_value_gstringl (PangoLayout *layout,GString *str,const GOFormatMeasure measure,const GOFontMetrics *metrics,GOFormat const *fmt,long double val,char type,const char *sval,GOColor *go_color,int col_width,GODateConventions const *date_conv,gboolean unicode_minus);
Render a floating-point value into layout in such a way that the
layouting width does not needlessly exceed col_width. Optionally
use unicode minus instead of hyphen.
|
Optional PangoLayout, probably preseeded with font attribute. |
|
a GString to store (not append!) the resulting string in. |
|
Function to measure width of string/layout. [scope call] |
|
Font metrics corresponding to mesaure. |
|
GOFormat |
|
floating-point value. Must be finite. |
|
a format character |
|
a string to append to str after val
|
|
a color to rende |
|
intended max width of layout in pango units. -1 means no restriction. |
|
GODateConventions |
|
Use unicode minuses, not hyphens. |
Returns : |
a GOFormatNumberError |
void go_render_general (PangoLayout *layout,GString *str,GOFormatMeasure measure,const GOFontMetrics *metrics,double val,int col_width,gboolean unicode_minus,guint numeral_shape,guint custom_shape_flags);
Render a floating-point value into layout in such a way that the
layouting width does not needlessly exceed col_width. Optionally
use unicode minus instead of hyphen.
|
Optional PangoLayout, probably preseeded with font attribute. |
|
a GString to store (not append!) the resulting string in. |
|
Function to measure width of string/layout. [scope call] |
|
Font metrics corresponding to mesaure. |
|
floating-point value. Must be finite. |
|
intended max width of layout in pango units. -1 means no restriction. |
|
Use unicode minuses, not hyphens. |
|
numeral shape identifier. |
|
flags for using numeral_shape. |
void go_render_generall (PangoLayout *layout,GString *str,GOFormatMeasure measure,const GOFontMetrics *metrics,long double val,int col_width,gboolean unicode_minus,guint numeral_shape,guint custom_shape_flags);
Render a floating-point value into layout in such a way that the
layouting width does not needlessly exceed col_width. Optionally
use unicode minus instead of hyphen.
|
Optional PangoLayout, probably preseeded with font attribute. |
|
a GString to store (not append!) the resulting string in. |
|
Function to measure width of string/layout. [scope call] |
|
Font metrics corresponding to mesaure. |
|
floating-point value. Must be finite. |
|
intended max width of layout in pango units. -1 means no restriction. |
|
Use unicode minuses, not hyphens. |
|
numeral shape identifier. |
|
flags for using numeral_shape. |