/[public]/psiconv/trunk/lib/psiconv/data.h
ViewVC logotype

Contents of /psiconv/trunk/lib/psiconv/data.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations)
Sun Oct 3 21:10:47 1999 UTC (24 years, 6 months ago) by frodo
File MIME type: text/plain
File size: 11873 byte(s)
Imported sources

1 /*
2 data.h - Part of psiconv, a PSION 5 file formats converter
3 Copyright (c) 1999 Frodo Looijaard <frodol@dds.nl>
4
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
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
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
22 parse routines, and read by the generation routines. */
23
24 #ifndef PSICONV_DATA_H
25 #define PSICONV_DATA_H
26
27 #include "general.h"
28 #include "list.h"
29
30 /* All types which end on _t are plain types; all other types are pointers
31 to structs */
32
33 typedef enum psiconv_file_type {
34 psiconv_unknown_file,
35 psiconv_word_file,
36 psiconv_texted_file,
37 psiconv_mfm_file,
38 psiconv_sketch_file
39 } psiconv_file_type_t;
40
41 /* Length indicators */
42 typedef psiconv_u32 psiconv_S_t;
43 typedef psiconv_u32 psiconv_X_t;
44
45 /* A string */
46 typedef char *psiconv_string_t;
47
48 /* In the Psion file, these are identical; but we translate them to more
49 human-readable quantities */
50 typedef float psiconv_length_t; /* For offsets in centimeters */
51 typedef float psiconv_size_t; /* For sizes in points */
52
53 /* Some enums */
54 typedef enum psiconv_bool
55 {
56 psiconv_bool_false,
57 psiconv_bool_true
58 } psiconv_bool_t;
59
60 typedef enum psiconv_super_sub
61 { psiconv_normalscript,
62 psiconv_superscript,
63 psiconv_subscript
64 } psiconv_super_sub_t;
65
66 typedef enum psiconv_justify_hor
67 { psiconv_justify_left,
68 psiconv_justify_centre,
69 psiconv_justify_right,
70 psiconv_justify_full
71 } psiconv_justify_hor_t;
72
73 typedef enum psiconv_justify_ver
74 { psiconv_justify_top,
75 psiconv_justify_middle,
76 psiconv_justify_bottom
77 } psiconv_justify_ver_t;
78
79 typedef enum psiconv_border_kind
80 { psiconv_border_none,
81 psiconv_border_solid,
82 psiconv_border_double,
83 psiconv_border_dotted,
84 psiconv_border_striped,
85 psiconv_border_dotstripe,
86 psiconv_border_dotdotstripe
87 } psiconv_border_kind_t;
88
89 /* Colors.
90 black: 0x00 0x00 0x00
91 white: 0xff 0xff 0xff */
92 typedef struct psiconv_color
93 {
94 psiconv_u8 red;
95 psiconv_u8 green;
96 psiconv_u8 blue;
97 } * psiconv_color;
98
99 typedef struct psiconv_font
100 {
101 char *name;
102 psiconv_u8 screenfont;
103 } *psiconv_font;
104
105 typedef struct psiconv_border
106 {
107 psiconv_border_kind_t kind;
108 psiconv_size_t thickness; /* Set to 1/20 for non-solid lines */
109 psiconv_color color;
110 } *psiconv_border;
111
112 typedef struct psiconv_bullet
113 {
114 psiconv_bool_t on;
115 psiconv_size_t font_size;
116 psiconv_u8 character;
117 psiconv_bool_t indent;
118 psiconv_color color;
119 psiconv_font font;
120 } *psiconv_bullet;
121
122 typedef enum psiconv_tab_kind
123 {
124 psiconv_tab_left,
125 psiconv_tab_centre,
126 psiconv_tab_right
127 } psiconv_tab_kind_t;
128
129 typedef struct psiconv_tab
130 {
131 psiconv_length_t location;
132 psiconv_tab_kind_t kind;
133 } *psiconv_tab;
134
135
136 typedef psiconv_list psiconv_tab_list; /* of struct psiconv_tab */
137
138 typedef struct psiconv_all_tabs
139 {
140 psiconv_length_t normal;
141 psiconv_tab_list extras;
142 } *psiconv_all_tabs;
143
144 typedef struct psiconv_character_layout
145 {
146 psiconv_color color;
147 psiconv_color back_color;
148 psiconv_size_t font_size;
149 psiconv_bool_t italic;
150 psiconv_bool_t bold;
151 psiconv_super_sub_t super_sub;
152 psiconv_bool_t underline;
153 psiconv_bool_t strike_out;
154 psiconv_font font;
155 } *psiconv_character_layout;
156
157 typedef struct psiconv_paragraph_layout
158 {
159 psiconv_color back_color;
160 psiconv_length_t indent_left;
161 psiconv_length_t indent_right;
162 psiconv_length_t indent_first;
163 psiconv_justify_hor_t justify_hor;
164 psiconv_justify_ver_t justify_ver;
165 psiconv_size_t interline;
166 psiconv_bool_t interline_exact;
167 psiconv_size_t top_space;
168 psiconv_size_t bottom_space;
169 psiconv_bool_t on_one_page;
170 psiconv_bool_t together_with; /* What the heck is this? */
171 psiconv_bool_t on_next_page;
172 psiconv_bool_t no_widow_protection;
173 psiconv_length_t border_distance;
174 psiconv_bullet bullet;
175 psiconv_border left_border;
176 psiconv_border right_border;
177 psiconv_border top_border;
178 psiconv_border bottom_border;
179 psiconv_all_tabs tabs;
180 } *psiconv_paragraph_layout;
181
182 typedef struct psiconv_header_section
183 {
184 psiconv_u32 uid1;
185 psiconv_u32 uid2;
186 psiconv_u32 uid3;
187 psiconv_u32 checksum;
188 psiconv_u32 section_table_offset;
189 psiconv_file_type_t file;
190 } *psiconv_header_section;
191
192 typedef struct psiconv_section_table_entry
193 {
194 psiconv_u32 id;
195 psiconv_u32 offset;
196 } *psiconv_section_table_entry;
197
198 typedef psiconv_list psiconv_section_table_section;
199 /* Of struct sectiontable_entry */
200
201 typedef struct psiconv_application_id_section
202 {
203 psiconv_u32 id;
204 psiconv_string_t name;
205 } *psiconv_application_id_section;
206
207 typedef struct psiconv_in_line_layout
208 {
209 psiconv_character_layout layout;
210 int length;
211 } *psiconv_in_line_layout;
212
213 typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */
214
215 typedef enum psiconv_replacement_type
216 {
217 psiconv_replace_time,
218 psiconv_replace_date,
219 psiconv_replace_pagenr,
220 psiconv_replace_nr_of_pages,
221 psiconv_replace_filename
222 } psiconv_replacement_type_t;
223
224 typedef struct psiconv_replacement
225 {
226 int offset;
227 int cur_len;
228 psiconv_replacement_type_t type;
229 } *psiconv_replacement;
230
231 typedef psiconv_list psiconv_replacements; /* of struct replacement */
232
233 typedef struct psiconv_paragraph
234 {
235 char *text;
236 psiconv_character_layout base_character;
237 psiconv_paragraph_layout base_paragraph;
238 psiconv_s16 base_style;
239 psiconv_in_line_layouts in_lines;
240 psiconv_replacements replacements;
241 } *psiconv_paragraph;
242
243 typedef psiconv_list psiconv_text_and_layout; /* Of struct paragraphs */
244
245 typedef struct psiconv_texted_section
246 {
247 psiconv_text_and_layout paragraphs;
248 } *psiconv_texted_section;
249
250 typedef struct psiconv_page_header
251 {
252 psiconv_bool_t on_first_page;
253 psiconv_paragraph_layout base_paragraph_layout;
254 psiconv_character_layout base_character_layout;
255 psiconv_texted_section text;
256 } *psiconv_page_header;
257
258 typedef struct psiconv_page_layout_section
259 {
260 psiconv_u32 first_page_nr;
261 psiconv_length_t header_dist;
262 psiconv_length_t footer_dist;
263 psiconv_length_t left_margin;
264 psiconv_length_t right_margin;
265 psiconv_length_t top_margin;
266 psiconv_length_t bottom_margin;
267 psiconv_length_t page_width;
268 psiconv_length_t page_height;
269 psiconv_page_header header;
270 psiconv_page_header footer;
271 } * psiconv_page_layout_section;
272
273 typedef struct psiconv_word_status_section
274 {
275 psiconv_bool_t show_tabs;
276 psiconv_bool_t show_spaces;
277 psiconv_bool_t show_paragraph_ends;
278 psiconv_bool_t show_line_breaks;
279 psiconv_bool_t show_hard_minus;
280 psiconv_bool_t show_hard_space;
281 psiconv_bool_t show_full_pictures;
282 psiconv_bool_t show_full_graphs;
283 psiconv_bool_t show_top_toolbar;
284 psiconv_bool_t show_side_toolbar;
285 psiconv_bool_t fit_lines_to_screen;
286 psiconv_u32 cursor_position;
287 psiconv_u32 display_size;
288 } *psiconv_word_status_section;
289
290 typedef struct psiconv_word_style
291 {
292 psiconv_character_layout character;
293 psiconv_paragraph_layout paragraph;
294 psiconv_u8 hotkey;
295 psiconv_string_t name;
296 psiconv_bool_t built_in;
297 } *psiconv_word_style;
298
299 typedef psiconv_list psiconv_word_style_list; /* Of style */
300
301 typedef struct psiconv_word_styles_section
302 {
303 psiconv_word_style normal;
304 psiconv_word_style_list styles;
305 } *psiconv_word_styles_section;
306
307 typedef struct psiconv_word_f {
308 psiconv_page_layout_section page_sec;
309 psiconv_text_and_layout paragraphs;
310 psiconv_word_status_section status_sec;
311 psiconv_word_styles_section styles_sec;
312 } *psiconv_word_f;
313
314 typedef struct psiconv_texted_f {
315 psiconv_page_layout_section page_sec;
316 psiconv_texted_section texted_sec;
317 } *psiconv_texted_f;
318
319 typedef struct psiconv_file {
320 psiconv_file_type_t type;
321 void *file;
322 } *psiconv_file;
323
324
325 /* UID1 */
326 #define PSICONV_ID_PSION5 0x10000037
327 /* UID2 */
328 #define PSICONV_ID_DATA_FILE 0x1000006D
329 /* UID3 */
330 #define PSICONV_ID_WORD 0x1000007F
331 #define PSICONV_ID_TEXTED 0x10000085
332
333 /* Section table ids */
334 #define PSICONV_ID_WORD_STATUS_SECTION 0x10000243
335 #define PSICONV_ID_APPL_ID_SECTION 0x10000089
336 #define PSICONV_ID_TEXT_SECTION 0x10000106
337 #define PSICONV_ID_LAYOUT_SECTION 0x10000143
338 #define PSICONV_ID_WORD_STYLES_SECTION 0x10000104
339 #define PSICONV_ID_PAGE_LAYOUT_SECTION 0x10000105
340 #define PSICONV_ID_PASSWORD_SECTION 0x100000CD
341
342 /* Other ids */
343 #define PSICONV_ID_PAGE_DIMENSIONS 0x100000fd
344 #define PSICONV_ID_TEXTED_BODY 0x1000005c
345 #define PSICONV_ID_TEXTED_REPLACEMENT 0x10000063
346 #define PSICONV_ID_TEXTED_UNKNOWN 0x10000065
347 #define PSICONV_ID_TEXTED_LAYOUT 0x10000066
348 #define PSICONV_ID_TEXTED_TEXT 0x10000064
349 #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F
350 #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C
351
352
353 /* Return a clean layout_status. You can modify it at will */
354 extern psiconv_character_layout psiconv_basic_character_layout(void);
355
356 /* Return a clean layout_status. You can modify it at will */
357 extern psiconv_paragraph_layout psiconv_basic_paragraph_layout(void);
358
359 /* Clone a layout_status: the new copy is completely independent of the
360 original one */
361 extern psiconv_paragraph_layout psiconv_clone_paragraph_layout
362 (psiconv_paragraph_layout ls);
363
364 extern psiconv_character_layout psiconv_clone_character_layout
365 (psiconv_character_layout ls);
366
367 /* Get a numbered style */
368 extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr);
369
370 extern void psiconv_free_color(psiconv_color color);
371 extern void psiconv_free_border(psiconv_border border);
372 extern void psiconv_free_bullet(psiconv_bullet bullet);
373 extern void psiconv_free_font(psiconv_font font);
374 extern void psiconv_free_tab(psiconv_tab tab);
375 extern void psiconv_free_tabs(psiconv_all_tabs tabs);
376 extern void psiconv_free_paragraph_layout(psiconv_paragraph_layout layout);
377 extern void psiconv_free_character_layout(psiconv_character_layout layout);
378 extern void psiconv_free_word_style(psiconv_word_style style);
379 extern void psiconv_free_word_styles_section
380 (psiconv_word_styles_section styles);
381 extern void psiconv_free_header_section(psiconv_header_section header);
382 extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry);
383 extern void psiconv_free_section_table_section
384 (psiconv_section_table_section section);
385 extern void psiconv_free_application_id_section
386 (psiconv_application_id_section section);
387 extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout);
388 extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts);
389 extern void psiconv_free_replacement(psiconv_replacement replacement);
390 extern void psiconv_free_replacements(psiconv_replacements replacements);
391 extern void psiconv_free_paragraph(psiconv_paragraph paragraph);
392 extern void psiconv_free_text_and_layout(psiconv_text_and_layout text);
393 extern void psiconv_free_texted_section(psiconv_texted_section section);
394 extern void psiconv_free_page_header(psiconv_page_header header);
395 extern void psiconv_free_page_layout_section
396 (psiconv_page_layout_section section);
397 extern void psiconv_free_word_status_section
398 (psiconv_word_status_section section);
399 extern void psiconv_free_word_f(psiconv_word_f file);
400 extern void psiconv_free_file(psiconv_file file);
401
402
403 #endif /* def PSICONV_DATA_H */

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26