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