/[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 94 Revision 111
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);
38static void psiconv_free_sheet_worksheet_aux (void *data);
37 39
38static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 40static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
39static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 41static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
40static psiconv_texted_section psiconv_empty_texted_section(void); 42static psiconv_texted_section psiconv_empty_texted_section(void);
41static psiconv_page_header psiconv_empty_page_header(void); 43static psiconv_page_header psiconv_empty_page_header(void);
42static psiconv_page_layout_section psiconv_empty_page_layout_section(void); 44static psiconv_page_layout_section psiconv_empty_page_layout_section(void);
43static psiconv_word_status_section psiconv_empty_word_status_section(void); 45static psiconv_word_status_section psiconv_empty_word_status_section(void);
44static psiconv_word_f psiconv_empty_word_f(void); 46static psiconv_word_f psiconv_empty_word_f(void);
45static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void); 47static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void);
48static psiconv_formula_list psiconv_empty_formula_list(void);
49static psiconv_sheet_workbook_section
50 psiconv_empty_sheet_workbook_section(void);
46static psiconv_sheet_f psiconv_empty_sheet_f(void); 51static psiconv_sheet_f psiconv_empty_sheet_f(void);
47static psiconv_texted_f psiconv_empty_texted_f(void); 52static psiconv_texted_f psiconv_empty_texted_f(void);
48static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 53static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
49static psiconv_pictures psiconv_empty_pictures(void); 54static psiconv_pictures psiconv_empty_pictures(void);
50static psiconv_mbm_f psiconv_empty_mbm_f(void); 55static 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 */
542{ 548{
543 if (section) 549 if (section)
544 free(section); 550 free(section);
545} 551}
546 552
553void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat)
554{
555 if (numberformat)
556 free(numberformat);
557}
558
559void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout)
560{
561 psiconv_free_paragraph_layout(layout->paragraph);
562 psiconv_free_character_layout(layout->character);
563 psiconv_free_sheet_numberformat(layout->numberformat);
564}
565
566void psiconv_free_sheet_cell(psiconv_sheet_cell cell)
567{
568 if (cell) {
569 psiconv_free_sheet_cell_layout(cell->layout);
570
571 if ((cell->type == psiconv_cell_string) && (cell->data.dat_string))
572 free(cell->data.dat_string);
573 free(cell);
574 }
575}
576
577void psiconv_free_sheet_cell_aux(void *data)
578{
579 psiconv_sheet_cell cell;
580 cell = data;
581 psiconv_free_sheet_cell(cell);
582}
583
584void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list)
585{
586 if (list)
587 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux);
588}
589
590void psiconv_free_sheet_worksheet_aux (void *data)
591{
592 psiconv_sheet_worksheet section = data;
593 psiconv_free_sheet_cell_layout(section->default_layout);
594 psiconv_free_sheet_cell_list(section->cells);
595}
596
597void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet)
598{
599 if (sheet) {
600 psiconv_free_sheet_worksheet_aux(sheet);
601 free(sheet);
602 }
603}
604
605void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list)
606{
607 if (list)
608 psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux);
609}
610
611void psiconv_free_formula_aux(void *data)
612{
613 psiconv_formula formula;
614 formula = data;
615 if (formula->type == psiconv_formula_dat_string)
616 free(formula->data.dat_string);
617 else if ((formula->type != psiconv_formula_dat_int) &&
618 (formula->type != psiconv_formula_dat_var) &&
619 (formula->type != psiconv_formula_dat_float) &&
620 (formula->type != psiconv_formula_dat_cellref) &&
621 (formula->type != psiconv_formula_dat_cellblock) &&
622 (formula->type != psiconv_formula_dat_vcellblock) &&
623 (formula->type != psiconv_formula_mark_opsep) &&
624 (formula->type != psiconv_formula_mark_opend) &&
625 (formula->type != psiconv_formula_mark_eof) &&
626 (formula->type != psiconv_formula_unknown))
627 psiconv_free_formula_list(formula->data.fun_operands);
628}
629
630void psiconv_free_formula(psiconv_formula formula)
631{
632 if (formula) {
633 psiconv_free_formula_aux(formula);
634 free(formula);
635 }
636}
637
638void psiconv_free_formula_list(psiconv_formula_list list)
639{
640 if (list)
641 psiconv_list_free_el(list,psiconv_free_formula_aux);
642}
643
644void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
645{
646 if (section) {
647 psiconv_free_formula_list(section->formulas);
648 psiconv_free_sheet_worksheet_list(section->worksheets);
649 free(section);
650 }
651}
652
547void psiconv_free_sheet_f(psiconv_sheet_f file) 653void psiconv_free_sheet_f(psiconv_sheet_f file)
548{ 654{
549 if (file) { 655 if (file) {
550 psiconv_free_page_layout_section(file->page_sec); 656 psiconv_free_page_layout_section(file->page_sec);
551 psiconv_free_sheet_status_section(file->status_sec); 657 psiconv_free_sheet_status_section(file->status_sec);
658 psiconv_free_sheet_workbook_section(file->workbook_sec);
552 free(file); 659 free(file);
553 } 660 }
554} 661}
555 662
556void psiconv_free_texted_f(psiconv_texted_f file) 663void psiconv_free_texted_f(psiconv_texted_f file)
953 result->cursor_row = result->cursor_column = 0; 1060 result->cursor_row = result->cursor_column = 0;
954 result->sheet_display_size = result->graph_display_size = 1000; 1061 result->sheet_display_size = result->graph_display_size = 1000;
955 return result; 1062 return result;
956} 1063}
957 1064
1065psiconv_formula_list psiconv_empty_formula_list(void)
1066{
1067 return psiconv_list_new(sizeof(struct psiconv_formula_s));
1068}
1069
1070psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
1071{
1072 psiconv_sheet_workbook_section result;
1073 if (!(result = malloc(sizeof(*result))))
1074 goto ERROR1;
1075 if (!(result->formulas = psiconv_empty_formula_list()))
1076 goto ERROR2;
1077 return result;
1078ERROR2:
1079 free(result);
1080ERROR1:
1081 return NULL;
1082}
1083
1084
958psiconv_sheet_f psiconv_empty_sheet_f(void) 1085psiconv_sheet_f psiconv_empty_sheet_f(void)
959{ 1086{
960 psiconv_sheet_f result; 1087 psiconv_sheet_f result;
961 if (!(result = malloc(sizeof(*result)))) 1088 if (!(result = malloc(sizeof(*result))))
962 goto ERROR1; 1089 goto ERROR1;
963 if (!(result->page_sec = psiconv_empty_page_layout_section())) 1090 if (!(result->page_sec = psiconv_empty_page_layout_section()))
964 goto ERROR2; 1091 goto ERROR2;
965 if (!(result->status_sec = psiconv_empty_sheet_status_section())) 1092 if (!(result->status_sec = psiconv_empty_sheet_status_section()))
966 goto ERROR3; 1093 goto ERROR3;
1094 if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section()))
1095 goto ERROR4;
967 return result; 1096 return result;
1097ERROR4:
1098 psiconv_free_sheet_status_section(result->status_sec);
968ERROR3: 1099ERROR3:
969 psiconv_free_page_layout_section(result->page_sec); 1100 psiconv_free_page_layout_section(result->page_sec);
970ERROR2: 1101ERROR2:
971 free(result); 1102 free(result);
972ERROR1: 1103ERROR1:

Legend:
Removed from v.94  
changed lines
  Added in v.111

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