2 # define _GNM_COLROW_H_
9 /* Size including margins, and right grid line */
13 unsigned is_default
: 1;
14 unsigned outline_level
: 4;
15 unsigned is_collapsed
: 1; /* Does this terminate an outline ? */
16 unsigned hard_size
: 1; /* are dimensions explicitly set ? */
17 unsigned visible
: 1; /* visible */
18 unsigned in_filter
: 1; /* in a filter */
19 unsigned in_advanced_filter
: 1; /* in an advanced filter */
20 unsigned needs_respan
: 1; /* mark a row as needing span generation */
22 /* TODO : Add per row/col min/max */
24 gpointer spans
; /* Only used for rows */
26 GType
col_row_info_get_type (void);
28 /* We never did get around to support 'thick' borders so these are effectively
29 * unitless (margins do not scale) constants . */
30 #define GNM_COL_MARGIN 2
31 #define GNM_ROW_MARGIN 0
33 /* The size, mask, and shift must be kept in sync */
34 #define COLROW_SEGMENT_SIZE 0x80
35 #define COLROW_SUB_INDEX(i) ((i) & 0x7f)
36 #define COLROW_SEGMENT_START(i) ((i) & ~(0x7f))
37 #define COLROW_SEGMENT_END(i) ((i) | 0x7f)
38 #define COLROW_SEGMENT_INDEX(i) ((i) >> 7)
39 #define COLROW_GET_SEGMENT(seg_array, i) \
40 (g_ptr_array_index ((seg_array)->info, COLROW_SEGMENT_INDEX(i)))
42 struct _ColRowSegment
{
43 ColRowInfo
*info
[COLROW_SEGMENT_SIZE
];
47 typedef struct _ColRowState
{
49 unsigned is_default
: 1;
50 unsigned outline_level
: 4;
51 unsigned is_collapsed
: 1; /* Does this terminate an outline ? */
52 unsigned hard_size
: 1; /* are dimensions explicitly set ? */
53 unsigned visible
: 1; /* visible */
61 #define COL_INTERNAL_WIDTH(col) \
62 ((col)->size_pixels - (GNM_COL_MARGIN + GNM_COL_MARGIN + 1))
64 double colrow_compute_pixel_scale (Sheet
const *sheet
, gboolean horizontal
);
65 void colrow_compute_pixels_from_pts (ColRowInfo
*cri
, Sheet
const *sheet
,
66 gboolean horizontal
, double scale
);
67 void colrow_compute_pts_from_pixels (ColRowInfo
*cri
, Sheet
const *sheet
,
68 gboolean horizontal
, double scale
);
70 gboolean
col_row_info_is_default (ColRowInfo
const *cri
);
71 gboolean
col_row_info_is_empty (ColRowInfo
const *cri
);
72 gboolean
col_row_info_equal (ColRowInfo
const *a
, ColRowInfo
const *b
);
73 void col_row_info_copy (ColRowInfo
*dst
, ColRowInfo
const *src
);
74 ColRowInfo
*col_row_info_new (void);
75 void colrow_free (ColRowInfo
*cri
);
79 ColRowInfo
const *cri
;
82 typedef gboolean (*ColRowHandler
)(GnmColRowIter
const *iter
, gpointer user_data
);
83 #define colrow_index_list_destroy(l) g_list_free_full ((l), g_free)
85 GString
*colrow_index_list_to_string (ColRowIndexList
*list
,
88 ColRowIndexList
*colrow_get_index_list (int first
, int last
,
89 ColRowIndexList
*list
);
90 ColRowIndexList
*colrow_index_list_copy (ColRowIndexList
*list
);
92 ColRowStateList
*colrow_state_list_destroy (ColRowStateList
*list
);
94 ColRowStateList
*colrow_get_states (Sheet
*sheet
, gboolean is_cols
,
96 void colrow_set_states (Sheet
*sheet
, gboolean is_cols
,
97 int first
, ColRowStateList
*states
);
98 gboolean
colrow_state_list_foreach (ColRowStateList
*list
,
102 ColRowHandler callback
,
105 ColRowStateGroup
*colrow_state_group_destroy (ColRowStateGroup
*set
);
106 ColRowStateGroup
*colrow_set_sizes (Sheet
*sheet
, gboolean is_cols
,
107 ColRowIndexList
*src
, int new_size
,
109 ColRowStateGroup
*colrow_get_sizes (Sheet
*sheet
, gboolean is_cols
,
110 ColRowIndexList
*src
, int new_size
);
111 void colrow_restore_state_group (Sheet
*sheet
, gboolean is_cols
,
112 ColRowIndexList
*selection
,
113 ColRowStateGroup
*state_groups
);
115 /* Support for Col/Row visibility */
116 void col_row_info_set_outline (ColRowInfo
*cri
, int outline_level
,
117 gboolean is_collapsed
);
118 int colrow_find_outline_bound (Sheet
const *sheet
, gboolean is_cols
,
119 int index
, int depth
, gboolean inc
);
120 ColRowVisList
*colrow_get_outline_toggle (Sheet
const *sheet
, gboolean is_cols
,
121 gboolean visible
, int first
, int last
);
122 ColRowVisList
*colrow_get_visibility_toggle (SheetView
*sv
, gboolean is_cols
,
124 void colrow_set_visibility (Sheet
*sheet
, gboolean is_cols
,
125 gboolean visible
, int first
, int last
);
126 void colrow_get_global_outline (Sheet
const *sheet
, gboolean is_cols
, int depth
,
127 ColRowVisList
**show
, ColRowVisList
**hide
);
129 #define colrow_vis_list_destroy(l) g_slist_free_full ((l), g_free)
130 gint
colrow_vis_list_length (ColRowVisList
*list
);
131 void colrow_set_visibility_list (Sheet
*sheet
, gboolean is_cols
,
133 ColRowVisList
*list
);
136 #define colrow_max(is_cols,sheet) ((is_cols) ? gnm_sheet_get_max_cols (sheet) : gnm_sheet_get_max_rows (sheet))
137 void rows_height_update (Sheet
*sheet
, GnmRange
const *range
,
140 void colrow_autofit (Sheet
*sheet
,
143 gboolean ignore_strings
,
144 gboolean min_current
,
145 gboolean min_default
,
146 ColRowIndexList
**indices
,
147 ColRowStateList
**sizes
);
148 void colrow_autofit_col (Sheet
*sheet
, GnmRange
*r
);
149 void colrow_autofit_row (Sheet
*sheet
, GnmRange
*r
);
153 #endif /* _GNM_COLROW_H_ */