/[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 128
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);
38 39
39static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 40static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
40static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 41static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
41static psiconv_texted_section psiconv_empty_texted_section(void); 42static psiconv_texted_section psiconv_empty_texted_section(void);
42static psiconv_page_header psiconv_empty_page_header(void); 43static psiconv_page_header psiconv_empty_page_header(void);
316 return ss->normal; 317 return ss->normal;
317 else 318 else
318 return psiconv_list_get(ss->styles,0xff - nr); 319 return psiconv_list_get(ss->styles,0xff - nr);
319} 320}
320 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
321void psiconv_free_color (psiconv_color color) 350void psiconv_free_color (psiconv_color color)
322{ 351{
323 if (color) 352 if (color)
324 free(color); 353 free(color);
325} 354}
547{ 576{
548 if (section) 577 if (section)
549 free(section); 578 free(section);
550} 579}
551 580
552void psiconv_free_numberformat(psiconv_numberformat numberformat) 581void psiconv_free_sheet_numberformat(psiconv_sheet_numberformat numberformat)
553{ 582{
554 if (numberformat) 583 if (numberformat)
555 free(numberformat); 584 free(numberformat);
556} 585}
557 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
558void psiconv_free_sheet_cell(psiconv_sheet_cell cell) 604void psiconv_free_sheet_cell(psiconv_sheet_cell cell)
559{ 605{
560 if (cell) { 606 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); 607 psiconv_free_sheet_cell_aux(cell);
608 free(cell);
609 }
577} 610}
578 611
579void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list) 612void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list)
580{ 613{
581 if (list) 614 if (list)
582 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux); 615 psiconv_list_free_el(list,psiconv_free_sheet_cell_aux);
583} 616}
584 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
585void psiconv_free_sheet_worksheet_section( 639void psiconv_free_sheet_worksheet_aux (void *data)
586 psiconv_sheet_worksheet_section section)
587{ 640{
588 if (section) { 641 psiconv_sheet_worksheet section = data;
589 psiconv_free_paragraph_layout(section->paragraph); 642 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); 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);
593 free(section); 652 free(sheet);
594 } 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);
595} 660}
596 661
597void psiconv_free_formula_aux(void *data) 662void psiconv_free_formula_aux(void *data)
598{ 663{
599 psiconv_formula formula; 664 psiconv_formula formula;
629 694
630void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section) 695void psiconv_free_sheet_workbook_section(psiconv_sheet_workbook_section section)
631{ 696{
632 if (section) { 697 if (section) {
633 psiconv_free_formula_list(section->formulas); 698 psiconv_free_formula_list(section->formulas);
634 psiconv_free_sheet_worksheet_section(section->worksheet); 699 psiconv_free_sheet_worksheet_list(section->worksheets);
635 free(section); 700 free(section);
636 } 701 }
637} 702}
638 703
639void psiconv_free_sheet_f(psiconv_sheet_f file) 704void psiconv_free_sheet_f(psiconv_sheet_f file)

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

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