1 | /* |
1 | /* |
2 | data.h - Part of psiconv, a PSION 5 file formats converter |
2 | data.h - Part of psiconv, a PSION 5 file formats converter |
3 | Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl> |
3 | Copyright (c) 1999-2014 Frodo Looijaard <frodo@frodo.looijaard.name> |
4 | |
4 | |
5 | This program is free software; you can redistribute it and/or modify |
5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by |
6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
… | |
… | |
16 | along with this program; if not, write to the Free Software |
16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
17 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
18 | */ |
18 | */ |
19 | |
19 | |
20 | /* This file contains the declarations of all types that are used to |
20 | /* This file contains the declarations of all types that are used to |
21 | represent the Word file. Variables of these types are written by the |
21 | represent the Psion files. Variables of these types are written by the |
22 | parse routines, and read by the generation routines. */ |
22 | parse routines, and read by the generation routines. |
|
|
23 | |
|
|
24 | Mostly, the data structures reflect the file format documentation, |
|
|
25 | as included in the formats directory. When in doubt, refer there. */ |
23 | |
26 | |
24 | #ifndef PSICONV_DATA_H |
27 | #ifndef PSICONV_DATA_H |
25 | #define PSICONV_DATA_H |
28 | #define PSICONV_DATA_H |
26 | |
29 | |
27 | #include <psiconv/general.h> |
30 | #include <psiconv/general.h> |
28 | #include <psiconv/list.h> |
31 | #include <psiconv/list.h> |
29 | |
32 | |
30 | /* All types which end on _t are plain types; all other types are pointers |
33 | /* All types which end on _t are plain types; all other types are pointers |
31 | to structs */ |
34 | to structs. */ |
32 | |
35 | |
33 | #ifdef __cplusplus |
36 | #ifdef __cplusplus |
34 | extern "C" { |
37 | extern "C" { |
35 | #endif /* __cplusplus */ |
38 | #endif /* __cplusplus */ |
36 | |
39 | |
37 | /* Forward declaration (for psiconv_embedded_object_section) */ |
40 | /* Forward declaration (for psiconv_embedded_object_section) */ |
38 | typedef struct psiconv_file_s *psiconv_file; |
41 | typedef struct psiconv_file_s *psiconv_file; |
39 | |
42 | |
|
|
43 | |
|
|
44 | /* Enums and simple types */ |
|
|
45 | |
|
|
46 | |
|
|
47 | /* Floating point number representation */ |
40 | typedef double psiconv_float_t; |
48 | typedef double psiconv_float_t; |
41 | |
49 | |
|
|
50 | /* The supported file types. */ |
42 | typedef enum psiconv_file_type { |
51 | typedef enum psiconv_file_type { |
43 | psiconv_unknown_file, |
52 | psiconv_unknown_file, |
44 | psiconv_word_file, |
53 | psiconv_word_file, |
45 | psiconv_texted_file, |
54 | psiconv_texted_file, |
46 | psiconv_mbm_file, |
55 | psiconv_mbm_file, |
47 | psiconv_sketch_file, |
56 | psiconv_sketch_file, |
48 | psiconv_clipart_file, |
57 | psiconv_clipart_file, |
49 | psiconv_sheet_file |
58 | psiconv_sheet_file |
50 | } psiconv_file_type_t; |
59 | } psiconv_file_type_t; |
51 | |
60 | |
52 | /* Length indicators */ |
61 | /* String representation. A string is an array of UCS2 characters, terminated |
53 | typedef psiconv_u32 psiconv_S_t; |
62 | by a 0. So they are just like normal C strings, except that they are built |
54 | typedef psiconv_u32 psiconv_X_t; |
63 | of psiconv_ucs2 elements instead of char elements. |
55 | |
64 | The psiconv_ucs2 type holds 16 bits; see unicode.h for more information. */ |
56 | /* A string */ |
|
|
57 | typedef psiconv_ucs2 *psiconv_string_t; |
65 | typedef psiconv_ucs2 *psiconv_string_t; |
58 | |
66 | |
|
|
67 | /* Represent lengths (in centimeters) and sizes (in points). |
59 | /* In the Psion file, these are identical; but we translate them to more |
68 | In the Psion file, these are identical; but we translate them to more |
60 | human-readable quantities */ |
69 | human-readable quantities */ |
61 | typedef float psiconv_length_t; /* For offsets in centimeters */ |
70 | typedef float psiconv_length_t; /* For offsets in centimeters */ |
62 | typedef float psiconv_size_t; /* For sizes in points */ |
71 | typedef float psiconv_size_t; /* For sizes in points */ |
63 | |
72 | |
64 | /* Some enums */ |
73 | /* Represent booleans. As false is zero in the enum, you can still do things |
|
|
74 | like { if (test) ... } instead of { if (test == psiconv_bool_true) ... }. |
|
|
75 | Choose whatever style suits you best. */ |
65 | typedef enum psiconv_bool |
76 | typedef enum psiconv_bool |
66 | { |
77 | { |
67 | psiconv_bool_false, |
78 | psiconv_bool_false, |
68 | psiconv_bool_true |
79 | psiconv_bool_true |
69 | } psiconv_bool_t; |
80 | } psiconv_bool_t; |
70 | |
81 | |
|
|
82 | /* Some kind of three-valued boolean, used at several places. */ |
71 | typedef enum psiconv_triple |
83 | typedef enum psiconv_triple |
72 | { |
84 | { |
73 | psiconv_triple_on, |
85 | psiconv_triple_on, |
74 | psiconv_triple_off, |
86 | psiconv_triple_off, |
75 | psiconv_triple_auto |
87 | psiconv_triple_auto |
76 | } psiconv_triple_t; |
88 | } psiconv_triple_t; |
77 | |
89 | |
|
|
90 | /* Text can be in superscript or subscript or neither, but never both |
|
|
91 | superscript and subscript at once. Also, super-superscript and things |
|
|
92 | like that do not exist in the Psion world. */ |
78 | typedef enum psiconv_super_sub |
93 | typedef enum psiconv_super_sub |
79 | { psiconv_normalscript, |
94 | { psiconv_normalscript, |
80 | psiconv_superscript, |
95 | psiconv_superscript, |
81 | psiconv_subscript |
96 | psiconv_subscript |
82 | } psiconv_super_sub_t; |
97 | } psiconv_super_sub_t; |
83 | |
98 | |
|
|
99 | /* Horizontal justification. */ |
84 | typedef enum psiconv_justify_hor |
100 | typedef enum psiconv_justify_hor |
85 | { psiconv_justify_left, |
101 | { psiconv_justify_left, |
86 | psiconv_justify_centre, |
102 | psiconv_justify_centre, |
87 | psiconv_justify_right, |
103 | psiconv_justify_right, |
88 | psiconv_justify_full |
104 | psiconv_justify_full |
89 | } psiconv_justify_hor_t; |
105 | } psiconv_justify_hor_t; |
90 | |
106 | |
|
|
107 | /* Vertical justification. */ |
91 | typedef enum psiconv_justify_ver |
108 | typedef enum psiconv_justify_ver |
92 | { psiconv_justify_top, |
109 | { psiconv_justify_top, |
93 | psiconv_justify_middle, |
110 | psiconv_justify_middle, |
94 | psiconv_justify_bottom |
111 | psiconv_justify_bottom |
95 | } psiconv_justify_ver_t; |
112 | } psiconv_justify_ver_t; |
96 | |
113 | |
|
|
114 | /* Borders around text fields. */ |
97 | typedef enum psiconv_border_kind |
115 | typedef enum psiconv_border_kind |
98 | { psiconv_border_none, |
116 | { psiconv_border_none, /* No border */ |
99 | psiconv_border_solid, |
117 | psiconv_border_solid, /* Single line */ |
100 | psiconv_border_double, |
118 | psiconv_border_double, /* Double line */ |
101 | psiconv_border_dotted, |
119 | psiconv_border_dotted, /* Dotted line: . . . . . */ |
102 | psiconv_border_dashed, |
120 | psiconv_border_dashed, /* Dashed line: _ _ _ _ _ */ |
103 | psiconv_border_dotdashed, |
121 | psiconv_border_dotdashed, /* Dotted/dashed line: _ . _ . _ */ |
104 | psiconv_border_dotdotdashed |
122 | psiconv_border_dotdotdashed /* Dotted/dashed line: . . _ . . _ */ |
105 | } psiconv_border_kind_t; |
123 | } psiconv_border_kind_t; |
106 | |
124 | |
|
|
125 | /* Though each printer driver has its own fonts for printing, they are |
|
|
126 | represented on the Psion screen by a few built-in fonts. */ |
107 | typedef enum psiconv_screenfont |
127 | typedef enum psiconv_screenfont |
108 | { |
128 | { |
109 | psiconv_font_misc, |
129 | psiconv_font_misc, /* Nonproportional symbols, like Wingbat? */ |
110 | psiconv_font_sansserif, |
130 | psiconv_font_sansserif, /* Proportional sans-serif, like Arial */ |
111 | psiconv_font_nonprop, |
131 | psiconv_font_nonprop, /* Nonproportional, like Courier */ |
112 | psiconv_font_serif |
132 | psiconv_font_serif /* Proportional serifed, like Times */ |
113 | } psiconv_screenfont_t; |
133 | } psiconv_screenfont_t; |
114 | |
134 | |
115 | /* Colors. |
135 | |
|
|
136 | /* The kind of tab. Note that decimal tabs are not supported by the Psion. */ |
|
|
137 | typedef enum psiconv_tab_kind |
|
|
138 | { |
|
|
139 | psiconv_tab_left, /* Left tab */ |
|
|
140 | psiconv_tab_centre, /* Centre tab */ |
|
|
141 | psiconv_tab_right /* Right tab */ |
|
|
142 | } psiconv_tab_kind_t; |
|
|
143 | |
|
|
144 | /* When text has to be replaced, the kind of replacement to do |
|
|
145 | (not yet implemented!) */ |
|
|
146 | typedef enum psiconv_replacement_type |
|
|
147 | { |
|
|
148 | psiconv_replace_time, |
|
|
149 | psiconv_replace_date, |
|
|
150 | psiconv_replace_pagenr, |
|
|
151 | psiconv_replace_nr_of_pages, |
|
|
152 | psiconv_replace_filename |
|
|
153 | } psiconv_replacement_type_t; |
|
|
154 | |
|
|
155 | |
|
|
156 | /* Here starts the struct definitions */ |
|
|
157 | |
|
|
158 | /* The color of a single pixel, in RGB format. |
116 | black: 0x00 0x00 0x00 |
159 | Black: 0x00 0x00 0x00 |
117 | white: 0xff 0xff 0xff */ |
160 | White: 0xff 0xff 0xff */ |
118 | typedef struct psiconv_color_s |
161 | typedef struct psiconv_color_s |
119 | { |
162 | { |
120 | psiconv_u8 red; |
163 | psiconv_u8 red; |
121 | psiconv_u8 green; |
164 | psiconv_u8 green; |
122 | psiconv_u8 blue; |
165 | psiconv_u8 blue; |
123 | } * psiconv_color; |
166 | } * psiconv_color; |
124 | |
167 | |
|
|
168 | |
|
|
169 | /* Complete font information: both a printer font and a corresponding screen |
|
|
170 | font to display it. */ |
125 | typedef struct psiconv_font_s |
171 | typedef struct psiconv_font_s |
126 | { |
172 | { |
127 | psiconv_string_t name; |
173 | psiconv_string_t name; /* Printer font */ |
128 | psiconv_screenfont_t screenfont; |
174 | psiconv_screenfont_t screenfont; /* Screen font */ |
129 | } *psiconv_font; |
175 | } *psiconv_font; |
130 | |
176 | |
|
|
177 | /* Complete border information */ |
131 | typedef struct psiconv_border_s |
178 | typedef struct psiconv_border_s |
132 | { |
179 | { |
133 | psiconv_border_kind_t kind; |
180 | psiconv_border_kind_t kind; /* Border kind */ |
134 | psiconv_size_t thickness; /* Set to 1/20 for non-solid lines */ |
181 | psiconv_size_t thickness; /* Set to 1/20 for non-solid lines */ |
135 | psiconv_color color; |
182 | psiconv_color color; /* Border color */ |
136 | } *psiconv_border; |
183 | } *psiconv_border; |
137 | |
184 | |
|
|
185 | /* Complete bullet information. |
|
|
186 | The interaction of left and first line indentation and bullets is quite |
|
|
187 | complicated. |
|
|
188 | |
|
|
189 | BULLET FIRST BULLET FIRST LINE NEXT LINES |
|
|
190 | |
|
|
191 | None = 0 - Left+First Left |
|
|
192 | > 0 - Left+First Left |
|
|
193 | < 0 - Left+First Left |
|
|
194 | |
|
|
195 | Indent Off = 0 Left Left(+Bullet) Left |
|
|
196 | > 0 Left Left+First Left |
|
|
197 | < 0 Left+First Left+First(+Bullet) Left |
|
|
198 | |
|
|
199 | Indent On = 0 Left Left(+Bullet) Left |
|
|
200 | > 0 Left Left+First Left+First |
|
|
201 | < 0 Left+First Left Left |
|
|
202 | */ |
138 | typedef struct psiconv_bullet_s |
203 | typedef struct psiconv_bullet_s |
139 | { |
204 | { |
140 | psiconv_bool_t on; |
205 | psiconv_bool_t on; /* Whether the bullet is shown */ |
141 | psiconv_size_t font_size; |
206 | psiconv_size_t font_size; /* Bullet font size */ |
142 | psiconv_ucs2 character; |
207 | psiconv_ucs2 character; /* Bullet character */ |
143 | psiconv_bool_t indent; |
208 | psiconv_bool_t indent; /* Whether to indent (see above */ |
144 | psiconv_color color; |
209 | psiconv_color color; /* Bullet color */ |
145 | psiconv_font font; |
210 | psiconv_font font; /* Bullet font */ |
146 | } *psiconv_bullet; |
211 | } *psiconv_bullet; |
147 | |
212 | |
148 | typedef enum psiconv_tab_kind |
213 | /* Complete single tab information */ |
149 | { |
|
|
150 | psiconv_tab_left, |
|
|
151 | psiconv_tab_centre, |
|
|
152 | psiconv_tab_right |
|
|
153 | } psiconv_tab_kind_t; |
|
|
154 | |
|
|
155 | typedef struct psiconv_tab_s |
214 | typedef struct psiconv_tab_s |
156 | { |
215 | { |
157 | psiconv_length_t location; |
216 | psiconv_length_t location; /* The indentation level */ |
158 | psiconv_tab_kind_t kind; |
217 | psiconv_tab_kind_t kind; /* Tab kind */ |
159 | } *psiconv_tab; |
218 | } *psiconv_tab; |
160 | |
219 | |
161 | |
220 | /* A list of tabs */ |
162 | typedef psiconv_list psiconv_tab_list; /* of struct psiconv_tab */ |
221 | typedef psiconv_list psiconv_tab_list; /* of struct psiconv_tab_s */ |
163 | |
222 | |
|
|
223 | /* Information about all tabs. |
|
|
224 | Normal tabs start after the rightmost extra tab */ |
164 | typedef struct psiconv_all_tabs_s |
225 | typedef struct psiconv_all_tabs_s |
165 | { |
226 | { |
166 | psiconv_length_t normal; |
227 | psiconv_length_t normal; /* Normal tab distance */ |
167 | psiconv_tab_list extras; |
228 | psiconv_tab_list extras; /* Additional defined tabs */ |
168 | } *psiconv_all_tabs; |
229 | } *psiconv_all_tabs; |
169 | |
230 | |
|
|
231 | /* Character layout. |
|
|
232 | This structure holds all layout information that can be applied on the |
|
|
233 | character level (as opposed to layouts that only apply to whole |
|
|
234 | paragraphs). |
|
|
235 | Note that at all times, this structure holds the complete layout |
|
|
236 | information; we do not use incremental layouts, unlike the Psion |
|
|
237 | file format itself. So if an italic text is also underlined, the |
|
|
238 | character_layout will have both set for that region. */ |
170 | typedef struct psiconv_character_layout_s |
239 | typedef struct psiconv_character_layout_s |
171 | { |
240 | { |
172 | psiconv_color color; |
241 | psiconv_color color; /* Character color */ |
173 | psiconv_color back_color; |
242 | psiconv_color back_color; /* Background color */ |
174 | psiconv_size_t font_size; |
243 | psiconv_size_t font_size; /* Font size */ |
175 | psiconv_bool_t italic; |
244 | psiconv_bool_t italic; /* Use italics? */ |
176 | psiconv_bool_t bold; |
245 | psiconv_bool_t bold; /* Use bold? */ |
177 | psiconv_super_sub_t super_sub; |
246 | psiconv_super_sub_t super_sub; /* Use super/subscript? */ |
178 | psiconv_bool_t underline; |
247 | psiconv_bool_t underline; /* Underline? */ |
179 | psiconv_bool_t strikethrough; |
248 | psiconv_bool_t strikethrough; /* Strike through? */ |
180 | psiconv_font font; |
249 | psiconv_font font; /* Character font */ |
181 | } *psiconv_character_layout; |
250 | } *psiconv_character_layout; |
182 | |
251 | |
|
|
252 | /* Paragraph layout. |
|
|
253 | This structure holds all layout information that can be applied on the |
|
|
254 | paragraph level (as opposed to layouts that also apply to single |
|
|
255 | characters). |
|
|
256 | Note that at all times, this structure holds the complete layout |
|
|
257 | information; we do not use incremental layouts, unlike the Psion |
|
|
258 | file format itself. |
|
|
259 | Linespacing is the amount of vertical space between lines. If |
|
|
260 | linespacing_exact is set, this amount is used even if that would make |
|
|
261 | text overlap; if it is not set, a greater distance is used if text would |
|
|
262 | otherwise overlap. |
|
|
263 | Several booleans determine where page breaks may be set. keep_together |
|
|
264 | forbids page breaks in the middle of the paragraph; keep_with_next |
|
|
265 | forbids page breaks between this and the next paragraph. on_next_page |
|
|
266 | forces a pagebreak before the paragraph. no_widow_protection allows |
|
|
267 | one single line of the paragraph on a page, and the rest on another page. |
|
|
268 | Sheet cell text normally does not wrap; wrap_to_fit_cell allows this. */ |
183 | typedef struct psiconv_paragraph_layout_s |
269 | typedef struct psiconv_paragraph_layout_s |
184 | { |
270 | { |
185 | psiconv_color back_color; |
271 | psiconv_color back_color; /* Background color */ |
186 | psiconv_length_t indent_left; |
272 | psiconv_length_t indent_left; /* Left indentation (except first line) */ |
187 | psiconv_length_t indent_right; |
273 | psiconv_length_t indent_right; /* Right indentation */ |
188 | psiconv_length_t indent_first; |
274 | psiconv_length_t indent_first; /* First line left indentation */ |
189 | psiconv_justify_hor_t justify_hor; |
275 | psiconv_justify_hor_t justify_hor; /* Horizontal justification */ |
190 | psiconv_justify_ver_t justify_ver; |
276 | psiconv_justify_ver_t justify_ver; /* Vertical justification */ |
191 | psiconv_size_t linespacing; |
277 | psiconv_size_t linespacing; /* The linespacing */ |
192 | psiconv_bool_t linespacing_exact; |
278 | psiconv_bool_t linespacing_exact; /* Is linespacing exact or the minimum? */ |
193 | psiconv_size_t space_above; |
279 | psiconv_size_t space_above; /* Vertical space before the paragraph */ |
194 | psiconv_size_t space_below; |
280 | psiconv_size_t space_below; /* Vertical space after the paragraph */ |
195 | psiconv_bool_t keep_together; |
281 | psiconv_bool_t keep_together; /* Keep lines on one page? */ |
196 | psiconv_bool_t keep_with_next; |
282 | psiconv_bool_t keep_with_next; /* Disallow pagebreak after paragraph? */ |
197 | psiconv_bool_t on_next_page; |
283 | psiconv_bool_t on_next_page; /* Force page break before paragraph? */ |
198 | psiconv_bool_t no_widow_protection; |
284 | psiconv_bool_t no_widow_protection; /* Undo widow protection? */ |
199 | psiconv_bool_t wrap_to_fit_cell; |
285 | psiconv_bool_t wrap_to_fit_cell; /* Wrap sheet cell text? */ |
200 | psiconv_length_t border_distance; |
286 | psiconv_length_t border_distance; /* Distance to borders */ |
201 | psiconv_bullet bullet; |
287 | psiconv_bullet bullet; /* Bullet information */ |
202 | psiconv_border left_border; |
288 | psiconv_border left_border; /* Left border information */ |
203 | psiconv_border right_border; |
289 | psiconv_border right_border; /* Right border information */ |
204 | psiconv_border top_border; |
290 | psiconv_border top_border; /* Top border information */ |
205 | psiconv_border bottom_border; |
291 | psiconv_border bottom_border; /* Bottom border information */ |
206 | psiconv_all_tabs tabs; |
292 | psiconv_all_tabs tabs; /* All tab information */ |
207 | } *psiconv_paragraph_layout; |
293 | } *psiconv_paragraph_layout; |
208 | |
294 | |
|
|
295 | /* A Header Section. |
|
|
296 | It contains the three UIDs and the checksum, and the type of file. |
|
|
297 | As the type of file uniquely defines the UIDs, and as the UIDs determine |
|
|
298 | the checksum, this is never included in a regular psiconv_file structure. |
|
|
299 | It can be used to read the header section separately, though. */ |
209 | typedef struct psiconv_header_section_s |
300 | typedef struct psiconv_header_section_s |
210 | { |
301 | { |
211 | psiconv_u32 uid1; |
302 | psiconv_u32 uid1; |
212 | psiconv_u32 uid2; |
303 | psiconv_u32 uid2; |
213 | psiconv_u32 uid3; |
304 | psiconv_u32 uid3; |
214 | psiconv_u32 checksum; |
305 | psiconv_u32 checksum; |
215 | psiconv_file_type_t file; |
306 | psiconv_file_type_t file; |
216 | } *psiconv_header_section; |
307 | } *psiconv_header_section; |
217 | |
308 | |
|
|
309 | /* A Section Table Section entry. |
|
|
310 | Each entry has a UID and an offset. |
|
|
311 | This is never included in a regular psiconv_file structure, as the |
|
|
312 | information is too low-level. It is used internally, though. */ |
218 | typedef struct psiconv_section_table_entry_s |
313 | typedef struct psiconv_section_table_entry_s |
219 | { |
314 | { |
220 | psiconv_u32 id; |
315 | psiconv_u32 id; /* Section UID */ |
221 | psiconv_u32 offset; |
316 | psiconv_u32 offset; /* Section offset within the file */ |
222 | } *psiconv_section_table_entry; |
317 | } *psiconv_section_table_entry; |
223 | |
318 | |
|
|
319 | /* A Section Table Section. |
|
|
320 | A list of sections and their offsets. |
|
|
321 | It is simply a list of Section Table Section Entries. |
|
|
322 | This is never included in a regular psiconv_file structure, as the |
|
|
323 | information is too low-level. It is used internally, though. */ |
224 | typedef psiconv_list psiconv_section_table_section; |
324 | typedef psiconv_list psiconv_section_table_section; |
225 | /* Of struct sectiontable_entry */ |
325 | /* Of struct psiconv_sectiontable_entry_s */ |
226 | |
326 | |
|
|
327 | /* An Application ID Section. |
|
|
328 | The type of file. |
|
|
329 | Never included in a regular psiconv_file structure, because it is too |
|
|
330 | low-level. You can always recover it if you know the file type. Used |
|
|
331 | internally. |
|
|
332 | The name should probably be case-insensitive. */ |
227 | typedef struct psiconv_application_id_section_s |
333 | typedef struct psiconv_application_id_section_s |
228 | { |
334 | { |
229 | psiconv_u32 id; |
335 | psiconv_u32 id; /* File type UID */ |
230 | psiconv_string_t name; |
336 | psiconv_string_t name; /* File type name */ |
231 | } *psiconv_application_id_section; |
337 | } *psiconv_application_id_section; |
232 | |
338 | |
|
|
339 | /* An Object Icon Section. |
|
|
340 | The icon used for an embedded object. */ |
233 | typedef struct psiconv_object_icon_section_s |
341 | typedef struct psiconv_object_icon_section_s |
234 | { |
342 | { |
235 | psiconv_length_t icon_width; |
343 | psiconv_length_t icon_width; /* Icon width */ |
236 | psiconv_length_t icon_height; |
344 | psiconv_length_t icon_height; /* Icon height */ |
237 | psiconv_string_t icon_name; |
345 | psiconv_string_t icon_name; /* Icon name */ |
238 | } *psiconv_object_icon_section; |
346 | } *psiconv_object_icon_section; |
239 | |
347 | |
|
|
348 | /* An Object Display Section. |
|
|
349 | How an embedded icon should be displayed. |
|
|
350 | The sizes are computed after cropping or resizing; if the object is shown |
|
|
351 | as an icon, the icon sizes are used here. */ |
240 | typedef struct psiconv_object_display_section_s |
352 | typedef struct psiconv_object_display_section_s |
241 | { |
353 | { |
242 | psiconv_bool_t show_icon; |
354 | psiconv_bool_t show_icon; /* Show an icon or the whole file? */ |
243 | psiconv_length_t width; |
355 | psiconv_length_t width; /* Object display width */ |
244 | psiconv_length_t height; |
356 | psiconv_length_t height; /* Object display height */ |
245 | } *psiconv_object_display_section; |
357 | } *psiconv_object_display_section; |
246 | |
358 | |
|
|
359 | /* An Embedded Object Section. |
|
|
360 | All data about an embedded object. |
|
|
361 | An object is another psiconv_file, which is embedded in the current |
|
|
362 | file. Objects can also be embedded in each other, of course. */ |
247 | typedef struct psiconv_embedded_object_section_s |
363 | typedef struct psiconv_embedded_object_section_s |
248 | { |
364 | { |
249 | psiconv_object_icon_section icon; |
365 | psiconv_object_icon_section icon; /* Icon information */ |
250 | psiconv_object_display_section display; |
366 | psiconv_object_display_section display; /* Display information */ |
251 | psiconv_file object; |
367 | psiconv_file object; /* The object itself */ |
252 | } *psiconv_embedded_object_section; |
368 | } *psiconv_embedded_object_section; |
253 | |
369 | |
|
|
370 | /* Inline character-level layout information. |
|
|
371 | Information how some characters should be laid out. |
|
|
372 | Note that, though you can choose specific layouts for an object, this |
|
|
373 | will probably not affect the object's rendering. |
|
|
374 | Usually, object will be NULL, and the object_width and object_height |
|
|
375 | will be ignored. |
|
|
376 | The object sizes are the same as in the Object Display Section, so |
|
|
377 | this information seems to be redundant. */ |
254 | typedef struct psiconv_in_line_layout_s |
378 | typedef struct psiconv_in_line_layout_s |
255 | { |
379 | { |
256 | psiconv_character_layout layout; |
380 | psiconv_character_layout layout; /* Layout information */ |
257 | int length; |
381 | int length; /* Number of characters */ |
258 | /* If object is NULL, this does not apply to an object */ |
382 | psiconv_embedded_object_section object; /* Embedded object or NULL */ |
259 | psiconv_embedded_object_section object; |
383 | psiconv_length_t object_width; /* Object display width */ |
260 | psiconv_length_t object_width; |
384 | psiconv_length_t object_height; /* Object display height */ |
261 | psiconv_length_t object_height; |
|
|
262 | } *psiconv_in_line_layout; |
385 | } *psiconv_in_line_layout; |
263 | |
386 | |
|
|
387 | /* Inline character information for a whole line. |
|
|
388 | A list of inline character information */ |
264 | typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */ |
389 | typedef psiconv_list psiconv_in_line_layouts; |
|
|
390 | /* of struct psiconv_in_line_layout_s */ |
265 | |
391 | |
266 | typedef enum psiconv_replacement_type |
392 | /* What to replace where in text. Not yet implemented! |
267 | { |
393 | (not yet implemented!) */ |
268 | psiconv_replace_time, |
|
|
269 | psiconv_replace_date, |
|
|
270 | psiconv_replace_pagenr, |
|
|
271 | psiconv_replace_nr_of_pages, |
|
|
272 | psiconv_replace_filename |
|
|
273 | } psiconv_replacement_type_t; |
|
|
274 | |
|
|
275 | typedef struct psiconv_replacement_s |
394 | typedef struct psiconv_replacement_s |
276 | { |
395 | { |
277 | int offset; |
396 | int offset; /* Offset in text */ |
278 | int cur_len; |
397 | int cur_len; /* Length of text to replace */ |
279 | psiconv_replacement_type_t type; |
398 | psiconv_replacement_type_t type; /* Kind of replacement */ |
280 | } *psiconv_replacement; |
399 | } *psiconv_replacement; |
281 | |
400 | |
|
|
401 | /* A list of replacements */ |
282 | typedef psiconv_list psiconv_replacements; /* of struct replacement */ |
402 | typedef psiconv_list psiconv_replacements; /* of struct psiconv_replacement_s */ |
283 | |
403 | |
|
|
404 | /* A paragraph of text. |
|
|
405 | Layout and actual paragraph text are combined here, even though |
|
|
406 | they are seperated in the Psion file format. |
|
|
407 | The base style is referred to, but the base_character and |
|
|
408 | base_paragraph have all style settings already incorporated. |
|
|
409 | The base style can be found using the psiconv_get_style function. |
|
|
410 | The in_lines are either an empty list, or they should apply to exactly |
|
|
411 | the number of characters in this paragraph */ |
284 | typedef struct psiconv_paragraph_s |
412 | typedef struct psiconv_paragraph_s |
285 | { |
413 | { |
286 | psiconv_string_t text; |
414 | psiconv_string_t text; /* Paragraph text */ |
287 | psiconv_character_layout base_character; |
415 | psiconv_character_layout base_character; /* Base character layout */ |
288 | psiconv_paragraph_layout base_paragraph; |
416 | psiconv_paragraph_layout base_paragraph; /* Base paragraph layout */ |
289 | psiconv_s16 base_style; |
417 | psiconv_s16 base_style; /* Paragraph style */ |
290 | psiconv_in_line_layouts in_lines; |
418 | psiconv_in_line_layouts in_lines; /* In-paragraph layout */ |
291 | psiconv_replacements replacements; |
419 | psiconv_replacements replacements; /* Replacements like the date */ |
292 | } *psiconv_paragraph; |
420 | } *psiconv_paragraph; |
293 | |
421 | |
|
|
422 | /* A collection of text paragraphs */ |
294 | typedef psiconv_list psiconv_text_and_layout; /* Of struct paragraphs */ |
423 | typedef psiconv_list psiconv_text_and_layout; |
|
|
424 | /* Of struct psiconv_paragraph_s */ |
295 | |
425 | |
|
|
426 | /* A TextEd Section. |
|
|
427 | Text and simple layout, without styles. */ |
296 | typedef struct psiconv_texted_section_s |
428 | typedef struct psiconv_texted_section_s |
297 | { |
429 | { |
298 | psiconv_text_and_layout paragraphs; |
430 | psiconv_text_and_layout paragraphs; |
299 | } *psiconv_texted_section; |
431 | } *psiconv_texted_section; |
300 | |
432 | |
|
|
433 | /* A Page Header. |
|
|
434 | All information about a page header or footer. |
|
|
435 | An explicit base paragraph and character layout is found; this is used |
|
|
436 | as a sort of base style, on which all further formatting is based */ |
301 | typedef struct psiconv_page_header_s |
437 | typedef struct psiconv_page_header_s |
302 | { |
438 | { |
303 | psiconv_bool_t on_first_page; |
439 | psiconv_bool_t on_first_page; /* Display on first page? */ |
304 | psiconv_paragraph_layout base_paragraph_layout; |
440 | psiconv_paragraph_layout base_paragraph_layout; /* Base paragraph layout */ |
305 | psiconv_character_layout base_character_layout; |
441 | psiconv_character_layout base_character_layout; /* Base character layout */ |
306 | psiconv_texted_section text; |
442 | psiconv_texted_section text; /* The actual text */ |
307 | } *psiconv_page_header; |
443 | } *psiconv_page_header; |
308 | |
444 | |
|
|
445 | /* A Page Layout Section |
|
|
446 | All information about the layout of a page. |
|
|
447 | Margins, page size, the header, the footer and page numbers */ |
309 | typedef struct psiconv_page_layout_section_s |
448 | typedef struct psiconv_page_layout_section_s |
310 | { |
449 | { |
311 | psiconv_u32 first_page_nr; |
450 | psiconv_u32 first_page_nr; /* Page numbers start counting here */ |
312 | psiconv_length_t header_dist; |
451 | psiconv_length_t header_dist; /* Distance of header to text */ |
313 | psiconv_length_t footer_dist; |
452 | psiconv_length_t footer_dist; /* Distance of footer to text */ |
314 | psiconv_length_t left_margin; |
453 | psiconv_length_t left_margin; /* Left margin */ |
315 | psiconv_length_t right_margin; |
454 | psiconv_length_t right_margin; /* Right margin */ |
316 | psiconv_length_t top_margin; |
455 | psiconv_length_t top_margin; /* Top margin */ |
317 | psiconv_length_t bottom_margin; |
456 | psiconv_length_t bottom_margin; /* Bottom margin */ |
318 | psiconv_length_t page_width; |
457 | psiconv_length_t page_width; /* Page width */ |
319 | psiconv_length_t page_height; |
458 | psiconv_length_t page_height; /* Page height */ |
320 | psiconv_page_header header; |
459 | psiconv_page_header header; /* Header information */ |
321 | psiconv_page_header footer; |
460 | psiconv_page_header footer; /* Footer information */ |
322 | psiconv_bool_t landscape; |
461 | psiconv_bool_t landscape; /* Landscape orientation? */ |
323 | } * psiconv_page_layout_section; |
462 | } * psiconv_page_layout_section; |
324 | |
463 | |
|
|
464 | /* A Word Status Section |
|
|
465 | Settings of the Word program. |
|
|
466 | Several whitespace and related characters can be explicitely shown. |
|
|
467 | Embedded pictures and graphs can be iconized or displayed full. |
|
|
468 | Toolbars can be shown or hidden. |
|
|
469 | Long lines can be wrapped, or you have to use scrolling. |
|
|
470 | The cursor position is the character number of the text. |
|
|
471 | Zoom level: 1000 is "normal" */ |
325 | typedef struct psiconv_word_status_section_s |
472 | typedef struct psiconv_word_status_section_s |
326 | { |
473 | { |
327 | psiconv_bool_t show_tabs; |
474 | psiconv_bool_t show_tabs; /* Show tabs? */ |
328 | psiconv_bool_t show_spaces; |
475 | psiconv_bool_t show_spaces; /* Show spaces? */ |
329 | psiconv_bool_t show_paragraph_ends; |
476 | psiconv_bool_t show_paragraph_ends; /* Show paragraph ends? */ |
330 | psiconv_bool_t show_line_breaks; |
477 | psiconv_bool_t show_line_breaks; /* Show line breaks */ |
331 | psiconv_bool_t show_hard_minus; |
478 | psiconv_bool_t show_hard_minus; /* Show hard dashes? */ |
332 | psiconv_bool_t show_hard_space; |
479 | psiconv_bool_t show_hard_space; /* Show hard spaces? */ |
333 | psiconv_bool_t show_full_pictures; |
480 | psiconv_bool_t show_full_pictures; /* Show embedded pictures (or iconize)? */ |
334 | psiconv_bool_t show_full_graphs; |
481 | psiconv_bool_t show_full_graphs; /* Show embedded graphs (or iconize)? */ |
335 | psiconv_bool_t show_top_toolbar; |
482 | psiconv_bool_t show_top_toolbar; /* Show top toolbar? */ |
336 | psiconv_bool_t show_side_toolbar; |
483 | psiconv_bool_t show_side_toolbar; /* Show side toolbar? */ |
337 | psiconv_bool_t fit_lines_to_screen; |
484 | psiconv_bool_t fit_lines_to_screen; /* Wrap lines? */ |
338 | psiconv_u32 cursor_position; |
485 | psiconv_u32 cursor_position; /* Cursor position (character number) */ |
339 | psiconv_u32 display_size; |
486 | psiconv_u32 display_size; /* Zooming level */ |
340 | } *psiconv_word_status_section; |
487 | } *psiconv_word_status_section; |
341 | |
488 | |
|
|
489 | /* A Word Style. |
|
|
490 | All information about a single Style. |
|
|
491 | A builtin style may not be changed in the Word program. |
|
|
492 | Outline level is zero if unused. |
|
|
493 | The name may be NULL for the normal style! */ |
342 | typedef struct psiconv_word_style_s |
494 | typedef struct psiconv_word_style_s |
343 | { |
495 | { |
344 | psiconv_character_layout character; |
496 | psiconv_character_layout character; /* character-level layout */ |
345 | psiconv_paragraph_layout paragraph; |
497 | psiconv_paragraph_layout paragraph; /* paragraph-level layout */ |
346 | psiconv_u8 hotkey; |
498 | psiconv_ucs2 hotkey; /* The hotkey */ |
347 | psiconv_string_t name; |
499 | psiconv_string_t name; /* Style name */ |
348 | psiconv_bool_t built_in; |
500 | psiconv_bool_t built_in; /* Builtin style? */ |
349 | psiconv_u32 outline_level; |
501 | psiconv_u32 outline_level; /* Outline level */ |
350 | } *psiconv_word_style; |
502 | } *psiconv_word_style; |
351 | |
503 | |
|
|
504 | /* A list of Word Styles */ |
352 | typedef psiconv_list psiconv_word_style_list; /* Of style */ |
505 | typedef psiconv_list psiconv_word_style_list; |
|
|
506 | /* Of struct psiconv_word_style_s */ |
353 | |
507 | |
|
|
508 | /* A Word Styles Section |
|
|
509 | All information about styles. |
|
|
510 | Note that the name of the normal style is NULL! */ |
354 | typedef struct psiconv_word_styles_section_s |
511 | typedef struct psiconv_word_styles_section_s |
355 | { |
512 | { |
356 | psiconv_word_style normal; |
513 | psiconv_word_style normal; /* The normal (unspecified) style */ |
357 | psiconv_word_style_list styles; |
514 | psiconv_word_style_list styles; /* All other defined styles */ |
358 | } *psiconv_word_styles_section; |
515 | } *psiconv_word_styles_section; |
359 | |
516 | |
|
|
517 | /* A Word File |
|
|
518 | All information about a Word File. |
|
|
519 | Note that a section can be NULL if it is not present. */ |
360 | typedef struct psiconv_word_f_s |
520 | typedef struct psiconv_word_f_s |
361 | { |
521 | { |
362 | psiconv_page_layout_section page_sec; |
522 | psiconv_page_layout_section page_sec; /* Page layout */ |
363 | psiconv_text_and_layout paragraphs; |
523 | psiconv_text_and_layout paragraphs; /* Text and text layout */ |
364 | psiconv_word_status_section status_sec; |
524 | psiconv_word_status_section status_sec; /* Internal Word program settings */ |
365 | psiconv_word_styles_section styles_sec; |
525 | psiconv_word_styles_section styles_sec; /* Styles */ |
366 | } *psiconv_word_f; |
526 | } *psiconv_word_f; |
367 | |
527 | |
|
|
528 | /* A TextEd File |
|
|
529 | All information about a TextEd File. |
|
|
530 | Note that a section can be NULL if it is not present. */ |
368 | typedef struct psiconv_texted_f_s |
531 | typedef struct psiconv_texted_f_s |
369 | { |
532 | { |
370 | psiconv_page_layout_section page_sec; |
533 | psiconv_page_layout_section page_sec; /* Page layout */ |
371 | psiconv_texted_section texted_sec; |
534 | psiconv_texted_section texted_sec; /* Text and text layout */ |
372 | } *psiconv_texted_f; |
535 | } *psiconv_texted_f; |
373 | |
536 | |
|
|
537 | /* A Jumptable Section. |
|
|
538 | A simple list of offsets. |
|
|
539 | This is never included in a regular psiconv_file structure, as the |
|
|
540 | information is too low-level. It is used internally, though. */ |
374 | typedef psiconv_list psiconv_jumptable_section; /* of psiconv_u32 */ |
541 | typedef psiconv_list psiconv_jumptable_section; /* of psiconv_u32 */ |
375 | |
542 | |
|
|
543 | /* A Paint Data Section |
|
|
544 | A collection of pixels. |
376 | /* Normalized values [0..1] for each component |
545 | Normalized values [0..1] for each color component. |
377 | Origin is (x,y)=(0,0), to get pixel at (X,Y) use index [Y*xsize+X] */ |
546 | Origin is (x,y)=(0,0), to get pixel at (X,Y) use index [Y*xsize+X] */ |
378 | typedef struct psiconv_paint_data_section_s |
547 | typedef struct psiconv_paint_data_section_s |
379 | { |
548 | { |
380 | psiconv_u32 xsize; |
549 | psiconv_u32 xsize; /* Number of pixels in a row */ |
381 | psiconv_u32 ysize; |
550 | psiconv_u32 ysize; /* Number of pixels in a column */ |
382 | psiconv_length_t pic_xsize; /* 0 if not specified */ |
551 | psiconv_length_t pic_xsize; /* 0 if not specified */ |
383 | psiconv_length_t pic_ysize; /* 0 if not specified */ |
552 | psiconv_length_t pic_ysize; /* 0 if not specified */ |
384 | float *red; |
553 | float *red; |
385 | float *green; |
554 | float *green; |
386 | float *blue; |
555 | float *blue; |
387 | } *psiconv_paint_data_section; |
556 | } *psiconv_paint_data_section; |
388 | |
557 | |
|
|
558 | /* A collection of Paint Data Sections */ |
389 | typedef psiconv_list psiconv_pictures; |
559 | typedef psiconv_list psiconv_pictures; |
390 | /* of struct psiconv_paint_data_section */ |
560 | /* of struct psiconv_paint_data_section_s */ |
391 | |
561 | |
|
|
562 | /* A MBM file |
|
|
563 | All information about a MBM file |
|
|
564 | MBM files contain one or more pictures. */ |
392 | typedef struct psiconv_mbm_f_s |
565 | typedef struct psiconv_mbm_f_s |
393 | { |
566 | { |
394 | psiconv_pictures sections; |
567 | psiconv_pictures sections; |
395 | } *psiconv_mbm_f; |
568 | } *psiconv_mbm_f; |
396 | |
569 | |
… | |
… | |
428 | { |
601 | { |
429 | /* Perhaps later on some currently unknown stuff. */ |
602 | /* Perhaps later on some currently unknown stuff. */ |
430 | psiconv_paint_data_section picture; |
603 | psiconv_paint_data_section picture; |
431 | } * psiconv_clipart_section; |
604 | } * psiconv_clipart_section; |
432 | |
605 | |
433 | typedef psiconv_list psiconv_cliparts; /* of struct psiconv_clipart_section */ |
606 | typedef psiconv_list psiconv_cliparts; /* of struct psiconv_clipart_section_s */ |
434 | |
607 | |
435 | typedef struct psiconv_clipart_f_s |
608 | typedef struct psiconv_clipart_f_s |
436 | { |
609 | { |
437 | psiconv_cliparts sections; |
610 | psiconv_cliparts sections; |
438 | } *psiconv_clipart_f; |
611 | } *psiconv_clipart_f; |
… | |
… | |
540 | psiconv_sheet_cell_layout layout; |
713 | psiconv_sheet_cell_layout layout; |
541 | psiconv_bool_t calculated; |
714 | psiconv_bool_t calculated; |
542 | psiconv_u32 ref_formula; |
715 | psiconv_u32 ref_formula; |
543 | } *psiconv_sheet_cell; |
716 | } *psiconv_sheet_cell; |
544 | |
717 | |
545 | typedef psiconv_list psiconv_sheet_cell_list; |
718 | typedef psiconv_list psiconv_sheet_cell_list; |
|
|
719 | /* Of struct psiconv_sheet_cell_s */ |
546 | |
720 | |
547 | typedef struct psiconv_sheet_status_section_s |
721 | typedef struct psiconv_sheet_status_section_s |
548 | { |
722 | { |
549 | psiconv_bool_t show_graph; |
723 | psiconv_bool_t show_graph; |
550 | psiconv_u32 cursor_row; |
724 | psiconv_u32 cursor_row; |
… | |
… | |
889 | extern psiconv_character_layout psiconv_clone_character_layout |
1063 | extern psiconv_character_layout psiconv_clone_character_layout |
890 | (psiconv_character_layout ls); |
1064 | (psiconv_character_layout ls); |
891 | |
1065 | |
892 | /* Get a numbered style. Returns NULL if the style is unknown. */ |
1066 | /* Get a numbered style. Returns NULL if the style is unknown. */ |
893 | extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr); |
1067 | extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr); |
|
|
1068 | |
|
|
1069 | /* Return the number corresponding to the stylename. Returns 0 on success, |
|
|
1070 | an error code on failure. */ |
|
|
1071 | extern int psiconv_find_style(const psiconv_word_styles_section ss, |
|
|
1072 | const psiconv_ucs2 *name,int *nr); |
|
|
1073 | |
894 | /* Get a numbered formula. Returns NULL if the style is unknown. */ |
1074 | /* Get a numbered formula. Returns NULL if the style is unknown. */ |
895 | extern psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr); |
1075 | extern psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr); |
896 | |
1076 | |
897 | /* Return the default layout */ |
1077 | /* Return the default layout */ |
898 | extern psiconv_sheet_cell_layout psiconv_get_default_layout |
1078 | extern psiconv_sheet_cell_layout psiconv_get_default_layout |
… | |
… | |
908 | extern void psiconv_free_tab(psiconv_tab tab); |
1088 | extern void psiconv_free_tab(psiconv_tab tab); |
909 | extern void psiconv_free_tabs(psiconv_all_tabs tabs); |
1089 | extern void psiconv_free_tabs(psiconv_all_tabs tabs); |
910 | extern void psiconv_free_paragraph_layout(psiconv_paragraph_layout layout); |
1090 | extern void psiconv_free_paragraph_layout(psiconv_paragraph_layout layout); |
911 | extern void psiconv_free_character_layout(psiconv_character_layout layout); |
1091 | extern void psiconv_free_character_layout(psiconv_character_layout layout); |
912 | extern void psiconv_free_word_style(psiconv_word_style style); |
1092 | extern void psiconv_free_word_style(psiconv_word_style style); |
|
|
1093 | extern void psiconv_free_word_style_list(psiconv_word_style_list style_list); |
913 | extern void psiconv_free_word_styles_section |
1094 | extern void psiconv_free_word_styles_section |
914 | (psiconv_word_styles_section styles); |
1095 | (psiconv_word_styles_section styles); |
915 | extern void psiconv_free_formula(psiconv_formula formula); |
1096 | extern void psiconv_free_formula(psiconv_formula formula); |
916 | extern void psiconv_free_formula_list(psiconv_formula_list list); |
1097 | extern void psiconv_free_formula_list(psiconv_formula_list list); |
917 | extern void psiconv_free_sheet_status_section |
1098 | extern void psiconv_free_sheet_status_section |