… | |
… | |
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); |
45 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(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); |
46 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
51 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
47 | static psiconv_texted_f psiconv_empty_texted_f(void); |
52 | static psiconv_texted_f psiconv_empty_texted_f(void); |
48 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
53 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
49 | static psiconv_pictures psiconv_empty_pictures(void); |
54 | static psiconv_pictures psiconv_empty_pictures(void); |
50 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
55 | static psiconv_mbm_f psiconv_empty_mbm_f(void); |
… | |
… | |
147 | 0.0, /* space_below */ |
152 | 0.0, /* space_below */ |
148 | psiconv_bool_false, /* keep_together */ |
153 | psiconv_bool_false, /* keep_together */ |
149 | psiconv_bool_false, /* keep_with_next */ |
154 | psiconv_bool_false, /* keep_with_next */ |
150 | psiconv_bool_false, /* on_next_page */ |
155 | psiconv_bool_false, /* on_next_page */ |
151 | psiconv_bool_false, /* no_widow_protection */ |
156 | psiconv_bool_false, /* no_widow_protection */ |
|
|
157 | psiconv_bool_false, /* wrap_to_fit_cell */ |
152 | 0.0, /* left_margin */ |
158 | 0.0, /* left_margin */ |
153 | &bullet, /* bullet */ |
159 | &bullet, /* bullet */ |
154 | &no_border, /* left_border */ |
160 | &no_border, /* left_border */ |
155 | &no_border, /* right_border */ |
161 | &no_border, /* right_border */ |
156 | &no_border, /* top_border */ |
162 | &no_border, /* top_border */ |
… | |
… | |
311 | return ss->normal; |
317 | return ss->normal; |
312 | else |
318 | else |
313 | return psiconv_list_get(ss->styles,0xff - nr); |
319 | return psiconv_list_get(ss->styles,0xff - nr); |
314 | } |
320 | } |
315 | |
321 | |
|
|
322 | psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) |
|
|
323 | { |
|
|
324 | return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); |
|
|
325 | } |
|
|
326 | |
|
|
327 | |
316 | void psiconv_free_color (psiconv_color color) |
328 | void psiconv_free_color (psiconv_color color) |
317 | { |
329 | { |
318 | if (color) |
330 | if (color) |
319 | free(color); |
331 | free(color); |
320 | } |
332 | } |
… | |
… | |
542 | { |
554 | { |
543 | if (section) |
555 | if (section) |
544 | free(section); |
556 | free(section); |
545 | } |
557 | } |
546 | |
558 | |
|
|
559 | void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat) |
|
|
560 | { |
|
|
561 | if (numberformat) |
|
|
562 | free(numberformat); |
|
|
563 | } |
|
|
564 | |
|
|
565 | void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout) |
|
|
566 | { |
|
|
567 | psiconv_free_paragraph_layout(layout->paragraph); |
|
|
568 | psiconv_free_character_layout(layout->character); |
|
|
569 | psiconv_free_sheet_numberformat(layout->numberformat); |
|
|
570 | } |
|
|
571 | |
|
|
572 | void psiconv_free_sheet_cell_aux(void *cell) |
|
|
573 | { |
|
|
574 | psiconv_sheet_cell data = cell; |
|
|
575 | |
|
|
576 | psiconv_free_sheet_cell_layout(data->layout); |
|
|
577 | |
|
|
578 | if ((data->type == psiconv_cell_string) && (data->data.dat_string)) |
|
|
579 | free(data->data.dat_string); |
|
|
580 | } |
|
|
581 | |
|
|
582 | void psiconv_free_sheet_cell(psiconv_sheet_cell cell) |
|
|
583 | { |
|
|
584 | if (cell) { |
|
|
585 | psiconv_free_sheet_cell_aux(cell); |
|
|
586 | free(cell); |
|
|
587 | } |
|
|
588 | } |
|
|
589 | |
|
|
590 | void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) |
|
|
591 | { |
|
|
592 | if (list) |
|
|
593 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
|
|
594 | } |
|
|
595 | |
|
|
596 | void psiconv_free_sheet_worksheet_aux (void *data) |
|
|
597 | { |
|
|
598 | psiconv_sheet_worksheet section = data; |
|
|
599 | psiconv_free_sheet_cell_layout(section->default_layout); |
|
|
600 | psiconv_free_sheet_cell_list(section->cells); |
|
|
601 | } |
|
|
602 | |
|
|
603 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
|
|
604 | { |
|
|
605 | if (sheet) { |
|
|
606 | psiconv_free_sheet_worksheet_aux(sheet); |
|
|
607 | free(sheet); |
|
|
608 | } |
|
|
609 | } |
|
|
610 | |
|
|
611 | void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list) |
|
|
612 | { |
|
|
613 | if (list) |
|
|
614 | psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux); |
|
|
615 | } |
|
|
616 | |
|
|
617 | void psiconv_free_formula_aux(void *data) |
|
|
618 | { |
|
|
619 | psiconv_formula formula; |
|
|
620 | formula = data; |
|
|
621 | if (formula->type == psiconv_formula_dat_string) |
|
|
622 | free(formula->data.dat_string); |
|
|
623 | else if ((formula->type != psiconv_formula_dat_int) && |
|
|
624 | (formula->type != psiconv_formula_dat_var) && |
|
|
625 | (formula->type != psiconv_formula_dat_float) && |
|
|
626 | (formula->type != psiconv_formula_dat_cellref) && |
|
|
627 | (formula->type != psiconv_formula_dat_cellblock) && |
|
|
628 | (formula->type != psiconv_formula_dat_vcellblock) && |
|
|
629 | (formula->type != psiconv_formula_mark_opsep) && |
|
|
630 | (formula->type != psiconv_formula_mark_opend) && |
|
|
631 | (formula->type != psiconv_formula_mark_eof) && |
|
|
632 | (formula->type != psiconv_formula_unknown)) |
|
|
633 | psiconv_free_formula_list(formula->data.fun_operands); |
|
|
634 | } |
|
|
635 | |
|
|
636 | void psiconv_free_formula(psiconv_formula formula) |
|
|
637 | { |
|
|
638 | if (formula) { |
|
|
639 | psiconv_free_formula_aux(formula); |
|
|
640 | free(formula); |
|
|
641 | } |
|
|
642 | } |
|
|
643 | |
|
|
644 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
645 | { |
|
|
646 | if (list) |
|
|
647 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
|
|
648 | } |
|
|
649 | |
|
|
650 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
|
|
651 | { |
|
|
652 | if (section) { |
|
|
653 | psiconv_free_formula_list(section->formulas); |
|
|
654 | psiconv_free_sheet_worksheet_list(section->worksheets); |
|
|
655 | free(section); |
|
|
656 | } |
|
|
657 | } |
|
|
658 | |
547 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
659 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
548 | { |
660 | { |
549 | if (file) { |
661 | if (file) { |
550 | psiconv_free_page_layout_section(file->page_sec); |
662 | psiconv_free_page_layout_section(file->page_sec); |
551 | psiconv_free_sheet_status_section(file->status_sec); |
663 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
664 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
552 | free(file); |
665 | free(file); |
553 | } |
666 | } |
554 | } |
667 | } |
555 | |
668 | |
556 | void psiconv_free_texted_f(psiconv_texted_f file) |
669 | void psiconv_free_texted_f(psiconv_texted_f file) |
… | |
… | |
953 | result->cursor_row = result->cursor_column = 0; |
1066 | result->cursor_row = result->cursor_column = 0; |
954 | result->sheet_display_size = result->graph_display_size = 1000; |
1067 | result->sheet_display_size = result->graph_display_size = 1000; |
955 | return result; |
1068 | return result; |
956 | } |
1069 | } |
957 | |
1070 | |
|
|
1071 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
1072 | { |
|
|
1073 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
1074 | } |
|
|
1075 | |
|
|
1076 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
|
|
1077 | { |
|
|
1078 | psiconv_sheet_workbook_section result; |
|
|
1079 | if (!(result = malloc(sizeof(*result)))) |
|
|
1080 | goto ERROR1; |
|
|
1081 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
1082 | goto ERROR2; |
|
|
1083 | return result; |
|
|
1084 | ERROR2: |
|
|
1085 | free(result); |
|
|
1086 | ERROR1: |
|
|
1087 | return NULL; |
|
|
1088 | } |
|
|
1089 | |
|
|
1090 | |
958 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
1091 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
959 | { |
1092 | { |
960 | psiconv_sheet_f result; |
1093 | psiconv_sheet_f result; |
961 | if (!(result = malloc(sizeof(*result)))) |
1094 | if (!(result = malloc(sizeof(*result)))) |
962 | goto ERROR1; |
1095 | goto ERROR1; |
963 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
1096 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
964 | goto ERROR2; |
1097 | goto ERROR2; |
965 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
1098 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
966 | goto ERROR3; |
1099 | goto ERROR3; |
|
|
1100 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1101 | goto ERROR4; |
967 | return result; |
1102 | return result; |
|
|
1103 | ERROR4: |
|
|
1104 | psiconv_free_sheet_status_section(result->status_sec); |
968 | ERROR3: |
1105 | ERROR3: |
969 | psiconv_free_page_layout_section(result->page_sec); |
1106 | psiconv_free_page_layout_section(result->page_sec); |
970 | ERROR2: |
1107 | ERROR2: |
971 | free(result); |
1108 | free(result); |
972 | ERROR1: |
1109 | ERROR1: |