/[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 90 - (hide annotations)
Wed Jan 10 16:39:30 2001 UTC (23 years, 2 months ago) by frodo
File MIME type: text/plain
File size: 16775 byte(s)
(Frodo) Abstracted screenfont into enum

1 frodo 2 /*
2     data.h - Part of psiconv, a PSION 5 file formats converter
3 frodo 63 Copyright (c) 1999, 2000 Frodo Looijaard <frodol@dds.nl>
4 frodo 2
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 frodo 58 #include <psiconv/general.h>
28     #include <psiconv/list.h>
29 frodo 2
30     /* All types which end on _t are plain types; all other types are pointers
31     to structs */
32    
33 frodo 55 #ifdef __cplusplus
34     extern "C" {
35     #endif /* __cplusplus */
36    
37    
38 frodo 2 typedef enum psiconv_file_type {
39     psiconv_unknown_file,
40     psiconv_word_file,
41     psiconv_texted_file,
42 frodo 12 psiconv_mbm_file,
43 frodo 41 psiconv_sketch_file,
44     psiconv_clipart_file
45 frodo 2 } psiconv_file_type_t;
46    
47     /* Length indicators */
48     typedef psiconv_u32 psiconv_S_t;
49     typedef psiconv_u32 psiconv_X_t;
50    
51     /* A string */
52     typedef char *psiconv_string_t;
53    
54     /* In the Psion file, these are identical; but we translate them to more
55     human-readable quantities */
56     typedef float psiconv_length_t; /* For offsets in centimeters */
57     typedef float psiconv_size_t; /* For sizes in points */
58    
59     /* Some enums */
60     typedef enum psiconv_bool
61     {
62     psiconv_bool_false,
63     psiconv_bool_true
64     } psiconv_bool_t;
65    
66     typedef enum psiconv_super_sub
67     { psiconv_normalscript,
68     psiconv_superscript,
69     psiconv_subscript
70     } psiconv_super_sub_t;
71    
72     typedef enum psiconv_justify_hor
73     { psiconv_justify_left,
74     psiconv_justify_centre,
75     psiconv_justify_right,
76     psiconv_justify_full
77     } psiconv_justify_hor_t;
78    
79     typedef enum psiconv_justify_ver
80     { psiconv_justify_top,
81     psiconv_justify_middle,
82     psiconv_justify_bottom
83     } psiconv_justify_ver_t;
84    
85     typedef enum psiconv_border_kind
86     { psiconv_border_none,
87     psiconv_border_solid,
88     psiconv_border_double,
89     psiconv_border_dotted,
90 frodo 67 psiconv_border_dashed,
91     psiconv_border_dotdashed,
92     psiconv_border_dotdotdashed
93 frodo 2 } psiconv_border_kind_t;
94    
95 frodo 90 typedef enum psiconv_screenfont
96     {
97     psiconv_font_misc,
98     psiconv_font_sansserif,
99     psiconv_font_nonprop,
100     psiconv_font_serif
101     } psiconv_screenfont_t;
102    
103 frodo 2 /* Colors.
104     black: 0x00 0x00 0x00
105     white: 0xff 0xff 0xff */
106 frodo 56 typedef struct psiconv_color_s
107 frodo 2 {
108     psiconv_u8 red;
109     psiconv_u8 green;
110     psiconv_u8 blue;
111     } * psiconv_color;
112    
113 frodo 56 typedef struct psiconv_font_s
114 frodo 2 {
115     char *name;
116 frodo 90 psiconv_screenfont_t screenfont;
117 frodo 2 } *psiconv_font;
118    
119 frodo 56 typedef struct psiconv_border_s
120 frodo 2 {
121     psiconv_border_kind_t kind;
122     psiconv_size_t thickness; /* Set to 1/20 for non-solid lines */
123     psiconv_color color;
124     } *psiconv_border;
125    
126 frodo 56 typedef struct psiconv_bullet_s
127 frodo 2 {
128     psiconv_bool_t on;
129     psiconv_size_t font_size;
130     psiconv_u8 character;
131     psiconv_bool_t indent;
132     psiconv_color color;
133     psiconv_font font;
134     } *psiconv_bullet;
135    
136     typedef enum psiconv_tab_kind
137     {
138     psiconv_tab_left,
139     psiconv_tab_centre,
140     psiconv_tab_right
141     } psiconv_tab_kind_t;
142    
143 frodo 56 typedef struct psiconv_tab_s
144 frodo 2 {
145     psiconv_length_t location;
146     psiconv_tab_kind_t kind;
147     } *psiconv_tab;
148    
149    
150     typedef psiconv_list psiconv_tab_list; /* of struct psiconv_tab */
151    
152 frodo 56 typedef struct psiconv_all_tabs_s
153 frodo 2 {
154     psiconv_length_t normal;
155     psiconv_tab_list extras;
156     } *psiconv_all_tabs;
157    
158 frodo 56 typedef struct psiconv_character_layout_s
159 frodo 2 {
160     psiconv_color color;
161     psiconv_color back_color;
162     psiconv_size_t font_size;
163     psiconv_bool_t italic;
164     psiconv_bool_t bold;
165     psiconv_super_sub_t super_sub;
166     psiconv_bool_t underline;
167 frodo 67 psiconv_bool_t strikethrough;
168 frodo 2 psiconv_font font;
169     } *psiconv_character_layout;
170    
171 frodo 56 typedef struct psiconv_paragraph_layout_s
172 frodo 2 {
173     psiconv_color back_color;
174     psiconv_length_t indent_left;
175     psiconv_length_t indent_right;
176     psiconv_length_t indent_first;
177     psiconv_justify_hor_t justify_hor;
178     psiconv_justify_ver_t justify_ver;
179 frodo 67 psiconv_size_t linespacing;
180     psiconv_bool_t linespacing_exact;
181     psiconv_size_t space_above;
182     psiconv_size_t space_below;
183     psiconv_bool_t keep_together;
184     psiconv_bool_t keep_with_next;
185 frodo 2 psiconv_bool_t on_next_page;
186     psiconv_bool_t no_widow_protection;
187     psiconv_length_t border_distance;
188     psiconv_bullet bullet;
189     psiconv_border left_border;
190     psiconv_border right_border;
191     psiconv_border top_border;
192     psiconv_border bottom_border;
193     psiconv_all_tabs tabs;
194     } *psiconv_paragraph_layout;
195    
196 frodo 56 typedef struct psiconv_header_section_s
197 frodo 2 {
198     psiconv_u32 uid1;
199     psiconv_u32 uid2;
200     psiconv_u32 uid3;
201     psiconv_u32 checksum;
202     psiconv_file_type_t file;
203     } *psiconv_header_section;
204    
205 frodo 56 typedef struct psiconv_section_table_entry_s
206 frodo 2 {
207     psiconv_u32 id;
208     psiconv_u32 offset;
209     } *psiconv_section_table_entry;
210    
211     typedef psiconv_list psiconv_section_table_section;
212     /* Of struct sectiontable_entry */
213    
214 frodo 56 typedef struct psiconv_application_id_section_s
215 frodo 2 {
216     psiconv_u32 id;
217     psiconv_string_t name;
218     } *psiconv_application_id_section;
219    
220 frodo 56 typedef struct psiconv_in_line_layout_s
221 frodo 2 {
222     psiconv_character_layout layout;
223     int length;
224     } *psiconv_in_line_layout;
225    
226     typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */
227    
228     typedef enum psiconv_replacement_type
229     {
230     psiconv_replace_time,
231     psiconv_replace_date,
232     psiconv_replace_pagenr,
233     psiconv_replace_nr_of_pages,
234     psiconv_replace_filename
235     } psiconv_replacement_type_t;
236    
237 frodo 56 typedef struct psiconv_replacement_s
238 frodo 2 {
239     int offset;
240     int cur_len;
241     psiconv_replacement_type_t type;
242     } *psiconv_replacement;
243    
244     typedef psiconv_list psiconv_replacements; /* of struct replacement */
245    
246 frodo 56 typedef struct psiconv_paragraph_s
247 frodo 2 {
248     char *text;
249     psiconv_character_layout base_character;
250     psiconv_paragraph_layout base_paragraph;
251     psiconv_s16 base_style;
252     psiconv_in_line_layouts in_lines;
253     psiconv_replacements replacements;
254     } *psiconv_paragraph;
255    
256     typedef psiconv_list psiconv_text_and_layout; /* Of struct paragraphs */
257    
258 frodo 56 typedef struct psiconv_texted_section_s
259 frodo 2 {
260     psiconv_text_and_layout paragraphs;
261     } *psiconv_texted_section;
262    
263 frodo 56 typedef struct psiconv_page_header_s
264 frodo 2 {
265     psiconv_bool_t on_first_page;
266     psiconv_paragraph_layout base_paragraph_layout;
267     psiconv_character_layout base_character_layout;
268     psiconv_texted_section text;
269     } *psiconv_page_header;
270    
271 frodo 56 typedef struct psiconv_page_layout_section_s
272 frodo 2 {
273     psiconv_u32 first_page_nr;
274     psiconv_length_t header_dist;
275     psiconv_length_t footer_dist;
276     psiconv_length_t left_margin;
277     psiconv_length_t right_margin;
278     psiconv_length_t top_margin;
279     psiconv_length_t bottom_margin;
280     psiconv_length_t page_width;
281     psiconv_length_t page_height;
282     psiconv_page_header header;
283     psiconv_page_header footer;
284 frodo 76 psiconv_bool_t landscape;
285 frodo 2 } * psiconv_page_layout_section;
286    
287 frodo 56 typedef struct psiconv_word_status_section_s
288 frodo 2 {
289     psiconv_bool_t show_tabs;
290     psiconv_bool_t show_spaces;
291     psiconv_bool_t show_paragraph_ends;
292     psiconv_bool_t show_line_breaks;
293     psiconv_bool_t show_hard_minus;
294     psiconv_bool_t show_hard_space;
295     psiconv_bool_t show_full_pictures;
296     psiconv_bool_t show_full_graphs;
297     psiconv_bool_t show_top_toolbar;
298     psiconv_bool_t show_side_toolbar;
299     psiconv_bool_t fit_lines_to_screen;
300     psiconv_u32 cursor_position;
301     psiconv_u32 display_size;
302     } *psiconv_word_status_section;
303    
304 frodo 56 typedef struct psiconv_word_style_s
305 frodo 2 {
306     psiconv_character_layout character;
307     psiconv_paragraph_layout paragraph;
308     psiconv_u8 hotkey;
309     psiconv_string_t name;
310     psiconv_bool_t built_in;
311 frodo 28 psiconv_u32 outline_level;
312 frodo 2 } *psiconv_word_style;
313    
314     typedef psiconv_list psiconv_word_style_list; /* Of style */
315    
316 frodo 56 typedef struct psiconv_word_styles_section_s
317 frodo 2 {
318     psiconv_word_style normal;
319     psiconv_word_style_list styles;
320     } *psiconv_word_styles_section;
321    
322 frodo 56 typedef struct psiconv_word_f_s
323     {
324 frodo 2 psiconv_page_layout_section page_sec;
325     psiconv_text_and_layout paragraphs;
326     psiconv_word_status_section status_sec;
327     psiconv_word_styles_section styles_sec;
328     } *psiconv_word_f;
329    
330 frodo 56 typedef struct psiconv_texted_f_s
331     {
332 frodo 2 psiconv_page_layout_section page_sec;
333     psiconv_texted_section texted_sec;
334     } *psiconv_texted_f;
335    
336 frodo 42 typedef psiconv_list psiconv_jumptable_section; /* of psiconv_u32 */
337 frodo 12
338 frodo 11 /* Normalized values [0..1] for each component
339     Origin is (x,y)=(0,0), to get pixel at (X,Y) use index [Y*xsize+X] */
340 frodo 56 typedef struct psiconv_paint_data_section_s
341     {
342 frodo 11 psiconv_u32 xsize;
343     psiconv_u32 ysize;
344 frodo 25 psiconv_length_t pic_xsize; /* 0 if not specified */
345     psiconv_length_t pic_ysize; /* 0 if not specified */
346 frodo 11 float *red;
347     float *green;
348     float *blue;
349     } *psiconv_paint_data_section;
350    
351 frodo 12 typedef psiconv_list psiconv_pictures;
352     /* of struct psiconv_paint_data_section */
353    
354 frodo 56 typedef struct psiconv_mbm_f_s
355     {
356 frodo 12 psiconv_pictures sections;
357     } *psiconv_mbm_f;
358    
359 frodo 24 /* This is a little intricated. A picture may be embedded in a larger form.
360     A form is empty, except for the picture. The form has size form_{x,y}size,
361     and the picture is at offset picture_{x,y}_offset within the form. The
362     picture itself has size picture_{x,y}size.
363     Cuts are always <= 1.0; a cut of 0.0 cuts nothing away, a cut of 1.0
364     cuts everything away. */
365 frodo 56 typedef struct psiconv_sketch_section_s
366     {
367 frodo 24 psiconv_u16 form_xsize;
368     psiconv_u16 form_ysize;
369     psiconv_u16 picture_x_offset;
370     psiconv_u16 picture_y_offset;
371     psiconv_u16 picture_xsize;
372     psiconv_u16 picture_ysize;
373     float magnification_x; /* computed relative to first six values */
374     float magnification_y; /* computed relative to first six values */
375     float cut_left; /* computed relative to first six values */
376     float cut_right; /* computed relative to first six values */
377     float cut_top; /* computed relative to first six values */
378     float cut_bottom; /* computed relative to first six values */
379     psiconv_paint_data_section picture;
380     } *psiconv_sketch_section;
381    
382 frodo 56 typedef struct psiconv_sketch_f_s
383     {
384 frodo 24 psiconv_sketch_section sketch_sec;
385     } *psiconv_sketch_f;
386    
387 frodo 56 typedef struct psiconv_clipart_section_s
388     {
389 frodo 41 /* Perhaps later on some currently unknown stuff. */
390     psiconv_paint_data_section picture;
391     } * psiconv_clipart_section;
392    
393     typedef psiconv_list psiconv_cliparts; /* of struct psiconv_clipart_section */
394    
395 frodo 56 typedef struct psiconv_clipart_f_s
396     {
397 frodo 41 psiconv_cliparts sections;
398     } *psiconv_clipart_f;
399    
400 frodo 56 typedef struct psiconv_file_s
401     {
402 frodo 2 psiconv_file_type_t type;
403     void *file;
404     } *psiconv_file;
405    
406    
407     /* UID1 */
408     #define PSICONV_ID_PSION5 0x10000037
409 frodo 41 #define PSICONV_ID_CLIPART 0x10000041
410 frodo 2 /* UID2 */
411     #define PSICONV_ID_DATA_FILE 0x1000006D
412 frodo 12 #define PSICONV_ID_MBM_FILE 0x10000042
413 frodo 2 /* UID3 */
414     #define PSICONV_ID_WORD 0x1000007F
415     #define PSICONV_ID_TEXTED 0x10000085
416 frodo 24 #define PSICONV_ID_SKETCH 0x1000007D
417 frodo 2
418     /* Section table ids */
419     #define PSICONV_ID_WORD_STATUS_SECTION 0x10000243
420     #define PSICONV_ID_APPL_ID_SECTION 0x10000089
421     #define PSICONV_ID_TEXT_SECTION 0x10000106
422     #define PSICONV_ID_LAYOUT_SECTION 0x10000143
423     #define PSICONV_ID_WORD_STYLES_SECTION 0x10000104
424     #define PSICONV_ID_PAGE_LAYOUT_SECTION 0x10000105
425     #define PSICONV_ID_PASSWORD_SECTION 0x100000CD
426 frodo 24 #define PSICONV_ID_SKETCH_SECTION 0x1000007D
427 frodo 2
428     /* Other ids */
429 frodo 76 #define PSICONV_ID_PAGE_DIMENSIONS1 0x100000fd
430     #define PSICONV_ID_PAGE_DIMENSIONS2 0x1000010e
431 frodo 2 #define PSICONV_ID_TEXTED_BODY 0x1000005c
432     #define PSICONV_ID_TEXTED_REPLACEMENT 0x10000063
433     #define PSICONV_ID_TEXTED_UNKNOWN 0x10000065
434     #define PSICONV_ID_TEXTED_LAYOUT 0x10000066
435     #define PSICONV_ID_TEXTED_TEXT 0x10000064
436     #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F
437     #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C
438 frodo 43 #define PSICONV_ID_CLIPART_ITEM 0x10000040
439 frodo 2
440    
441 frodo 62 /* Return a clean layout_status. You can modify it at will. Returns NULL
442     if there is not enough memory. */
443 frodo 2 extern psiconv_character_layout psiconv_basic_character_layout(void);
444    
445 frodo 62 /* Return a clean layout_status. You can modify it at will. Returns NULL
446     if there is not enough memory. */
447 frodo 2 extern psiconv_paragraph_layout psiconv_basic_paragraph_layout(void);
448    
449     /* Clone a layout_status: the new copy is completely independent of the
450 frodo 62 original one. Returns NULL if there is not enough memory. */
451 frodo 2 extern psiconv_paragraph_layout psiconv_clone_paragraph_layout
452     (psiconv_paragraph_layout ls);
453    
454     extern psiconv_character_layout psiconv_clone_character_layout
455     (psiconv_character_layout ls);
456    
457 frodo 62 /* Get a numbered style. Returns NULL if the style is unknown. */
458 frodo 2 extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr);
459    
460     extern void psiconv_free_color(psiconv_color color);
461     extern void psiconv_free_border(psiconv_border border);
462     extern void psiconv_free_bullet(psiconv_bullet bullet);
463     extern void psiconv_free_font(psiconv_font font);
464     extern void psiconv_free_tab(psiconv_tab tab);
465     extern void psiconv_free_tabs(psiconv_all_tabs tabs);
466     extern void psiconv_free_paragraph_layout(psiconv_paragraph_layout layout);
467     extern void psiconv_free_character_layout(psiconv_character_layout layout);
468     extern void psiconv_free_word_style(psiconv_word_style style);
469     extern void psiconv_free_word_styles_section
470     (psiconv_word_styles_section styles);
471     extern void psiconv_free_header_section(psiconv_header_section header);
472     extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry);
473     extern void psiconv_free_section_table_section
474     (psiconv_section_table_section section);
475     extern void psiconv_free_application_id_section
476     (psiconv_application_id_section section);
477     extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout);
478     extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts);
479     extern void psiconv_free_replacement(psiconv_replacement replacement);
480     extern void psiconv_free_replacements(psiconv_replacements replacements);
481     extern void psiconv_free_paragraph(psiconv_paragraph paragraph);
482     extern void psiconv_free_text_and_layout(psiconv_text_and_layout text);
483     extern void psiconv_free_texted_section(psiconv_texted_section section);
484     extern void psiconv_free_page_header(psiconv_page_header header);
485     extern void psiconv_free_page_layout_section
486     (psiconv_page_layout_section section);
487     extern void psiconv_free_word_status_section
488     (psiconv_word_status_section section);
489     extern void psiconv_free_word_f(psiconv_word_f file);
490 frodo 12 extern void psiconv_free_texted_f(psiconv_texted_f file);
491     extern void psiconv_free_paint_data_section(psiconv_paint_data_section section);
492     extern void psiconv_free_pictures(psiconv_pictures section);
493 frodo 42 extern void psiconv_free_jumptable_section
494     (psiconv_jumptable_section section);
495 frodo 12 extern void psiconv_free_mbm_f(psiconv_mbm_f file);
496 frodo 24 extern void psiconv_free_sketch_section(psiconv_sketch_section sec);
497     extern void psiconv_free_sketch_f(psiconv_sketch_f file);
498 frodo 41 extern void psiconv_free_clipart_section(psiconv_clipart_section section);
499     extern void psiconv_free_cliparts(psiconv_cliparts section);
500     extern void psiconv_free_clipart_f(psiconv_clipart_f file);
501 frodo 24
502 frodo 2 extern void psiconv_free_file(psiconv_file file);
503    
504 frodo 78 extern int psiconv_compare_color(const psiconv_color value1,
505     const psiconv_color value2);
506     extern int psiconv_compare_font(const psiconv_font value1,
507     const psiconv_font value2);
508     extern int psiconv_compare_border(const psiconv_border value1,
509     const psiconv_border value2);
510     extern int psiconv_compare_bullet(const psiconv_bullet value1,
511     const psiconv_bullet value2);
512     extern int psiconv_compare_tab(const psiconv_tab value1,
513     const psiconv_tab value2);
514     extern int psiconv_compare_all_tabs(const psiconv_all_tabs value1,
515     const psiconv_all_tabs value2);
516     extern int psiconv_compare_paragraph_layout
517     (const psiconv_paragraph_layout value1,
518     const psiconv_paragraph_layout value2);
519    
520     extern int psiconv_compare_character_layout
521     (const psiconv_character_layout value1,
522     const psiconv_character_layout value2);
523    
524 frodo 87 /* Get a newly allocated file with sensible defaults, ready to generate. */
525     extern psiconv_file psiconv_empty_file(psiconv_file_type_t type);
526 frodo 78
527 frodo 87
528 frodo 55 #ifdef __cplusplus
529     }
530     #endif /* __cplusplus */
531 frodo 2
532     #endif /* def PSICONV_DATA_H */

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