/[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 87 Revision 98
40static psiconv_texted_section psiconv_empty_texted_section(void); 40static psiconv_texted_section psiconv_empty_texted_section(void);
41static psiconv_page_header psiconv_empty_page_header(void); 41static psiconv_page_header psiconv_empty_page_header(void);
42static psiconv_page_layout_section psiconv_empty_page_layout_section(void); 42static psiconv_page_layout_section psiconv_empty_page_layout_section(void);
43static psiconv_word_status_section psiconv_empty_word_status_section(void); 43static psiconv_word_status_section psiconv_empty_word_status_section(void);
44static psiconv_word_f psiconv_empty_word_f(void); 44static psiconv_word_f psiconv_empty_word_f(void);
45static psiconv_sheet_status_section psiconv_empty_sheet_status_section(void);
46static psiconv_formula_list psiconv_empty_formula_list(void);
47static psiconv_sheet_workbook_section
48 psiconv_empty_sheet_workbook_section(void);
49static psiconv_sheet_f psiconv_empty_sheet_f(void);
45static psiconv_texted_f psiconv_empty_texted_f(void); 50static psiconv_texted_f psiconv_empty_texted_f(void);
46static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 51static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
47static psiconv_pictures psiconv_empty_pictures(void); 52static psiconv_pictures psiconv_empty_pictures(void);
48static psiconv_mbm_f psiconv_empty_mbm_f(void); 53static psiconv_mbm_f psiconv_empty_mbm_f(void);
49static psiconv_sketch_section psiconv_empty_sketch_section(void); 54static psiconv_sketch_section psiconv_empty_sketch_section(void);
534 psiconv_free_word_styles_section(file->styles_sec); 539 psiconv_free_word_styles_section(file->styles_sec);
535 free(file); 540 free(file);
536 } 541 }
537} 542}
538 543
544void psiconv_free_sheet_status_section(psiconv_sheet_status_section section)
545{
546 if (section)
547 free(section);
548}
549
550/* TODO: Free sublists, strings etc. depending on formula->type */
551void psiconv_free_formula(psiconv_formula formula)
552{
553 if (formula)
554 free(formula);
555}
556
557void psiconv_free_formula_list(psiconv_formula_list list)
558{
559 if (list)
560 psiconv_list_free(list);
561}
562
563void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
564{
565 if (section) {
566 psiconv_free_formula_list(section->formulas);
567 free(section);
568 }
569}
570
571void psiconv_free_sheet_f(psiconv_sheet_f file)
572{
573 if (file) {
574 psiconv_free_page_layout_section(file->page_sec);
575 psiconv_free_sheet_status_section(file->status_sec);
576 psiconv_free_sheet_workbook_section(file->workbook_sec);
577 free(file);
578 }
579}
580
539void psiconv_free_texted_f(psiconv_texted_f file) 581void psiconv_free_texted_f(psiconv_texted_f file)
540{ 582{
541 if (file) { 583 if (file) {
542 psiconv_free_page_layout_section(file->page_sec); 584 psiconv_free_page_layout_section(file->page_sec);
543 psiconv_free_texted_section(file->texted_sec); 585 psiconv_free_texted_section(file->texted_sec);
638 psiconv_free_mbm_f((psiconv_mbm_f) file->file); 680 psiconv_free_mbm_f((psiconv_mbm_f) file->file);
639 else if (file->type == psiconv_sketch_file) 681 else if (file->type == psiconv_sketch_file)
640 psiconv_free_sketch_f((psiconv_sketch_f) file->file); 682 psiconv_free_sketch_f((psiconv_sketch_f) file->file);
641 else if (file->type == psiconv_clipart_file) 683 else if (file->type == psiconv_clipart_file)
642 psiconv_free_clipart_f((psiconv_clipart_f) file->file); 684 psiconv_free_clipart_f((psiconv_clipart_f) file->file);
685 else if (file->type == psiconv_sheet_file)
686 psiconv_free_sheet_f((psiconv_sheet_f) file->file);
643 free(file); 687 free(file);
644 } 688 }
645} 689}
646 690
647int psiconv_compare_color(const psiconv_color value1, 691int psiconv_compare_color(const psiconv_color value1,
856psiconv_page_layout_section psiconv_empty_page_layout_section(void) 900psiconv_page_layout_section psiconv_empty_page_layout_section(void)
857{ 901{
858 psiconv_page_layout_section result; 902 psiconv_page_layout_section result;
859 if (!(result = malloc(sizeof(*result)))) 903 if (!(result = malloc(sizeof(*result))))
860 goto ERROR1; 904 goto ERROR1;
861 result->first_page_nr = 0; 905 result->first_page_nr = 1;
862 result->header_dist = result->footer_dist = 1.27; 906 result->header_dist = result->footer_dist = 1.27;
863 result->left_margin = result->right_margin = 3.175; 907 result->left_margin = result->right_margin = 3.175;
864 result->top_margin = result->bottom_margin = 2.54; 908 result->top_margin = result->bottom_margin = 2.54;
865 result->page_width = 21.0; 909 result->page_width = 21.0;
866 result->page_height = 29.7; 910 result->page_height = 29.7;
918 free(result); 962 free(result);
919ERROR1: 963ERROR1:
920 return NULL; 964 return NULL;
921} 965}
922 966
967psiconv_sheet_status_section psiconv_empty_sheet_status_section(void)
968{
969 psiconv_sheet_status_section result;
970 if (!(result = malloc(sizeof(*result))))
971 return NULL;
972 result->show_horizontal_scrollbar = result->show_vertical_scrollbar =
973 psiconv_triple_auto;
974 result->show_graph = psiconv_bool_false;
975 result->show_top_sheet_toolbar = result->show_side_sheet_toolbar =
976 result->show_top_graph_toolbar = result->show_side_graph_toolbar =
977 psiconv_bool_true;
978 result->cursor_row = result->cursor_column = 0;
979 result->sheet_display_size = result->graph_display_size = 1000;
980 return result;
981}
982
983psiconv_formula_list psiconv_empty_formula_list(void)
984{
985 return psiconv_list_new(sizeof(struct psiconv_formula_s));
986}
987
988psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
989{
990 psiconv_sheet_workbook_section result;
991 if (!(result = malloc(sizeof(*result))))
992 goto ERROR1;
993 if (!(result->formulas = psiconv_empty_formula_list()))
994 goto ERROR2;
995 return result;
996ERROR2:
997 free(result);
998ERROR1:
999 return NULL;
1000}
1001
1002
1003psiconv_sheet_f psiconv_empty_sheet_f(void)
1004{
1005 psiconv_sheet_f result;
1006 if (!(result = malloc(sizeof(*result))))
1007 goto ERROR1;
1008 if (!(result->page_sec = psiconv_empty_page_layout_section()))
1009 goto ERROR2;
1010 if (!(result->status_sec = psiconv_empty_sheet_status_section()))
1011 goto ERROR3;
1012 if (!(result->workbook_sec = psiconv_empty_sheet_workbook_section()))
1013 goto ERROR4;
1014 return result;
1015ERROR4:
1016 psiconv_free_sheet_status_section(result->status_sec);
1017ERROR3:
1018 psiconv_free_page_layout_section(result->page_sec);
1019ERROR2:
1020 free(result);
1021ERROR1:
1022 return NULL;
1023}
1024
923psiconv_texted_f psiconv_empty_texted_f(void) 1025psiconv_texted_f psiconv_empty_texted_f(void)
924{ 1026{
925 psiconv_texted_f result; 1027 psiconv_texted_f result;
926 if (!(result = malloc(sizeof(*result)))) 1028 if (!(result = malloc(sizeof(*result))))
927 goto ERROR1; 1029 goto ERROR1;
1059 if (!(result = malloc(sizeof(*result)))) 1161 if (!(result = malloc(sizeof(*result))))
1060 return NULL; 1162 return NULL;
1061 result->type = type; 1163 result->type = type;
1062 if (type == psiconv_word_file) { 1164 if (type == psiconv_word_file) {
1063 if (!(result->file = psiconv_empty_word_f())) 1165 if (!(result->file = psiconv_empty_word_f()))
1166 goto ERROR;
1167 } else if (type == psiconv_sheet_file) {
1168 if (!(result->file = psiconv_empty_sheet_f()))
1064 goto ERROR; 1169 goto ERROR;
1065 } else if (type == psiconv_texted_file) { 1170 } else if (type == psiconv_texted_file) {
1066 if (!(result->file = psiconv_empty_texted_f())) 1171 if (!(result->file = psiconv_empty_texted_f()))
1067 goto ERROR; 1172 goto ERROR;
1068 } else if (type == psiconv_mbm_file) { 1173 } else if (type == psiconv_mbm_file) {

Legend:
Removed from v.87  
changed lines
  Added in v.98

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