static void sax_style_handler (GsfXMLIn *xin, GnmStyle *style, gpointer user) { GnmFT *ft = (GnmFT *)xin->user_state; GnmFTMember *member = ft->members->data; gnm_style_ref (style); member->mstyle = style; }
/** * gnm_ft_member_clone: * * Clone a template member * * Return value: a copy of @member **/ static GnmFTMember * gnm_ft_member_clone (GnmFTMember *member) { GnmFTMember *clone = gnm_ft_member_new (); clone->row = member->row; clone->col = member->col; clone->direction = member->direction; clone->repeat = member->repeat; clone->skip = member->skip; clone->edge = member->edge; clone->mstyle = member->mstyle; gnm_style_ref (member->mstyle); return clone; }
static void thrash_insert (Sheet *sheet) { int j; GnmStyle *style1 = gnm_style_new (); GnmStyle *style2 = gnm_style_new (); gnm_style_set_font_bold (style1, TRUE); gnm_style_set_font_italic (style1, TRUE); gnm_style_set_font_size (style2, 20.0); for (j = 0; j < INSERT_HEIGHT; j++) { GnmRange r; int i; for (i = 0; i < INSERT_WIDTH; i++) { GnmCell *cell; GnmStyle *setstyle; r.start.col = i; r.start.row = j; r.end = r.start; if (((i / 31) % 2) == 0) setstyle = style1; else setstyle = style2; gnm_style_ref (setstyle); sheet_style_attach (sheet, &r, setstyle); cell = sheet_cell_fetch (sheet, i, j); gnm_cell_set_value (cell, value_new_int (i), NULL); } r.start.col = 0; r.start.row = MAX (0, j - 1); r.end.col = gnm_sheet_get_max_cols (sheet); r.end.row = MIN (gnm_sheet_get_max_rows (sheet), j + 1); sheet_style_optimize (sheet, r); } gnm_style_unref (style1); gnm_style_unref (style2); }
static void preview_grid_set_property (GObject *obj, guint param_id, GValue const *value, GParamSpec *pspec) { GnmPreviewGrid *pg = GNM_PREVIEW_GRID (obj); switch (param_id){ case PREVIEW_GRID_PROP_RENDER_GRIDLINES : pg->gridlines = g_value_get_boolean (value); break; case PREVIEW_GRID_PROP_DEFAULT_COL_WIDTH : pg->defaults.col_width = g_value_get_uint (value); break; case PREVIEW_GRID_PROP_DEFAULT_ROW_HEIGHT : pg->defaults.row_height = g_value_get_uint (value); break; case PREVIEW_GRID_PROP_DEFAULT_STYLE : { /* add a ref */ GnmStyle *style = g_value_get_pointer (value); g_return_if_fail (style != NULL); gnm_style_ref (style); gnm_style_unref (pg->defaults.style); pg->defaults.style = style; break; } case PREVIEW_GRID_PROP_DEFAULT_VALUE : { /* steal ownership */ GnmValue *val = g_value_get_pointer (value); g_return_if_fail (val != NULL); if (pg->defaults.value != val) { value_release (pg->defaults.value); pg->defaults.value = val; } break; } default: G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, param_id, pspec); return; /* NOTE : RETURN */ } goc_item_invalidate (GOC_ITEM (obj)); }