--- psiconv/trunk/program/psiconv/gen_rtf.c 1999/10/27 15:05:03 20 +++ psiconv/trunk/program/psiconv/gen_rtf.c 2000/12/15 18:52:49 67 @@ -22,9 +22,10 @@ #include "compat.h" #include #include -#include "data.h" -#include "list.h" +#include "psiconv/data.h" +#include "psiconv/list.h" #include "gen.h" +#include "psiconv.h" /* @@ -326,11 +327,11 @@ static psiconv_character_layout gen_base_char(psiconv_list colors, psiconv_list fonts) { - struct psiconv_color white = { 0,0,0 }; - struct psiconv_color black = { 0xff,0xff,0xff }; - struct psiconv_font font = { NULL,-1 }; /* Pseudo - not added! */ + struct psiconv_color_s white = { 0,0,0 }; + struct psiconv_color_s black = { 0xff,0xff,0xff }; + struct psiconv_font_s font = { NULL,-1 }; /* Pseudo - not added! */ - struct psiconv_character_layout base_char_struct = + struct psiconv_character_layout_s base_char_struct = { &black, /* color */ &white, /* back_color */ @@ -339,7 +340,7 @@ psiconv_bool_false, /* bold */ psiconv_normalscript, /* super_sub */ psiconv_bool_false, /* underline */ - psiconv_bool_false, /* strike_out */ + psiconv_bool_false, /* strikethrough */ &font, /* font */ }; @@ -373,8 +374,8 @@ fprintf(of,"\\i%s",new->italic?"":"0"); if (old->underline != new->underline) fprintf(of,"\\ul%s",new->underline?"":"0"); - if (old->strike_out != new->strike_out) - fprintf(of,"\\strike%s",new->strike_out?"":"0"); + if (old->strikethrough != new->strikethrough) + fprintf(of,"\\strike%s",new->strikethrough?"":"0"); if ((old->color->red != new->color->red) || (old->color->green != new->color->green) || (old->color->blue != new->color->blue)) @@ -412,16 +413,16 @@ fprintf(of,"\\ql"); */ } - if (para->interline != 0.0) - fprintf(of,"\\sl%d",(para->interline_exact?-1:1) * - length_to_twips(para->interline)); - if (para->top_space != 0.0) - fprintf(of,"\\sb%d",length_to_twips(para->top_space)); - if (para->bottom_space != 0.0) - fprintf(of,"\\sa%d",length_to_twips(para->bottom_space)); - if (para->on_one_page) + if (para->linespacing != 0.0) + fprintf(of,"\\sl%d",(para->linespacing_exact?-1:1) * + length_to_twips(para->linespacing)); + if (para->space_above != 0.0) + fprintf(of,"\\sb%d",length_to_twips(para->space_above)); + if (para->space_below != 0.0) + fprintf(of,"\\sa%d",length_to_twips(para->space_below)); + if (para->keep_together) fprintf(of,"\\keep"); - if (para->together_with) + if (para->keep_with_next) fprintf(of,"\\keepn"); if (!para->on_next_page) fprintf(of,"pagebb"); @@ -521,13 +522,33 @@ psiconv_list_free(colors); } -void psiconv_gen_rtf(FILE * of, psiconv_file file) +static int psiconv_gen_rtf(const char *filename, const psiconv_file file, + const char *dest) { - if (file->type == psiconv_word_file) + FILE *of = fopen(filename,"w"); + if (! of) + return -1; + + if (file->type == psiconv_word_file) { psiconv_gen_rtf_word(of,(psiconv_word_f) file->file); - else if (file->type == psiconv_texted_file) + } else if (file->type == psiconv_texted_file) { psiconv_gen_rtf_texted(of,(psiconv_texted_f) file->file); - else - return; + } else { + fclose(of); + return -1; + } + return fclose(of); +} + +static struct psiconv_fileformat_s ff = +{ + "RTF", + "Rich Text Format (not functional yet!)", + psiconv_gen_rtf +}; + +void init_rtf(void) +{ + /* psiconv_list_add(fileformat_list,&ff); */ }