/[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 97 Revision 128
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);
46static psiconv_sheet_formula_list psiconv_empty_sheet_formula_list(void); 48static psiconv_formula_list psiconv_empty_formula_list(void);
47static psiconv_sheet_workbook_section 49static psiconv_sheet_workbook_section
48 psiconv_empty_sheet_workbook_section(void); 50 psiconv_empty_sheet_workbook_section(void);
49static psiconv_sheet_f psiconv_empty_sheet_f(void); 51static psiconv_sheet_f psiconv_empty_sheet_f(void);
50static psiconv_texted_f psiconv_empty_texted_f(void); 52static psiconv_texted_f psiconv_empty_texted_f(void);
51static psiconv_paint_data_section psiconv_empty_paint_data_section(void); 53static psiconv_paint_data_section psiconv_empty_paint_data_section(void);
150 0.0, /* space_below */ 152 0.0, /* space_below */
151 psiconv_bool_false, /* keep_together */ 153 psiconv_bool_false, /* keep_together */
152 psiconv_bool_false, /* keep_with_next */ 154 psiconv_bool_false, /* keep_with_next */
153 psiconv_bool_false, /* on_next_page */ 155 psiconv_bool_false, /* on_next_page */
154 psiconv_bool_false, /* no_widow_protection */ 156 psiconv_bool_false, /* no_widow_protection */
157 psiconv_bool_false, /* wrap_to_fit_cell */
155 0.0, /* left_margin */ 158 0.0, /* left_margin */
156 &bullet, /* bullet */ 159 &bullet, /* bullet */
157 &no_border, /* left_border */ 160 &no_border, /* left_border */
158 &no_border, /* right_border */ 161 &no_border, /* right_border */
159 &no_border, /* top_border */ 162 &no_border, /* top_border */
314 return ss->normal; 317 return ss->normal;
315 else 318 else
316 return psiconv_list_get(ss->styles,0xff - nr); 319 return psiconv_list_get(ss->styles,0xff - nr);
317} 320}
318 321
322psiconv_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/* TODO: What if a cell is both in a default row and a default column?!? */
328psiconv_sheet_cell_layout psiconv_get_default_layout
329 (psiconv_sheet_line_list row_defaults,
330 psiconv_sheet_line_list col_defaults,
331 psiconv_sheet_cell_layout cell_default,
332 int row,int col)
333{
334 int i;
335 psiconv_sheet_line line;
336 for (i = 0;i < psiconv_list_length(row_defaults);i++) {
337 line = psiconv_list_get(row_defaults,i);
338 if (line->position == row)
339 return line->layout;
340 }
341 for (i = 0;i < psiconv_list_length(col_defaults);i++) {
342 line = psiconv_list_get(col_defaults,i);
343 if (line->position == col)
344 return line->layout;
345 }
346 return cell_default;
347}
348
349
319void psiconv_free_color (psiconv_color color) 350void psiconv_free_color (psiconv_color color)
320{ 351{
321 if (color) 352 if (color)
322 free(color); 353 free(color);
323} 354}
545{ 576{
546 if (section) 577 if (section)
547 free(section); 578 free(section);
548} 579}
549 580
581void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat)
582{
583 if (numberformat)
584 free(numberformat);
585}
586
587void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout)
588{
589 psiconv_free_paragraph_layout(layout->paragraph);
590 psiconv_free_character_layout(layout->character);
591 psiconv_free_sheet_numberformat(layout->numberformat);
592}
593
594void psiconv_free_sheet_cell_aux(void *cell)
595{
596 psiconv_sheet_cell data = cell;
597
598 psiconv_free_sheet_cell_layout(data->layout);
599
600 if ((data->type == psiconv_cell_string) && (data->data.dat_string))
601 free(data->data.dat_string);
602}
603
604void psiconv_free_sheet_cell(psiconv_sheet_cell cell)
605{
606 if (cell) {
607 psiconv_free_sheet_cell_aux(cell);
608 free(cell);
609 }
610}
611
612void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list)
613{
614 if (list)
615 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux);
616}
617
618void psiconv_free_sheet_line_aux(void *line)
619{
620 psiconv_sheet_line data = line;
621
622 psiconv_free_sheet_cell_layout(data->layout);
623}
624
625void psiconv_free_sheet_line(psiconv_sheet_line line)
626{
627 if (line) {
628 psiconv_free_sheet_line_aux(line);
629 free(line);
630 }
631}
632
633void psiconv_free_sheet_line_list(psiconv_sheet_line_list list)
634{
635 if (list)
636 psiconv_list_free_el(list,psiconv_free_sheet_line_aux);
637}
638
639void psiconv_free_sheet_worksheet_aux (void *data)
640{
641 psiconv_sheet_worksheet section = data;
642 psiconv_free_sheet_cell_layout(section->default_layout);
643 psiconv_free_sheet_cell_list(section->cells);
644 psiconv_free_sheet_line_list(section->row_default_layouts);
645 psiconv_free_sheet_line_list(section->col_default_layouts);
646}
647
648void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet)
649{
650 if (sheet) {
651 psiconv_free_sheet_worksheet_aux(sheet);
652 free(sheet);
653 }
654}
655
656void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list)
657{
658 if (list)
659 psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux);
660}
661
662void psiconv_free_formula_aux(void *data)
663{
664 psiconv_formula formula;
665 formula = data;
666 if (formula->type == psiconv_formula_dat_string)
667 free(formula->data.dat_string);
668 else if ((formula->type != psiconv_formula_dat_int) &&
669 (formula->type != psiconv_formula_dat_var) &&
670 (formula->type != psiconv_formula_dat_float) &&
671 (formula->type != psiconv_formula_dat_cellref) &&
672 (formula->type != psiconv_formula_dat_cellblock) &&
673 (formula->type != psiconv_formula_dat_vcellblock) &&
674 (formula->type != psiconv_formula_mark_opsep) &&
675 (formula->type != psiconv_formula_mark_opend) &&
676 (formula->type != psiconv_formula_mark_eof) &&
677 (formula->type != psiconv_formula_unknown))
678 psiconv_free_formula_list(formula->data.fun_operands);
679}
680
550void psiconv_free_sheet_formula(psiconv_sheet_formula formula) 681void psiconv_free_formula(psiconv_formula formula)
551{ 682{
552 if (formula) 683 if (formula) {
684 psiconv_free_formula_aux(formula);
553 free(formula); 685 free(formula);
686 }
554} 687}
555 688
556void psiconv_free_sheet_formula_list(psiconv_sheet_formula_list list) 689void psiconv_free_formula_list(psiconv_formula_list list)
557{ 690{
558 if (list) 691 if (list)
559 psiconv_list_free(list); 692 psiconv_list_free_el(list,psiconv_free_formula_aux);
560} 693}
561 694
562void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) 695void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
563{ 696{
564 if (section) { 697 if (section) {
565 psiconv_free_sheet_formula_list(section->formulas); 698 psiconv_free_formula_list(section->formulas);
699 psiconv_free_sheet_worksheet_list(section->worksheets);
566 free(section); 700 free(section);
567 } 701 }
568} 702}
569 703
570void psiconv_free_sheet_f(psiconv_sheet_f file) 704void psiconv_free_sheet_f(psiconv_sheet_f file)
977 result->cursor_row = result->cursor_column = 0; 1111 result->cursor_row = result->cursor_column = 0;
978 result->sheet_display_size = result->graph_display_size = 1000; 1112 result->sheet_display_size = result->graph_display_size = 1000;
979 return result; 1113 return result;
980} 1114}
981 1115
982psiconv_sheet_formula_list psiconv_empty_sheet_formula_list(void) 1116psiconv_formula_list psiconv_empty_formula_list(void)
983{ 1117{
984 return psiconv_list_new(sizeof(struct psiconv_sheet_formula_s)); 1118 return psiconv_list_new(sizeof(struct psiconv_formula_s));
985} 1119}
986 1120
987psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void) 1121psiconv_sheet_workbook_section psiconv_empty_sheet_workbook_section(void)
988{ 1122{
989 psiconv_sheet_workbook_section result; 1123 psiconv_sheet_workbook_section result;
990 if (!(result = malloc(sizeof(*result)))) 1124 if (!(result = malloc(sizeof(*result))))
991 goto ERROR1; 1125 goto ERROR1;
992 if (!(result->formulas = psiconv_empty_sheet_formula_list())) 1126 if (!(result->formulas = psiconv_empty_formula_list()))
993 goto ERROR2; 1127 goto ERROR2;
994 return result; 1128 return result;
995ERROR2: 1129ERROR2:
996 free(result); 1130 free(result);
997ERROR1: 1131ERROR1:

Legend:
Removed from v.97  
changed lines
  Added in v.128

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