1 #ifndef _GNM_WORKBOOK_PRIV_H_ 2 # define _GNM_WORKBOOK_PRIV_H_ 3 4 #include <workbook.h> 5 #include <goffice/goffice.h> 6 7 G_BEGIN_DECLS 8 9 struct _Workbook { 10 GODoc doc; 11 12 #ifndef __GI_SCANNER__ 13 GPtrArray *wb_views; 14 15 GPtrArray *sheets; 16 GHashTable *sheet_hash_private; 17 GHashTable *sheet_order_dependents; 18 GHashTable *sheet_local_functions; 19 20 gboolean sheet_size_cached; 21 GnmSheetSize sheet_size; 22 23 gboolean is_placeholder; 24 25 GOFileFormatLevel file_format_level; 26 GOFileFormatLevel file_export_format_level; 27 GOFileSaver *file_saver; 28 GOFileSaver *file_exporter; 29 char *last_export_uri; 30 31 /* Undo support */ 32 GSList *undo_commands; 33 GSList *redo_commands; 34 35 GnmNamedExprCollection *names; 36 37 /* Calculation options */ 38 struct { 39 gboolean enabled; 40 int max_number; 41 double tolerance; 42 } iteration; 43 gboolean recalc_auto; 44 GODateConventions const *date_conv; 45 46 gboolean during_destruction; 47 gboolean being_reordered; 48 gboolean recursive_dirty_enabled; 49 gboolean being_loaded; 50 #endif 51 }; 52 53 typedef struct { 54 GODocClass base; 55 56 void (*sheet_order_changed) (Workbook *wb); 57 void (*sheet_added) (Workbook *wb); 58 void (*sheet_deleted) (Workbook *wb); 59 } WorkbookClass; 60 61 #define WORKBOOK_FOREACH_VIEW(wb, view, code) \ 62 do { \ 63 int InD; \ 64 GPtrArray *wb_views = (wb)->wb_views; \ 65 if (wb_views != NULL) /* Reverse is important during destruction */ \ 66 for (InD = wb_views->len; InD-- > 0; ) { \ 67 WorkbookView *view = g_ptr_array_index (wb_views, InD); \ 68 code \ 69 } \ 70 } while (0) 71 72 #define WORKBOOK_FOREACH_CONTROL(wb, view, control, code) \ 73 WORKBOOK_FOREACH_VIEW((wb), view, \ 74 WORKBOOK_VIEW_FOREACH_CONTROL(view, control, code);) 75 76 /* 77 * Walk the dependents. WARNING: Note, that it is only valid to muck with 78 * the current dependency in the code. 79 */ 80 #define WORKBOOK_FOREACH_DEPENDENT(wb, dep, code) \ 81 do { \ 82 /* Maybe external deps here. */ \ 83 \ 84 WORKBOOK_FOREACH_SHEET(wb, _wfd_sheet, { \ 85 SHEET_FOREACH_DEPENDENT (_wfd_sheet, dep, code); \ 86 }); \ 87 } while (0) 88 89 G_END_DECLS 90 91 #endif /* _GNM_WORKBOOK_PRIV_H_ */ 92