GUI: Move .ui files from goffice resources to glib resources
[gnumeric.git] / src / workbook.h
blobc35d0b1ab43d738441e72d754f105691ef59126c
1 /* vim: set sw=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
2 #ifndef _GNM_WORKBOOK_H_
3 # define _GNM_WORKBOOK_H_
5 #include "gnumeric.h"
6 #include <goffice/goffice.h>
7 #include <glib-object.h>
8 #include "gui-file.h"
10 G_BEGIN_DECLS
12 #define GNM_WORKBOOK_TYPE (workbook_get_type ())
13 #define WORKBOOK(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNM_WORKBOOK_TYPE, Workbook))
14 #define GNM_IS_WORKBOOK(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNM_WORKBOOK_TYPE))
16 GType workbook_get_type (void);
17 Workbook *workbook_new (void);
18 Workbook *workbook_new_with_sheets (int sheet_count);
20 /* Sheet support routines */
21 GSList *workbook_sheets (Workbook const *wb);
22 int workbook_sheet_count (Workbook const *wb);
23 Sheet *workbook_sheet_by_index (Workbook const *wb, int i);
24 Sheet *workbook_sheet_by_name (Workbook const *wb, char const *sheet_name);
25 void workbook_sheet_attach (Workbook *wb, Sheet *new_sheet);
26 void workbook_sheet_attach_at_pos (Workbook *wb, Sheet *new_sheet, int pos);
27 Sheet *workbook_sheet_add (Workbook *wb, int pos, int columns, int rows);
28 Sheet *workbook_sheet_add_with_type (Workbook *wb, GnmSheetType sheet_type, int pos, int columns, int rows);
29 void workbook_sheet_delete (Sheet *sheet);
30 void workbook_sheet_move (Sheet *sheet, int direction);
31 char *workbook_sheet_get_free_name (Workbook *wb,
32 char const *base,
33 gboolean always_suffix,
34 gboolean handle_counter);
35 gboolean workbook_sheet_reorder (Workbook *wb,
36 GSList *new_order);
37 gboolean workbook_sheet_rename (Workbook *wb,
38 GSList *sheet_indices,
39 GSList *new_names,
40 GOCmdContext *cc);
42 unsigned workbook_find_command (Workbook *wb,
43 gboolean is_undo, gpointer cmd);
45 GnmExprSharer *workbook_share_expressions (Workbook *wb, gboolean freeit);
46 void workbook_optimize_style (Workbook *wb);
48 void workbook_update_graphs (Workbook *wb);
50 /* IO Routines */
51 gboolean workbook_set_saveinfo (Workbook *wb, GOFileFormatLevel lev,
52 GOFileSaver *saver);
53 void workbook_update_history (Workbook *wb, GnmFileSaveAsStyle type);
54 GOFileSaver *workbook_get_file_saver (Workbook *wb);
55 GOFileSaver *workbook_get_file_exporter (Workbook *wb);
56 gchar const *workbook_get_last_export_uri (Workbook *wb);
57 void workbook_set_file_exporter (Workbook *wb, GOFileSaver *fs);
58 void workbook_set_last_export_uri (Workbook *wb, const gchar *uri);
60 /* See also sheet_foreach_cell_in_region */
61 GnmValue *workbook_foreach_cell_in_range (GnmEvalPos const *pos,
62 GnmValue const *cell_range,
63 CellIterFlags flags,
64 CellIterFunc handler,
65 gpointer closure);
66 GPtrArray *workbook_cells (Workbook *wb, gboolean comments,
67 GnmSheetVisibility vis);
69 void workbook_foreach_name (Workbook const *wb, gboolean globals_only,
70 GHFunc func, gpointer data);
73 /* Calculation */
74 void workbook_recalc (Workbook *wb); /* in dependent.c */
75 void workbook_recalc_all (Workbook *wb); /* in dependent.c */
76 gboolean workbook_enable_recursive_dirty (Workbook *wb, gboolean enable);
77 void workbook_set_recalcmode (Workbook *wb, gboolean enable);
78 gboolean workbook_get_recalcmode (Workbook const *wb);
79 void workbook_iteration_enabled (Workbook *wb, gboolean enable);
80 void workbook_iteration_max_number (Workbook *wb, int max_number);
81 void workbook_iteration_tolerance (Workbook *wb, double tolerance);
83 GODateConventions const *workbook_date_conv (Workbook const *wb);
84 void workbook_set_date_conv (Workbook *wb, GODateConventions const *date_conv);
85 void workbook_set_1904 (Workbook *wb, gboolean base1904);
87 GnmSheetSize const *workbook_get_sheet_size (Workbook const *wb);
89 void workbook_attach_view (WorkbookView *wbv);
90 void workbook_detach_view (WorkbookView *wbv);
92 GType workbook_sheet_state_get_type (void);
93 WorkbookSheetState *workbook_sheet_state_new (Workbook const *wb);
94 void workbook_sheet_state_free (WorkbookSheetState *wss);
95 void workbook_sheet_state_restore (Workbook *wb, WorkbookSheetState const *wss);
96 int workbook_sheet_state_size (WorkbookSheetState const *wss);
97 char *workbook_sheet_state_diff (WorkbookSheetState const *wss_a,
98 WorkbookSheetState const *wss_b);
100 #define WORKBOOK_FOREACH_SHEET(wb, sheet, code) \
101 do { \
102 const Workbook *wb_ = (wb); \
103 unsigned sheetno_; \
104 unsigned sheetcount_ = workbook_sheet_count (wb_); \
105 for (sheetno_ = 0; sheetno_ < sheetcount_; sheetno_++) { \
106 Sheet *sheet = workbook_sheet_by_index (wb_, sheetno_); \
107 code; \
109 } while (0)
112 G_END_DECLS
114 #endif /* _GNM_WORKBOOK_H_ */