… | |
… | |
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 */ |
… | |
… | |
309 | return ss->normal; |
317 | return ss->normal; |
310 | else |
318 | else |
311 | return psiconv_list_get(ss->styles,0xff - nr); |
319 | return psiconv_list_get(ss->styles,0xff - nr); |
312 | } |
320 | } |
313 | |
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 | |
314 | void psiconv_free_color (psiconv_color color) |
328 | void psiconv_free_color (psiconv_color color) |
315 | { |
329 | { |
316 | if (color) |
330 | if (color) |
317 | free(color); |
331 | free(color); |
318 | } |
332 | } |
… | |
… | |
530 | if (file) { |
544 | if (file) { |
531 | psiconv_free_page_layout_section(file->page_sec); |
545 | psiconv_free_page_layout_section(file->page_sec); |
532 | psiconv_free_text_and_layout(file->paragraphs); |
546 | psiconv_free_text_and_layout(file->paragraphs); |
533 | psiconv_free_word_status_section(file->status_sec); |
547 | psiconv_free_word_status_section(file->status_sec); |
534 | psiconv_free_word_styles_section(file->styles_sec); |
548 | psiconv_free_word_styles_section(file->styles_sec); |
|
|
549 | free(file); |
|
|
550 | } |
|
|
551 | } |
|
|
552 | |
|
|
553 | void psiconv_free_sheet_status_section(psiconv_sheet_status_section section) |
|
|
554 | { |
|
|
555 | if (section) |
|
|
556 | free(section); |
|
|
557 | } |
|
|
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 | |
|
|
659 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
|
|
660 | { |
|
|
661 | if (file) { |
|
|
662 | psiconv_free_page_layout_section(file->page_sec); |
|
|
663 | psiconv_free_sheet_status_section(file->status_sec); |
|
|
664 | psiconv_free_sheet_workbook_section(file->workbook_sec); |
535 | free(file); |
665 | free(file); |
536 | } |
666 | } |
537 | } |
667 | } |
538 | |
668 | |
539 | void psiconv_free_texted_f(psiconv_texted_f file) |
669 | void psiconv_free_texted_f(psiconv_texted_f file) |
… | |
… | |
638 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
768 | psiconv_free_mbm_f((psiconv_mbm_f) file->file); |
639 | else if (file->type == psiconv_sketch_file) |
769 | else if (file->type == psiconv_sketch_file) |
640 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
770 | psiconv_free_sketch_f((psiconv_sketch_f) file->file); |
641 | else if (file->type == psiconv_clipart_file) |
771 | else if (file->type == psiconv_clipart_file) |
642 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
772 | psiconv_free_clipart_f((psiconv_clipart_f) file->file); |
|
|
773 | else if (file->type == psiconv_sheet_file) |
|
|
774 | psiconv_free_sheet_f((psiconv_sheet_f) file->file); |
643 | free(file); |
775 | free(file); |
644 | } |
776 | } |
645 | } |
777 | } |
646 | |
778 | |
647 | int psiconv_compare_color(const psiconv_color value1, |
779 | int psiconv_compare_color(const psiconv_color value1, |
… | |
… | |
918 | free(result); |
1050 | free(result); |
919 | ERROR1: |
1051 | ERROR1: |
920 | return NULL; |
1052 | return NULL; |
921 | } |
1053 | } |
922 | |
1054 | |
|
|
1055 | psiconv_sheet_status_section psiconv_empty_sheet_status_section(void) |
|
|
1056 | { |
|
|
1057 | psiconv_sheet_status_section result; |
|
|
1058 | if (!(result = malloc(sizeof(*result)))) |
|
|
1059 | return NULL; |
|
|
1060 | result->show_horizontal_scrollbar = result->show_vertical_scrollbar = |
|
|
1061 | psiconv_triple_auto; |
|
|
1062 | result->show_graph = psiconv_bool_false; |
|
|
1063 | result->show_top_sheet_toolbar = result->show_side_sheet_toolbar = |
|
|
1064 | result->show_top_graph_toolbar = result->show_side_graph_toolbar = |
|
|
1065 | psiconv_bool_true; |
|
|
1066 | result->cursor_row = result->cursor_column = 0; |
|
|
1067 | result->sheet_display_size = result->graph_display_size = 1000; |
|
|
1068 | return result; |
|
|
1069 | } |
|
|
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 | |
|
|
1091 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
|
|
1092 | { |
|
|
1093 | psiconv_sheet_f result; |
|
|
1094 | if (!(result = malloc(sizeof(*result)))) |
|
|
1095 | goto ERROR1; |
|
|
1096 | if (!(result->page_sec = psiconv_empty_page_layout_section())) |
|
|
1097 | goto ERROR2; |
|
|
1098 | if (!(result->status_sec = psiconv_empty_sheet_status_section())) |
|
|
1099 | goto ERROR3; |
|
|
1100 | if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section())) |
|
|
1101 | goto ERROR4; |
|
|
1102 | return result; |
|
|
1103 | ERROR4: |
|
|
1104 | psiconv_free_sheet_status_section(result->status_sec); |
|
|
1105 | ERROR3: |
|
|
1106 | psiconv_free_page_layout_section(result->page_sec); |
|
|
1107 | ERROR2: |
|
|
1108 | free(result); |
|
|
1109 | ERROR1: |
|
|
1110 | return NULL; |
|
|
1111 | } |
|
|
1112 | |
923 | psiconv_texted_f psiconv_empty_texted_f(void) |
1113 | psiconv_texted_f psiconv_empty_texted_f(void) |
924 | { |
1114 | { |
925 | psiconv_texted_f result; |
1115 | psiconv_texted_f result; |
926 | if (!(result = malloc(sizeof(*result)))) |
1116 | if (!(result = malloc(sizeof(*result)))) |
927 | goto ERROR1; |
1117 | goto ERROR1; |
… | |
… | |
1059 | if (!(result = malloc(sizeof(*result)))) |
1249 | if (!(result = malloc(sizeof(*result)))) |
1060 | return NULL; |
1250 | return NULL; |
1061 | result->type = type; |
1251 | result->type = type; |
1062 | if (type == psiconv_word_file) { |
1252 | if (type == psiconv_word_file) { |
1063 | if (!(result->file = psiconv_empty_word_f())) |
1253 | if (!(result->file = psiconv_empty_word_f())) |
|
|
1254 | goto ERROR; |
|
|
1255 | } else if (type == psiconv_sheet_file) { |
|
|
1256 | if (!(result->file = psiconv_empty_sheet_f())) |
1064 | goto ERROR; |
1257 | goto ERROR; |
1065 | } else if (type == psiconv_texted_file) { |
1258 | } else if (type == psiconv_texted_file) { |
1066 | if (!(result->file = psiconv_empty_texted_f())) |
1259 | if (!(result->file = psiconv_empty_texted_f())) |
1067 | goto ERROR; |
1260 | goto ERROR; |
1068 | } else if (type == psiconv_mbm_file) { |
1261 | } else if (type == psiconv_mbm_file) { |