… | |
… | |
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 | #include "config.h" |
20 | #include "config.h" |
|
|
21 | #include "compat.h" |
21 | #include <stdlib.h> |
22 | #include <stdlib.h> |
22 | #include <string.h> |
23 | #include <string.h> |
23 | #include "data.h" |
24 | #include "data.h" |
24 | #include "list.h" |
25 | #include "list.h" |
25 | #include "general.h" |
26 | #include "general.h" |
… | |
… | |
30 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
31 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
31 | static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs); |
32 | static psiconv_all_tabs clone_all_tabs(psiconv_all_tabs all_tabs); |
32 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paragraph_aux(void * paragraph); |
|
|
36 | static void psiconv_free_paint_data_section_aux(void * section); |
|
|
37 | static void psiconv_free_clipart_section_aux(void * section); |
35 | |
38 | |
36 | psiconv_character_layout psiconv_basic_character_layout(void) |
39 | psiconv_character_layout psiconv_basic_character_layout(void) |
37 | { |
40 | { |
|
|
41 | /* Make the structures static, to oblige IRIX */ |
38 | struct psiconv_color black = |
42 | static struct psiconv_color black = |
39 | { |
43 | { |
40 | 0x00, /* red */ |
44 | 0x00, /* red */ |
41 | 0x00, /* green */ |
45 | 0x00, /* green */ |
42 | 0x00, /* blue */ |
46 | 0x00, /* blue */ |
43 | }; |
47 | }; |
44 | struct psiconv_color white = |
48 | static struct psiconv_color white = |
45 | { |
49 | { |
46 | 0xff, /* red */ |
50 | 0xff, /* red */ |
47 | 0xff, /* green */ |
51 | 0xff, /* green */ |
48 | 0xff, /* blue */ |
52 | 0xff, /* blue */ |
|
|
53 | }; |
|
|
54 | static struct psiconv_font font = |
|
|
55 | { |
|
|
56 | "Times New Roman", /* name */ |
|
|
57 | 3 /* screenfont */ |
49 | }; |
58 | }; |
50 | struct psiconv_character_layout cl = |
59 | struct psiconv_character_layout cl = |
51 | { |
60 | { |
52 | &black, /* color */ |
61 | &black, /* color */ |
53 | &white, /* back_color */ |
62 | &white, /* back_color */ |
… | |
… | |
55 | psiconv_bool_false, /* italic */ |
64 | psiconv_bool_false, /* italic */ |
56 | psiconv_bool_false, /* bold */ |
65 | psiconv_bool_false, /* bold */ |
57 | psiconv_normalscript, /* super_sub */ |
66 | psiconv_normalscript, /* super_sub */ |
58 | psiconv_bool_false, /* underline */ |
67 | psiconv_bool_false, /* underline */ |
59 | psiconv_bool_false, /* strike_out */ |
68 | psiconv_bool_false, /* strike_out */ |
60 | NULL, /* font */ |
69 | &font, /* font */ |
61 | }; |
70 | }; |
62 | |
71 | |
63 | cl.color = malloc(sizeof(*cl.color)); |
|
|
64 | cl.color->red = 0x00; |
|
|
65 | cl.color->green = 0x00; |
|
|
66 | cl.color->blue = 0x00; |
|
|
67 | cl.back_color = malloc(sizeof(*cl.color)); |
|
|
68 | cl.back_color->red = 0xff; |
|
|
69 | cl.back_color->green = 0xff; |
|
|
70 | cl.back_color->blue = 0xff; |
|
|
71 | cl.font = malloc(sizeof(*cl.font)); |
|
|
72 | cl.font->name = strdup("Times New Roman"); |
|
|
73 | cl.font->screenfont = 3; |
|
|
74 | return psiconv_clone_character_layout(&cl); |
72 | return psiconv_clone_character_layout(&cl); |
75 | } |
73 | } |
76 | |
74 | |
77 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
75 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
78 | { |
76 | { |
79 | char base_font[] = "Times New Roman"; |
|
|
80 | |
|
|
81 | struct psiconv_font font = |
77 | static struct psiconv_font font = |
82 | { |
78 | { |
83 | base_font, /* name */ |
79 | "Times New Roman", /* name */ |
84 | 2 /* screenfont */ |
80 | 2 /* screenfont */ |
85 | }; |
81 | }; |
86 | struct psiconv_color black = |
82 | static struct psiconv_color black = |
87 | { |
83 | { |
88 | 0x00, /* red */ |
84 | 0x00, /* red */ |
89 | 0x00, /* green */ |
85 | 0x00, /* green */ |
90 | 0x00, /* blue */ |
86 | 0x00, /* blue */ |
91 | }; |
87 | }; |
92 | struct psiconv_color white = |
88 | static struct psiconv_color white = |
93 | { |
89 | { |
94 | 0xff, /* red */ |
90 | 0xff, /* red */ |
95 | 0xff, /* green */ |
91 | 0xff, /* green */ |
96 | 0xff, /* blue */ |
92 | 0xff, /* blue */ |
97 | }; |
93 | }; |
98 | struct psiconv_border no_border = |
94 | static struct psiconv_border no_border = |
99 | { |
95 | { |
100 | psiconv_border_none, /* kind */ |
96 | psiconv_border_none, /* kind */ |
101 | 1, /* thickness */ |
97 | 1, /* thickness */ |
102 | &black /* color */ |
98 | &black /* color */ |
103 | }; |
99 | }; |
104 | struct psiconv_bullet bullet = |
100 | static struct psiconv_bullet bullet = |
105 | { |
101 | { |
106 | psiconv_bool_false, /* on */ |
102 | psiconv_bool_false, /* on */ |
107 | 10.0, /* font_size */ |
103 | 10.0, /* font_size */ |
108 | 0x95, /* character */ |
104 | 0x95, /* character */ |
109 | psiconv_bool_true, /* indent */ |
105 | psiconv_bool_true, /* indent */ |
110 | &black, /* color */ |
106 | &black, /* color */ |
111 | &font, /* font */ |
107 | &font, /* font */ |
112 | }; |
108 | }; |
113 | struct psiconv_all_tabs tabs = |
109 | static struct psiconv_all_tabs tabs = |
114 | { |
110 | { |
115 | 0.64, /* normal */ |
111 | 0.64, /* normal */ |
116 | NULL /* kind */ |
112 | NULL /* kind */ |
117 | }; |
113 | }; |
118 | struct psiconv_paragraph_layout pl = |
114 | struct psiconv_paragraph_layout pl = |
… | |
… | |
453 | psiconv_free_word_styles_section(file->styles_sec); |
449 | psiconv_free_word_styles_section(file->styles_sec); |
454 | free(file); |
450 | free(file); |
455 | } |
451 | } |
456 | } |
452 | } |
457 | |
453 | |
|
|
454 | void psiconv_free_texted_f(psiconv_texted_f file) |
|
|
455 | { |
|
|
456 | if (file) { |
|
|
457 | psiconv_free_page_layout_section(file->page_sec); |
|
|
458 | psiconv_free_texted_section(file->texted_sec); |
|
|
459 | free(file); |
|
|
460 | } |
|
|
461 | } |
|
|
462 | |
|
|
463 | void psiconv_free_paint_data_section_aux(void * section) |
|
|
464 | { |
|
|
465 | if (((psiconv_paint_data_section) section)->red) |
|
|
466 | free(((psiconv_paint_data_section)section) -> red); |
|
|
467 | if (((psiconv_paint_data_section) section)->green) |
|
|
468 | free(((psiconv_paint_data_section)section) -> green); |
|
|
469 | if (((psiconv_paint_data_section) section)->blue) |
|
|
470 | free(((psiconv_paint_data_section)section) -> blue); |
|
|
471 | } |
|
|
472 | |
|
|
473 | void psiconv_free_paint_data_section(psiconv_paint_data_section section) |
|
|
474 | { |
|
|
475 | if (section) { |
|
|
476 | psiconv_free_paint_data_section_aux(section); |
|
|
477 | free(section); |
|
|
478 | } |
|
|
479 | } |
|
|
480 | |
|
|
481 | void psiconv_free_pictures(psiconv_pictures section) |
|
|
482 | { |
|
|
483 | if (section) |
|
|
484 | psiconv_list_free_el(section,&psiconv_free_paint_data_section_aux); |
|
|
485 | } |
|
|
486 | |
|
|
487 | void psiconv_free_jumptable_section (psiconv_jumptable_section section) |
|
|
488 | { |
|
|
489 | if (section) |
|
|
490 | psiconv_list_free(section); |
|
|
491 | } |
|
|
492 | |
|
|
493 | void psiconv_free_mbm_f(psiconv_mbm_f file) |
|
|
494 | { |
|
|
495 | if (file) { |
|
|
496 | psiconv_free_pictures(file->sections); |
|
|
497 | free(file); |
|
|
498 | } |
|
|
499 | } |
|
|
500 | |
|
|
501 | void psiconv_free_sketch_section(psiconv_sketch_section sec) |
|
|
502 | { |
|
|
503 | if (sec) { |
|
|
504 | psiconv_free_paint_data_section(sec->picture); |
|
|
505 | free(sec); |
|
|
506 | } |
|
|
507 | } |
|
|
508 | |
|
|
509 | void psiconv_free_sketch_f(psiconv_sketch_f file) |
|
|
510 | { |
|
|
511 | if (file) { |
|
|
512 | psiconv_free_sketch_section(file->sketch_sec); |
|
|
513 | free(file); |
|
|
514 | } |
|
|
515 | } |
|
|
516 | |
|
|
517 | void psiconv_free_clipart_section_aux(void *section) |
|
|
518 | { |
|
|
519 | if (section) |
|
|
520 | free(((psiconv_clipart_section ) section)->picture); |
|
|
521 | } |
|
|
522 | |
|
|
523 | void psiconv_free_clipart_section(psiconv_clipart_section section) |
|
|
524 | { |
|
|
525 | if (section) { |
|
|
526 | psiconv_free_clipart_section_aux(section); |
|
|
527 | free(section); |
|
|
528 | } |
|
|
529 | } |
|
|
530 | |
|
|
531 | void psiconv_free_cliparts(psiconv_cliparts section) |
|
|
532 | { |
|
|
533 | if (section) |
|
|
534 | psiconv_list_free_el(section,&psiconv_free_clipart_section_aux); |
|
|
535 | } |
|
|
536 | |
|
|
537 | void psiconv_free_clipart_f(psiconv_clipart_f file) |
|
|
538 | { |
|
|
539 | if (file) { |
|
|
540 | psiconv_free_cliparts(file->sections); |
|
|
541 | free(file); |
|
|
542 | } |
|
|
543 | } |
|
|
544 | |
458 | void psiconv_free_file(psiconv_file file) |
545 | void psiconv_free_file(psiconv_file file) |
459 | { |
546 | { |
460 | if (file) { |
547 | if (file) { |
461 | if (file->type == psiconv_word_file) |
548 | if (file->type == psiconv_word_file) |
462 | psiconv_free_word_f((psiconv_word_f) file->file); |
549 | psiconv_free_word_f((psiconv_word_f) file->file); |
|
|
550 | else if (file->type == psiconv_texted_file) |
|
|
551 | psiconv_free_texted_f((psiconv_texted_f) file->file); |
|
|
552 | else if (file->type == psiconv_mbm_file) |
|
|
553 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
|
|
554 | else if (file->type == psiconv_sketch_file) |
|
|
555 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
|
|
556 | else if (file->type == psiconv_clipart_file) |
|
|
557 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
463 | free(file); |
558 | free(file); |
464 | } |
559 | } |
465 | } |
560 | } |