… | |
… | |
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); |
37 | |
38 | |
38 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_f psiconv_empty_word_f(void); |
45 | static psiconv_word_f psiconv_empty_word_f(void); |
|
|
46 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
|
|
47 | static psiconv_formula_list psiconv_empty_formula_list(void); |
|
|
48 | static psiconv_sheet_workbook_section |
|
|
49 | psiconv_empty_sheet_workbook_section(void); |
|
|
50 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
45 | static psiconv_texted_f psiconv_empty_texted_f(void); |
51 | static psiconv_texted_f psiconv_empty_texted_f(void); |
46 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
52 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
47 | static psiconv_pictures psiconv_empty_pictures(void); |
53 | static psiconv_pictures psiconv_empty_pictures(void); |
48 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
54 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
49 | static psiconv_sketch_section psiconv_empty_sketch_section(void); |
55 | static psiconv_sketch_section psiconv_empty_sketch_section(void); |
… | |
… | |
145 | 0.0, /* space_below */ |
151 | 0.0, /* space_below */ |
146 | psiconv_bool_false, /* keep_together */ |
152 | psiconv_bool_false, /* keep_together */ |
147 | psiconv_bool_false, /* keep_with_next */ |
153 | psiconv_bool_false, /* keep_with_next */ |
148 | psiconv_bool_false, /* on_next_page */ |
154 | psiconv_bool_false, /* on_next_page */ |
149 | psiconv_bool_false, /* no_widow_protection */ |
155 | psiconv_bool_false, /* no_widow_protection */ |
|
|
156 | psiconv_bool_false, /* wrap_to_fit_cell */ |
150 | 0.0, /* left_margin */ |
157 | 0.0, /* left_margin */ |
151 | &bullet, /* bullet */ |
158 | &bullet, /* bullet */ |
152 | &no_border, /* left_border */ |
159 | &no_border, /* left_border */ |
153 | &no_border, /* right_border */ |
160 | &no_border, /* right_border */ |
154 | &no_border, /* top_border */ |
161 | &no_border, /* top_border */ |
… | |
… | |
534 | psiconv_free_word_styles_section(file->styles_sec); |
541 | psiconv_free_word_styles_section(file->styles_sec); |
535 | free(file); |
542 | free(file); |
536 | } |
543 | } |
537 | } |
544 | } |
538 | |
545 | |
|
|
546 | void psiconv_free_sheet_status_section(psiconv_sheet_status_section section) |
|
|
547 | { |
|
|
548 | if (section) |
|
|
549 | free(section); |
|
|
550 | } |
|
|
551 | |
|
|
552 | void psiconv_free_formula_aux(void *data) |
|
|
553 | { |
|
|
554 | psiconv_formula formula; |
|
|
555 | formula = data; |
|
|
556 | if (formula->type == psiconv_formula_dat_string) |
|
|
557 | free(formula->data.dat_string); |
|
|
558 | else if ((formula->type != psiconv_formula_dat_int) && |
|
|
559 | (formula->type != psiconv_formula_dat_var) && |
|
|
560 | (formula->type != psiconv_formula_dat_float) && |
|
|
561 | (formula->type != psiconv_formula_dat_cellref) && |
|
|
562 | (formula->type != psiconv_formula_dat_cellblock) && |
|
|
563 | (formula->type != psiconv_formula_dat_vcellblock) && |
|
|
564 | (formula->type != psiconv_formula_mark_opsep) && |
|
|
565 | (formula->type != psiconv_formula_mark_opend) && |
|
|
566 | (formula->type != psiconv_formula_mark_eof) && |
|
|
567 | (formula->type != psiconv_formula_unknown)) |
|
|
568 | psiconv_free_formula_list(formula->data.fun_operands); |
|
|
569 | } |
|
|
570 | |
|
|
571 | void psiconv_free_formula(psiconv_formula formula) |
|
|
572 | { |
|
|
573 | if (formula) { |
|
|
574 | psiconv_free_formula_aux(formula); |
|
|
575 | free(formula); |
|
|
576 | } |
|
|
577 | } |
|
|
578 | |
|
|
579 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
580 | { |
|
|
581 | if (list) |
|
|
582 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
|
|
583 | } |
|
|
584 | |
|
|
585 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
|
|
586 | { |
|
|
587 | if (section) { |
|
|
588 | psiconv_free_formula_list(section->formulas); |
|
|
589 | free(section); |
|
|
590 | } |
|
|
591 | } |
|
|
592 | |
|
|
593 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
|
|
594 | { |
|
|
595 | if (file) { |
|
|
596 | psiconv_free_page_layout_section(file->page_sec); |
|
|
597 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
598 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
|
|
599 | free(file); |
|
|
600 | } |
|
|
601 | } |
|
|
602 | |
539 | void psiconv_free_texted_f(psiconv_texted_f file) |
603 | void psiconv_free_texted_f(psiconv_texted_f file) |
540 | { |
604 | { |
541 | if (file) { |
605 | if (file) { |
542 | psiconv_free_page_layout_section(file->page_sec); |
606 | psiconv_free_page_layout_section(file->page_sec); |
543 | psiconv_free_texted_section(file->texted_sec); |
607 | psiconv_free_texted_section(file->texted_sec); |
… | |
… | |
638 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
702 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
639 | else if (file->type == psiconv_sketch_file) |
703 | else if (file->type == psiconv_sketch_file) |
640 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
704 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
641 | else if (file->type == psiconv_clipart_file) |
705 | else if (file->type == psiconv_clipart_file) |
642 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
706 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
|
|
707 | else if (file->type == psiconv_sheet_file) |
|
|
708 | psiconv_free_sheet_f((psiconv_sheet_f) file->file); |
643 | free(file); |
709 | free(file); |
644 | } |
710 | } |
645 | } |
711 | } |
646 | |
712 | |
647 | int psiconv_compare_color(const psiconv_color value1, |
713 | int psiconv_compare_color(const psiconv_color value1, |
… | |
… | |
918 | free(result); |
984 | free(result); |
919 | ERROR1: |
985 | ERROR1: |
920 | return NULL; |
986 | return NULL; |
921 | } |
987 | } |
922 | |
988 | |
|
|
989 | psiconv_sheet_status_section psiconv_empty_sheet_status_section(void) |
|
|
990 | { |
|
|
991 | psiconv_sheet_status_section result; |
|
|
992 | if (!(result = malloc(sizeof(*result)))) |
|
|
993 | return NULL; |
|
|
994 | result->show_horizontal_scrollbar = result->show_vertical_scrollbar = |
|
|
995 | psiconv_triple_auto; |
|
|
996 | result->show_graph = psiconv_bool_false; |
|
|
997 | result->show_top_sheet_toolbar = result->show_side_sheet_toolbar = |
|
|
998 | result->show_top_graph_toolbar = result->show_side_graph_toolbar = |
|
|
999 | psiconv_bool_true; |
|
|
1000 | result->cursor_row = result->cursor_column = 0; |
|
|
1001 | result->sheet_display_size = result->graph_display_size = 1000; |
|
|
1002 | return result; |
|
|
1003 | } |
|
|
1004 | |
|
|
1005 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
1006 | { |
|
|
1007 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
1008 | } |
|
|
1009 | |
|
|
1010 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
|
|
1011 | { |
|
|
1012 | psiconv_sheet_workbook_section result; |
|
|
1013 | if (!(result = malloc(sizeof(*result)))) |
|
|
1014 | goto ERROR1; |
|
|
1015 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
1016 | goto ERROR2; |
|
|
1017 | return result; |
|
|
1018 | ERROR2: |
|
|
1019 | free(result); |
|
|
1020 | ERROR1: |
|
|
1021 | return NULL; |
|
|
1022 | } |
|
|
1023 | |
|
|
1024 | |
|
|
1025 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
|
|
1026 | { |
|
|
1027 | psiconv_sheet_f result; |
|
|
1028 | if (!(result = malloc(sizeof(*result)))) |
|
|
1029 | goto ERROR1; |
|
|
1030 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
1031 | goto ERROR2; |
|
|
1032 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
|
|
1033 | goto ERROR3; |
|
|
1034 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1035 | goto ERROR4; |
|
|
1036 | return result; |
|
|
1037 | ERROR4: |
|
|
1038 | psiconv_free_sheet_status_section(result->status_sec); |
|
|
1039 | ERROR3: |
|
|
1040 | psiconv_free_page_layout_section(result->page_sec); |
|
|
1041 | ERROR2: |
|
|
1042 | free(result); |
|
|
1043 | ERROR1: |
|
|
1044 | return NULL; |
|
|
1045 | } |
|
|
1046 | |
923 | psiconv_texted_f psiconv_empty_texted_f(void) |
1047 | psiconv_texted_f psiconv_empty_texted_f(void) |
924 | { |
1048 | { |
925 | psiconv_texted_f result; |
1049 | psiconv_texted_f result; |
926 | if (!(result = malloc(sizeof(*result)))) |
1050 | if (!(result = malloc(sizeof(*result)))) |
927 | goto ERROR1; |
1051 | goto ERROR1; |
… | |
… | |
1059 | if (!(result = malloc(sizeof(*result)))) |
1183 | if (!(result = malloc(sizeof(*result)))) |
1060 | return NULL; |
1184 | return NULL; |
1061 | result->type = type; |
1185 | result->type = type; |
1062 | if (type == psiconv_word_file) { |
1186 | if (type == psiconv_word_file) { |
1063 | if (!(result->file = psiconv_empty_word_f())) |
1187 | if (!(result->file = psiconv_empty_word_f())) |
|
|
1188 | goto ERROR; |
|
|
1189 | } else if (type == psiconv_sheet_file) { |
|
|
1190 | if (!(result->file = psiconv_empty_sheet_f())) |
1064 | goto ERROR; |
1191 | goto ERROR; |
1065 | } else if (type == psiconv_texted_file) { |
1192 | } else if (type == psiconv_texted_file) { |
1066 | if (!(result->file = psiconv_empty_texted_f())) |
1193 | if (!(result->file = psiconv_empty_texted_f())) |
1067 | goto ERROR; |
1194 | goto ERROR; |
1068 | } else if (type == psiconv_mbm_file) { |
1195 | } else if (type == psiconv_mbm_file) { |