… | |
… | |
21 | #include "compat.h" |
21 | #include "compat.h" |
22 | #include <stdlib.h> |
22 | #include <stdlib.h> |
23 | #include <string.h> |
23 | #include <string.h> |
24 | #include "data.h" |
24 | #include "data.h" |
25 | #include "list.h" |
25 | #include "list.h" |
|
|
26 | #include "unicode.h" |
|
|
27 | |
|
|
28 | #ifdef DMALLOC |
|
|
29 | #include <dmalloc.h> |
|
|
30 | #endif |
26 | |
31 | |
27 | static psiconv_color clone_color(psiconv_color color); |
32 | static psiconv_color clone_color(psiconv_color color); |
28 | static psiconv_font clone_font(psiconv_font font); |
33 | static psiconv_font clone_font(psiconv_font font); |
29 | static psiconv_border clone_border(psiconv_border border); |
34 | static psiconv_border clone_border(psiconv_border border); |
30 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
35 | static psiconv_bullet clone_bullet(psiconv_bullet bullet); |
… | |
… | |
32 | static void psiconv_free_style_aux(void *style); |
37 | static void psiconv_free_style_aux(void *style); |
33 | static void psiconv_free_in_line_layout_aux(void * layout); |
38 | static void psiconv_free_in_line_layout_aux(void * layout); |
34 | static void psiconv_free_paragraph_aux(void * paragraph); |
39 | static void psiconv_free_paragraph_aux(void * paragraph); |
35 | static void psiconv_free_paint_data_section_aux(void * section); |
40 | static void psiconv_free_paint_data_section_aux(void * section); |
36 | static void psiconv_free_clipart_section_aux(void * section); |
41 | static void psiconv_free_clipart_section_aux(void * section); |
|
|
42 | static void psiconv_free_formula_aux(void *data); |
|
|
43 | static void psiconv_free_sheet_worksheet_aux (void *data); |
|
|
44 | static void psiconv_free_sheet_variable_aux(void * variable); |
|
|
45 | static void psiconv_free_sheet_cell_aux(void *cell); |
|
|
46 | static void psiconv_free_sheet_line_aux(void *line); |
|
|
47 | static void psiconv_free_sheet_worksheet_aux (void *data); |
37 | |
48 | |
38 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
49 | static psiconv_word_styles_section psiconv_empty_word_styles_section(void); |
39 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
50 | static psiconv_text_and_layout psiconv_empty_text_and_layout(void); |
40 | static psiconv_texted_section psiconv_empty_texted_section(void); |
51 | static psiconv_texted_section psiconv_empty_texted_section(void); |
41 | static psiconv_page_header psiconv_empty_page_header(void); |
52 | static psiconv_page_header psiconv_empty_page_header(void); |
42 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
53 | static psiconv_page_layout_section psiconv_empty_page_layout_section(void); |
43 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
54 | static psiconv_word_status_section psiconv_empty_word_status_section(void); |
44 | static psiconv_word_f psiconv_empty_word_f(void); |
55 | static psiconv_word_f psiconv_empty_word_f(void); |
45 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
56 | static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); |
|
|
57 | static psiconv_formula_list psiconv_empty_formula_list(void); |
46 | static psiconv_sheet_workbook_section |
58 | static psiconv_sheet_workbook_section |
47 | psiconv_empty_sheet_workbook_section(void); |
59 | psiconv_empty_sheet_workbook_section(void); |
48 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
60 | static psiconv_sheet_f psiconv_empty_sheet_f(void); |
49 | static psiconv_texted_f psiconv_empty_texted_f(void); |
61 | static psiconv_texted_f psiconv_empty_texted_f(void); |
50 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
62 | static psiconv_paint_data_section psiconv_empty_paint_data_section(void); |
… | |
… | |
71 | { |
83 | { |
72 | 0xff, /* red */ |
84 | 0xff, /* red */ |
73 | 0xff, /* green */ |
85 | 0xff, /* green */ |
74 | 0xff, /* blue */ |
86 | 0xff, /* blue */ |
75 | }; |
87 | }; |
|
|
88 | static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ', |
|
|
89 | 'N','e','w',' ', |
|
|
90 | 'R','o','m','a','n',0 }; |
76 | static struct psiconv_font_s font = |
91 | static struct psiconv_font_s font = |
77 | { |
92 | { |
78 | "Times New Roman", /* name */ |
93 | font_times, /* name */ |
79 | 3 /* screenfont */ |
94 | 3 /* screenfont */ |
80 | }; |
95 | }; |
81 | struct psiconv_character_layout_s cl = |
96 | struct psiconv_character_layout_s cl = |
82 | { |
97 | { |
83 | &black, /* color */ |
98 | &black, /* color */ |
… | |
… | |
96 | |
111 | |
97 | /* Note: these defaults seem to be hard-coded somewhere outside the |
112 | /* Note: these defaults seem to be hard-coded somewhere outside the |
98 | files themself. */ |
113 | files themself. */ |
99 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
114 | psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) |
100 | { |
115 | { |
|
|
116 | static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ', |
|
|
117 | 'N','e','w',' ', |
|
|
118 | 'R','o','m','a','n',0 }; |
|
|
119 | |
101 | static struct psiconv_font_s font = |
120 | static struct psiconv_font_s font = |
102 | { |
121 | { |
103 | "Times New Roman", /* name */ |
122 | font_times, /* name */ |
104 | 2 /* screenfont */ |
123 | 2 /* screenfont */ |
105 | }; |
124 | }; |
106 | static struct psiconv_color_s black = |
125 | static struct psiconv_color_s black = |
107 | { |
126 | { |
108 | 0x00, /* red */ |
127 | 0x00, /* red */ |
… | |
… | |
123 | }; |
142 | }; |
124 | static struct psiconv_bullet_s bullet = |
143 | static struct psiconv_bullet_s bullet = |
125 | { |
144 | { |
126 | psiconv_bool_false, /* on */ |
145 | psiconv_bool_false, /* on */ |
127 | 10.0, /* font_size */ |
146 | 10.0, /* font_size */ |
128 | 0x95, /* character */ |
147 | 0x201d, /* character */ |
129 | psiconv_bool_true, /* indent */ |
148 | psiconv_bool_true, /* indent */ |
130 | &black, /* color */ |
149 | &black, /* color */ |
131 | &font, /* font */ |
150 | &font, /* font */ |
132 | }; |
151 | }; |
133 | static struct psiconv_all_tabs_s tabs = |
152 | static struct psiconv_all_tabs_s tabs = |
… | |
… | |
149 | 0.0, /* space_below */ |
168 | 0.0, /* space_below */ |
150 | psiconv_bool_false, /* keep_together */ |
169 | psiconv_bool_false, /* keep_together */ |
151 | psiconv_bool_false, /* keep_with_next */ |
170 | psiconv_bool_false, /* keep_with_next */ |
152 | psiconv_bool_false, /* on_next_page */ |
171 | psiconv_bool_false, /* on_next_page */ |
153 | psiconv_bool_false, /* no_widow_protection */ |
172 | psiconv_bool_false, /* no_widow_protection */ |
|
|
173 | psiconv_bool_false, /* wrap_to_fit_cell */ |
154 | 0.0, /* left_margin */ |
174 | 0.0, /* left_margin */ |
155 | &bullet, /* bullet */ |
175 | &bullet, /* bullet */ |
156 | &no_border, /* left_border */ |
176 | &no_border, /* left_border */ |
157 | &no_border, /* right_border */ |
177 | &no_border, /* right_border */ |
158 | &no_border, /* top_border */ |
178 | &no_border, /* top_border */ |
… | |
… | |
181 | { |
201 | { |
182 | psiconv_font result; |
202 | psiconv_font result; |
183 | if(!(result = malloc(sizeof(*result)))) |
203 | if(!(result = malloc(sizeof(*result)))) |
184 | goto ERROR1; |
204 | goto ERROR1; |
185 | *result = *font; |
205 | *result = *font; |
186 | if (!(result->name = strdup(result->name))) |
206 | if (!(result->name = psiconv_unicode_strdup(result->name))) |
187 | goto ERROR2; |
207 | goto ERROR2; |
188 | return result; |
208 | return result; |
189 | ERROR2: |
209 | ERROR2: |
190 | free(result); |
210 | free(result); |
191 | ERROR1: |
211 | ERROR1: |
… | |
… | |
313 | return ss->normal; |
333 | return ss->normal; |
314 | else |
334 | else |
315 | return psiconv_list_get(ss->styles,0xff - nr); |
335 | return psiconv_list_get(ss->styles,0xff - nr); |
316 | } |
336 | } |
317 | |
337 | |
|
|
338 | psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr) |
|
|
339 | { |
|
|
340 | return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1); |
|
|
341 | } |
|
|
342 | |
|
|
343 | /* TODO: What if a cell is both in a default row and a default column?!? */ |
|
|
344 | psiconv_sheet_cell_layout psiconv_get_default_layout |
|
|
345 | (psiconv_sheet_line_list row_defaults, |
|
|
346 | psiconv_sheet_line_list col_defaults, |
|
|
347 | psiconv_sheet_cell_layout cell_default, |
|
|
348 | int row,int col) |
|
|
349 | { |
|
|
350 | int i; |
|
|
351 | psiconv_sheet_line line; |
|
|
352 | for (i = 0;i < psiconv_list_length(row_defaults);i++) { |
|
|
353 | line = psiconv_list_get(row_defaults,i); |
|
|
354 | if (line->position == row) |
|
|
355 | return line->layout; |
|
|
356 | } |
|
|
357 | for (i = 0;i < psiconv_list_length(col_defaults);i++) { |
|
|
358 | line = psiconv_list_get(col_defaults,i); |
|
|
359 | if (line->position == col) |
|
|
360 | return line->layout; |
|
|
361 | } |
|
|
362 | return cell_default; |
|
|
363 | } |
|
|
364 | |
|
|
365 | |
318 | void psiconv_free_color (psiconv_color color) |
366 | void psiconv_free_color (psiconv_color color) |
319 | { |
367 | { |
320 | if (color) |
368 | if (color) |
321 | free(color); |
369 | free(color); |
322 | } |
370 | } |
… | |
… | |
405 | { |
453 | { |
406 | if (styles) { |
454 | if (styles) { |
407 | psiconv_free_word_style(styles->normal); |
455 | psiconv_free_word_style(styles->normal); |
408 | if (styles->styles) |
456 | if (styles->styles) |
409 | psiconv_list_free_el(styles->styles,psiconv_free_style_aux); |
457 | psiconv_list_free_el(styles->styles,psiconv_free_style_aux); |
|
|
458 | free(styles); |
410 | } |
459 | } |
411 | } |
460 | } |
412 | |
461 | |
413 | void psiconv_free_header_section(psiconv_header_section header) |
462 | void psiconv_free_header_section(psiconv_header_section header) |
414 | { |
463 | { |
… | |
… | |
435 | free(section->name); |
484 | free(section->name); |
436 | free(section); |
485 | free(section); |
437 | } |
486 | } |
438 | } |
487 | } |
439 | |
488 | |
|
|
489 | void psiconv_free_object_icon_section(psiconv_object_icon_section section) |
|
|
490 | { |
|
|
491 | if (section) { |
|
|
492 | if (section->icon_name) |
|
|
493 | free(section->icon_name); |
|
|
494 | free(section); |
|
|
495 | } |
|
|
496 | } |
|
|
497 | |
|
|
498 | void psiconv_free_object_display_section(psiconv_object_display_section section) |
|
|
499 | { |
|
|
500 | if (section) |
|
|
501 | free(section); |
|
|
502 | } |
|
|
503 | |
|
|
504 | void psiconv_free_embedded_object_section |
|
|
505 | (psiconv_embedded_object_section object) |
|
|
506 | { |
|
|
507 | if (object) { |
|
|
508 | psiconv_free_object_icon_section(object->icon); |
|
|
509 | psiconv_free_object_display_section(object->display); |
|
|
510 | psiconv_free_file(object->object); |
|
|
511 | free(object); |
|
|
512 | } |
|
|
513 | } |
|
|
514 | |
440 | void psiconv_free_in_line_layout_aux(void * layout) |
515 | void psiconv_free_in_line_layout_aux(void * layout) |
441 | { |
516 | { |
442 | psiconv_free_character_layout(((psiconv_in_line_layout) layout)->layout); |
517 | psiconv_free_character_layout(((psiconv_in_line_layout) layout)->layout); |
|
|
518 | psiconv_free_embedded_object_section |
|
|
519 | (((psiconv_in_line_layout) layout)->object); |
443 | } |
520 | } |
444 | |
521 | |
445 | void psiconv_free_in_line_layout(psiconv_in_line_layout layout) |
522 | void psiconv_free_in_line_layout(psiconv_in_line_layout layout) |
446 | { |
523 | { |
447 | if (layout) { |
524 | if (layout) { |
… | |
… | |
544 | { |
621 | { |
545 | if (section) |
622 | if (section) |
546 | free(section); |
623 | free(section); |
547 | } |
624 | } |
548 | |
625 | |
|
|
626 | void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat) |
|
|
627 | { |
|
|
628 | if (numberformat) |
|
|
629 | free(numberformat); |
|
|
630 | } |
|
|
631 | |
|
|
632 | void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout) |
|
|
633 | { |
|
|
634 | psiconv_free_paragraph_layout(layout->paragraph); |
|
|
635 | psiconv_free_character_layout(layout->character); |
|
|
636 | psiconv_free_sheet_numberformat(layout->numberformat); |
|
|
637 | } |
|
|
638 | |
|
|
639 | void psiconv_free_sheet_cell_aux(void *cell) |
|
|
640 | { |
|
|
641 | psiconv_sheet_cell data = cell; |
|
|
642 | |
|
|
643 | psiconv_free_sheet_cell_layout(data->layout); |
|
|
644 | |
|
|
645 | if ((data->type == psiconv_cell_string) && (data->data.dat_string)) |
|
|
646 | free(data->data.dat_string); |
|
|
647 | } |
|
|
648 | |
|
|
649 | void psiconv_free_sheet_cell(psiconv_sheet_cell cell) |
|
|
650 | { |
|
|
651 | if (cell) { |
|
|
652 | psiconv_free_sheet_cell_aux(cell); |
|
|
653 | free(cell); |
|
|
654 | } |
|
|
655 | } |
|
|
656 | |
|
|
657 | void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) |
|
|
658 | { |
|
|
659 | if (list) |
|
|
660 | psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); |
|
|
661 | } |
|
|
662 | |
|
|
663 | void psiconv_free_sheet_line_aux(void *line) |
|
|
664 | { |
|
|
665 | psiconv_sheet_line data = line; |
|
|
666 | |
|
|
667 | psiconv_free_sheet_cell_layout(data->layout); |
|
|
668 | } |
|
|
669 | |
|
|
670 | void psiconv_free_sheet_line(psiconv_sheet_line line) |
|
|
671 | { |
|
|
672 | if (line) { |
|
|
673 | psiconv_free_sheet_line_aux(line); |
|
|
674 | free(line); |
|
|
675 | } |
|
|
676 | } |
|
|
677 | |
|
|
678 | |
|
|
679 | void psiconv_free_sheet_line_list(psiconv_sheet_line_list list) |
|
|
680 | { |
|
|
681 | if (list) |
|
|
682 | psiconv_list_free_el(list,psiconv_free_sheet_line_aux); |
|
|
683 | } |
|
|
684 | |
|
|
685 | void psiconv_free_sheet_grid_break_list(psiconv_sheet_grid_break_list list) |
|
|
686 | { |
|
|
687 | if (list) |
|
|
688 | psiconv_list_free(list); |
|
|
689 | } |
|
|
690 | |
|
|
691 | void psiconv_free_sheet_grid_size(psiconv_sheet_grid_size s) |
|
|
692 | { |
|
|
693 | if (s) |
|
|
694 | free(s); |
|
|
695 | } |
|
|
696 | |
|
|
697 | void psiconv_free_sheet_grid_size_list(psiconv_sheet_grid_size_list list) |
|
|
698 | { |
|
|
699 | if (list) |
|
|
700 | psiconv_list_free(list); |
|
|
701 | } |
|
|
702 | |
|
|
703 | void psiconv_free_sheet_grid_section(psiconv_sheet_grid_section sec) |
|
|
704 | { |
|
|
705 | if (sec) { |
|
|
706 | psiconv_free_sheet_grid_size_list(sec->row_heights); |
|
|
707 | psiconv_free_sheet_grid_size_list(sec->column_heights); |
|
|
708 | psiconv_free_sheet_grid_break_list(sec->row_page_breaks); |
|
|
709 | psiconv_free_sheet_grid_break_list(sec->column_page_breaks); |
|
|
710 | free(sec); |
|
|
711 | } |
|
|
712 | } |
|
|
713 | |
|
|
714 | void psiconv_free_sheet_worksheet_aux (void *data) |
|
|
715 | { |
|
|
716 | psiconv_sheet_worksheet section = data; |
|
|
717 | psiconv_free_sheet_cell_layout(section->default_layout); |
|
|
718 | psiconv_free_sheet_cell_list(section->cells); |
|
|
719 | psiconv_free_sheet_line_list(section->row_default_layouts); |
|
|
720 | psiconv_free_sheet_line_list(section->col_default_layouts); |
|
|
721 | psiconv_free_sheet_grid_section(section->grid); |
|
|
722 | } |
|
|
723 | |
|
|
724 | void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet) |
|
|
725 | { |
|
|
726 | if (sheet) { |
|
|
727 | psiconv_free_sheet_worksheet_aux(sheet); |
|
|
728 | free(sheet); |
|
|
729 | } |
|
|
730 | } |
|
|
731 | |
|
|
732 | void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list) |
|
|
733 | { |
|
|
734 | if (list) |
|
|
735 | psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux); |
|
|
736 | } |
|
|
737 | |
|
|
738 | void psiconv_free_formula_aux(void *data) |
|
|
739 | { |
|
|
740 | psiconv_formula formula; |
|
|
741 | formula = data; |
|
|
742 | if (formula->type == psiconv_formula_dat_string) |
|
|
743 | free(formula->data.dat_string); |
|
|
744 | else if ((formula->type != psiconv_formula_dat_int) && |
|
|
745 | (formula->type != psiconv_formula_dat_var) && |
|
|
746 | (formula->type != psiconv_formula_dat_float) && |
|
|
747 | (formula->type != psiconv_formula_dat_cellref) && |
|
|
748 | (formula->type != psiconv_formula_dat_cellblock) && |
|
|
749 | (formula->type != psiconv_formula_dat_vcellblock) && |
|
|
750 | (formula->type != psiconv_formula_mark_opsep) && |
|
|
751 | (formula->type != psiconv_formula_mark_opend) && |
|
|
752 | (formula->type != psiconv_formula_mark_eof) && |
|
|
753 | (formula->type != psiconv_formula_unknown)) |
|
|
754 | psiconv_free_formula_list(formula->data.fun_operands); |
|
|
755 | } |
|
|
756 | |
|
|
757 | void psiconv_free_formula(psiconv_formula formula) |
|
|
758 | { |
|
|
759 | if (formula) { |
|
|
760 | psiconv_free_formula_aux(formula); |
|
|
761 | free(formula); |
|
|
762 | } |
|
|
763 | } |
|
|
764 | |
|
|
765 | void psiconv_free_formula_list(psiconv_formula_list list) |
|
|
766 | { |
|
|
767 | if (list) |
|
|
768 | psiconv_list_free_el(list,psiconv_free_formula_aux); |
|
|
769 | } |
|
|
770 | |
|
|
771 | void psiconv_free_sheet_name_section(psiconv_sheet_name_section section) |
|
|
772 | { |
|
|
773 | if (section) { |
|
|
774 | if(section->name) |
|
|
775 | free(section->name); |
|
|
776 | free(section); |
|
|
777 | } |
|
|
778 | } |
|
|
779 | |
|
|
780 | void psiconv_free_sheet_info_section(psiconv_sheet_info_section section) |
|
|
781 | { |
|
|
782 | if (section) { |
|
|
783 | free(section); |
|
|
784 | } |
|
|
785 | } |
|
|
786 | |
|
|
787 | void psiconv_free_sheet_variable_aux(void * variable) |
|
|
788 | { |
|
|
789 | psiconv_sheet_variable var = variable; |
|
|
790 | if (var->name) |
|
|
791 | free(var->name); |
|
|
792 | if (var->type == psiconv_var_string) |
|
|
793 | free(var->data.dat_string); |
|
|
794 | } |
|
|
795 | |
|
|
796 | void psiconv_free_sheet_variable(psiconv_sheet_variable var) |
|
|
797 | { |
|
|
798 | if (var) { |
|
|
799 | psiconv_free_sheet_variable_aux(var); |
|
|
800 | free(var); |
|
|
801 | } |
|
|
802 | } |
|
|
803 | |
|
|
804 | void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list) |
|
|
805 | { |
|
|
806 | if (list) |
|
|
807 | psiconv_list_free_el(list,psiconv_free_sheet_variable_aux); |
|
|
808 | } |
|
|
809 | |
549 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
810 | void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) |
550 | { |
811 | { |
551 | if (section) |
812 | if (section) { |
|
|
813 | psiconv_free_formula_list(section->formulas); |
|
|
814 | psiconv_free_sheet_worksheet_list(section->worksheets); |
|
|
815 | psiconv_free_sheet_name_section(section->name); |
|
|
816 | psiconv_free_sheet_info_section(section->info); |
|
|
817 | psiconv_free_sheet_variable_list(section->variables); |
552 | free(section); |
818 | free(section); |
|
|
819 | } |
553 | } |
820 | } |
554 | |
821 | |
555 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
822 | void psiconv_free_sheet_f(psiconv_sheet_f file) |
556 | { |
823 | { |
557 | if (file) { |
824 | if (file) { |
… | |
… | |
689 | const psiconv_font value2) |
956 | const psiconv_font value2) |
690 | { |
957 | { |
691 | if (!value1 || !value2 || !value1->name || !value2->name) |
958 | if (!value1 || !value2 || !value1->name || !value2->name) |
692 | return 1; |
959 | return 1; |
693 | if ((value1->screenfont == value2->screenfont) && |
960 | if ((value1->screenfont == value2->screenfont) && |
694 | !strcmp(value1->name,value2->name)) |
961 | !psiconv_unicode_strcmp(value1->name,value2->name)) |
695 | return 0; |
962 | return 0; |
696 | else |
963 | else |
697 | return 1; |
964 | return 1; |
698 | } |
965 | } |
699 | |
966 | |
… | |
… | |
962 | result->cursor_row = result->cursor_column = 0; |
1229 | result->cursor_row = result->cursor_column = 0; |
963 | result->sheet_display_size = result->graph_display_size = 1000; |
1230 | result->sheet_display_size = result->graph_display_size = 1000; |
964 | return result; |
1231 | return result; |
965 | } |
1232 | } |
966 | |
1233 | |
|
|
1234 | psiconv_formula_list psiconv_empty_formula_list(void) |
|
|
1235 | { |
|
|
1236 | return psiconv_list_new(sizeof(struct psiconv_formula_s)); |
|
|
1237 | } |
|
|
1238 | |
967 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
1239 | psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) |
968 | { |
1240 | { |
969 | psiconv_sheet_workbook_section result; |
1241 | psiconv_sheet_workbook_section result; |
970 | if (!(result = malloc(sizeof(*result)))) |
1242 | if (!(result = malloc(sizeof(*result)))) |
|
|
1243 | goto ERROR1; |
|
|
1244 | if (!(result->formulas = psiconv_empty_formula_list())) |
|
|
1245 | goto ERROR2; |
|
|
1246 | return result; |
|
|
1247 | ERROR2: |
|
|
1248 | free(result); |
|
|
1249 | ERROR1: |
971 | return NULL; |
1250 | return NULL; |
972 | return result; |
|
|
973 | } |
1251 | } |
|
|
1252 | |
974 | |
1253 | |
975 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
1254 | psiconv_sheet_f psiconv_empty_sheet_f(void) |
976 | { |
1255 | { |
977 | psiconv_sheet_f result; |
1256 | psiconv_sheet_f result; |
978 | if (!(result = malloc(sizeof(*result)))) |
1257 | if (!(result = malloc(sizeof(*result)))) |
… | |
… | |
1075 | psiconv_sketch_section psiconv_empty_sketch_section(void) |
1354 | psiconv_sketch_section psiconv_empty_sketch_section(void) |
1076 | { |
1355 | { |
1077 | psiconv_sketch_section result; |
1356 | psiconv_sketch_section result; |
1078 | if (!(result = malloc(sizeof(*result)))) |
1357 | if (!(result = malloc(sizeof(*result)))) |
1079 | goto ERROR1; |
1358 | goto ERROR1; |
1080 | result->form_xsize = 320; |
1359 | result->displayed_xsize = 320; |
1081 | result->form_ysize = 200; |
1360 | result->displayed_ysize = 200; |
1082 | result->picture_x_offset = result->picture_y_offset = result->picture_xsize = |
1361 | result->picture_data_x_offset = result->picture_data_y_offset = |
1083 | result->picture_ysize = 0; |
1362 | result->form_xsize = result->form_ysize = |
|
|
1363 | result->displayed_size_x_offset = result->displayed_size_y_offset = 0; |
1084 | result->magnification_x = result->magnification_y = 1.0; |
1364 | result->magnification_x = result->magnification_y = 1.0; |
1085 | result->cut_left = result->cut_right = result->cut_top = |
1365 | result->cut_left = result->cut_right = result->cut_top = |
1086 | result->cut_bottom = 0.0; |
1366 | result->cut_bottom = 0.0; |
1087 | if (!(result->picture = psiconv_empty_paint_data_section())) |
1367 | if (!(result->picture = psiconv_empty_paint_data_section())) |
1088 | goto ERROR2; |
1368 | goto ERROR2; |