1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_SHEET_STYLE_H_
3 # define _GNM_SHEET_STYLE_H_
6 #include "style-border.h"
10 struct _GnmStyleRegion
{
11 GnmRange range
; /* must be 1st */
17 int row
, start_col
, end_col
;
19 GnmStyle
const **styles
;
20 GnmBorder
const **top
;
21 GnmBorder
const **bottom
;
22 GnmBorder
const **vertical
;
25 GnmStyle
*sheet_style_default (Sheet
const *sheet
);
26 GnmStyle
const *sheet_style_get (Sheet
const *sheet
, int col
, int row
);
27 GnmStyle
*sheet_style_find (Sheet
const *sheet
, GnmStyle
*st
);
28 void sheet_style_get_row (Sheet
const *sheet
, GnmStyleRow
*sr
);
29 GnmStyle
**sheet_style_get_row2 (Sheet
const *sheet
, int row
);
30 void sheet_style_apply_border (Sheet
*sheet
, GnmRange
const *range
,
32 void sheet_style_apply_range (Sheet
*sheet
, GnmRange
const *range
,
34 void sheet_style_apply_range2 (Sheet
*sheet
, GnmRange
const *range
,
36 void sheet_style_set_range (Sheet
*sheet
, GnmRange
const *range
,
38 void sheet_style_apply_col (Sheet
*sheet
, int col
,
40 void sheet_style_apply_row (Sheet
*sheet
, int row
,
42 void sheet_style_set_pos (Sheet
*sheet
, int col
, int row
,
44 void sheet_style_apply_pos (Sheet
*sheet
, int col
, int row
,
47 void sheet_style_insdel_colrow (GnmExprRelocateInfo
const *rinfo
);
48 void sheet_style_relocate (GnmExprRelocateInfo
const *rinfo
);
49 unsigned int sheet_style_find_conflicts (Sheet
const *sheet
, GnmRange
const *r
,
51 GnmBorder
*borders
[GNM_STYLE_BORDER_EDGE_MAX
]);
52 void sheet_style_get_extent (Sheet
const *sheet
, GnmRange
*r
);
53 void sheet_style_get_nondefault_extent (Sheet
const *sheet
, GnmRange
*extent
,
54 const GnmRange
*src
, GnmStyle
**col_defaults
);
55 guint8
* sheet_style_get_nondefault_rows (Sheet
const *sheet
,
56 GnmStyle
**col_defaults
);
58 gboolean
sheet_style_is_default (Sheet
const *sheet
, const GnmRange
*r
, GnmStyle
**col_defaults
);
59 void style_row_init (GnmBorder
const * * *prev_vert
,
60 GnmStyleRow
*sr
, GnmStyleRow
*next_sr
,
61 int start_col
, int end_col
,
62 gpointer mem
, gboolean hide_grid
);
63 GnmHLink
*sheet_style_region_contains_link (Sheet
const *sheet
, GnmRange
const *r
);
64 void sheet_style_foreach (Sheet
const *sheet
,
67 void sheet_style_range_foreach (Sheet
const *sheet
, GnmRange
const *r
,
71 GnmStyle
**sheet_style_most_common (Sheet
const *sheet
, gboolean is_col
);
73 void sheet_style_init (Sheet
*sheet
);
74 void sheet_style_resize (Sheet
*sheet
, int cols
, int rows
);
75 void sheet_style_shutdown (Sheet
*sheet
);
77 void sheet_style_set_auto_pattern_color (Sheet
*sheet
,
78 GnmColor
*grid_color
);
79 GnmColor
*sheet_style_get_auto_pattern_color (Sheet
const *sheet
);
80 void sheet_style_update_grid_color (Sheet
const *sheet
);
82 GnmStyle
const *style_list_get_style (GnmStyleList
const *l
, int col
, int row
);
83 void style_list_free (GnmStyleList
*l
);
84 GnmStyleList
*sheet_style_get_range (Sheet
const *sheet
, GnmRange
const *r
);
86 typedef gboolean (*sheet_style_set_list_cb_t
) (GnmRange
*range
,
89 GnmSpanCalcFlags
sheet_style_set_list (Sheet
*sheet
,
90 GnmCellPos
const *corner
,
91 GnmStyleList
const *l
,
92 sheet_style_set_list_cb_t range_modify
,
95 GnmStyleList
*sheet_style_collect_conditions (Sheet
const *sheet
,
97 GnmStyleList
*sheet_style_collect_hlinks (Sheet
const *sheet
,
99 GnmStyleList
*sheet_style_collect_validations (Sheet
const *sheet
,
102 GType
gnm_style_region_get_type (void); /* boxed type */
103 GnmStyleRegion
*gnm_style_region_new (GnmRange
const *range
, GnmStyle
*style
);
104 void gnm_style_region_free (GnmStyleRegion
*sr
);
107 /* For internal use only */
108 void sheet_style_unlink (Sheet
*sheet
, GnmStyle
*st
);
110 void sheet_style_optimize (Sheet
*sheet
);
112 void sheet_style_clear_style_dependents (Sheet
*sheet
, GnmRange
const *r
);
116 #endif /* _GNM_SHEET_STYLE_H_ */