… | |
… | |
31 | to structs */ |
31 | to structs */ |
32 | |
32 | |
33 | #ifdef __cplusplus |
33 | #ifdef __cplusplus |
34 | extern "C" { |
34 | extern "C" { |
35 | #endif /* __cplusplus */ |
35 | #endif /* __cplusplus */ |
|
|
36 | |
|
|
37 | /* Forward declaration (for psiconv_embedded_object_section) */ |
|
|
38 | typedef struct psiconv_file_s *psiconv_file; |
36 | |
39 | |
37 | typedef double psiconv_float_t; |
40 | typedef double psiconv_float_t; |
38 | |
41 | |
39 | typedef enum psiconv_file_type { |
42 | typedef enum psiconv_file_type { |
40 | psiconv_unknown_file, |
43 | psiconv_unknown_file, |
… | |
… | |
225 | { |
228 | { |
226 | psiconv_u32 id; |
229 | psiconv_u32 id; |
227 | psiconv_string_t name; |
230 | psiconv_string_t name; |
228 | } *psiconv_application_id_section; |
231 | } *psiconv_application_id_section; |
229 | |
232 | |
|
|
233 | typedef struct psiconv_object_icon_section_s |
|
|
234 | { |
|
|
235 | psiconv_length_t icon_width; |
|
|
236 | psiconv_length_t icon_height; |
|
|
237 | psiconv_string_t icon_name; |
|
|
238 | } *psiconv_object_icon_section; |
|
|
239 | |
|
|
240 | typedef struct psiconv_object_display_section_s |
|
|
241 | { |
|
|
242 | psiconv_bool_t show_icon; |
|
|
243 | psiconv_length_t width; |
|
|
244 | psiconv_length_t height; |
|
|
245 | } *psiconv_object_display_section; |
|
|
246 | |
|
|
247 | typedef struct psiconv_embedded_object_section_s |
|
|
248 | { |
|
|
249 | psiconv_object_icon_section icon; |
|
|
250 | psiconv_object_display_section display; |
|
|
251 | psiconv_file object; |
|
|
252 | } *psiconv_embedded_object_section; |
|
|
253 | |
230 | typedef struct psiconv_in_line_layout_s |
254 | typedef struct psiconv_in_line_layout_s |
231 | { |
255 | { |
232 | psiconv_character_layout layout; |
256 | psiconv_character_layout layout; |
233 | int length; |
257 | int length; |
|
|
258 | /* If object is NULL, this does not apply to an object */ |
|
|
259 | psiconv_embedded_object_section object; |
|
|
260 | psiconv_length_t object_width; |
|
|
261 | psiconv_length_t object_height; |
234 | } *psiconv_in_line_layout; |
262 | } *psiconv_in_line_layout; |
235 | |
263 | |
236 | typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */ |
264 | typedef psiconv_list psiconv_in_line_layouts; /* of struct in_line_layout */ |
237 | |
265 | |
238 | typedef enum psiconv_replacement_type |
266 | typedef enum psiconv_replacement_type |
… | |
… | |
364 | typedef struct psiconv_mbm_f_s |
392 | typedef struct psiconv_mbm_f_s |
365 | { |
393 | { |
366 | psiconv_pictures sections; |
394 | psiconv_pictures sections; |
367 | } *psiconv_mbm_f; |
395 | } *psiconv_mbm_f; |
368 | |
396 | |
369 | /* This is a little intricated. A picture may be embedded in a larger form. |
397 | /* Read the Psiconv file format documentation for a complete discription. |
370 | A form is empty, except for the picture. The form has size form_{x,y}size, |
398 | Basic idea: a picture has a certain display size. Within it, the pixel |
371 | and the picture is at offset picture_{x,y}_offset within the form. The |
399 | data begins at a certain offset. Around it, there is an empty form. |
372 | picture itself has size picture_{x,y}size. |
400 | The first eight values are before magnification and cuts. |
373 | Cuts are always <= 1.0; a cut of 0.0 cuts nothing away, a cut of 1.0 |
401 | Cuts are always <= 1.0; a cut of 0.0 cuts nothing away, a cut of 1.0 |
374 | cuts everything away. */ |
402 | cuts everything away. */ |
375 | typedef struct psiconv_sketch_section_s |
403 | typedef struct psiconv_sketch_section_s |
376 | { |
404 | { |
|
|
405 | psiconv_u16 displayed_xsize; |
|
|
406 | psiconv_u16 displayed_ysize; |
|
|
407 | psiconv_u16 picture_data_x_offset; |
|
|
408 | psiconv_u16 picture_data_y_offset; |
377 | psiconv_u16 form_xsize; |
409 | psiconv_u16 form_xsize; |
378 | psiconv_u16 form_ysize; |
410 | psiconv_u16 form_ysize; |
379 | psiconv_u16 picture_x_offset; |
411 | psiconv_u16 displayed_size_x_offset; |
380 | psiconv_u16 picture_y_offset; |
412 | psiconv_u16 displayed_size_y_offset; |
381 | psiconv_u16 picture_xsize; |
|
|
382 | psiconv_u16 picture_ysize; |
|
|
383 | float magnification_x; /* computed relative to first six values */ |
413 | float magnification_x; /* computed relative to first eight values */ |
384 | float magnification_y; /* computed relative to first six values */ |
414 | float magnification_y; /* computed relative to first eight values */ |
385 | float cut_left; /* computed relative to first six values */ |
415 | float cut_left; /* computed relative to first eight values */ |
386 | float cut_right; /* computed relative to first six values */ |
416 | float cut_right; /* computed relative to first eight values */ |
387 | float cut_top; /* computed relative to first six values */ |
417 | float cut_top; /* computed relative to first eight values */ |
388 | float cut_bottom; /* computed relative to first six values */ |
418 | float cut_bottom; /* computed relative to first eight values */ |
389 | psiconv_paint_data_section picture; |
419 | psiconv_paint_data_section picture; |
390 | } *psiconv_sketch_section; |
420 | } *psiconv_sketch_section; |
391 | |
421 | |
392 | typedef struct psiconv_sketch_f_s |
422 | typedef struct psiconv_sketch_f_s |
393 | { |
423 | { |
… | |
… | |
502 | psiconv_cell_type_t type; |
532 | psiconv_cell_type_t type; |
503 | union { |
533 | union { |
504 | psiconv_u32 dat_int; |
534 | psiconv_u32 dat_int; |
505 | double dat_float; |
535 | double dat_float; |
506 | char *dat_string; |
536 | char *dat_string; |
507 | psiconv_bool_t dat_bool; |
537 | psiconv_bool_t dat_bool; |
508 | psiconv_sheet_errorcode_t dat_error; |
538 | psiconv_sheet_errorcode_t dat_error; |
509 | } data; |
539 | } data; |
510 | psiconv_sheet_cell_layout layout; |
540 | psiconv_sheet_cell_layout layout; |
511 | psiconv_bool_t calculated; |
541 | psiconv_bool_t calculated; |
512 | psiconv_u32 ref_formula; |
542 | psiconv_u32 ref_formula; |
513 | } *psiconv_sheet_cell; |
543 | } *psiconv_sheet_cell; |
514 | |
544 | |
515 | typedef psiconv_list psiconv_sheet_cell_list; |
545 | typedef psiconv_list psiconv_sheet_cell_list; |
516 | /* Of struct psiconv_sheet_cell_s */ |
|
|
517 | |
546 | |
518 | typedef struct psiconv_sheet_status_section_s |
547 | typedef struct psiconv_sheet_status_section_s |
519 | { |
548 | { |
520 | psiconv_bool_t show_graph; |
549 | psiconv_bool_t show_graph; |
521 | psiconv_u32 cursor_row; |
550 | psiconv_u32 cursor_row; |
… | |
… | |
678 | double dat_float; |
707 | double dat_float; |
679 | char *dat_string; |
708 | char *dat_string; |
680 | psiconv_sheet_cell_reference_t dat_cellref; |
709 | psiconv_sheet_cell_reference_t dat_cellref; |
681 | psiconv_sheet_cell_block_t dat_cellblock; |
710 | psiconv_sheet_cell_block_t dat_cellblock; |
682 | psiconv_formula_list fun_operands; |
711 | psiconv_formula_list fun_operands; |
|
|
712 | psiconv_u32 dat_variable; |
683 | } data; |
713 | } data; |
684 | } *psiconv_formula; |
714 | } *psiconv_formula; |
|
|
715 | |
|
|
716 | typedef struct psiconv_sheet_line_s |
|
|
717 | { |
|
|
718 | psiconv_u32 position; |
|
|
719 | psiconv_sheet_cell_layout layout; |
|
|
720 | } *psiconv_sheet_line; |
|
|
721 | |
|
|
722 | typedef psiconv_list psiconv_sheet_line_list; |
|
|
723 | /* Of struct psiconv_sheet_line_s */ |
|
|
724 | |
|
|
725 | typedef struct psiconv_sheet_grid_size_s |
|
|
726 | { |
|
|
727 | psiconv_u32 line_number; |
|
|
728 | psiconv_length_t size; |
|
|
729 | } *psiconv_sheet_grid_size; |
|
|
730 | |
|
|
731 | typedef psiconv_list psiconv_sheet_grid_size_list; |
|
|
732 | /* Of struct psiconv_sheet_grid_size_s */ |
|
|
733 | |
|
|
734 | typedef psiconv_list psiconv_sheet_grid_break_list; /* of psiconv_u32 */ |
|
|
735 | |
|
|
736 | typedef struct psiconv_sheet_grid_section_s |
|
|
737 | { |
|
|
738 | psiconv_bool_t show_column_titles; |
|
|
739 | psiconv_bool_t show_row_titles; |
|
|
740 | psiconv_bool_t show_vertical_grid; |
|
|
741 | psiconv_bool_t show_horizontal_grid; |
|
|
742 | psiconv_bool_t freeze_rows; |
|
|
743 | psiconv_bool_t freeze_columns; |
|
|
744 | psiconv_u32 frozen_rows; |
|
|
745 | psiconv_u32 frozen_columns; |
|
|
746 | psiconv_u32 first_unfrozen_row_displayed; |
|
|
747 | psiconv_u32 first_unfrozen_column_displayed; |
|
|
748 | psiconv_bool_t show_page_breaks; |
|
|
749 | psiconv_u32 first_row; |
|
|
750 | psiconv_u32 first_column; |
|
|
751 | psiconv_u32 last_row; |
|
|
752 | psiconv_u32 last_column; |
|
|
753 | psiconv_length_t default_row_height; |
|
|
754 | psiconv_length_t default_column_width; |
|
|
755 | psiconv_sheet_grid_size_list row_heights; |
|
|
756 | psiconv_sheet_grid_size_list column_heights; |
|
|
757 | psiconv_sheet_grid_break_list row_page_breaks; |
|
|
758 | psiconv_sheet_grid_break_list column_page_breaks; |
|
|
759 | } *psiconv_sheet_grid_section; |
685 | |
760 | |
686 | typedef struct psiconv_sheet_worksheet_s |
761 | typedef struct psiconv_sheet_worksheet_s |
687 | { |
762 | { |
688 | psiconv_sheet_cell_layout default_layout; |
763 | psiconv_sheet_cell_layout default_layout; |
689 | psiconv_sheet_cell_list cells; |
764 | psiconv_sheet_cell_list cells; |
690 | psiconv_bool_t show_zeros; |
765 | psiconv_bool_t show_zeros; |
|
|
766 | psiconv_sheet_line_list row_default_layouts; |
|
|
767 | psiconv_sheet_line_list col_default_layouts; |
|
|
768 | psiconv_sheet_grid_section grid; |
691 | } *psiconv_sheet_worksheet; |
769 | } *psiconv_sheet_worksheet; |
692 | |
770 | |
693 | typedef psiconv_list psiconv_sheet_worksheet_list; |
771 | typedef psiconv_list psiconv_sheet_worksheet_list; |
694 | /* of struct psiconv_sheet_worksheet */ |
772 | /* of struct psiconv_sheet_worksheet_s */ |
|
|
773 | |
|
|
774 | typedef enum psiconv_variable_type |
|
|
775 | { |
|
|
776 | psiconv_var_int, |
|
|
777 | psiconv_var_float, |
|
|
778 | psiconv_var_string, |
|
|
779 | psiconv_var_cellref, |
|
|
780 | psiconv_var_cellblock |
|
|
781 | } psiconv_variable_type_t; |
|
|
782 | |
|
|
783 | typedef struct psiconv_sheet_variable_s |
|
|
784 | { |
|
|
785 | psiconv_u32 number; |
|
|
786 | char *name; |
|
|
787 | psiconv_variable_type_t type; |
|
|
788 | union { |
|
|
789 | psiconv_s32 dat_int; |
|
|
790 | double dat_float; |
|
|
791 | char *dat_string; |
|
|
792 | psiconv_sheet_cell_reference_t dat_cellref; |
|
|
793 | psiconv_sheet_cell_block_t dat_cellblock; |
|
|
794 | } data; |
|
|
795 | } *psiconv_sheet_variable; |
|
|
796 | |
|
|
797 | typedef psiconv_list psiconv_sheet_variable_list; |
|
|
798 | /* of struct psiconv_sheet_variable_s */ |
|
|
799 | |
|
|
800 | typedef struct psiconv_sheet_name_section_s |
|
|
801 | { |
|
|
802 | char *name; |
|
|
803 | } *psiconv_sheet_name_section; |
|
|
804 | |
|
|
805 | typedef struct psiconv_sheet_info_section_s |
|
|
806 | { |
|
|
807 | psiconv_bool_t auto_recalc; |
|
|
808 | } *psiconv_sheet_info_section; |
695 | |
809 | |
696 | typedef struct psiconv_sheet_workbook_section_s |
810 | typedef struct psiconv_sheet_workbook_section_s |
697 | { |
811 | { |
698 | psiconv_formula_list formulas; |
812 | psiconv_formula_list formulas; |
699 | psiconv_sheet_worksheet_list worksheets; |
813 | psiconv_sheet_worksheet_list worksheets; |
|
|
814 | psiconv_sheet_variable_list variables; |
|
|
815 | psiconv_sheet_info_section info; |
|
|
816 | psiconv_sheet_name_section name; |
700 | } *psiconv_sheet_workbook_section; |
817 | } *psiconv_sheet_workbook_section; |
701 | |
818 | |
702 | typedef struct psiconv_sheet_f_s |
819 | typedef struct psiconv_sheet_f_s |
703 | { |
820 | { |
704 | psiconv_page_layout_section page_sec; |
821 | psiconv_page_layout_section page_sec; |
705 | psiconv_sheet_status_section status_sec; |
822 | psiconv_sheet_status_section status_sec; |
706 | psiconv_sheet_workbook_section workbook_sec; |
823 | psiconv_sheet_workbook_section workbook_sec; |
707 | } *psiconv_sheet_f; |
824 | } *psiconv_sheet_f; |
708 | |
825 | |
|
|
826 | /* NB: psiconv_file is already defined above */ |
709 | typedef struct psiconv_file_s |
827 | struct psiconv_file_s |
710 | { |
828 | { |
711 | psiconv_file_type_t type; |
829 | psiconv_file_type_t type; |
712 | void *file; |
830 | void *file; |
713 | } *psiconv_file; |
831 | }; |
714 | |
832 | |
715 | |
833 | |
716 | /* UID1 */ |
834 | /* UID1 */ |
717 | #define PSICONV_ID_PSION5 0x10000037 |
835 | #define PSICONV_ID_PSION5 0x10000037 |
718 | #define PSICONV_ID_CLIPART 0x10000041 |
836 | #define PSICONV_ID_CLIPART 0x10000041 |
… | |
… | |
747 | #define PSICONV_ID_TEXTED_LAYOUT 0x10000066 |
865 | #define PSICONV_ID_TEXTED_LAYOUT 0x10000066 |
748 | #define PSICONV_ID_TEXTED_TEXT 0x10000064 |
866 | #define PSICONV_ID_TEXTED_TEXT 0x10000064 |
749 | #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F |
867 | #define PSICONV_ID_STYLE_REMOVABLE 0x1000004F |
750 | #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C |
868 | #define PSICONV_ID_STYLE_BUILT_IN 0x1000004C |
751 | #define PSICONV_ID_CLIPART_ITEM 0x10000040 |
869 | #define PSICONV_ID_CLIPART_ITEM 0x10000040 |
|
|
870 | #define PSICONV_ID_OBJECT 0x10000051 |
|
|
871 | #define PSICONV_ID_OBJECT_DISPLAY_SECTION 0x10000146 |
|
|
872 | #define PSICONV_ID_OBJECT_ICON_SECTION 0x1000012A |
|
|
873 | #define PSICONV_ID_OBJECT_SECTION_TABLE_SECTION 0x10000144 |
752 | |
874 | |
753 | |
875 | |
754 | /* Return a clean layout_status. You can modify it at will. Returns NULL |
876 | /* Return a clean layout_status. You can modify it at will. Returns NULL |
755 | if there is not enough memory. */ |
877 | if there is not enough memory. */ |
756 | extern psiconv_character_layout psiconv_basic_character_layout(void); |
878 | extern psiconv_character_layout psiconv_basic_character_layout(void); |
… | |
… | |
767 | extern psiconv_character_layout psiconv_clone_character_layout |
889 | extern psiconv_character_layout psiconv_clone_character_layout |
768 | (psiconv_character_layout ls); |
890 | (psiconv_character_layout ls); |
769 | |
891 | |
770 | /* Get a numbered style. Returns NULL if the style is unknown. */ |
892 | /* Get a numbered style. Returns NULL if the style is unknown. */ |
771 | extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr); |
893 | extern psiconv_word_style psiconv_get_style (psiconv_word_styles_section ss, int nr); |
|
|
894 | /* Get a numbered formula. Returns NULL if the style is unknown. */ |
|
|
895 | extern psiconv_formula psiconv_get_formula (psiconv_formula_list ss, int nr); |
|
|
896 | |
|
|
897 | /* Return the default layout */ |
|
|
898 | extern psiconv_sheet_cell_layout psiconv_get_default_layout |
|
|
899 | (psiconv_sheet_line_list row_defaults, |
|
|
900 | psiconv_sheet_line_list col_defaults, |
|
|
901 | psiconv_sheet_cell_layout cell_default, |
|
|
902 | int row,int col); |
772 | |
903 | |
773 | extern void psiconv_free_color(psiconv_color color); |
904 | extern void psiconv_free_color(psiconv_color color); |
774 | extern void psiconv_free_border(psiconv_border border); |
905 | extern void psiconv_free_border(psiconv_border border); |
775 | extern void psiconv_free_bullet(psiconv_bullet bullet); |
906 | extern void psiconv_free_bullet(psiconv_bullet bullet); |
776 | extern void psiconv_free_font(psiconv_font font); |
907 | extern void psiconv_free_font(psiconv_font font); |
… | |
… | |
784 | extern void psiconv_free_formula(psiconv_formula formula); |
915 | extern void psiconv_free_formula(psiconv_formula formula); |
785 | extern void psiconv_free_formula_list(psiconv_formula_list list); |
916 | extern void psiconv_free_formula_list(psiconv_formula_list list); |
786 | extern void psiconv_free_sheet_status_section |
917 | extern void psiconv_free_sheet_status_section |
787 | (psiconv_sheet_status_section section); |
918 | (psiconv_sheet_status_section section); |
788 | extern void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout); |
919 | extern void psiconv_free_sheet_cell_layout(psiconv_sheet_cell_layout layout); |
|
|
920 | extern void psiconv_free_sheet_grid_break_list |
|
|
921 | (psiconv_sheet_grid_break_list list); |
|
|
922 | extern void psiconv_free_sheet_grid_size(psiconv_sheet_grid_size s); |
|
|
923 | extern void psiconv_free_sheet_grid_size_list |
|
|
924 | (psiconv_sheet_grid_size_list list); |
|
|
925 | extern void psiconv_free_sheet_grid_section(psiconv_sheet_grid_section sec); |
789 | extern void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet); |
926 | extern void psiconv_free_sheet_worksheet(psiconv_sheet_worksheet sheet); |
790 | extern void psiconv_free_sheet_worksheet_list |
927 | extern void psiconv_free_sheet_worksheet_list |
791 | (psiconv_sheet_worksheet_list list); |
928 | (psiconv_sheet_worksheet_list list); |
792 | |
929 | |
793 | extern void psiconv_free_sheet_f(psiconv_sheet_f file); |
930 | extern void psiconv_free_sheet_f(psiconv_sheet_f file); |
794 | extern void psiconv_free_sheet_cell(psiconv_sheet_cell cell); |
931 | extern void psiconv_free_sheet_cell(psiconv_sheet_cell cell); |
795 | extern void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list); |
932 | extern void psiconv_free_sheet_cell_list(psiconv_sheet_cell_list list); |
796 | extern void psiconv_free_sheet_numberformat |
933 | extern void psiconv_free_sheet_numberformat |
797 | (psiconv_sheet_numberformat numberformat); |
934 | (psiconv_sheet_numberformat numberformat); |
|
|
935 | extern void psiconv_free_sheet_line_list(psiconv_sheet_line_list list); |
|
|
936 | extern void psiconv_free_sheet_line(psiconv_sheet_line line); |
|
|
937 | extern void psiconv_free_sheet_name_section(psiconv_sheet_name_section section); |
|
|
938 | extern void psiconv_free_sheet_variable(psiconv_sheet_variable list); |
|
|
939 | extern void psiconv_free_sheet_variable_list(psiconv_sheet_variable_list list); |
|
|
940 | extern void psiconv_free_sheet_info_section(psiconv_sheet_info_section section); |
798 | extern void psiconv_free_header_section(psiconv_header_section header); |
941 | extern void psiconv_free_header_section(psiconv_header_section header); |
799 | extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry); |
942 | extern void psiconv_free_section_table_entry(psiconv_section_table_entry entry); |
800 | extern void psiconv_free_section_table_section |
943 | extern void psiconv_free_section_table_section |
801 | (psiconv_section_table_section section); |
944 | (psiconv_section_table_section section); |
802 | extern void psiconv_free_application_id_section |
945 | extern void psiconv_free_application_id_section |
803 | (psiconv_application_id_section section); |
946 | (psiconv_application_id_section section); |
|
|
947 | extern void psiconv_free_object_display_section |
|
|
948 | (psiconv_object_display_section section); |
|
|
949 | extern void psiconv_free_object_icon_section |
|
|
950 | (psiconv_object_icon_section section); |
|
|
951 | extern void psiconv_free_embedded_object_section |
|
|
952 | (psiconv_embedded_object_section object); |
804 | extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout); |
953 | extern void psiconv_free_in_line_layout(psiconv_in_line_layout layout); |
805 | extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts); |
954 | extern void psiconv_free_in_line_layouts(psiconv_in_line_layouts layouts); |
806 | extern void psiconv_free_replacement(psiconv_replacement replacement); |
955 | extern void psiconv_free_replacement(psiconv_replacement replacement); |
807 | extern void psiconv_free_replacements(psiconv_replacements replacements); |
956 | extern void psiconv_free_replacements(psiconv_replacements replacements); |
808 | extern void psiconv_free_paragraph(psiconv_paragraph paragraph); |
957 | extern void psiconv_free_paragraph(psiconv_paragraph paragraph); |