/[public]/psiconv/trunk/lib/psiconv/data.c
ViewVC logotype

Diff of /psiconv/trunk/lib/psiconv/data.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 88 Revision 110
32static void psiconv_free_style_aux(void *style); 32static void psiconv_free_style_aux(void *style);
33static void psiconv_free_in_line_layout_aux(void * layout); 33static void psiconv_free_in_line_layout_aux(void * layout);
34static void psiconv_free_paragraph_aux(void * paragraph); 34static void psiconv_free_paragraph_aux(void * paragraph);
35static void psiconv_free_paint_data_section_aux(void * section); 35static void psiconv_free_paint_data_section_aux(void * section);
36static void psiconv_free_clipart_section_aux(void * section); 36static void psiconv_free_clipart_section_aux(void * section);
37static void psiconv_free_formula_aux(void *data);
37 38
38static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 39static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
39static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 40static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
40static psiconv_texted_section psiconv_empty_texted_section(void); 41static psiconv_texted_section psiconv_empty_texted_section(void);
41static psiconv_page_header psiconv_empty_page_header(void); 42static psiconv_page_header psiconv_empty_page_header(void);
42static psiconv_page_layout_section psiconv_empty_page_layout_section(void); 43static psiconv_page_layout_section psiconv_empty_page_layout_section(void);
43static psiconv_word_status_section psiconv_empty_word_status_section(void); 44static psiconv_word_status_section psiconv_empty_word_status_section(void);
44static psiconv_word_f psiconv_empty_word_f(void); 45static psiconv_word_f psiconv_empty_word_f(void);
46static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void);
47static psiconv_formula_list psiconv_empty_formula_list(void);
48static psiconv_sheet_workbook_section
49 psiconv_empty_sheet_workbook_section(void);
50static psiconv_sheet_f psiconv_empty_sheet_f(void);
45static psiconv_texted_f psiconv_empty_texted_f(void); 51static psiconv_texted_f psiconv_empty_texted_f(void);
46static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 52static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
47static psiconv_pictures psiconv_empty_pictures(void); 53static psiconv_pictures psiconv_empty_pictures(void);
48static psiconv_mbm_f psiconv_empty_mbm_f(void); 54static psiconv_mbm_f psiconv_empty_mbm_f(void);
49static psiconv_sketch_section psiconv_empty_sketch_section(void); 55static 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
546void psiconv_free_sheet_status_section(psiconv_sheet_status_section section)
547{
548 if (section)
549 free(section);
550}
551
552void psiconv_free_numberformat(psiconv_numberformat numberformat)
553{
554 if (numberformat)
555 free(numberformat);
556}
557
558void psiconv_free_sheet_cell(psiconv_sheet_cell cell)
559{
560 if (cell) {
561 psiconv_free_paragraph_layout(cell->paragraph);
562 psiconv_free_character_layout(cell->character);
563 psiconv_free_numberformat(cell->numberformat);
564
565 if ((cell->type == psiconv_cell_string) && (cell->data.dat_string))
566 free(cell->data.dat_string);
567
568 free(cell);
569 }
570}
571
572void psiconv_free_sheet_cell_aux(void *data)
573{
574 psiconv_sheet_cell cell;
575 cell = data;
576 psiconv_free_sheet_cell(cell);
577}
578
579void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list)
580{
581 if (list)
582 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux);
583}
584
585void psiconv_free_sheet_worksheet_section(
586 psiconv_sheet_worksheet_section section)
587{
588 if (section) {
589 psiconv_free_paragraph_layout(section->paragraph);
590 psiconv_free_character_layout(section->character);
591 psiconv_free_numberformat(section->numberformat);
592 psiconv_free_sheet_cell_list(section->cells);
593 free(section);
594 }
595}
596
597void psiconv_free_formula_aux(void *data)
598{
599 psiconv_formula formula;
600 formula = data;
601 if (formula->type == psiconv_formula_dat_string)
602 free(formula->data.dat_string);
603 else if ((formula->type != psiconv_formula_dat_int) &&
604 (formula->type != psiconv_formula_dat_var) &&
605 (formula->type != psiconv_formula_dat_float) &&
606 (formula->type != psiconv_formula_dat_cellref) &&
607 (formula->type != psiconv_formula_dat_cellblock) &&
608 (formula->type != psiconv_formula_dat_vcellblock) &&
609 (formula->type != psiconv_formula_mark_opsep) &&
610 (formula->type != psiconv_formula_mark_opend) &&
611 (formula->type != psiconv_formula_mark_eof) &&
612 (formula->type != psiconv_formula_unknown))
613 psiconv_free_formula_list(formula->data.fun_operands);
614}
615
616void psiconv_free_formula(psiconv_formula formula)
617{
618 if (formula) {
619 psiconv_free_formula_aux(formula);
620 free(formula);
621 }
622}
623
624void psiconv_free_formula_list(psiconv_formula_list list)
625{
626 if (list)
627 psiconv_list_free_el(list,psiconv_free_formula_aux);
628}
629
630void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
631{
632 if (section) {
633 psiconv_free_formula_list(section->formulas);
634 psiconv_free_sheet_worksheet_section(section->worksheet);
635 free(section);
636 }
637}
638
639void psiconv_free_sheet_f(psiconv_sheet_f file)
640{
641 if (file) {
642 psiconv_free_page_layout_section(file->page_sec);
643 psiconv_free_sheet_status_section(file->status_sec);
644 psiconv_free_sheet_workbook_section(file->workbook_sec);
645 free(file);
646 }
647}
648
539void psiconv_free_texted_f(psiconv_texted_f file) 649void psiconv_free_texted_f(psiconv_texted_f file)
540{ 650{
541 if (file) { 651 if (file) {
542 psiconv_free_page_layout_section(file->page_sec); 652 psiconv_free_page_layout_section(file->page_sec);
543 psiconv_free_texted_section(file->texted_sec); 653 psiconv_free_texted_section(file->texted_sec);
638 psiconv_free_mbm_f((psiconv_mbm_f) file->file); 748 psiconv_free_mbm_f((psiconv_mbm_f) file->file);
639 else if (file->type == psiconv_sketch_file) 749 else if (file->type == psiconv_sketch_file)
640 psiconv_free_sketch_f((psiconv_sketch_f) file->file); 750 psiconv_free_sketch_f((psiconv_sketch_f) file->file);
641 else if (file->type == psiconv_clipart_file) 751 else if (file->type == psiconv_clipart_file)
642 psiconv_free_clipart_f((psiconv_clipart_f) file->file); 752 psiconv_free_clipart_f((psiconv_clipart_f) file->file);
753 else if (file->type == psiconv_sheet_file)
754 psiconv_free_sheet_f((psiconv_sheet_f) file->file);
643 free(file); 755 free(file);
644 } 756 }
645} 757}
646 758
647int psiconv_compare_color(const psiconv_color value1, 759int psiconv_compare_color(const psiconv_color value1,
918 free(result); 1030 free(result);
919ERROR1: 1031ERROR1:
920 return NULL; 1032 return NULL;
921} 1033}
922 1034
1035psiconv_sheet_status_section psiconv_empty_sheet_status_section(void)
1036{
1037 psiconv_sheet_status_section result;
1038 if (!(result = malloc(sizeof(*result))))
1039 return NULL;
1040 result->show_horizontal_scrollbar = result->show_vertical_scrollbar =
1041 psiconv_triple_auto;
1042 result->show_graph = psiconv_bool_false;
1043 result->show_top_sheet_toolbar = result->show_side_sheet_toolbar =
1044 result->show_top_graph_toolbar = result->show_side_graph_toolbar =
1045 psiconv_bool_true;
1046 result->cursor_row = result->cursor_column = 0;
1047 result->sheet_display_size = result->graph_display_size = 1000;
1048 return result;
1049}
1050
1051psiconv_formula_list psiconv_empty_formula_list(void)
1052{
1053 return psiconv_list_new(sizeof(struct psiconv_formula_s));
1054}
1055
1056psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
1057{
1058 psiconv_sheet_workbook_section result;
1059 if (!(result = malloc(sizeof(*result))))
1060 goto ERROR1;
1061 if (!(result->formulas = psiconv_empty_formula_list()))
1062 goto ERROR2;
1063 return result;
1064ERROR2:
1065 free(result);
1066ERROR1:
1067 return NULL;
1068}
1069
1070
1071psiconv_sheet_f psiconv_empty_sheet_f(void)
1072{
1073 psiconv_sheet_f result;
1074 if (!(result = malloc(sizeof(*result))))
1075 goto ERROR1;
1076 if (!(result->page_sec = psiconv_empty_page_layout_section()))
1077 goto ERROR2;
1078 if (!(result->status_sec = psiconv_empty_sheet_status_section()))
1079 goto ERROR3;
1080 if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section()))
1081 goto ERROR4;
1082 return result;
1083ERROR4:
1084 psiconv_free_sheet_status_section(result->status_sec);
1085ERROR3:
1086 psiconv_free_page_layout_section(result->page_sec);
1087ERROR2:
1088 free(result);
1089ERROR1:
1090 return NULL;
1091}
1092
923psiconv_texted_f psiconv_empty_texted_f(void) 1093psiconv_texted_f psiconv_empty_texted_f(void)
924{ 1094{
925 psiconv_texted_f result; 1095 psiconv_texted_f result;
926 if (!(result = malloc(sizeof(*result)))) 1096 if (!(result = malloc(sizeof(*result))))
927 goto ERROR1; 1097 goto ERROR1;
1059 if (!(result = malloc(sizeof(*result)))) 1229 if (!(result = malloc(sizeof(*result))))
1060 return NULL; 1230 return NULL;
1061 result->type = type; 1231 result->type = type;
1062 if (type == psiconv_word_file) { 1232 if (type == psiconv_word_file) {
1063 if (!(result->file = psiconv_empty_word_f())) 1233 if (!(result->file = psiconv_empty_word_f()))
1234 goto ERROR;
1235 } else if (type == psiconv_sheet_file) {
1236 if (!(result->file = psiconv_empty_sheet_f()))
1064 goto ERROR; 1237 goto ERROR;
1065 } else if (type == psiconv_texted_file) { 1238 } else if (type == psiconv_texted_file) {
1066 if (!(result->file = psiconv_empty_texted_f())) 1239 if (!(result->file = psiconv_empty_texted_f()))
1067 goto ERROR; 1240 goto ERROR;
1068 } else if (type == psiconv_mbm_file) { 1241 } else if (type == psiconv_mbm_file) {

Legend:
Removed from v.88  
changed lines
  Added in v.110

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26