1 #ifndef _GNM_SHEET_OBJECT_IMPL_H_
2 # define _GNM_SHEET_OBJECT_IMPL_H_
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>
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 */
26 GObject parent_object
;
29 SheetObjectAnchor anchor
;
30 SheetObjectFlags flags
;
34 typedef void (*SheetObjectActionFunc
) (SheetObject
*so
, SheetControl
*sc
);
35 typedef gboolean (*SheetObjectEnableActionFunc
) (SheetObject
const *so
);
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
;
46 GObjectClass parent_class
;
49 void (*bounds_changed
) (SheetObject
*so
);
50 void (*unrealized
) (SheetObject
*so
);
51 void (*signal_pad1
) (void);
52 void (*signal_pad2
) (void);
55 gboolean (*remove_from_sheet
) (SheetObject
*so
);
56 gboolean (*assign_to_sheet
) (SheetObject
*so
,
59 SheetObjectView
*(*new_view
) (SheetObject
*so
,
60 SheetObjectViewContainer
*container
);
61 void (*populate_menu
) (SheetObject
*so
,
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
,
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
,
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.
99 char const *xml_export_name
;
106 #define GNM_SO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNM_SO_TYPE, SheetObjectClass))
108 /***************************************************************************/
110 struct _SheetObjectView
{
113 GnmSOResizeMode resize_mode
;
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
,
137 /***************************************************************************/
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
;
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
);
156 /***************************************************************************/
161 GtkTargetList
*(*get_target_list
) (SheetObject
const *so
);
162 void (*write_image
) (SheetObject
const *so
,
167 } SheetObjectImageableIface
;
169 /***************************************************************************/
174 GtkTargetList
*(*get_target_list
) (SheetObject
const *so
);
175 void (*write_object
) (SheetObject
const *so
,
177 GsfOutput
*output
, GError
**err
,
178 GnmConventions
const *convs
);
179 } SheetObjectExportableIface
;
183 #endif /* _GNM_SHEET_OBJECT_IMPL_H_ */