--- psiconv/trunk/lib/psiconv/data.c 2001/07/24 20:32:51 129 +++ psiconv/trunk/lib/psiconv/data.c 2004/01/06 20:15:01 184 @@ -23,6 +23,11 @@ #include #include "data.h" #include "list.h" +#include "unicode.h" + +#ifdef DMALLOC +#include +#endif static psiconv_color clone_color(psiconv_color color); static psiconv_font clone_font(psiconv_font font); @@ -37,6 +42,9 @@ static void psiconv_free_formula_aux(void *data); static void psiconv_free_sheet_worksheet_aux (void *data); static void psiconv_free_sheet_variable_aux(void * variable); +static void psiconv_free_sheet_cell_aux(void *cell); +static void psiconv_free_sheet_line_aux(void *line); +static void psiconv_free_sheet_worksheet_aux (void *data); static psiconv_word_styles_section psiconv_empty_word_styles_section(void); static psiconv_text_and_layout psiconv_empty_text_and_layout(void); @@ -77,9 +85,12 @@ 0xff, /* green */ 0xff, /* blue */ }; + static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ', + 'N','e','w',' ', + 'R','o','m','a','n',0 }; static struct psiconv_font_s font = { - "Times New Roman", /* name */ + font_times, /* name */ 3 /* screenfont */ }; struct psiconv_character_layout_s cl = @@ -102,9 +113,13 @@ files themself. */ psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) { + static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ', + 'N','e','w',' ', + 'R','o','m','a','n',0 }; + static struct psiconv_font_s font = { - "Times New Roman", /* name */ + font_times, /* name */ 2 /* screenfont */ }; static struct psiconv_color_s black = @@ -129,7 +144,7 @@ { psiconv_bool_false, /* on */ 10.0, /* font_size */ - 0x95, /* character */ + 0x201d, /* character */ psiconv_bool_true, /* indent */ &black, /* color */ &font, /* font */ @@ -188,7 +203,7 @@ if(!(result = malloc(sizeof(*result)))) goto ERROR1; *result = *font; - if (!(result->name = strdup(result->name))) + if (!(result->name = psiconv_unicode_strdup(result->name))) goto ERROR2; return result; ERROR2: @@ -440,6 +455,7 @@ psiconv_free_word_style(styles->normal); if (styles->styles) psiconv_list_free_el(styles->styles,psiconv_free_style_aux); + free(styles); } } @@ -470,9 +486,37 @@ } } +void psiconv_free_object_icon_section(psiconv_object_icon_section section) +{ + if (section) { + if (section->icon_name) + free(section->icon_name); + free(section); + } +} + +void psiconv_free_object_display_section(psiconv_object_display_section section) +{ + if (section) + free(section); +} + +void psiconv_free_embedded_object_section + (psiconv_embedded_object_section object) +{ + if (object) { + psiconv_free_object_icon_section(object->icon); + psiconv_free_object_display_section(object->display); + psiconv_free_file(object->object); + free(object); + } +} + void psiconv_free_in_line_layout_aux(void * layout) { psiconv_free_character_layout(((psiconv_in_line_layout) layout)->layout); + psiconv_free_embedded_object_section + (((psiconv_in_line_layout) layout)->object); } void psiconv_free_in_line_layout(psiconv_in_line_layout layout) @@ -631,12 +675,42 @@ } } + void psiconv_free_sheet_line_list(psiconv_sheet_line_list list) { if (list) psiconv_list_free_el(list,psiconv_free_sheet_line_aux); } +void psiconv_free_sheet_grid_break_list(psiconv_sheet_grid_break_list list) +{ + if (list) + psiconv_list_free(list); +} + +void psiconv_free_sheet_grid_size(psiconv_sheet_grid_size s) +{ + if (s) + free(s); +} + +void psiconv_free_sheet_grid_size_list(psiconv_sheet_grid_size_list list) +{ + if (list) + psiconv_list_free(list); +} + +void psiconv_free_sheet_grid_section(psiconv_sheet_grid_section sec) +{ + if (sec) { + psiconv_free_sheet_grid_size_list(sec->row_heights); + psiconv_free_sheet_grid_size_list(sec->column_heights); + psiconv_free_sheet_grid_break_list(sec->row_page_breaks); + psiconv_free_sheet_grid_break_list(sec->column_page_breaks); + free(sec); + } +} + void psiconv_free_sheet_worksheet_aux (void *data) { psiconv_sheet_worksheet section = data; @@ -644,6 +718,7 @@ psiconv_free_sheet_cell_list(section->cells); psiconv_free_sheet_line_list(section->row_default_layouts); psiconv_free_sheet_line_list(section->col_default_layouts); + psiconv_free_sheet_grid_section(section->grid); } void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) @@ -883,7 +958,7 @@ if (!value1 || !value2 || !value1->name || !value2->name) return 1; if ((value1->screenfont == value2->screenfont) && - !strcmp(value1->name,value2->name)) + !psiconv_unicode_strcmp(value1->name,value2->name)) return 0; else return 1; @@ -1281,10 +1356,11 @@ psiconv_sketch_section result; if (!(result = malloc(sizeof(*result)))) goto ERROR1; - result->form_xsize = 320; - result->form_ysize = 200; - result->picture_x_offset = result->picture_y_offset = result->picture_xsize = - result->picture_ysize = 0; + result->displayed_xsize = 320; + result->displayed_ysize = 200; + result->picture_data_x_offset = result->picture_data_y_offset = + result->form_xsize = result->form_ysize = + result->displayed_size_x_offset = result->displayed_size_y_offset = 0; result->magnification_x = result->magnification_y = 1.0; result->cut_left = result->cut_right = result->cut_top = result->cut_bottom = 0.0;