… | |
… | |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
37 | static void psiconv_free_formula_aux(void *data); |
37 | static void psiconv_free_formula_aux(void *data); |
38 | static void psiconv_free_sheet_worksheet_aux (void *data); |
38 | static void psiconv_free_sheet_worksheet_aux (void *data); |
|
|
39 | static void psiconv_free_sheet_variable_aux(void * variable); |
39 | |
40 | |
40 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
41 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
41 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
42 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
42 | static psiconv_texted_section psiconv_empty_texted_section(void); |
43 | static psiconv_texted_section psiconv_empty_texted_section(void); |
43 | static psiconv_page_header psiconv_empty_page_header(void); |
44 | static psiconv_page_header psiconv_empty_page_header(void); |
… | |
… | |
322 | psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) |
323 | psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) |
323 | { |
324 | { |
324 | return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); |
325 | return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); |
325 | } |
326 | } |
326 | |
327 | |
|
|
328 | /* TODO: What if a cell is both in a default row and a default column?!? */ |
|
|
329 | psiconv_sheet_cell_layout psiconv_get_default_layout |
|
|
330 | (psiconv_sheet_line_list row_defaults, |
|
|
331 | psiconv_sheet_line_list col_defaults, |
|
|
332 | psiconv_sheet_cell_layout cell_default, |
|
|
333 | int row,int col) |
|
|
334 | { |
|
|
335 | int i; |
|
|
336 | psiconv_sheet_line line; |
|
|
337 | for (i = 0;i < psiconv_list_length(row_defaults);i++) { |
|
|
338 | line = psiconv_list_get(row_defaults,i); |
|
|
339 | if (line->position == row) |
|
|
340 | return line->layout; |
|
|
341 | } |
|
|
342 | for (i = 0;i < psiconv_list_length(col_defaults);i++) { |
|
|
343 | line = psiconv_list_get(col_defaults,i); |
|
|
344 | if (line->position == col) |
|
|
345 | return line->layout; |
|
|
346 | } |
|
|
347 | return cell_default; |
|
|
348 | } |
|
|
349 | |
327 | |
350 | |
328 | void psiconv_free_color (psiconv_color color) |
351 | void psiconv_free_color (psiconv_color color) |
329 | { |
352 | { |
330 | if (color) |
353 | if (color) |
331 | free(color); |
354 | free(color); |
… | |
… | |
591 | { |
614 | { |
592 | if (list) |
615 | if (list) |
593 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
616 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
594 | } |
617 | } |
595 | |
618 | |
|
|
619 | void psiconv_free_sheet_line_aux(void *line) |
|
|
620 | { |
|
|
621 | psiconv_sheet_line data = line; |
|
|
622 | |
|
|
623 | psiconv_free_sheet_cell_layout(data->layout); |
|
|
624 | } |
|
|
625 | |
|
|
626 | void psiconv_free_sheet_line(psiconv_sheet_line line) |
|
|
627 | { |
|
|
628 | if (line) { |
|
|
629 | psiconv_free_sheet_line_aux(line); |
|
|
630 | free(line); |
|
|
631 | } |
|
|
632 | } |
|
|
633 | |
|
|
634 | void psiconv_free_sheet_line_list(psiconv_sheet_line_list list) |
|
|
635 | { |
|
|
636 | if (list) |
|
|
637 | psiconv_list_free_el(list,psiconv_free_sheet_line_aux); |
|
|
638 | } |
|
|
639 | |
596 | void psiconv_free_sheet_worksheet_aux (void *data) |
640 | void psiconv_free_sheet_worksheet_aux (void *data) |
597 | { |
641 | { |
598 | psiconv_sheet_worksheet section = data; |
642 | psiconv_sheet_worksheet section = data; |
599 | psiconv_free_sheet_cell_layout(section->default_layout); |
643 | psiconv_free_sheet_cell_layout(section->default_layout); |
600 | psiconv_free_sheet_cell_list(section->cells); |
644 | psiconv_free_sheet_cell_list(section->cells); |
|
|
645 | psiconv_free_sheet_line_list(section->row_default_layouts); |
|
|
646 | psiconv_free_sheet_line_list(section->col_default_layouts); |
601 | } |
647 | } |
602 | |
648 | |
603 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
649 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
604 | { |
650 | { |
605 | if (sheet) { |
651 | if (sheet) { |
… | |
… | |
645 | { |
691 | { |
646 | if (list) |
692 | if (list) |
647 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
693 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
648 | } |
694 | } |
649 | |
695 | |
|
|
696 | void psiconv_free_sheet_name_section(psiconv_sheet_name_section section) |
|
|
697 | { |
|
|
698 | if (section) { |
|
|
699 | if(section->name) |
|
|
700 | free(section->name); |
|
|
701 | free(section); |
|
|
702 | } |
|
|
703 | } |
|
|
704 | |
|
|
705 | void psiconv_free_sheet_info_section(psiconv_sheet_info_section section) |
|
|
706 | { |
|
|
707 | if (section) { |
|
|
708 | free(section); |
|
|
709 | } |
|
|
710 | } |
|
|
711 | |
|
|
712 | void psiconv_free_sheet_variable_aux(void * variable) |
|
|
713 | { |
|
|
714 | psiconv_sheet_variable var = variable; |
|
|
715 | if (var->name) |
|
|
716 | free(var->name); |
|
|
717 | if (var->type == psiconv_var_string) |
|
|
718 | free(var->data.dat_string); |
|
|
719 | } |
|
|
720 | |
|
|
721 | void psiconv_free_sheet_variable(psiconv_sheet_variable var) |
|
|
722 | { |
|
|
723 | if (var) { |
|
|
724 | psiconv_free_sheet_variable_aux(var); |
|
|
725 | free(var); |
|
|
726 | } |
|
|
727 | } |
|
|
728 | |
|
|
729 | void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list) |
|
|
730 | { |
|
|
731 | if (list) |
|
|
732 | psiconv_list_free_el(list,psiconv_free_sheet_variable_aux); |
|
|
733 | } |
|
|
734 | |
650 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
735 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
651 | { |
736 | { |
652 | if (section) { |
737 | if (section) { |
653 | psiconv_free_formula_list(section->formulas); |
738 | psiconv_free_formula_list(section->formulas); |
654 | psiconv_free_sheet_worksheet_list(section->worksheets); |
739 | psiconv_free_sheet_worksheet_list(section->worksheets); |
|
|
740 | psiconv_free_sheet_name_section(section->name); |
|
|
741 | psiconv_free_sheet_info_section(section->info); |
|
|
742 | psiconv_free_sheet_variable_list(section->variables); |
655 | free(section); |
743 | free(section); |
656 | } |
744 | } |
657 | } |
745 | } |
658 | |
746 | |
659 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
747 | void psiconv_free_sheet_f(psiconv_sheet_f file) |