1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_WORKBOOK_VIEW_H_
3 # define _GNM_WORKBOOK_VIEW_H_
7 #include <goffice/goffice.h>
11 struct _WorkbookView
{
15 GPtrArray
*wb_controls
;
17 Sheet
*current_sheet
; /* convenience */
18 SheetView
*current_sheet_view
;
21 gboolean show_horizontal_scrollbar
;
22 gboolean show_vertical_scrollbar
;
23 gboolean show_notebook_tabs
;
24 gboolean show_function_cell_markers
;
25 gboolean show_extension_markers
;
26 gboolean do_auto_completion
;
27 gboolean is_protected
;
29 /* Non-normative size information */
30 int preferred_width
, preferred_height
;
32 /* The auto-expression */
37 gboolean use_max_precision
;
39 gulong sheet_detached_sig
;
43 char *selection_description
;
45 /* Style for feedback */
46 GnmStyle
const *current_style
;
47 SheetObject
*in_cell_combo
; /* validation or data slicer */
51 GObjectClass base_class
;
52 void (*sheet_entered
) (Sheet
*sheet
);
55 #define GNM_WORKBOOK_VIEW_TYPE (workbook_view_get_type ())
56 #define GNM_WORKBOOK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNM_WORKBOOK_VIEW_TYPE, WorkbookView))
57 #define GNM_IS_WORKBOOK_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_WORKBOOK_VIEW_TYPE))
60 GType
workbook_view_get_type (void);
61 WorkbookView
*workbook_view_new (Workbook
*wb
);
62 void wb_view_attach_control (WorkbookView
*wbv
, WorkbookControl
*wbc
);
63 void wb_view_detach_control (WorkbookControl
*wbc
);
64 void wb_view_detach_from_workbook (WorkbookView
*wbv
);
67 GODoc
*wb_view_get_doc (WorkbookView
const *wbv
);
68 Workbook
*wb_view_get_workbook (WorkbookView
const *wbv
);
69 int wb_view_get_index_in_wb (WorkbookView
const *wbv
);
70 Sheet
*wb_view_cur_sheet (WorkbookView
const *wbv
);
71 SheetView
*wb_view_cur_sheet_view (WorkbookView
const *wbv
);
72 void wb_view_sheet_focus (WorkbookView
*wbv
, Sheet
*sheet
);
73 void wb_view_sheet_add (WorkbookView
*wbv
, Sheet
*new_sheet
);
74 gboolean
wb_view_is_protected (WorkbookView
*wbv
, gboolean check_sheet
);
77 void wb_view_set_attribute (WorkbookView
*wbv
, char const *name
,
79 void wb_view_preferred_size (WorkbookView
*wbv
,
80 int w_pixels
, int h_pixels
);
81 void wb_view_style_feedback (WorkbookView
*wbv
);
82 void wb_view_menus_update (WorkbookView
*wbv
);
83 void wb_view_selection_desc (WorkbookView
*wbv
, gboolean use_pos
,
84 WorkbookControl
*wbc
);
85 void wb_view_edit_line_set (WorkbookView
*wbv
,
86 WorkbookControl
*wbc
);
87 void wb_view_auto_expr_recalc (WorkbookView
*wbv
);
90 gboolean
workbook_view_save_as (WorkbookView
*wbv
, GOFileSaver
*fs
,
91 char const *uri
, GOCmdContext
*cc
);
92 gboolean
workbook_view_save (WorkbookView
*wbv
, GOCmdContext
*cc
);
93 void workbook_view_save_to_output (WorkbookView
*wbv
,
94 GOFileSaver
const *fs
,
96 GOIOContext
*io_context
);
97 void workbook_view_save_to_uri (WorkbookView
*wbv
, GOFileSaver
const *fs
,
98 char const *uri
, GOIOContext
*io_context
);
100 WorkbookView
*workbook_view_new_from_input (GsfInput
*input
,
102 GOFileOpener
const *file_opener
,
103 GOIOContext
*io_context
,
104 gchar
const *encoding
);
105 WorkbookView
*workbook_view_new_from_uri (char const *uri
,
106 GOFileOpener
const *file_opener
,
107 GOIOContext
*io_context
,
108 gchar
const *encoding
);
110 #define WORKBOOK_VIEW_FOREACH_CONTROL(wbv, control, code) \
113 GPtrArray *wb_controls = (wbv)->wb_controls; \
114 if (wb_controls != NULL) /* Reverse is important during destruction */ \
115 for (jNd = wb_controls->len; jNd-- > 0 ;) { \
116 WorkbookControl *control = \
117 g_ptr_array_index (wb_controls, jNd); \
125 #endif /* _GNM_WORKBOOK_VIEW_H_ */