… | |
… | |
20 | |
20 | |
21 | #include "config.h" |
21 | #include "config.h" |
22 | #include "compat.h" |
22 | #include "compat.h" |
23 | #include <stdio.h> |
23 | #include <stdio.h> |
24 | #include <string.h> |
24 | #include <string.h> |
25 | #include "data.h" |
25 | #include "psiconv/data.h" |
26 | #include "list.h" |
26 | #include "psiconv/list.h" |
27 | #include "gen.h" |
27 | #include "gen.h" |
|
|
28 | #include "psiconv.h" |
28 | |
29 | |
29 | |
30 | |
30 | /* |
31 | /* |
31 | * Various string tables for RTF settings |
32 | * Various string tables for RTF settings |
32 | */ |
33 | */ |
… | |
… | |
324 | /* This is not necessarily the same as returned by basic_character_layout_status |
325 | /* This is not necessarily the same as returned by basic_character_layout_status |
325 | This one is specific for the base point of RTF */ |
326 | This one is specific for the base point of RTF */ |
326 | static psiconv_character_layout |
327 | static psiconv_character_layout |
327 | gen_base_char(psiconv_list colors, psiconv_list fonts) |
328 | gen_base_char(psiconv_list colors, psiconv_list fonts) |
328 | { |
329 | { |
329 | struct psiconv_color white = { 0,0,0 }; |
330 | struct psiconv_color_s white = { 0,0,0 }; |
330 | struct psiconv_color black = { 0xff,0xff,0xff }; |
331 | struct psiconv_color_s black = { 0xff,0xff,0xff }; |
331 | struct psiconv_font font = { NULL,-1 }; /* Pseudo - not added! */ |
332 | struct psiconv_font_s font = { NULL,-1 }; /* Pseudo - not added! */ |
332 | |
333 | |
333 | struct psiconv_character_layout base_char_struct = |
334 | struct psiconv_character_layout_s base_char_struct = |
334 | { |
335 | { |
335 | &black, /* color */ |
336 | &black, /* color */ |
336 | &white, /* back_color */ |
337 | &white, /* back_color */ |
337 | 13.0, /* font_size */ |
338 | 13.0, /* font_size */ |
338 | psiconv_bool_false, /* italic */ |
339 | psiconv_bool_false, /* italic */ |
… | |
… | |
519 | |
520 | |
520 | psiconv_list_free(fonts); |
521 | psiconv_list_free(fonts); |
521 | psiconv_list_free(colors); |
522 | psiconv_list_free(colors); |
522 | } |
523 | } |
523 | |
524 | |
524 | void psiconv_gen_rtf(FILE * of, psiconv_file file) |
525 | static int psiconv_gen_rtf(const char *filename, const psiconv_file file, |
|
|
526 | const char *dest) |
525 | { |
527 | { |
|
|
528 | FILE *of = fopen(filename,"w"); |
|
|
529 | if (! of) |
|
|
530 | return -1; |
|
|
531 | |
526 | if (file->type == psiconv_word_file) |
532 | if (file->type == psiconv_word_file) { |
527 | psiconv_gen_rtf_word(of,(psiconv_word_f) file->file); |
533 | psiconv_gen_rtf_word(of,(psiconv_word_f) file->file); |
528 | else if (file->type == psiconv_texted_file) |
534 | } else if (file->type == psiconv_texted_file) { |
529 | psiconv_gen_rtf_texted(of,(psiconv_texted_f) file->file); |
535 | psiconv_gen_rtf_texted(of,(psiconv_texted_f) file->file); |
530 | else |
536 | } else { |
|
|
537 | fclose(of); |
531 | return; |
538 | return -1; |
|
|
539 | } |
|
|
540 | return fclose(of); |
532 | } |
541 | } |
533 | |
542 | |
|
|
543 | static struct psiconv_fileformat_s ff = |
|
|
544 | { |
|
|
545 | "RTF", |
|
|
546 | "Rich Text Format (not functional yet!)", |
|
|
547 | psiconv_gen_rtf |
|
|
548 | }; |
|
|
549 | |
|
|
550 | void init_rtf(void) |
|
|
551 | { |
|
|
552 | /* psiconv_list_add(fileformat_list,&ff); */ |
|
|
553 | } |
|
|
554 | |