/[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 110 Revision 129
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); 37static void psiconv_free_formula_aux(void *data);
38static void psiconv_free_sheet_worksheet_aux (void *data);
39static void psiconv_free_sheet_variable_aux(void * variable);
38 40
39static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 41static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
40static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 42static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
41static psiconv_texted_section psiconv_empty_texted_section(void); 43static psiconv_texted_section psiconv_empty_texted_section(void);
42static psiconv_page_header psiconv_empty_page_header(void); 44static psiconv_page_header psiconv_empty_page_header(void);
316 return ss->normal; 318 return ss->normal;
317 else 319 else
318 return psiconv_list_get(ss->styles,0xff - nr); 320 return psiconv_list_get(ss->styles,0xff - nr);
319} 321}
320 322
323psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr)
324{
325 return psiconv_list_get(ss,psiconv_list_length(ss)-nr-1);
326}
327
328/* TODO: What if a cell is both in a default row and a default column?!? */
329psiconv_sheet_cell_layout psiconv_get_default_layout
330 (psiconv_sheet_line_list row_defaults,
331 psiconv_sheet_line_list col_defaults,
332 psiconv_sheet_cell_layout cell_default,
333 int row,int col)
334{
335 int i;
336 psiconv_sheet_line line;
337 for (i = 0;i < psiconv_list_length(row_defaults);i++) {
338 line = psiconv_list_get(row_defaults,i);
339 if (line->position == row)
340 return line->layout;
341 }
342 for (i = 0;i < psiconv_list_length(col_defaults);i++) {
343 line = psiconv_list_get(col_defaults,i);
344 if (line->position == col)
345 return line->layout;
346 }
347 return cell_default;
348}
349
350
321void psiconv_free_color (psiconv_color color) 351void psiconv_free_color (psiconv_color color)
322{ 352{
323 if (color) 353 if (color)
324 free(color); 354 free(color);
325} 355}
547{ 577{
548 if (section) 578 if (section)
549 free(section); 579 free(section);
550} 580}
551 581
552void psiconv_free_numberformat(psiconv_numberformat numberformat) 582void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat)
553{ 583{
554 if (numberformat) 584 if (numberformat)
555 free(numberformat); 585 free(numberformat);
556} 586}
557 587
588void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout)
589{
590 psiconv_free_paragraph_layout(layout->paragraph);
591 psiconv_free_character_layout(layout->character);
592 psiconv_free_sheet_numberformat(layout->numberformat);
593}
594
595void psiconv_free_sheet_cell_aux(void *cell)
596{
597 psiconv_sheet_cell data = cell;
598
599 psiconv_free_sheet_cell_layout(data->layout);
600
601 if ((data->type == psiconv_cell_string) && (data->data.dat_string))
602 free(data->data.dat_string);
603}
604
558void psiconv_free_sheet_cell(psiconv_sheet_cell cell) 605void psiconv_free_sheet_cell(psiconv_sheet_cell cell)
559{ 606{
560 if (cell) { 607 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); 608 psiconv_free_sheet_cell_aux(cell);
609 free(cell);
610 }
577} 611}
578 612
579void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) 613void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list)
580{ 614{
581 if (list) 615 if (list)
582 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); 616 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux);
583} 617}
584 618
619void psiconv_free_sheet_line_aux(void *line)
620{
621 psiconv_sheet_line data = line;
622
623 psiconv_free_sheet_cell_layout(data->layout);
624}
625
626void psiconv_free_sheet_line(psiconv_sheet_line line)
627{
628 if (line) {
629 psiconv_free_sheet_line_aux(line);
630 free(line);
631 }
632}
633
634void psiconv_free_sheet_line_list(psiconv_sheet_line_list list)
635{
636 if (list)
637 psiconv_list_free_el(list,psiconv_free_sheet_line_aux);
638}
639
585void psiconv_free_sheet_worksheet_section( 640void psiconv_free_sheet_worksheet_aux (void *data)
586 psiconv_sheet_worksheet_section section)
587{ 641{
588 if (section) { 642 psiconv_sheet_worksheet section = data;
589 psiconv_free_paragraph_layout(section->paragraph); 643 psiconv_free_sheet_cell_layout(section->default_layout);
590 psiconv_free_character_layout(section->character);
591 psiconv_free_numberformat(section->numberformat);
592 psiconv_free_sheet_cell_list(section->cells); 644 psiconv_free_sheet_cell_list(section->cells);
645 psiconv_free_sheet_line_list(section->row_default_layouts);
646 psiconv_free_sheet_line_list(section->col_default_layouts);
647}
648
649void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet)
650{
651 if (sheet) {
652 psiconv_free_sheet_worksheet_aux(sheet);
593 free(section); 653 free(sheet);
594 } 654 }
655}
656
657void psiconv_free_sheet_worksheet_list(psiconv_sheet_worksheet_list list)
658{
659 if (list)
660 psiconv_list_free_el(list,psiconv_free_sheet_worksheet_aux);
595} 661}
596 662
597void psiconv_free_formula_aux(void *data) 663void psiconv_free_formula_aux(void *data)
598{ 664{
599 psiconv_formula formula; 665 psiconv_formula formula;
625{ 691{
626 if (list) 692 if (list)
627 psiconv_list_free_el(list,psiconv_free_formula_aux); 693 psiconv_list_free_el(list,psiconv_free_formula_aux);
628} 694}
629 695
696void psiconv_free_sheet_name_section(psiconv_sheet_name_section section)
697{
698 if (section) {
699 if(section->name)
700 free(section->name);
701 free(section);
702 }
703}
704
705void psiconv_free_sheet_info_section(psiconv_sheet_info_section section)
706{
707 if (section) {
708 free(section);
709 }
710}
711
712void psiconv_free_sheet_variable_aux(void * variable)
713{
714 psiconv_sheet_variable var = variable;
715 if (var->name)
716 free(var->name);
717 if (var->type == psiconv_var_string)
718 free(var->data.dat_string);
719}
720
721void psiconv_free_sheet_variable(psiconv_sheet_variable var)
722{
723 if (var) {
724 psiconv_free_sheet_variable_aux(var);
725 free(var);
726 }
727}
728
729void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list)
730{
731 if (list)
732 psiconv_list_free_el(list,psiconv_free_sheet_variable_aux);
733}
734
630void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) 735void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
631{ 736{
632 if (section) { 737 if (section) {
633 psiconv_free_formula_list(section->formulas); 738 psiconv_free_formula_list(section->formulas);
634 psiconv_free_sheet_worksheet_section(section->worksheet); 739 psiconv_free_sheet_worksheet_list(section->worksheets);
740 psiconv_free_sheet_name_section(section->name);
741 psiconv_free_sheet_info_section(section->info);
742 psiconv_free_sheet_variable_list(section->variables);
635 free(section); 743 free(section);
636 } 744 }
637} 745}
638 746
639void psiconv_free_sheet_f(psiconv_sheet_f file) 747void psiconv_free_sheet_f(psiconv_sheet_f file)

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

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