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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 43 - (hide annotations)
Sat Dec 4 00:40:10 1999 UTC (20 years, 6 months ago) by frodo
File MIME type: text/plain
File size: 14921 byte(s)
(Frodo) Clipart file parsing completed

1 frodo 2 /*
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 frodo 12 psiconv_mbm_file,
38 frodo 41 psiconv_sketch_file,
39     psiconv_clipart_file
40 frodo 2 } psiconv_file_type_t;
41    
42     /* Length indicators */
43     typedef psiconv_u32 psiconv_S_t;
44     typedef psiconv_u32 psiconv_X_t;
45    
46     /* A string */
47     typedef char *psiconv_string_t;
48    
49     /* In the Psion file, these are identical; but we translate them to more
50     human-readable quantities */
51     typedef float psiconv_length_t; /* For offsets in centimeters */
52     typedef float psiconv_size_t; /* For sizes in points */
53    
54     /* Some enums */
55     typedef enum psiconv_bool
56     {
57     psiconv_bool_false,
58     psiconv_bool_true
59     } psiconv_bool_t;
60    
61     typedef enum psiconv_super_sub
62     { psiconv_normalscript,
63     psiconv_superscript,
64     psiconv_subscript
65     } psiconv_super_sub_t;
66    
67     typedef enum psiconv_justify_hor
68     { psiconv_justify_left,
69     psiconv_justify_centre,
70     psiconv_justify_right,
71     psiconv_justify_full
72     } psiconv_justify_hor_t;
73    
74     typedef enum psiconv_justify_ver
75     { psiconv_justify_top,
76     psiconv_justify_middle,
77     psiconv_justify_bottom
78     } psiconv_justify_ver_t;
79    
80     typedef enum psiconv_border_kind
81     { psiconv_border_none,
82     psiconv_border_solid,
83     psiconv_border_double,
84     psiconv_border_dotted,
85     psiconv_border_striped,
86     psiconv_border_dotstripe,
87     psiconv_border_dotdotstripe
88     } psiconv_border_kind_t;
89    
90     /* Colors.
91     black: 0x00 0x00 0x00
92     white: 0xff 0xff 0xff */
93     typedef struct psiconv_color
94     {
95     psiconv_u8 red;
96     psiconv_u8 green;
97     psiconv_u8 blue;
98     } * psiconv_color;
99    
100     typedef struct psiconv_font
101     {
102     char *name;
103     psiconv_u8 screenfont;
104     } *psiconv_font;
105    
106     typedef struct psiconv_border
107     {
108     psiconv_border_kind_t kind;
109     psiconv_size_t thickness; /* Set to 1/20 for non-solid lines */
110     psiconv_color color;
111     } *psiconv_border;
112    
113     typedef struct psiconv_bullet
114     {
115     psiconv_bool_t on;
116     psiconv_size_t font_size;
117     psiconv_u8 character;
118     psiconv_bool_t indent;
119     psiconv_color color;
120     psiconv_font font;
121     } *psiconv_bullet;
122    
123     typedef enum psiconv_tab_kind
124     {
125     psiconv_tab_left,
126     psiconv_tab_centre,
127     psiconv_tab_right
128     } psiconv_tab_kind_t;
129    
130     typedef struct psiconv_tab
131     {
132     psiconv_length_t location;
133     psiconv_tab_kind_t kind;
134     } *psiconv_tab;
135    
136    
137     typedef psiconv_list psiconv_tab_list; /* of struct psiconv_tab */
138    
139     typedef struct psiconv_all_tabs
140     {
141     psiconv_length_t normal;
142     psiconv_tab_list extras;
143     } *psiconv_all_tabs;
144    
145     typedef struct psiconv_character_layout
146     {
147     psiconv_color color;
148     psiconv_color back_color;
149     psiconv_size_t font_size;
150     psiconv_bool_t italic;
151     psiconv_bool_t bold;
152     psiconv_super_sub_t super_sub;
153     psiconv_bool_t underline;
154     psiconv_bool_t strike_out;
155     psiconv_font font;
156     } *psiconv_character_layout;
157    
158     typedef struct psiconv_paragraph_layout
159     {
160     psiconv_color back_color;
161     psiconv_length_t indent_left;
162     psiconv_length_t indent_right;
163     psiconv_length_t indent_first;
164     psiconv_justify_hor_t justify_hor;
165     psiconv_justify_ver_t justify_ver;
166     psiconv_size_t interline;
167     psiconv_bool_t interline_exact;
168     psiconv_size_t top_space;
169     psiconv_size_t bottom_space;
170     psiconv_bool_t on_one_page;
171     psiconv_bool_t together_with; /* What the heck is this? */
172     psiconv_bool_t on_next_page;
173     psiconv_bool_t no_widow_protection;
174     psiconv_length_t border_distance;
175     psiconv_bullet bullet;
176     psiconv_border left_border;
177     psiconv_border right_border;
178     psiconv_border top_border;
179     psiconv_border bottom_border;
180     psiconv_all_tabs tabs;
181     } *psiconv_paragraph_layout;
182    
183     typedef struct psiconv_header_section
184     {
185     psiconv_u32 uid1;
186     psiconv_u32 uid2;
187     psiconv_u32 uid3;
188     psiconv_u32 checksum;
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 frodo 28 psiconv_u32 outline_level;
298 frodo 2 } *psiconv_word_style;
299    
300     typedef psiconv_list psiconv_word_style_list; /* Of style */
301    
302     typedef struct psiconv_word_styles_section
303     {
304     psiconv_word_style normal;
305     psiconv_word_style_list styles;
306     } *psiconv_word_styles_section;
307    
308     typedef struct psiconv_word_f {
309     psiconv_page_layout_section page_sec;
310     psiconv_text_and_layout paragraphs;
311     psiconv_word_status_section status_sec;
312     psiconv_word_styles_section styles_sec;
313     } *psiconv_word_f;
314    
315     typedef struct psiconv_texted_f {
316     psiconv_page_layout_section page_sec;
317     psiconv_texted_section texted_sec;
318     } *psiconv_texted_f;
319    
320 frodo 42 typedef psiconv_list psiconv_jumptable_section; /* of psiconv_u32 */
321 frodo 12
322 frodo 11 /* Normalized values [0..1] for each component
323     Origin is (x,y)=(0,0), to get pixel at (X,Y) use index [Y*xsize+X] */
324     typedef struct psiconv_paint_data_section {
325     psiconv_u32 xsize;
326     psiconv_u32 ysize;
327 frodo 25 psiconv_length_t pic_xsize; /* 0 if not specified */
328     psiconv_length_t pic_ysize; /* 0 if not specified */
329 frodo 11 float *red;
330     float *green;
331     float *blue;
332     } *psiconv_paint_data_section;
333    
334 frodo 12 typedef psiconv_list psiconv_pictures;
335     /* of struct psiconv_paint_data_section */
336    
337     typedef struct psiconv_mbm_f {
338     psiconv_pictures sections;
339     } *psiconv_mbm_f;
340    
341 frodo 24 /* This is a little intricated. A picture may be embedded in a larger form.
342     A form is empty, except for the picture. The form has size form_{x,y}size,
343     and the picture is at offset picture_{x,y}_offset within the form. The
344     picture itself has size picture_{x,y}size.
345     Cuts are always <= 1.0; a cut of 0.0 cuts nothing away, a cut of 1.0
346     cuts everything away. */
347     typedef struct psiconv_sketch_section {
348     psiconv_u16 form_xsize;
349     psiconv_u16 form_ysize;
350     psiconv_u16 picture_x_offset;
351     psiconv_u16 picture_y_offset;
352     psiconv_u16 picture_xsize;
353     psiconv_u16 picture_ysize;
354     float magnification_x; /* computed relative to first six values */
355     float magnification_y; /* computed relative to first six values */
356     float cut_left; /* computed relative to first six values */
357     float cut_right; /* computed relative to first six values */
358     float cut_top; /* computed relative to first six values */
359     float cut_bottom; /* computed relative to first six values */
360     psiconv_paint_data_section picture;
361     } *psiconv_sketch_section;
362    
363     typedef struct psiconv_sketch_f {
364     psiconv_sketch_section sketch_sec;
365     } *psiconv_sketch_f;
366    
367 frodo 41 typedef struct psiconv_clipart_section {
368     /* Perhaps later on some currently unknown stuff. */
369     psiconv_paint_data_section picture;
370     } * psiconv_clipart_section;
371    
372     typedef psiconv_list psiconv_cliparts; /* of struct psiconv_clipart_section */
373    
374     typedef struct psiconv_clipart_f {
375     psiconv_cliparts sections;
376     } *psiconv_clipart_f;
377    
378 frodo 2 typedef struct psiconv_file {
379     psiconv_file_type_t type;
380     void *file;
381     } *psiconv_file;
382    
383    
384     /* UID1 */
385     #define PSICONV_ID_PSION5 0x10000037
386 frodo 41 #define PSICONV_ID_CLIPART 0x10000041
387 frodo 2 /* UID2 */
388     #define PSICONV_ID_DATA_FILE 0x1000006D
389 frodo 12 #define PSICONV_ID_MBM_FILE 0x10000042
390 frodo 2 /* UID3 */
391     #define PSICONV_ID_WORD 0x1000007F
392     #define PSICONV_ID_TEXTED 0x10000085
393 frodo 24 #define PSICONV_ID_SKETCH 0x1000007D
394 frodo 2
395     /* Section table ids */
396     #define PSICONV_ID_WORD_STATUS_SECTION 0x10000243
397     #define PSICONV_ID_APPL_ID_SECTION 0x10000089
398     #define PSICONV_ID_TEXT_SECTION 0x10000106
399     #define PSICONV_ID_LAYOUT_SECTION 0x10000143
400     #define PSICONV_ID_WORD_STYLES_SECTION 0x10000104
401     #define PSICONV_ID_PAGE_LAYOUT_SECTION 0x10000105
402     #define PSICONV_ID_PASSWORD_SECTION 0x100000CD
403 frodo 24 #define PSICONV_ID_SKETCH_SECTION 0x1000007D
404 frodo 2
405     /* Other ids */
406     #define PSICONV_ID_PAGE_DIMENSIONS 0x100000fd
407     #define PSICONV_ID_TEXTED_BODY 0x1000005c
408     #define PSICONV_ID_TEXTED_REPLACEMENT 0x10000063
409     #define PSICONV_ID_TEXTED_UNKNOWN 0x10000065
410     #define PSICONV_ID_TEXTED_LAYOUT 0x10000066
411     #define PSICONV_ID_TEXTED_TEXT 0x10000064
412     #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F
413     #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C
414 frodo 43 #define PSICONV_ID_CLIPART_ITEM 0x10000040
415 frodo 2
416    
417     /* Return a clean layout_status. You can modify it at will */
418     extern psiconv_character_layout psiconv_basic_character_layout(void);
419    
420     /* Return a clean layout_status. You can modify it at will */
421     extern psiconv_paragraph_layout psiconv_basic_paragraph_layout(void);
422    
423     /* Clone a layout_status: the new copy is completely independent of the
424     original one */
425     extern psiconv_paragraph_layout psiconv_clone_paragraph_layout
426     (psiconv_paragraph_layout ls);
427    
428     extern psiconv_character_layout psiconv_clone_character_layout
429     (psiconv_character_layout ls);
430    
431     /* Get a numbered style */
432     extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr);
433    
434     extern void psiconv_free_color(psiconv_color color);
435     extern void psiconv_free_border(psiconv_border border);
436     extern void psiconv_free_bullet(psiconv_bullet bullet);
437     extern void psiconv_free_font(psiconv_font font);
438     extern void psiconv_free_tab(psiconv_tab tab);
439     extern void psiconv_free_tabs(psiconv_all_tabs tabs);
440     extern void psiconv_free_paragraph_layout(psiconv_paragraph_layout layout);
441     extern void psiconv_free_character_layout(psiconv_character_layout layout);
442     extern void psiconv_free_word_style(psiconv_word_style style);
443     extern void psiconv_free_word_styles_section
444     (psiconv_word_styles_section styles);
445     extern void psiconv_free_header_section(psiconv_header_section header);
446     extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry);
447     extern void psiconv_free_section_table_section
448     (psiconv_section_table_section section);
449     extern void psiconv_free_application_id_section
450     (psiconv_application_id_section section);
451     extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout);
452     extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts);
453     extern void psiconv_free_replacement(psiconv_replacement replacement);
454     extern void psiconv_free_replacements(psiconv_replacements replacements);
455     extern void psiconv_free_paragraph(psiconv_paragraph paragraph);
456     extern void psiconv_free_text_and_layout(psiconv_text_and_layout text);
457     extern void psiconv_free_texted_section(psiconv_texted_section section);
458     extern void psiconv_free_page_header(psiconv_page_header header);
459     extern void psiconv_free_page_layout_section
460     (psiconv_page_layout_section section);
461     extern void psiconv_free_word_status_section
462     (psiconv_word_status_section section);
463     extern void psiconv_free_word_f(psiconv_word_f file);
464 frodo 12 extern void psiconv_free_texted_f(psiconv_texted_f file);
465     extern void psiconv_free_paint_data_section(psiconv_paint_data_section section);
466     extern void psiconv_free_pictures(psiconv_pictures section);
467 frodo 42 extern void psiconv_free_jumptable_section
468     (psiconv_jumptable_section section);
469 frodo 12 extern void psiconv_free_mbm_f(psiconv_mbm_f file);
470 frodo 24 extern void psiconv_free_sketch_section(psiconv_sketch_section sec);
471     extern void psiconv_free_sketch_f(psiconv_sketch_f file);
472 frodo 41 extern void psiconv_free_clipart_section(psiconv_clipart_section section);
473     extern void psiconv_free_cliparts(psiconv_cliparts section);
474     extern void psiconv_free_clipart_f(psiconv_clipart_f file);
475 frodo 24
476 frodo 41
477 frodo 2 extern void psiconv_free_file(psiconv_file file);
478    
479    
480     #endif /* def PSICONV_DATA_H */

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