--- psiconv/trunk/lib/psiconv/data.c 2001/03/04 22:10:45 110 +++ psiconv/trunk/lib/psiconv/data.c 2001/07/10 22:38:49 125 @@ -35,6 +35,7 @@ static void psiconv_free_paint_data_section_aux(void * section); static void psiconv_free_clipart_section_aux(void * section); static void psiconv_free_formula_aux(void *data); +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); @@ -318,6 +319,12 @@ return psiconv_list_get(ss->styles,0xff - nr); } +psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) +{ + return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); +} + + void psiconv_free_color (psiconv_color color) { if (color) @@ -549,31 +556,35 @@ free(section); } -void psiconv_free_numberformat(psiconv_numberformat numberformat) +void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat) { if (numberformat) free(numberformat); } -void psiconv_free_sheet_cell(psiconv_sheet_cell cell) +void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout) { - if (cell) { - psiconv_free_paragraph_layout(cell->paragraph); - psiconv_free_character_layout(cell->character); - psiconv_free_numberformat(cell->numberformat); + psiconv_free_paragraph_layout(layout->paragraph); + psiconv_free_character_layout(layout->character); + psiconv_free_sheet_numberformat(layout->numberformat); +} - if ((cell->type == psiconv_cell_string) && (cell->data.dat_string)) - free(cell->data.dat_string); +void psiconv_free_sheet_cell_aux(void *cell) +{ + psiconv_sheet_cell data = cell; - free(cell); - } + psiconv_free_sheet_cell_layout(data->layout); + + if ((data->type == psiconv_cell_string) && (data->data.dat_string)) + free(data->data.dat_string); } -void psiconv_free_sheet_cell_aux(void *data) +void psiconv_free_sheet_cell(psiconv_sheet_cell cell) { - psiconv_sheet_cell cell; - cell = data; - psiconv_free_sheet_cell(cell); + if (cell) { + psiconv_free_sheet_cell_aux(cell); + free(cell); + } } void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) @@ -582,18 +593,27 @@ psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); } -void psiconv_free_sheet_worksheet_section( - psiconv_sheet_worksheet_section section) +void psiconv_free_sheet_worksheet_aux (void *data) { - if (section) { - psiconv_free_paragraph_layout(section->paragraph); - psiconv_free_character_layout(section->character); - psiconv_free_numberformat(section->numberformat); - psiconv_free_sheet_cell_list(section->cells); - free(section); + psiconv_sheet_worksheet section = data; + psiconv_free_sheet_cell_layout(section->default_layout); + psiconv_free_sheet_cell_list(section->cells); +} + +void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) +{ + if (sheet) { + psiconv_free_sheet_worksheet_aux(sheet); + free(sheet); } } +void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list) +{ + if (list) + psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux); +} + void psiconv_free_formula_aux(void *data) { psiconv_formula formula; @@ -631,7 +651,7 @@ { if (section) { psiconv_free_formula_list(section->formulas); - psiconv_free_sheet_worksheet_section(section->worksheet); + psiconv_free_sheet_worksheet_list(section->worksheets); free(section); } }