1 /* vim: set sw=8 ts=8: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
3 * ms-excel-write.h: MS Excel export
6 * Jody Goldberg (jody@gnome.org)
7 * Michael Meeks (michael@ximian.com)
9 * (C) 1998-2001 Michael Meeks
10 * (C) 2002-2005 Jody Goldberg
12 #ifndef GNM_MS_EXCEL_WRITE_H
13 #define GNM_MS_EXCEL_WRITE_H
16 #include "ms-excel-biff.h"
17 #include "ms-excel-util.h"
19 #include <goffice-data.h>
27 /* Don't use GnmFont. In the case where a font does not exist on the
28 * display system it does the wrong thing. GnmStyle can contain an
29 * invalid font. GnmFont gets remapped to the default
32 char const *font_name
;
33 char *font_name_copy
; /* some times we need to keep a local copy */
38 GnmUnderline underline
;
39 gboolean strikethrough
;
47 guint32 boundsheetPos
;
48 gint32 max_col
, max_row
;
51 GnmStyleList
*conditions
, *hlinks
, *validations
;
52 GSList
*blips
, *objects
, *graphs
, *comments
;
53 GHashTable
*commentshash
;
54 GHashTable
*widget_macroname
;
55 unsigned cur_obj
, num_objs
;
60 WorkbookView
const *wb_view
;
63 TwoWayTable
*two_way_table
;
64 GnmStyle
*default_style
;
65 GHashTable
*value_fmt_styles
;
66 GHashTable
*cell_style_variant
;
69 TwoWayTable
*two_way_table
;
70 guint8 entry_in_use
[EXCEL_DEF_PAL_LEN
];
73 TwoWayTable
*two_way_table
;
76 TwoWayTable
*two_way_table
;
78 GHashTable
*pivot_caches
;
84 GOIOContext
*io_context
;
88 GHashTable
*function_map
;
89 GHashTable
*sheet_pairs
;
90 GHashTable
*cell_markup
;
92 /* we use the ewb as a closure for things, this is useful */
96 gboolean double_stream_file
;
97 GPtrArray
*externnames
;
101 /* no need to use a full fledged two table, we already know that the
102 * Strings are unique. */
108 unsigned num_obj_groups
, cur_obj_group
, cur_blip
;
109 gboolean export_macros
;
111 guint32 unique_name_id
;
114 #define XF_RESERVED 21
116 #define FONTS_MINIMUM 5
119 #define FORMAT_MAGIC 0
120 #define PALETTE_BLACK 8
121 #define PALETTE_WHITE 9
122 #define PALETTE_AUTO_PATTERN 64
123 #define PALETTE_AUTO_BACK 65
124 #define PALETTE_AUTO_FONT 0x7fff
127 #define FILL_MAGIC FILL_NONE
128 #define BORDER_MAGIC GNM_STYLE_BORDER_NONE
131 STR_ONE_BYTE_LENGTH
= 0,
132 STR_TWO_BYTE_LENGTH
= 1,
133 STR_FOUR_BYTE_LENGTH
= 2,
135 STR_LENGTH_MASK
= 3, /* (1 << (flag & LENGTH_MASK)) == size */
137 /* biff7 will always be LEN_IN_BYTES,
138 * biff8 will respect the flag and default to length in characters */
139 STR_LEN_IN_BYTES
= 1 << 2,
141 /* Drop 2byte/rich/phonetic header and force the use of 2byte chars */
142 STR_SUPPRESS_HEADER
= 1 << 3,
144 /* include a trailing null */
145 STR_TRAILING_NULL
= 1 << 4
148 unsigned excel_write_string (BiffPut
*bp
, WriteStringFlags flags
,
150 unsigned excel_write_BOF (BiffPut
*bp
, MsBiffFileType type
);
151 void excel_write_SETUP (BiffPut
*bp
, ExcelWriteSheet
*esheet
);
152 void excel_write_SCL (BiffPut
*bp
, double zoom
, gboolean force
);
154 int palette_get_index (XLExportBase
const *ewb
, guint c
);
155 int excel_write_get_externsheet_idx (ExcelWriteState
*wb
,
159 int excel_write_map_errcode (GnmValue
const *v
);
161 GHashTable
*excel_collect_pivot_caches (Workbook
const *wb
);
163 void excel_sheet_extent (Sheet
const *sheet
, GnmRange
*extent
, GnmStyle
**col_styles
,
164 int maxcols
, int maxrows
, GOIOContext
*io_context
);
166 int excel_font_from_go_font (XLExportBase
*ewb
, GOFont
const *font
);
168 void xls_write_pivot_caches (ExcelWriteState
*ewb
, GsfOutfile
*outfile
,
169 MsBiffVersion version
, int codepage
);
171 int excel_write_add_object_format (ExcelWriteState
*ewb
, GOFormat
*format
);
173 #endif /* GNM_MS_EXCEL_WRITE_H */