… | |
… | |
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); |
… | |
… | |
317 | return ss->normal; |
318 | return ss->normal; |
318 | else |
319 | else |
319 | return psiconv_list_get(ss->styles,0xff - nr); |
320 | return psiconv_list_get(ss->styles,0xff - nr); |
320 | } |
321 | } |
321 | |
322 | |
|
|
323 | psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) |
|
|
324 | { |
|
|
325 | return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); |
|
|
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 | |
|
|
350 | |
322 | void psiconv_free_color (psiconv_color color) |
351 | void psiconv_free_color (psiconv_color color) |
323 | { |
352 | { |
324 | if (color) |
353 | if (color) |
325 | free(color); |
354 | free(color); |
326 | } |
355 | } |
… | |
… | |
585 | { |
614 | { |
586 | if (list) |
615 | if (list) |
587 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
616 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
588 | } |
617 | } |
589 | |
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 | |
|
|
635 | void psiconv_free_sheet_line_list(psiconv_sheet_line_list list) |
|
|
636 | { |
|
|
637 | if (list) |
|
|
638 | psiconv_list_free_el(list,psiconv_free_sheet_line_aux); |
|
|
639 | } |
|
|
640 | |
|
|
641 | void psiconv_free_sheet_grid_break_list(psiconv_sheet_grid_break_list list) |
|
|
642 | { |
|
|
643 | if (list) |
|
|
644 | psiconv_list_free(list); |
|
|
645 | } |
|
|
646 | |
|
|
647 | void psiconv_free_sheet_grid_size(psiconv_sheet_grid_size s) |
|
|
648 | { |
|
|
649 | if (s) |
|
|
650 | free(s); |
|
|
651 | } |
|
|
652 | |
|
|
653 | void psiconv_free_sheet_grid_size_list(psiconv_sheet_grid_size_list list) |
|
|
654 | { |
|
|
655 | if (list) |
|
|
656 | psiconv_list_free(list); |
|
|
657 | } |
|
|
658 | |
|
|
659 | void psiconv_free_sheet_grid_section(psiconv_sheet_grid_section sec) |
|
|
660 | { |
|
|
661 | if (sec) { |
|
|
662 | psiconv_free_sheet_grid_size_list(sec->row_heights); |
|
|
663 | psiconv_free_sheet_grid_size_list(sec->column_heights); |
|
|
664 | psiconv_free_sheet_grid_break_list(sec->row_page_breaks); |
|
|
665 | psiconv_free_sheet_grid_break_list(sec->column_page_breaks); |
|
|
666 | free(sec); |
|
|
667 | } |
|
|
668 | } |
|
|
669 | |
590 | void psiconv_free_sheet_worksheet_aux (void *data) |
670 | void psiconv_free_sheet_worksheet_aux (void *data) |
591 | { |
671 | { |
592 | psiconv_sheet_worksheet section = data; |
672 | psiconv_sheet_worksheet section = data; |
593 | psiconv_free_sheet_cell_layout(section->default_layout); |
673 | psiconv_free_sheet_cell_layout(section->default_layout); |
594 | psiconv_free_sheet_cell_list(section->cells); |
674 | psiconv_free_sheet_cell_list(section->cells); |
|
|
675 | psiconv_free_sheet_line_list(section->row_default_layouts); |
|
|
676 | psiconv_free_sheet_line_list(section->col_default_layouts); |
|
|
677 | psiconv_free_sheet_grid_section(section->grid); |
595 | } |
678 | } |
596 | |
679 | |
597 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
680 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
598 | { |
681 | { |
599 | if (sheet) { |
682 | if (sheet) { |
… | |
… | |
639 | { |
722 | { |
640 | if (list) |
723 | if (list) |
641 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
724 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
642 | } |
725 | } |
643 | |
726 | |
|
|
727 | void psiconv_free_sheet_name_section(psiconv_sheet_name_section section) |
|
|
728 | { |
|
|
729 | if (section) { |
|
|
730 | if(section->name) |
|
|
731 | free(section->name); |
|
|
732 | free(section); |
|
|
733 | } |
|
|
734 | } |
|
|
735 | |
|
|
736 | void psiconv_free_sheet_info_section(psiconv_sheet_info_section section) |
|
|
737 | { |
|
|
738 | if (section) { |
|
|
739 | free(section); |
|
|
740 | } |
|
|
741 | } |
|
|
742 | |
|
|
743 | void psiconv_free_sheet_variable_aux(void * variable) |
|
|
744 | { |
|
|
745 | psiconv_sheet_variable var = variable; |
|
|
746 | if (var->name) |
|
|
747 | free(var->name); |
|
|
748 | if (var->type == psiconv_var_string) |
|
|
749 | free(var->data.dat_string); |
|
|
750 | } |
|
|
751 | |
|
|
752 | void psiconv_free_sheet_variable(psiconv_sheet_variable var) |
|
|
753 | { |
|
|
754 | if (var) { |
|
|
755 | psiconv_free_sheet_variable_aux(var); |
|
|
756 | free(var); |
|
|
757 | } |
|
|
758 | } |
|
|
759 | |
|
|
760 | void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list) |
|
|
761 | { |
|
|
762 | if (list) |
|
|
763 | psiconv_list_free_el(list,psiconv_free_sheet_variable_aux); |
|
|
764 | } |
|
|
765 | |
644 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
766 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
645 | { |
767 | { |
646 | if (section) { |
768 | if (section) { |
647 | psiconv_free_formula_list(section->formulas); |
769 | psiconv_free_formula_list(section->formulas); |
648 | psiconv_free_sheet_worksheet_list(section->worksheets); |
770 | psiconv_free_sheet_worksheet_list(section->worksheets); |
|
|
771 | psiconv_free_sheet_name_section(section->name); |
|
|
772 | psiconv_free_sheet_info_section(section->info); |
|
|
773 | psiconv_free_sheet_variable_list(section->variables); |
649 | free(section); |
774 | free(section); |
650 | } |
775 | } |
651 | } |
776 | } |
652 | |
777 | |
653 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
778 | void psiconv_free_sheet_f(psiconv_sheet_f file) |