From b48ee037bd610ca845b3d7e070fb73284083423f Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Sat, 15 Sep 2018 21:18:43 +0000 Subject: Cleanup. Remove duplicated code. Reorganize initialization process (S. Hirata). git-svn-id: svn://tug.org/texlive/trunk@48671 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/pdfdoc.h | 132 ++++++++++++++++++++--------------- 1 file changed, 76 insertions(+), 56 deletions(-) (limited to 'Build/source/texk/dvipdfm-x/pdfdoc.h') diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.h b/Build/source/texk/dvipdfm-x/pdfdoc.h index e3d81f46db4..6612fb46480 100644 --- a/Build/source/texk/dvipdfm-x/pdfdoc.h +++ b/Build/source/texk/dvipdfm-x/pdfdoc.h @@ -26,7 +26,8 @@ #include "pdfobj.h" #include "pdfdev.h" -enum pdf_page_boundary { +enum pdf_page_boundary +{ pdf_page_boundary__auto = 0, pdf_page_boundary_mediabox, pdf_page_boundary_cropbox, @@ -37,40 +38,61 @@ enum pdf_page_boundary { #define PDF_DOC_GRABBING_NEST_MAX 4 -extern void pdf_open_document (const char *filename, - int enable_encrypt, - int enable_objstm, - double media_width, double media_height, - double annot_grow_amount, - int bookmark_open_depth, - int check_gotos); -extern void pdf_close_document (void); +struct pdf_dev_setting { + double dvi2pts; /* conversion unit */ + int precision; /* number of decimal digits kept */ + int ignore_colors; /* 1 for black or white */ +}; +struct pdf_enc_setting { + int key_size; + uint32_t permission; + const char *uplain, *oplain; /* password */ + int use_aes; + int encrypt_metadata; +}; -/* PDF document metadata */ -extern void pdf_doc_set_creator (const char *creator); +struct pdf_obj_setting { + int enable_objstm; + int enable_predictor; +}; +struct pdf_setting +{ + double media_width, media_height; + double annot_grow_amount; + int outline_open_depth; + int check_gotos; + int enable_encrypt; + struct pdf_enc_setting encrypt; + struct pdf_dev_setting device; + struct pdf_obj_setting object; +}; + +extern void pdf_open_document (const char *filename, const char **ids, + struct pdf_setting settings); +extern void pdf_close_document(void); /* They just return PDF dictionary object. * Callers are completely responsible for doing right thing... */ -extern pdf_obj *pdf_doc_get_dictionary (const char *category); -extern pdf_obj *pdf_doc_get_reference (const char *category); +extern pdf_obj *pdf_doc_get_dictionary(const char *category); +extern pdf_obj *pdf_doc_get_reference(const char *category); #define pdf_doc_page_tree() pdf_doc_get_dictionary("Pages") -#define pdf_doc_catalog() pdf_doc_get_dictionary("Catalog") -#define pdf_doc_docinfo() pdf_doc_get_dictionary("Info") -#define pdf_doc_names() pdf_doc_get_dictionary("Names") +#define pdf_doc_catalog() pdf_doc_get_dictionary("Catalog") +#define pdf_doc_docinfo() pdf_doc_get_dictionary("Info") +#define pdf_doc_names() pdf_doc_get_dictionary("Names") #define pdf_doc_this_page() pdf_doc_get_dictionary("@THISPAGE") -extern int pdf_doc_get_page_count (pdf_file *pf); -extern pdf_obj *pdf_doc_get_page (pdf_file *pf, int page_no, enum pdf_page_boundary opt_bbox, - pdf_rect *bbox, pdf_tmatrix *matrix, pdf_obj **resources_p); +extern int pdf_doc_get_page_count(pdf_file *pf); +extern pdf_obj *pdf_doc_get_page(pdf_file *pf, int page_no, enum pdf_page_boundary opt_bbox, + pdf_rect *bbox, pdf_tmatrix *matrix, pdf_obj **resources_p); -extern int pdf_doc_current_page_number (void); -extern pdf_obj *pdf_doc_current_page_resources (void); +extern int pdf_doc_current_page_number(void); +extern pdf_obj *pdf_doc_current_page_resources(void); -extern pdf_obj *pdf_doc_ref_page (unsigned page_no); +extern pdf_obj *pdf_doc_ref_page(unsigned page_no); #define pdf_doc_this_page_ref() pdf_doc_get_reference("@THISPAGE") #define pdf_doc_next_page_ref() pdf_doc_get_reference("@NEXTPAGE") #define pdf_doc_prev_page_ref() pdf_doc_get_reference("@PREVPAGE") @@ -78,57 +100,55 @@ extern pdf_obj *pdf_doc_ref_page (unsigned page_no); /* Not really managing tree... * There should be something for number tree. */ -extern int pdf_doc_add_names (const char *category, - const void *key, int keylen, pdf_obj *value); +extern int pdf_doc_add_names(const char *category, + const void *key, int keylen, pdf_obj *value); -extern void pdf_doc_set_bop_content (const char *str, unsigned length); -extern void pdf_doc_set_eop_content (const char *str, unsigned length); +extern void pdf_doc_set_bop_content(const char *str, unsigned length); +extern void pdf_doc_set_eop_content(const char *str, unsigned length); /* Page */ -extern void pdf_doc_begin_page (double scale, double x_origin, double y_origin); -extern void pdf_doc_end_page (void); +extern void pdf_doc_begin_page(double scale, double x_origin, double y_origin); +extern void pdf_doc_end_page(void); -extern void pdf_doc_set_mediabox (unsigned page_no, const pdf_rect *mediabox); +extern void pdf_doc_set_mediabox(unsigned page_no, const pdf_rect *mediabox); -extern void pdf_doc_add_page_content (const char *buffer, unsigned length); -extern void pdf_doc_add_page_resource (const char *category, - const char *resource_name, pdf_obj *resources); +extern void pdf_doc_add_page_content(const char *buffer, unsigned length); +extern void pdf_doc_add_page_resource(const char *category, + const char *resource_name, pdf_obj *resources); /* Article thread */ -extern void pdf_doc_begin_article (const char *article_id, pdf_obj *info); -extern void pdf_doc_add_bead (const char *article_id, - const char *bead_id, - int page_no, const pdf_rect *rect); +extern void pdf_doc_begin_article(const char *article_id, pdf_obj *info); +extern void pdf_doc_add_bead(const char *article_id, + const char *bead_id, + int page_no, const pdf_rect *rect); /* Bookmarks */ -extern int pdf_doc_bookmarks_up (void); -extern int pdf_doc_bookmarks_down (void); -extern void pdf_doc_bookmarks_add (pdf_obj *dict, int is_open); -extern int pdf_doc_bookmarks_depth (void); - +extern int pdf_doc_bookmarks_up(void); +extern int pdf_doc_bookmarks_down(void); +extern void pdf_doc_bookmarks_add(pdf_obj *dict, int is_open); +extern int pdf_doc_bookmarks_depth(void); /* Returns xobj_id of started xform. */ -extern int pdf_doc_begin_grabbing (const char *ident, - double ref_x, double ref_y, - const pdf_rect *cropbox); -extern void pdf_doc_end_grabbing (pdf_obj *attrib); - +extern int pdf_doc_begin_grabbing(const char *ident, + double ref_x, double ref_y, + const pdf_rect *cropbox); +extern void pdf_doc_end_grabbing(pdf_obj *attrib); /* Annotation */ -extern void pdf_doc_add_annot (unsigned page_no, - const pdf_rect *rect, - pdf_obj *annot_dict, - int new_annot); +extern void pdf_doc_add_annot(unsigned page_no, + const pdf_rect *rect, + pdf_obj *annot_dict, + int new_annot); /* Annotation with auto- clip and line (or page) break */ -extern void pdf_doc_begin_annot (pdf_obj *dict); -extern void pdf_doc_end_annot (void); +extern void pdf_doc_begin_annot(pdf_obj *dict); +extern void pdf_doc_end_annot(void); -extern void pdf_doc_break_annot (void); -extern void pdf_doc_expand_box (const pdf_rect *rect); +extern void pdf_doc_break_annot(void); +extern void pdf_doc_expand_box(const pdf_rect *rect); /* Manual thumbnail */ -extern void pdf_doc_enable_manual_thumbnails (void); +extern void pdf_doc_enable_manual_thumbnails(void); #if 0 /* PageLabels - */ @@ -140,6 +160,6 @@ extern void pdf_doc_set_pagelabel (int page_start, /* Similar to bop_content */ #include "pdfcolor.h" -extern void pdf_doc_set_bgcolor (const pdf_color *color); +extern void pdf_doc_set_bgcolor(const pdf_color *color); #endif /* _PDFDOC_H_ */ -- cgit v1.2.3