… | |
… | |
32 | static void psiconv_free_style_aux(void *style); |
32 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
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); |
|
|
38 | static void psiconv_free_sheet_worksheet_aux (void *data); |
37 | |
39 | |
38 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
40 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
41 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_texted_section psiconv_empty_texted_section(void); |
42 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_page_header psiconv_empty_page_header(void); |
43 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
44 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
45 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_f psiconv_empty_word_f(void); |
46 | static psiconv_word_f psiconv_empty_word_f(void); |
|
|
47 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
|
|
48 | static psiconv_formula_list psiconv_empty_formula_list(void); |
|
|
49 | static psiconv_sheet_workbook_section |
|
|
50 | psiconv_empty_sheet_workbook_section(void); |
|
|
51 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
45 | static psiconv_texted_f psiconv_empty_texted_f(void); |
52 | static psiconv_texted_f psiconv_empty_texted_f(void); |
46 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
53 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
47 | static psiconv_pictures psiconv_empty_pictures(void); |
54 | static psiconv_pictures psiconv_empty_pictures(void); |
48 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
55 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
49 | static psiconv_sketch_section psiconv_empty_sketch_section(void); |
56 | static psiconv_sketch_section psiconv_empty_sketch_section(void); |
… | |
… | |
145 | 0.0, /* space_below */ |
152 | 0.0, /* space_below */ |
146 | psiconv_bool_false, /* keep_together */ |
153 | psiconv_bool_false, /* keep_together */ |
147 | psiconv_bool_false, /* keep_with_next */ |
154 | psiconv_bool_false, /* keep_with_next */ |
148 | psiconv_bool_false, /* on_next_page */ |
155 | psiconv_bool_false, /* on_next_page */ |
149 | psiconv_bool_false, /* no_widow_protection */ |
156 | psiconv_bool_false, /* no_widow_protection */ |
|
|
157 | psiconv_bool_false, /* wrap_to_fit_cell */ |
150 | 0.0, /* left_margin */ |
158 | 0.0, /* left_margin */ |
151 | &bullet, /* bullet */ |
159 | &bullet, /* bullet */ |
152 | &no_border, /* left_border */ |
160 | &no_border, /* left_border */ |
153 | &no_border, /* right_border */ |
161 | &no_border, /* right_border */ |
154 | &no_border, /* top_border */ |
162 | &no_border, /* top_border */ |
… | |
… | |
534 | psiconv_free_word_styles_section(file->styles_sec); |
542 | psiconv_free_word_styles_section(file->styles_sec); |
535 | free(file); |
543 | free(file); |
536 | } |
544 | } |
537 | } |
545 | } |
538 | |
546 | |
|
|
547 | void psiconv_free_sheet_status_section(psiconv_sheet_status_section section) |
|
|
548 | { |
|
|
549 | if (section) |
|
|
550 | free(section); |
|
|
551 | } |
|
|
552 | |
|
|
553 | void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat) |
|
|
554 | { |
|
|
555 | if (numberformat) |
|
|
556 | free(numberformat); |
|
|
557 | } |
|
|
558 | |
|
|
559 | void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout) |
|
|
560 | { |
|
|
561 | psiconv_free_paragraph_layout(layout->paragraph); |
|
|
562 | psiconv_free_character_layout(layout->character); |
|
|
563 | psiconv_free_sheet_numberformat(layout->numberformat); |
|
|
564 | } |
|
|
565 | |
|
|
566 | void psiconv_free_sheet_cell(psiconv_sheet_cell cell) |
|
|
567 | { |
|
|
568 | if (cell) { |
|
|
569 | psiconv_free_sheet_cell_layout(cell->layout); |
|
|
570 | |
|
|
571 | if ((cell->type == psiconv_cell_string) && (cell->data.dat_string)) |
|
|
572 | free(cell->data.dat_string); |
|
|
573 | free(cell); |
|
|
574 | } |
|
|
575 | } |
|
|
576 | |
|
|
577 | void psiconv_free_sheet_cell_aux(void *data) |
|
|
578 | { |
|
|
579 | psiconv_sheet_cell cell; |
|
|
580 | cell = data; |
|
|
581 | psiconv_free_sheet_cell(cell); |
|
|
582 | } |
|
|
583 | |
|
|
584 | void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) |
|
|
585 | { |
|
|
586 | if (list) |
|
|
587 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
|
|
588 | } |
|
|
589 | |
|
|
590 | void psiconv_free_sheet_worksheet_aux (void *data) |
|
|
591 | { |
|
|
592 | psiconv_sheet_worksheet section = data; |
|
|
593 | psiconv_free_sheet_cell_layout(section->default_layout); |
|
|
594 | psiconv_free_sheet_cell_list(section->cells); |
|
|
595 | } |
|
|
596 | |
|
|
597 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
|
|
598 | { |
|
|
599 | if (sheet) { |
|
|
600 | psiconv_free_sheet_worksheet_aux(sheet); |
|
|
601 | free(sheet); |
|
|
602 | } |
|
|
603 | } |
|
|
604 | |
|
|
605 | void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list) |
|
|
606 | { |
|
|
607 | if (list) |
|
|
608 | psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux); |
|
|
609 | } |
|
|
610 | |
|
|
611 | void psiconv_free_formula_aux(void *data) |
|
|
612 | { |
|
|
613 | psiconv_formula formula; |
|
|
614 | formula = data; |
|
|
615 | if (formula->type == psiconv_formula_dat_string) |
|
|
616 | free(formula->data.dat_string); |
|
|
617 | else if ((formula->type != psiconv_formula_dat_int) && |
|
|
618 | (formula->type != psiconv_formula_dat_var) && |
|
|
619 | (formula->type != psiconv_formula_dat_float) && |
|
|
620 | (formula->type != psiconv_formula_dat_cellref) && |
|
|
621 | (formula->type != psiconv_formula_dat_cellblock) && |
|
|
622 | (formula->type != psiconv_formula_dat_vcellblock) && |
|
|
623 | (formula->type != psiconv_formula_mark_opsep) && |
|
|
624 | (formula->type != psiconv_formula_mark_opend) && |
|
|
625 | (formula->type != psiconv_formula_mark_eof) && |
|
|
626 | (formula->type != psiconv_formula_unknown)) |
|
|
627 | psiconv_free_formula_list(formula->data.fun_operands); |
|
|
628 | } |
|
|
629 | |
|
|
630 | void psiconv_free_formula(psiconv_formula formula) |
|
|
631 | { |
|
|
632 | if (formula) { |
|
|
633 | psiconv_free_formula_aux(formula); |
|
|
634 | free(formula); |
|
|
635 | } |
|
|
636 | } |
|
|
637 | |
|
|
638 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
639 | { |
|
|
640 | if (list) |
|
|
641 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
|
|
642 | } |
|
|
643 | |
|
|
644 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
|
|
645 | { |
|
|
646 | if (section) { |
|
|
647 | psiconv_free_formula_list(section->formulas); |
|
|
648 | psiconv_free_sheet_worksheet_list(section->worksheets); |
|
|
649 | free(section); |
|
|
650 | } |
|
|
651 | } |
|
|
652 | |
|
|
653 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
|
|
654 | { |
|
|
655 | if (file) { |
|
|
656 | psiconv_free_page_layout_section(file->page_sec); |
|
|
657 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
658 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
|
|
659 | free(file); |
|
|
660 | } |
|
|
661 | } |
|
|
662 | |
539 | void psiconv_free_texted_f(psiconv_texted_f file) |
663 | void psiconv_free_texted_f(psiconv_texted_f file) |
540 | { |
664 | { |
541 | if (file) { |
665 | if (file) { |
542 | psiconv_free_page_layout_section(file->page_sec); |
666 | psiconv_free_page_layout_section(file->page_sec); |
543 | psiconv_free_texted_section(file->texted_sec); |
667 | psiconv_free_texted_section(file->texted_sec); |
… | |
… | |
638 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
762 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
639 | else if (file->type == psiconv_sketch_file) |
763 | else if (file->type == psiconv_sketch_file) |
640 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
764 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
641 | else if (file->type == psiconv_clipart_file) |
765 | else if (file->type == psiconv_clipart_file) |
642 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
766 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
|
|
767 | else if (file->type == psiconv_sheet_file) |
|
|
768 | psiconv_free_sheet_f((psiconv_sheet_f) file->file); |
643 | free(file); |
769 | free(file); |
644 | } |
770 | } |
645 | } |
771 | } |
646 | |
772 | |
647 | int psiconv_compare_color(const psiconv_color value1, |
773 | int psiconv_compare_color(const psiconv_color value1, |
… | |
… | |
918 | free(result); |
1044 | free(result); |
919 | ERROR1: |
1045 | ERROR1: |
920 | return NULL; |
1046 | return NULL; |
921 | } |
1047 | } |
922 | |
1048 | |
|
|
1049 | psiconv_sheet_status_section psiconv_empty_sheet_status_section(void) |
|
|
1050 | { |
|
|
1051 | psiconv_sheet_status_section result; |
|
|
1052 | if (!(result = malloc(sizeof(*result)))) |
|
|
1053 | return NULL; |
|
|
1054 | result->show_horizontal_scrollbar = result->show_vertical_scrollbar = |
|
|
1055 | psiconv_triple_auto; |
|
|
1056 | result->show_graph = psiconv_bool_false; |
|
|
1057 | result->show_top_sheet_toolbar = result->show_side_sheet_toolbar = |
|
|
1058 | result->show_top_graph_toolbar = result->show_side_graph_toolbar = |
|
|
1059 | psiconv_bool_true; |
|
|
1060 | result->cursor_row = result->cursor_column = 0; |
|
|
1061 | result->sheet_display_size = result->graph_display_size = 1000; |
|
|
1062 | return result; |
|
|
1063 | } |
|
|
1064 | |
|
|
1065 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
1066 | { |
|
|
1067 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
1068 | } |
|
|
1069 | |
|
|
1070 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
|
|
1071 | { |
|
|
1072 | psiconv_sheet_workbook_section result; |
|
|
1073 | if (!(result = malloc(sizeof(*result)))) |
|
|
1074 | goto ERROR1; |
|
|
1075 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
1076 | goto ERROR2; |
|
|
1077 | return result; |
|
|
1078 | ERROR2: |
|
|
1079 | free(result); |
|
|
1080 | ERROR1: |
|
|
1081 | return NULL; |
|
|
1082 | } |
|
|
1083 | |
|
|
1084 | |
|
|
1085 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
|
|
1086 | { |
|
|
1087 | psiconv_sheet_f result; |
|
|
1088 | if (!(result = malloc(sizeof(*result)))) |
|
|
1089 | goto ERROR1; |
|
|
1090 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
1091 | goto ERROR2; |
|
|
1092 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
|
|
1093 | goto ERROR3; |
|
|
1094 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1095 | goto ERROR4; |
|
|
1096 | return result; |
|
|
1097 | ERROR4: |
|
|
1098 | psiconv_free_sheet_status_section(result->status_sec); |
|
|
1099 | ERROR3: |
|
|
1100 | psiconv_free_page_layout_section(result->page_sec); |
|
|
1101 | ERROR2: |
|
|
1102 | free(result); |
|
|
1103 | ERROR1: |
|
|
1104 | return NULL; |
|
|
1105 | } |
|
|
1106 | |
923 | psiconv_texted_f psiconv_empty_texted_f(void) |
1107 | psiconv_texted_f psiconv_empty_texted_f(void) |
924 | { |
1108 | { |
925 | psiconv_texted_f result; |
1109 | psiconv_texted_f result; |
926 | if (!(result = malloc(sizeof(*result)))) |
1110 | if (!(result = malloc(sizeof(*result)))) |
927 | goto ERROR1; |
1111 | goto ERROR1; |
… | |
… | |
1059 | if (!(result = malloc(sizeof(*result)))) |
1243 | if (!(result = malloc(sizeof(*result)))) |
1060 | return NULL; |
1244 | return NULL; |
1061 | result->type = type; |
1245 | result->type = type; |
1062 | if (type == psiconv_word_file) { |
1246 | if (type == psiconv_word_file) { |
1063 | if (!(result->file = psiconv_empty_word_f())) |
1247 | if (!(result->file = psiconv_empty_word_f())) |
|
|
1248 | goto ERROR; |
|
|
1249 | } else if (type == psiconv_sheet_file) { |
|
|
1250 | if (!(result->file = psiconv_empty_sheet_f())) |
1064 | goto ERROR; |
1251 | goto ERROR; |
1065 | } else if (type == psiconv_texted_file) { |
1252 | } else if (type == psiconv_texted_file) { |
1066 | if (!(result->file = psiconv_empty_texted_f())) |
1253 | if (!(result->file = psiconv_empty_texted_f())) |
1067 | goto ERROR; |
1254 | goto ERROR; |
1068 | } else if (type == psiconv_mbm_file) { |
1255 | } else if (type == psiconv_mbm_file) { |