Update Spanish translation
[gnumeric.git] / src / sheet-object-impl.h
blobab06616cba06b39186abe66049568022b0b73c0e
1 #ifndef _GNM_SHEET_OBJECT_IMPL_H_
2 # define _GNM_SHEET_OBJECT_IMPL_H_
4 G_BEGIN_DECLS
6 #include <sheet-object.h>
7 #include <goffice/goffice.h>
8 #include <gsf/gsf-libxml.h>
9 #include <libxml/tree.h>
10 #include <glib-object.h>
12 typedef enum {
13 SHEET_OBJECT_IS_VISIBLE = 1 << 0, /* user selectable */
14 SHEET_OBJECT_PRINT = 1 << 1,
15 SHEET_OBJECT_CAN_PRESS = 1 << 2,
16 SHEET_OBJECT_CAN_RESIZE = 1 << 3,
17 SHEET_OBJECT_CAN_EDIT = 1 << 4,
19 /* Gnumeric specific properties */
20 SHEET_OBJECT_MOVE_WITH_CELLS = 1 << 16,
21 SHEET_OBJECT_SIZE_WITH_CELLS = 1 << 17,
22 SHEET_OBJECT_OBSCURED = 1 << 18 /* cells associated with region are hidden */
23 } SheetObjectFlags;
25 struct _SheetObject {
26 GObject parent_object;
27 Sheet *sheet;
28 GList *realized_list;
29 SheetObjectAnchor anchor;
30 SheetObjectFlags flags;
31 char *name;
34 typedef void (*SheetObjectActionFunc) (SheetObject *so, SheetControl *sc);
35 typedef gboolean (*SheetObjectEnableActionFunc) (SheetObject const *so);
36 typedef struct {
37 char const *icon; /* optionally NULL */
38 char const *label; /* NULL for separators */
39 char const *msg_domain; /* for plugins to specify translations */
40 int submenu; /* > 1 starts a menu, < 1 end one */
41 SheetObjectActionFunc func;
42 SheetObjectEnableActionFunc enable_func;
43 } SheetObjectAction;
45 typedef struct {
46 GObjectClass parent_class;
48 /* Signals */
49 void (*bounds_changed) (SheetObject *so);
50 void (*unrealized) (SheetObject *so);
51 void (*signal_pad1) (void);
52 void (*signal_pad2) (void);
54 /* Virtual methods */
55 gboolean (*remove_from_sheet) (SheetObject *so);
56 gboolean (*assign_to_sheet) (SheetObject *so,
57 Sheet *sheet);
59 SheetObjectView *(*new_view) (SheetObject *so,
60 SheetObjectViewContainer *container);
61 void (*populate_menu) (SheetObject *so,
62 GPtrArray *actions);
63 void (*user_config) (SheetObject *so,
64 SheetControl *s_control);
65 void (*prep_sax_parser) (SheetObject *so,
66 GsfXMLIn *xin, xmlChar const **attrs,
67 GnmConventions const *convs);
68 void (*write_xml_sax) (SheetObject const *so,
69 GsfXMLOut *output,
70 GnmConventions const *convs);
71 void (*copy) (SheetObject *dst,
72 SheetObject const *src);
74 void (*default_size) (SheetObject const *so,
75 double *w, double *h);
77 void (*draw_cairo) (SheetObject const *so, cairo_t *cr,
78 double width, double height);
80 void (*foreach_dep) (SheetObject *so,
81 SheetObjectForeachDepFunc func,
82 gpointer user);
84 void (*func_pad1) (void);
85 void (*func_pad2) (void);
88 * If false, we draw a rectangle where the object is going to
89 * be layed out If true, we draw the object while laying
90 * it out on the sheet.
92 gboolean rubber_band_directly;
95 * If FALSE, a mouse click will select the object.
97 gboolean interactive;
99 char const *xml_export_name;
101 void *data_pad1;
102 void *data_pad2;
103 void *data_pad3;
104 void *data_pad4;
105 } SheetObjectClass;
106 #define GNM_SO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNM_SO_TYPE, SheetObjectClass))
108 /***************************************************************************/
110 struct _SheetObjectView {
111 GocGroup base;
113 GnmSOResizeMode resize_mode;
116 typedef struct {
117 GocGroupClass base;
119 void (*active) (SheetObjectView *sov, gboolean is_active);
120 void (*set_bounds) (SheetObjectView *sov,
121 double const *coords, gboolean visible);
122 } SheetObjectViewClass;
124 #define GNM_SO_VIEW_TYPE (sheet_object_view_get_type ())
125 #define GNM_SO_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GNM_SO_VIEW_TYPE, SheetObjectView))
126 #define GNM_IS_SO_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GNM_SO_VIEW_TYPE))
127 #define GNM_SO_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNM_SO_VIEW_TYPE, SheetObjectViewIface))
128 #define GNM_IS_SO_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GNM_SO_VIEW_TYPE))
129 #define GNM_SO_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNM_SO_VIEW_TYPE, SheetObjectViewClass))
131 GType sheet_object_view_get_type (void);
132 SheetObject *sheet_object_view_get_so (SheetObjectView *sov);
133 void sheet_object_view_set_bounds (SheetObjectView *sov,
134 double const *coords,
135 gboolean visible);
137 /***************************************************************************/
139 typedef struct {
140 GTypeInterface base;
142 /* Map between anchors and un-normalized coordinates */
143 void (*anchor_to_coords) (SheetObjectViewContainer *sovc,
144 SheetObjectAnchor const *input, double *output);
145 void (*coords_to_anchor) (SheetObjectViewContainer *sovc,
146 double const *input, SheetObjectAnchor *output);
147 } SheetObjectViewContainerIface;
149 #if 0
150 void so_vc_anchor_to_coords (SheetObjectViewContainer *sovc,
151 SheetObjectAnchor const *input, double *output);
152 void so_vc_coords_to_anchor (SheetObjectViewContainer *sovc,
153 double const *input, SheetObjectAnchor *output);
154 #endif
156 /***************************************************************************/
158 typedef struct {
159 GTypeInterface base;
161 GtkTargetList *(*get_target_list) (SheetObject const *so);
162 void (*write_image) (SheetObject const *so,
163 char const *format,
164 double resolution,
165 GsfOutput *output,
166 GError **err);
167 } SheetObjectImageableIface;
169 /***************************************************************************/
171 typedef struct {
172 GTypeInterface base;
174 GtkTargetList *(*get_target_list) (SheetObject const *so);
175 void (*write_object) (SheetObject const *so,
176 char const *format,
177 GsfOutput *output, GError **err,
178 GnmConventions const *convs);
179 } SheetObjectExportableIface;
181 G_END_DECLS
183 #endif /* _GNM_SHEET_OBJECT_IMPL_H_ */