--- psiconv/trunk/lib/psiconv/data.c 2000/12/15 18:52:49 67 +++ psiconv/trunk/lib/psiconv/data.c 2000/12/25 14:34:17 78 @@ -34,6 +34,8 @@ static void psiconv_free_paint_data_section_aux(void * section); static void psiconv_free_clipart_section_aux(void * section); +/* Note: these defaults seem to be hard-coded somewhere outside the + files themself. */ psiconv_character_layout psiconv_basic_character_layout(void) { /* Make the structures static, to oblige IRIX */ @@ -70,6 +72,8 @@ return psiconv_clone_character_layout(&cl); } +/* Note: these defaults seem to be hard-coded somewhere outside the + files themself. */ psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) { static struct psiconv_font_s font = @@ -117,7 +121,7 @@ 0.0, /* indent_first */ psiconv_justify_left, /* justify_hor */ psiconv_justify_middle,/* justify_ver */ - 0.0, /* linespacing */ + 10.0, /* linespacing */ psiconv_bool_false, /* linespacing_exact */ 0.0, /* space_above */ 0.0, /* space_below */ @@ -621,3 +625,138 @@ free(file); } } + +int psiconv_compare_color(const psiconv_color value1, + const psiconv_color value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->red == value2->red) && + (value1->green == value2->green) && + (value1->blue == value2->blue)) + return 0; + else + return 1; +} + +int psiconv_compare_font(const psiconv_font value1, + const psiconv_font value2) +{ + if (!value1 || !value2 || !value1->name || !value2->name) + return 1; + if ((value1->screenfont == value2->screenfont) && + !strcmp(value1->name,value2->name)) + return 0; + else + return 1; +} + +int psiconv_compare_border(const psiconv_border value1, + const psiconv_border value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->kind == value2->kind) && + (value1->thickness == value2->thickness) && + !psiconv_compare_color(value1->color,value2->color)) + return 0; + else + return 1; +} + +int psiconv_compare_bullet(const psiconv_bullet value1, + const psiconv_bullet value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->on == value2->on) && + (value1->font_size == value2->font_size) && + (value1->character == value2->character) && + (value1->indent == value2->indent) && + !psiconv_compare_color(value1->color,value2->color) && + !psiconv_compare_font(value1->font,value2->font)) + return 0; + else + return 1; +} + +int psiconv_compare_tab(const psiconv_tab value1, const psiconv_tab value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->location == value2->location) && + (value1->kind == value2->kind)) + return 0; + else + return 1; +} + +int psiconv_compare_all_tabs(const psiconv_all_tabs value1, + const psiconv_all_tabs value2) +{ + int i; + + if (!value1 || !value2 || !value1->extras || !value2->extras) + return 1; + + if ((value1->normal != value2->normal) || + psiconv_list_length(value1->extras) != + psiconv_list_length(value2->extras)) + return 1; + for (i = 0; i < psiconv_list_length(value1->extras); i++) + if (psiconv_compare_tab(psiconv_list_get(value1->extras,i), + psiconv_list_get(value2->extras,i))) + + return 1; + return 0; +} + +int psiconv_compare_paragraph_layout(const psiconv_paragraph_layout value1, + const psiconv_paragraph_layout value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->indent_left == value2->indent_left) && + (value1->indent_right == value2->indent_right) && + (value1->indent_first == value2->indent_first) && + (value1->justify_hor == value2->justify_hor) && + (value1->justify_ver == value2->justify_ver) && + (value1->linespacing == value2->linespacing) && + (value1->space_above == value2->space_above) && + (value1->space_below == value2->space_below) && + (value1->keep_together == value2->keep_together) && + (value1->keep_with_next == value2->keep_with_next) && + (value1->on_next_page == value2->on_next_page) && + (value1->no_widow_protection == value2->no_widow_protection) && + (value1->border_distance == value2->border_distance) && + !psiconv_compare_color(value1->back_color,value2->back_color) && + !psiconv_compare_bullet(value1->bullet,value2->bullet) && + !psiconv_compare_border(value1->left_border,value2->left_border) && + !psiconv_compare_border(value1->right_border,value2->right_border) && + !psiconv_compare_border(value1->top_border,value2->top_border) && + !psiconv_compare_border(value1->bottom_border,value2->bottom_border) && + !psiconv_compare_all_tabs(value1->tabs,value2->tabs)) + return 0; + else + return 1; +} + + +int psiconv_compare_character_layout(const psiconv_character_layout value1, + const psiconv_character_layout value2) +{ + if (!value1 || !value2) + return 1; + if ((value1->font_size == value2->font_size) && + (value1->italic == value2->italic) && + (value1->bold == value2->bold) && + (value1->super_sub == value2->super_sub) && + (value1->underline == value2->underline) && + (value1->strikethrough == value2->strikethrough) && + !psiconv_compare_color(value1->color,value2->color) && + !psiconv_compare_color(value1->back_color,value2->back_color) && + !psiconv_compare_font(value1->font,value2->font)) + return 0; + else + return 1; +}