/[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 143 Revision 184
21#include "compat.h" 21#include "compat.h"
22#include <stdlib.h> 22#include <stdlib.h>
23#include <string.h> 23#include <string.h>
24#include "data.h" 24#include "data.h"
25#include "list.h" 25#include "list.h"
26#include "unicode.h"
26 27
27#ifdef DMALLOC 28#ifdef DMALLOC
28#include <dmalloc.h> 29#include <dmalloc.h>
29#endif 30#endif
30 31
39static void psiconv_free_paint_data_section_aux(void * section); 40static void psiconv_free_paint_data_section_aux(void * section);
40static void psiconv_free_clipart_section_aux(void * section); 41static void psiconv_free_clipart_section_aux(void * section);
41static void psiconv_free_formula_aux(void *data); 42static void psiconv_free_formula_aux(void *data);
42static void psiconv_free_sheet_worksheet_aux (void *data); 43static void psiconv_free_sheet_worksheet_aux (void *data);
43static void psiconv_free_sheet_variable_aux(void * variable); 44static void psiconv_free_sheet_variable_aux(void * variable);
45static void psiconv_free_sheet_cell_aux(void *cell);
46static void psiconv_free_sheet_line_aux(void *line);
47static void psiconv_free_sheet_worksheet_aux (void *data);
44 48
45static psiconv_word_styles_section psiconv_empty_word_styles_section(void); 49static psiconv_word_styles_section psiconv_empty_word_styles_section(void);
46static psiconv_text_and_layout psiconv_empty_text_and_layout(void); 50static psiconv_text_and_layout psiconv_empty_text_and_layout(void);
47static psiconv_texted_section psiconv_empty_texted_section(void); 51static psiconv_texted_section psiconv_empty_texted_section(void);
48static psiconv_page_header psiconv_empty_page_header(void); 52static psiconv_page_header psiconv_empty_page_header(void);
79 { 83 {
80 0xff, /* red */ 84 0xff, /* red */
81 0xff, /* green */ 85 0xff, /* green */
82 0xff, /* blue */ 86 0xff, /* blue */
83 }; 87 };
88 static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ',
89 'N','e','w',' ',
90 'R','o','m','a','n',0 };
84 static struct psiconv_font_s font = 91 static struct psiconv_font_s font =
85 { 92 {
86 "Times New Roman", /* name */ 93 font_times, /* name */
87 3 /* screenfont */ 94 3 /* screenfont */
88 }; 95 };
89 struct psiconv_character_layout_s cl = 96 struct psiconv_character_layout_s cl =
90 { 97 {
91 &black, /* color */ 98 &black, /* color */
104 111
105/* Note: these defaults seem to be hard-coded somewhere outside the 112/* Note: these defaults seem to be hard-coded somewhere outside the
106 files themself. */ 113 files themself. */
107psiconv_paragraph_layout psiconv_basic_paragraph_layout(void) 114psiconv_paragraph_layout psiconv_basic_paragraph_layout(void)
108{ 115{
116 static psiconv_ucs2 font_times[16] = { 'T','i','m','e','s',' ',
117 'N','e','w',' ',
118 'R','o','m','a','n',0 };
119
109 static struct psiconv_font_s font = 120 static struct psiconv_font_s font =
110 { 121 {
111 "Times New Roman", /* name */ 122 font_times, /* name */
112 2 /* screenfont */ 123 2 /* screenfont */
113 }; 124 };
114 static struct psiconv_color_s black = 125 static struct psiconv_color_s black =
115 { 126 {
116 0x00, /* red */ 127 0x00, /* red */
131 }; 142 };
132 static struct psiconv_bullet_s bullet = 143 static struct psiconv_bullet_s bullet =
133 { 144 {
134 psiconv_bool_false, /* on */ 145 psiconv_bool_false, /* on */
135 10.0, /* font_size */ 146 10.0, /* font_size */
136 0x95, /* character */ 147 0x201d, /* character */
137 psiconv_bool_true, /* indent */ 148 psiconv_bool_true, /* indent */
138 &black, /* color */ 149 &black, /* color */
139 &font, /* font */ 150 &font, /* font */
140 }; 151 };
141 static struct psiconv_all_tabs_s tabs = 152 static struct psiconv_all_tabs_s tabs =
190{ 201{
191 psiconv_font result; 202 psiconv_font result;
192 if(!(result = malloc(sizeof(*result)))) 203 if(!(result = malloc(sizeof(*result))))
193 goto ERROR1; 204 goto ERROR1;
194 *result = *font; 205 *result = *font;
195 if (!(result->name = strdup(result->name))) 206 if (!(result->name = psiconv_unicode_strdup(result->name)))
196 goto ERROR2; 207 goto ERROR2;
197 return result; 208 return result;
198ERROR2: 209ERROR2:
199 free(result); 210 free(result);
200ERROR1: 211ERROR1:
473 free(section->name); 484 free(section->name);
474 free(section); 485 free(section);
475 } 486 }
476} 487}
477 488
489void psiconv_free_object_icon_section(psiconv_object_icon_section section)
490{
491 if (section) {
492 if (section->icon_name)
493 free(section->icon_name);
494 free(section);
495 }
496}
497
498void psiconv_free_object_display_section(psiconv_object_display_section section)
499{
500 if (section)
501 free(section);
502}
503
504void psiconv_free_embedded_object_section
505 (psiconv_embedded_object_section object)
506{
507 if (object) {
508 psiconv_free_object_icon_section(object->icon);
509 psiconv_free_object_display_section(object->display);
510 psiconv_free_file(object->object);
511 free(object);
512 }
513}
514
478void psiconv_free_in_line_layout_aux(void * layout) 515void psiconv_free_in_line_layout_aux(void * layout)
479{ 516{
480 psiconv_free_character_layout(((psiconv_in_line_layout) layout)->layout); 517 psiconv_free_character_layout(((psiconv_in_line_layout) layout)->layout);
518 psiconv_free_embedded_object_section
519 (((psiconv_in_line_layout) layout)->object);
481} 520}
482 521
483void psiconv_free_in_line_layout(psiconv_in_line_layout layout) 522void psiconv_free_in_line_layout(psiconv_in_line_layout layout)
484{ 523{
485 if (layout) { 524 if (layout) {
917 const psiconv_font value2) 956 const psiconv_font value2)
918{ 957{
919 if (!value1 || !value2 || !value1->name || !value2->name) 958 if (!value1 || !value2 || !value1->name || !value2->name)
920 return 1; 959 return 1;
921 if ((value1->screenfont == value2->screenfont) && 960 if ((value1->screenfont == value2->screenfont) &&
922 !strcmp(value1->name,value2->name)) 961 !psiconv_unicode_strcmp(value1->name,value2->name))
923 return 0; 962 return 0;
924 else 963 else
925 return 1; 964 return 1;
926} 965}
927 966
1315psiconv_sketch_section psiconv_empty_sketch_section(void) 1354psiconv_sketch_section psiconv_empty_sketch_section(void)
1316{ 1355{
1317 psiconv_sketch_section result; 1356 psiconv_sketch_section result;
1318 if (!(result = malloc(sizeof(*result)))) 1357 if (!(result = malloc(sizeof(*result))))
1319 goto ERROR1; 1358 goto ERROR1;
1320 result->form_xsize = 320; 1359 result->displayed_xsize = 320;
1321 result->form_ysize = 200; 1360 result->displayed_ysize = 200;
1322 result->picture_x_offset = result->picture_y_offset = result->picture_xsize = 1361 result->picture_data_x_offset = result->picture_data_y_offset =
1323 result->picture_ysize = 0; 1362 result->form_xsize = result->form_ysize =
1363 result->displayed_size_x_offset = result->displayed_size_y_offset = 0;
1324 result->magnification_x = result->magnification_y = 1.0; 1364 result->magnification_x = result->magnification_y = 1.0;
1325 result->cut_left = result->cut_right = result->cut_top = 1365 result->cut_left = result->cut_right = result->cut_top =
1326 result->cut_bottom = 0.0; 1366 result->cut_bottom = 0.0;
1327 if (!(result->picture = psiconv_empty_paint_data_section())) 1367 if (!(result->picture = psiconv_empty_paint_data_section()))
1328 goto ERROR2; 1368 goto ERROR2;

Legend:
Removed from v.143  
changed lines
  Added in v.184

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