1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_WORKBOOK_CONTROL_H_
3 # define _GNM_WORKBOOK_CONTROL_H_
6 #include "validation.h"
7 #include <glib-object.h>
11 #define GNM_WBC_TYPE (workbook_control_get_type ())
12 #define GNM_WBC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GNM_WBC_TYPE, WorkbookControl))
13 #define GNM_IS_WBC(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_WBC_TYPE))
15 GType
workbook_control_get_type (void);
16 void wb_control_set_view (WorkbookControl
*wbc
,
17 WorkbookView
*optional_view
,
18 Workbook
*optional_wb
);
19 void wb_control_init_state (WorkbookControl
*wbc
);
21 /* Create a new control of the same form */
22 WorkbookControl
*workbook_control_new_wrapper (WorkbookControl
*wbc
,
23 WorkbookView
*wbv
, Workbook
*wb
,
26 void wb_control_style_feedback (WorkbookControl
*wbc
, GnmStyle
const *changes
);
27 void wb_control_edit_line_set (WorkbookControl
*wbc
, char const *text
);
28 void wb_control_selection_descr_set (WorkbookControl
*wbc
, char const *text
);
30 void wb_control_sheet_add (WorkbookControl
*wbc
, SheetView
*sv
);
31 void wb_control_sheet_remove (WorkbookControl
*wbc
, Sheet
*sheet
);
32 void wb_control_sheet_focus (WorkbookControl
*wbc
, Sheet
*sheet
);
33 void wb_control_sheet_remove_all (WorkbookControl
*wbc
);
35 void wb_control_undo_redo_truncate (WorkbookControl
*wbc
, int n
, gboolean is_undo
);
36 void wb_control_undo_redo_pop (WorkbookControl
*wbc
, gboolean is_undo
);
37 void wb_control_undo_redo_push (WorkbookControl
*wbc
, gboolean is_undo
,
38 char const *text
, gpointer key
);
39 void wb_control_undo_redo_labels (WorkbookControl
*wbc
,
40 char const *undo
, char const *redo
);
41 int wb_control_validation_msg (WorkbookControl
*wbc
, ValidationStyle v
,
42 char const *title
, char const *msg
);
44 /* Menu state update flags, use them to specify which menu items to update */
46 MS_INSERT_COLS
= 1 << 0,
47 MS_INSERT_ROWS
= 1 << 1,
48 MS_INSERT_CELLS
= 1 << 2,
49 MS_SHOWHIDE_DETAIL
= 1 << 3,
50 MS_PASTE_SPECIAL
= 1 << 4,
51 MS_PRINT_SETUP
= 1 << 5,
52 MS_SEARCH_REPLACE
= 1 << 6,
53 MS_DEFINE_NAME
= 1 << 7,
54 MS_CONSOLIDATE
= 1 << 8,
55 MS_FREEZE_VS_THAW
= 1 << 9,
56 MS_ADD_VS_REMOVE_FILTER
= 1 << 10,
57 MS_SHOW_PRINTAREA
= 1 << 11,
58 MS_PAGE_BREAKS
= 1 << 12,
59 MS_SELECT_OBJECT
= 1 << 13,
60 MS_FILTER_STATE_CHANGED
= 1 << 14,
61 MS_COMMENT_LINKS_RANGE
= 1 << 15,
62 MS_COMMENT_LINKS
= 1 << 16,
63 MS_FILE_EXPORT_IMPORT
= 1 << 17
67 (MS_INSERT_COLS | MS_INSERT_ROWS | MS_INSERT_CELLS | \
68 MS_SHOWHIDE_DETAIL | MS_PASTE_SPECIAL | \
69 MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE | \
70 MS_FREEZE_VS_THAW | MS_ADD_VS_REMOVE_FILTER | MS_SHOW_PRINTAREA | \
71 MS_PAGE_BREAKS | MS_SELECT_OBJECT | MS_FILTER_STATE_CHANGED | MS_FILE_EXPORT_IMPORT)
72 #define MS_GURU_MENU_ITEMS \
73 (MS_PRINT_SETUP | MS_SEARCH_REPLACE | MS_DEFINE_NAME | MS_CONSOLIDATE)
75 void wb_control_menu_state_update (WorkbookControl
*wbc
, int flags
);
76 void wb_control_update_action_sensitivity (WorkbookControl
*wbc
);
78 void wb_control_paste_from_selection (WorkbookControl
*wbc
,
79 GnmPasteTarget
const *pt
);
80 gboolean
wb_control_claim_selection (WorkbookControl
*wbc
);
82 WorkbookView
*wb_control_view (WorkbookControl
const *wbc
);
83 Workbook
*wb_control_get_workbook (WorkbookControl
const *wbc
);
84 GODoc
*wb_control_get_doc (WorkbookControl
const *wbc
);
85 Sheet
*wb_control_cur_sheet (WorkbookControl
const *wbc
);
86 SheetView
*wb_control_cur_sheet_view (WorkbookControl
const *wbc
);
88 gboolean
wb_control_parse_and_jump (WorkbookControl
*wbc
, char const *text
);
89 gboolean
wb_control_jump (WorkbookControl
*wbc
, Sheet
*sheet
, const GnmRangeRef
*r
);
96 } wb_control_navigator_t
;
98 void wb_control_navigate_to_cell (WorkbookControl
*wbc
, wb_control_navigator_t to
);
103 #endif /* _GNM_WORKBOOK_CONTROL_H_ */