--- psiconv/trunk/lib/psiconv/data.h 2001/01/31 00:35:06 102 +++ psiconv/trunk/lib/psiconv/data.h 2003/11/23 21:47:24 167 @@ -34,6 +34,9 @@ extern "C" { #endif /* __cplusplus */ +/* Forward declaration (for psiconv_embedded_object_section) */ +typedef struct psiconv_file_s *psiconv_file; + typedef double psiconv_float_t; typedef enum psiconv_file_type { @@ -193,6 +196,7 @@ psiconv_bool_t keep_with_next; psiconv_bool_t on_next_page; psiconv_bool_t no_widow_protection; + psiconv_bool_t wrap_to_fit_cell; psiconv_length_t border_distance; psiconv_bullet bullet; psiconv_border left_border; @@ -226,10 +230,35 @@ psiconv_string_t name; } *psiconv_application_id_section; +typedef struct psiconv_object_icon_section_s +{ + psiconv_length_t icon_width; + psiconv_length_t icon_height; + psiconv_string_t icon_name; +} *psiconv_object_icon_section; + +typedef struct psiconv_object_display_section_s +{ + psiconv_bool_t show_icon; + psiconv_length_t width; + psiconv_length_t height; +} *psiconv_object_display_section; + +typedef struct psiconv_embedded_object_section_s +{ + psiconv_object_icon_section icon; + psiconv_object_display_section display; + psiconv_file object; +} *psiconv_embedded_object_section; + typedef struct psiconv_in_line_layout_s { psiconv_character_layout layout; int length; + /* If object is NULL, this does not apply to an object */ + psiconv_embedded_object_section object; + psiconv_length_t object_width; + psiconv_length_t object_height; } *psiconv_in_line_layout; typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */ @@ -365,26 +394,28 @@ psiconv_pictures sections; } *psiconv_mbm_f; -/* This is a little intricated. A picture may be embedded in a larger form. - A form is empty, except for the picture. The form has size form_{x,y}size, - and the picture is at offset picture_{x,y}_offset within the form. The - picture itself has size picture_{x,y}size. +/* Read the Psiconv file format documentation for a complete discription. + Basic idea: a picture has a certain display size. Within it, the pixel + data begins at a certain offset. Around it, there is an empty form. + The first eight values are before magnification and cuts. Cuts are always <= 1.0; a cut of 0.0 cuts nothing away, a cut of 1.0 cuts everything away. */ typedef struct psiconv_sketch_section_s { + psiconv_u16 displayed_xsize; + psiconv_u16 displayed_ysize; + psiconv_u16 picture_data_x_offset; + psiconv_u16 picture_data_y_offset; psiconv_u16 form_xsize; psiconv_u16 form_ysize; - psiconv_u16 picture_x_offset; - psiconv_u16 picture_y_offset; - psiconv_u16 picture_xsize; - psiconv_u16 picture_ysize; - float magnification_x; /* computed relative to first six values */ - float magnification_y; /* computed relative to first six values */ - float cut_left; /* computed relative to first six values */ - float cut_right; /* computed relative to first six values */ - float cut_top; /* computed relative to first six values */ - float cut_bottom; /* computed relative to first six values */ + psiconv_u16 displayed_size_x_offset; + psiconv_u16 displayed_size_y_offset; + float magnification_x; /* computed relative to first eight values */ + float magnification_y; /* computed relative to first eight values */ + float cut_left; /* computed relative to first eight values */ + float cut_right; /* computed relative to first eight values */ + float cut_top; /* computed relative to first eight values */ + float cut_bottom; /* computed relative to first eight values */ psiconv_paint_data_section picture; } *psiconv_sketch_section; @@ -424,6 +455,95 @@ psiconv_sheet_cell_reference_t last; } psiconv_sheet_cell_block_t; +typedef enum psiconv_cell_type +{ + psiconv_cell_blank, + psiconv_cell_int, + psiconv_cell_bool, + psiconv_cell_error, + psiconv_cell_float, + psiconv_cell_string +} psiconv_cell_type_t; + +typedef enum psiconv_sheet_errorcode +{ + psiconv_sheet_error_none, + psiconv_sheet_error_null, + psiconv_sheet_error_divzero, + psiconv_sheet_error_value, + psiconv_sheet_error_reference, + psiconv_sheet_error_name, + psiconv_sheet_error_number, + psiconv_sheet_error_notavail +} psiconv_sheet_errorcode_t; + +typedef enum psiconv_sheet_numberformat_code +{ + psiconv_numberformat_general, + psiconv_numberformat_fixeddecimal, + psiconv_numberformat_scientific, + psiconv_numberformat_currency, + psiconv_numberformat_percent, + psiconv_numberformat_triads, + psiconv_numberformat_boolean, + psiconv_numberformat_text, + psiconv_numberformat_date_dmm, + psiconv_numberformat_date_mmd, + psiconv_numberformat_date_ddmmyy, + psiconv_numberformat_date_mmddyy, + psiconv_numberformat_date_yymmdd, + psiconv_numberformat_date_dmmm, + psiconv_numberformat_date_dmmmyy, + psiconv_numberformat_date_ddmmmyy, + psiconv_numberformat_date_mmm, + psiconv_numberformat_date_monthname, + psiconv_numberformat_date_mmmyy, + psiconv_numberformat_date_monthnameyy, + psiconv_numberformat_date_monthnamedyyyy, + psiconv_numberformat_datetime_ddmmyyyyhhii, + psiconv_numberformat_datetime_ddmmyyyyHHii, + psiconv_numberformat_datetime_mmddyyyyhhii, + psiconv_numberformat_datetime_mmddyyyyHHii, + psiconv_numberformat_datetime_yyyymmddhhii, + psiconv_numberformat_datetime_yyyymmddHHii, + psiconv_numberformat_time_hhii, + psiconv_numberformat_time_hhiiss, + psiconv_numberformat_time_HHii, + psiconv_numberformat_time_HHiiss +} psiconv_sheet_numberformat_code_t; + +typedef struct psiconv_sheet_numberformat_s +{ + psiconv_sheet_numberformat_code_t code; + psiconv_u8 decimal; +} *psiconv_sheet_numberformat; + +typedef struct psiconv_sheet_cell_layout_s +{ + psiconv_character_layout character; + psiconv_paragraph_layout paragraph; + psiconv_sheet_numberformat numberformat; +} * psiconv_sheet_cell_layout; + +typedef struct psiconv_sheet_cell_s +{ + psiconv_u16 column; + psiconv_u16 row; + psiconv_cell_type_t type; + union { + psiconv_u32 dat_int; + double dat_float; + char *dat_string; + psiconv_bool_t dat_bool; + psiconv_sheet_errorcode_t dat_error; + } data; + psiconv_sheet_cell_layout layout; + psiconv_bool_t calculated; + psiconv_u32 ref_formula; +} *psiconv_sheet_cell; + +typedef psiconv_list psiconv_sheet_cell_list; + typedef struct psiconv_sheet_status_section_s { psiconv_bool_t show_graph; @@ -455,6 +575,9 @@ psiconv_formula_op_pow, psiconv_formula_op_pos, psiconv_formula_op_neg, + psiconv_formula_op_not, + psiconv_formula_op_and, + psiconv_formula_op_or, psiconv_formula_op_con, psiconv_formula_op_bra, psiconv_formula_mark_eof, @@ -586,12 +709,111 @@ psiconv_sheet_cell_reference_t dat_cellref; psiconv_sheet_cell_block_t dat_cellblock; psiconv_formula_list fun_operands; + psiconv_u32 dat_variable; } data; } *psiconv_formula; +typedef struct psiconv_sheet_line_s +{ + psiconv_u32 position; + psiconv_sheet_cell_layout layout; +} *psiconv_sheet_line; + +typedef psiconv_list psiconv_sheet_line_list; + /* Of struct psiconv_sheet_line_s */ + +typedef struct psiconv_sheet_grid_size_s +{ + psiconv_u32 line_number; + psiconv_length_t size; +} *psiconv_sheet_grid_size; + +typedef psiconv_list psiconv_sheet_grid_size_list; + /* Of struct psiconv_sheet_grid_size_s */ + +typedef psiconv_list psiconv_sheet_grid_break_list; /* of psiconv_u32 */ + +typedef struct psiconv_sheet_grid_section_s +{ + psiconv_bool_t show_column_titles; + psiconv_bool_t show_row_titles; + psiconv_bool_t show_vertical_grid; + psiconv_bool_t show_horizontal_grid; + psiconv_bool_t freeze_rows; + psiconv_bool_t freeze_columns; + psiconv_u32 frozen_rows; + psiconv_u32 frozen_columns; + psiconv_u32 first_unfrozen_row_displayed; + psiconv_u32 first_unfrozen_column_displayed; + psiconv_bool_t show_page_breaks; + psiconv_u32 first_row; + psiconv_u32 first_column; + psiconv_u32 last_row; + psiconv_u32 last_column; + psiconv_length_t default_row_height; + psiconv_length_t default_column_width; + psiconv_sheet_grid_size_list row_heights; + psiconv_sheet_grid_size_list column_heights; + psiconv_sheet_grid_break_list row_page_breaks; + psiconv_sheet_grid_break_list column_page_breaks; +} *psiconv_sheet_grid_section; + +typedef struct psiconv_sheet_worksheet_s +{ + psiconv_sheet_cell_layout default_layout; + psiconv_sheet_cell_list cells; + psiconv_bool_t show_zeros; + psiconv_sheet_line_list row_default_layouts; + psiconv_sheet_line_list col_default_layouts; + psiconv_sheet_grid_section grid; +} *psiconv_sheet_worksheet; + +typedef psiconv_list psiconv_sheet_worksheet_list; + /* of struct psiconv_sheet_worksheet_s */ + +typedef enum psiconv_variable_type +{ + psiconv_var_int, + psiconv_var_float, + psiconv_var_string, + psiconv_var_cellref, + psiconv_var_cellblock +} psiconv_variable_type_t; + +typedef struct psiconv_sheet_variable_s +{ + psiconv_u32 number; + char *name; + psiconv_variable_type_t type; + union { + psiconv_s32 dat_int; + double dat_float; + char *dat_string; + psiconv_sheet_cell_reference_t dat_cellref; + psiconv_sheet_cell_block_t dat_cellblock; + } data; +} *psiconv_sheet_variable; + +typedef psiconv_list psiconv_sheet_variable_list; + /* of struct psiconv_sheet_variable_s */ + +typedef struct psiconv_sheet_name_section_s +{ + char *name; +} *psiconv_sheet_name_section; + +typedef struct psiconv_sheet_info_section_s +{ + psiconv_bool_t auto_recalc; +} *psiconv_sheet_info_section; + typedef struct psiconv_sheet_workbook_section_s { psiconv_formula_list formulas; + psiconv_sheet_worksheet_list worksheets; + psiconv_sheet_variable_list variables; + psiconv_sheet_info_section info; + psiconv_sheet_name_section name; } *psiconv_sheet_workbook_section; typedef struct psiconv_sheet_f_s @@ -601,11 +823,12 @@ psiconv_sheet_workbook_section workbook_sec; } *psiconv_sheet_f; -typedef struct psiconv_file_s +/* NB: psiconv_file is already defined above */ +struct psiconv_file_s { psiconv_file_type_t type; void *file; -} *psiconv_file; +}; /* UID1 */ @@ -631,6 +854,7 @@ #define PSICONV_ID_SKETCH_SECTION 0x1000007D #define PSICONV_ID_SHEET_STATUS_SECTION 0x1000011F #define PSICONV_ID_SHEET_WORKBOOK_SECTION 0x1000011D +#define PSICONV_ID_SHEET_GRAPH_SECTION 0x10000121 /* Other ids */ #define PSICONV_ID_PAGE_DIMENSIONS1 0x100000fd @@ -643,6 +867,10 @@ #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C #define PSICONV_ID_CLIPART_ITEM 0x10000040 +#define PSICONV_ID_OBJECT 0x10000051 +#define PSICONV_ID_OBJECT_DISPLAY_SECTION 0x10000146 +#define PSICONV_ID_OBJECT_ICON_SECTION 0x1000012A +#define PSICONV_ID_OBJECT_SECTION_TABLE_SECTION 0x10000144 /* Return a clean layout_status. You can modify it at will. Returns NULL @@ -663,6 +891,15 @@ /* Get a numbered style. Returns NULL if the style is unknown. */ extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr); +/* Get a numbered formula. Returns NULL if the style is unknown. */ +extern psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr); + +/* Return the default layout */ +extern psiconv_sheet_cell_layout psiconv_get_default_layout + (psiconv_sheet_line_list row_defaults, + psiconv_sheet_line_list col_defaults, + psiconv_sheet_cell_layout cell_default, + int row,int col); extern void psiconv_free_color(psiconv_color color); extern void psiconv_free_border(psiconv_border border); @@ -679,13 +916,40 @@ extern void psiconv_free_formula_list(psiconv_formula_list list); extern void psiconv_free_sheet_status_section (psiconv_sheet_status_section section); +extern void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout); +extern void psiconv_free_sheet_grid_break_list + (psiconv_sheet_grid_break_list list); +extern void psiconv_free_sheet_grid_size(psiconv_sheet_grid_size s); +extern void psiconv_free_sheet_grid_size_list + (psiconv_sheet_grid_size_list list); +extern void psiconv_free_sheet_grid_section(psiconv_sheet_grid_section sec); +extern void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet); +extern void psiconv_free_sheet_worksheet_list + (psiconv_sheet_worksheet_list list); + extern void psiconv_free_sheet_f(psiconv_sheet_f file); +extern void psiconv_free_sheet_cell(psiconv_sheet_cell cell); +extern void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list); +extern void psiconv_free_sheet_numberformat + (psiconv_sheet_numberformat numberformat); +extern void psiconv_free_sheet_line_list(psiconv_sheet_line_list list); +extern void psiconv_free_sheet_line(psiconv_sheet_line line); +extern void psiconv_free_sheet_name_section(psiconv_sheet_name_section section); +extern void psiconv_free_sheet_variable(psiconv_sheet_variable list); +extern void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list); +extern void psiconv_free_sheet_info_section(psiconv_sheet_info_section section); extern void psiconv_free_header_section(psiconv_header_section header); extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry); extern void psiconv_free_section_table_section (psiconv_section_table_section section); extern void psiconv_free_application_id_section (psiconv_application_id_section section); +extern void psiconv_free_object_display_section + (psiconv_object_display_section section); +extern void psiconv_free_object_icon_section + (psiconv_object_icon_section section); +extern void psiconv_free_embedded_object_section + (psiconv_embedded_object_section object); extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout); extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts); extern void psiconv_free_replacement(psiconv_replacement replacement);