Update Spanish translation
[gnumeric.git] / src / workbook-view.h
blob5cb980d0fed75676be3140997b255963353e9bfa
1 #ifndef _GNM_WORKBOOK_VIEW_H_
2 # define _GNM_WORKBOOK_VIEW_H_
4 #include <gnumeric.h>
5 #include <dependent.h>
6 #include <goffice/goffice.h>
8 G_BEGIN_DECLS
10 struct _WorkbookView {
11 GoView base;
13 Workbook *wb;
14 GPtrArray *wb_controls;
16 Sheet *current_sheet; /* convenience */
17 SheetView *current_sheet_view;
19 /* preferences */
20 gboolean show_horizontal_scrollbar;
21 gboolean show_vertical_scrollbar;
22 gboolean show_notebook_tabs;
23 gboolean show_function_cell_markers;
24 gboolean show_extension_markers;
25 gboolean do_auto_completion;
26 gboolean is_protected;
28 /* Non-normative size information */
29 int preferred_width, preferred_height;
31 /* The auto-expression */
32 struct {
33 GnmFunc *func;
34 char *descr;
35 GnmValue *value;
36 gboolean use_max_precision;
37 GnmDependent dep;
38 gulong sheet_detached_sig;
39 } auto_expr;
41 /* selection */
42 char *selection_description;
44 /* Style for feedback */
45 GnmStyle const *current_style;
46 SheetObject *in_cell_combo; /* validation or data slicer */
49 typedef struct {
50 GObjectClass base_class;
51 void (*sheet_entered) (Sheet *sheet);
52 } WorkbookViewClass;
54 #define GNM_WORKBOOK_VIEW_TYPE (workbook_view_get_type ())
55 #define GNM_WORKBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNM_WORKBOOK_VIEW_TYPE, WorkbookView))
56 #define GNM_IS_WORKBOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_WORKBOOK_VIEW_TYPE))
58 /* Lifecycle */
59 GType workbook_view_get_type (void);
60 WorkbookView *workbook_view_new (Workbook *wb);
61 void wb_view_attach_control (WorkbookView *wbv, WorkbookControl *wbc);
62 void wb_view_detach_control (WorkbookControl *wbc);
63 void wb_view_detach_from_workbook (WorkbookView *wbv);
65 /* Information */
66 GODoc *wb_view_get_doc (WorkbookView const *wbv);
67 Workbook *wb_view_get_workbook (WorkbookView const *wbv);
68 int wb_view_get_index_in_wb (WorkbookView const *wbv);
69 Sheet *wb_view_cur_sheet (WorkbookView const *wbv);
70 SheetView *wb_view_cur_sheet_view (WorkbookView const *wbv);
71 void wb_view_sheet_focus (WorkbookView *wbv, Sheet *sheet);
72 void wb_view_sheet_add (WorkbookView *wbv, Sheet *new_sheet);
73 gboolean wb_view_is_protected (WorkbookView *wbv, gboolean check_sheet);
75 /* Manipulation */
76 void wb_view_set_attribute (WorkbookView *wbv, char const *name,
77 char const *value);
78 void wb_view_preferred_size (WorkbookView *wbv,
79 int w_pixels, int h_pixels);
80 void wb_view_style_feedback (WorkbookView *wbv);
81 void wb_view_menus_update (WorkbookView *wbv);
82 void wb_view_selection_desc (WorkbookView *wbv, gboolean use_pos,
83 WorkbookControl *wbc);
84 void wb_view_edit_line_set (WorkbookView *wbv,
85 WorkbookControl *wbc);
86 void wb_view_auto_expr_recalc (WorkbookView *wbv);
88 /* I/O routines */
89 gboolean workbook_view_save_as (WorkbookView *wbv, GOFileSaver *fs,
90 char const *uri, GOCmdContext *cc);
91 gboolean workbook_view_save (WorkbookView *wbv, GOCmdContext *cc);
92 void workbook_view_save_to_output (WorkbookView *wbv,
93 GOFileSaver const *fs,
94 GsfOutput *output,
95 GOIOContext *io_context);
96 void workbook_view_save_to_uri (WorkbookView *wbv, GOFileSaver const *fs,
97 char const *uri, GOIOContext *io_context);
99 WorkbookView *workbook_view_new_from_input (GsfInput *input,
100 const char *uri,
101 GOFileOpener const *file_opener,
102 GOIOContext *io_context,
103 gchar const *encoding);
104 WorkbookView *workbook_view_new_from_uri (char const *uri,
105 GOFileOpener const *file_opener,
106 GOIOContext *io_context,
107 gchar const *encoding);
109 #define WORKBOOK_VIEW_FOREACH_CONTROL(wbv, control, code) \
110 do { \
111 int jNd; \
112 GPtrArray *wb_controls = (wbv)->wb_controls; \
113 if (wb_controls != NULL) /* Reverse is important during destruction */ \
114 for (jNd = wb_controls->len; jNd-- > 0 ;) { \
115 WorkbookControl *control = \
116 g_ptr_array_index (wb_controls, jNd); \
117 code \
119 } while (0)
122 G_END_DECLS
124 #endif /* _GNM_WORKBOOK_VIEW_H_ */