summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorPaul Gardiner <paul.gardiner@artifex.com>2013-06-09 12:30:16 -0400
committerRobin Watts <robin.watts@artifex.com>2013-06-09 12:48:24 -0400
commit8b3bfb0a08896c14a405dd91f86a998a602045a2 (patch)
treec256d5edf52d00ec8ef0bddcb0205616beb2ef69 /fitz
parent60005383aae11f8b8fabd8926e439e7f0bdc29de (diff)
downloadmupdf-8b3bfb0a08896c14a405dd91f86a998a602045a2.tar.xz
Remove fz_interactive API in favour of direct use of pdf API
Diffstat (limited to 'fitz')
-rw-r--r--fitz/crypt_pkcs7.c12
-rw-r--r--fitz/doc_document.c7
-rw-r--r--fitz/doc_interactive.c132
-rw-r--r--fitz/fitz-internal.h36
-rw-r--r--fitz/fitz.h384
5 files changed, 6 insertions, 565 deletions
diff --git a/fitz/crypt_pkcs7.c b/fitz/crypt_pkcs7.c
index a1c434dd..da50c913 100644
--- a/fitz/crypt_pkcs7.c
+++ b/fitz/crypt_pkcs7.c
@@ -1,4 +1,4 @@
-#include "fitz.h"
+#include "mupdf-internal.h"
#ifdef HAVE_OPENSSL
@@ -344,7 +344,7 @@ exit:
return res;
}
-int fz_check_signature(fz_context *ctx, fz_interactive *idoc, fz_widget *widget, char *file, char *ebuf, int ebufsize)
+int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, char *file, char *ebuf, int ebufsize)
{
int (*byte_range)[2] = NULL;
int byte_range_len;
@@ -356,14 +356,14 @@ int fz_check_signature(fz_context *ctx, fz_interactive *idoc, fz_widget *widget,
fz_var(res);
fz_try(ctx);
{
- byte_range_len = fz_signature_widget_byte_range(idoc, widget, NULL);
+ byte_range_len = pdf_signature_widget_byte_range(doc, widget, NULL);
if (byte_range_len)
{
byte_range = fz_calloc(ctx, byte_range_len, sizeof(*byte_range));
- fz_signature_widget_byte_range(idoc, widget, byte_range);
+ pdf_signature_widget_byte_range(doc, widget, byte_range);
}
- contents_len = fz_signature_widget_contents(idoc, widget, &contents);
+ contents_len = pdf_signature_widget_contents(doc, widget, &contents);
if (byte_range && contents)
{
res = verify_sig(contents, contents_len, file, byte_range, byte_range_len, ebuf, ebufsize);
@@ -393,7 +393,7 @@ int fz_check_signature(fz_context *ctx, fz_interactive *idoc, fz_widget *widget,
#else /* HAVE_OPENSSL */
-int fz_check_signature(fz_context *ctx, fz_interactive *idoc, fz_widget *widget, char *file, char *ebuf, int ebufsize)
+int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, char *file, char *ebuf, int ebufsize)
{
strncpy(ebuf, "This version of MuPDF was built without signature support", ebufsize);
diff --git a/fitz/doc_document.c b/fitz/doc_document.c
index af70ddbc..5eda08c7 100644
--- a/fitz/doc_document.c
+++ b/fitz/doc_document.c
@@ -255,13 +255,6 @@ fz_page_presentation(fz_document *doc, fz_page *page, float *duration)
return NULL;
}
-fz_interactive *fz_interact(fz_document *doc)
-{
- if (doc && doc->interact)
- return doc->interact(doc);
- return NULL;
-}
-
int fz_javascript_supported(void)
{
return pdf_js_supported();
diff --git a/fitz/doc_interactive.c b/fitz/doc_interactive.c
deleted file mode 100644
index c9cdf6aa..00000000
--- a/fitz/doc_interactive.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#include "fitz.h"
-#include "mupdf-internal.h"
-
-/*
- PDF is currently the only interactive format, so no need
- to indirect through function pointers.
-*/
-
-int fz_has_unsaved_changes(fz_interactive *idoc)
-{
- return pdf_has_unsaved_changes((pdf_document*)idoc);
-}
-
-int fz_pass_event(fz_interactive *idoc, fz_page *page, fz_ui_event *ui_event)
-{
- return pdf_pass_event((pdf_document*)idoc, (pdf_page*)page, ui_event);
-}
-
-void fz_update_page(fz_interactive *idoc, fz_page *page)
-{
- pdf_update_page((pdf_document*)idoc, (pdf_page*)page);
-}
-
-fz_annot *fz_poll_changed_annot(fz_interactive *idoc, fz_page *page)
-{
- return (fz_annot*)pdf_poll_changed_annot((pdf_document*)idoc, (pdf_page*)page);
-}
-
-fz_widget *fz_focused_widget(fz_interactive *idoc)
-{
- return pdf_focused_widget((pdf_document*)idoc);
-}
-
-fz_widget *fz_first_widget(fz_interactive *idoc, fz_page *page)
-{
- return pdf_first_widget((pdf_document*)idoc, (pdf_page*)page);
-}
-
-fz_widget *fz_next_widget(fz_interactive *idoc, fz_widget *previous)
-{
- return pdf_next_widget(previous);
-}
-
-char *fz_text_widget_text(fz_interactive *idoc, fz_widget *tw)
-{
- return pdf_text_widget_text((pdf_document *)idoc, tw);
-}
-
-int fz_text_widget_max_len(fz_interactive *idoc, fz_widget *tw)
-{
- return pdf_text_widget_max_len((pdf_document *)idoc, tw);
-}
-
-int fz_text_widget_content_type(fz_interactive *idoc, fz_widget *tw)
-{
- return pdf_text_widget_content_type((pdf_document *)idoc, tw);
-}
-
-int fz_text_widget_set_text(fz_interactive *idoc, fz_widget *tw, char *text)
-{
- return pdf_text_widget_set_text((pdf_document *)idoc, tw, text);
-}
-
-int fz_choice_widget_options(fz_interactive *idoc, fz_widget *tw, char *opts[])
-{
- return pdf_choice_widget_options((pdf_document *)idoc, tw, opts);
-}
-
-int fz_choice_widget_is_multiselect(fz_interactive *idoc, fz_widget *tw)
-{
- return pdf_choice_widget_is_multiselect((pdf_document *)idoc, tw);
-}
-
-int fz_choice_widget_value(fz_interactive *idoc, fz_widget *tw, char *opts[])
-{
- return pdf_choice_widget_value((pdf_document *)idoc, tw, opts);
-}
-
-void fz_choice_widget_set_value(fz_interactive *idoc, fz_widget *tw, int n, char *opts[])
-{
- pdf_choice_widget_set_value((pdf_document *)idoc, tw, n, opts);
-}
-
-int fz_signature_widget_byte_range(fz_interactive *idoc, fz_widget *widget, int (*byte_range)[2])
-{
- return pdf_signature_widget_byte_range((pdf_document *)idoc, widget, byte_range);
-}
-
-int fz_signature_widget_contents(fz_interactive *idoc, fz_widget *widget, char **contents)
-{
- return pdf_signature_widget_contents((pdf_document *)idoc, widget, contents);
-}
-
-fz_annot_type fz_get_annot_type(fz_annot *annot)
-{
- return pdf_annot_type((pdf_annot *)annot);
-}
-
-fz_annot *fz_create_annot(fz_interactive *idoc, fz_page *page, fz_annot_type type)
-{
- return (fz_annot *)pdf_create_annot((pdf_document *)idoc, (pdf_page *)page, type);
-}
-
-void fz_delete_annot(fz_interactive *idoc, fz_page *page, fz_annot *annot)
-{
- pdf_delete_annot((pdf_document *)idoc, (pdf_page *)page, (pdf_annot *)annot);
-}
-
-void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_rect *rect, fz_display_list *disp_list)
-{
- pdf_set_annot_appearance((pdf_document *)idoc, (pdf_annot *)annot, rect, disp_list);
-}
-
-void fz_set_markup_annot_quadpoints(fz_interactive *idoc, fz_annot *annot, fz_point *qp, int n)
-{
- pdf_set_markup_annot_quadpoints((pdf_document *)idoc, (pdf_annot *)annot, qp, n);
-}
-
-void fz_set_markup_appearance(fz_interactive *idoc, fz_annot *annot, float color[3], float alpha, float line_thickness, float line_height)
-{
- pdf_set_markup_appearance((pdf_document *)idoc, (pdf_annot *)annot, color, alpha, line_thickness, line_height);
-}
-
-void fz_set_ink_annot_list(fz_interactive *idoc, fz_annot *annot, fz_point *pts, int *counts, int ncount, float color[3], float thickness)
-{
- pdf_set_ink_annot_list((pdf_document *)idoc, (pdf_annot *)annot, pts, counts, ncount, color, thickness);
-}
-
-void fz_set_doc_event_callback(fz_interactive *idoc, fz_doc_event_cb *event_cb, void *data)
-{
- pdf_set_doc_event_callback((pdf_document *)idoc, event_cb, data);
-}
diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h
index e2bd2df4..5b415f4a 100644
--- a/fitz/fitz-internal.h
+++ b/fitz/fitz-internal.h
@@ -1260,41 +1260,6 @@ void fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, i
void fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid, int nestedDepth);
/*
- fz_create_annot: create a new annotation of the specified type on the
- specified page. The returned pdf_annot structure is owned by the page
- and does not need to be freed.
-*/
-fz_annot *fz_create_annot(fz_interactive *idoc, fz_page *page, fz_annot_type type);
-
-/*
- fz_delete_annot: delete an annotation
-*/
-void fz_delete_annot(fz_interactive *idoc, fz_page *page, fz_annot *annot);
-
-/*
- fz_set_annot_appearance: update the appearance of an annotation based
- on a display list.
-*/
-void fz_set_annot_appearance(fz_interactive *idoc, fz_annot *annot, fz_rect *rect, fz_display_list *disp_list);
-
-/*
- fz_set_markup_annot_quadpoints: set the quadpoints for a text-markup annotation.
-*/
-void fz_set_markup_annot_quadpoints(fz_interactive *idoc, fz_annot *annot, fz_point *qp, int n);
-
-/*
- fz_set_markup_appearance: set the appearance stream of a text markup annotations, basing it on
- its QuadPoints array
-*/
-void fz_set_markup_appearance(fz_interactive *idoc, fz_annot *annot, float color[3], float alpha, float line_thickness, float line_height);
-
-/*
- fz_set_ink_annot_list: set the details of an ink annotation. All the points of the multiple arcs
- are carried in a single array, with the counts for each arc held in a secondary array.
-*/
-void fz_set_ink_annot_list(fz_interactive *idoc, fz_annot *annot, fz_point *pts, int *counts, int ncount, float color[3], float thickness);
-
-/*
* Text buffer.
*
* The trm field contains the a, b, c and d coefficients.
@@ -1641,7 +1606,6 @@ struct fz_document_s
void (*free_page)(fz_document *doc, fz_page *page);
int (*meta)(fz_document *doc, int key, void *ptr, int size);
fz_transition *(*page_presentation)(fz_document *doc, fz_page *page, float *duration);
- fz_interactive *(*interact)(fz_document *doc);
void (*write)(fz_document *doc, char *filename, fz_write_options *opts);
fz_annot *(*first_annot)(fz_document *doc, fz_page *page);
fz_annot *(*next_annot)(fz_document *doc, fz_annot *annot);
diff --git a/fitz/fitz.h b/fitz/fitz.h
index c89dc618..6a7a0a12 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -3028,391 +3028,7 @@ enum
*/
fz_transition *fz_page_presentation(fz_document *doc, fz_page *page, float *duration);
-/* Interactive features */
-/* Types of widget */
-enum
-{
- FZ_WIDGET_TYPE_NOT_WIDGET = -1,
- FZ_WIDGET_TYPE_PUSHBUTTON,
- FZ_WIDGET_TYPE_CHECKBOX,
- FZ_WIDGET_TYPE_RADIOBUTTON,
- FZ_WIDGET_TYPE_TEXT,
- FZ_WIDGET_TYPE_LISTBOX,
- FZ_WIDGET_TYPE_COMBOBOX,
- FZ_WIDGET_TYPE_SIGNATURE
-};
-
-/* Types of text widget content */
-enum
-{
- FZ_WIDGET_CONTENT_UNRESTRAINED,
- FZ_WIDGET_CONTENT_NUMBER,
- FZ_WIDGET_CONTENT_SPECIAL,
- FZ_WIDGET_CONTENT_DATE,
- FZ_WIDGET_CONTENT_TIME
-};
-
-/* Types of UI event */
-enum
-{
- FZ_EVENT_TYPE_POINTER,
-};
-
-/* Types of pointer event */
-enum
-{
- FZ_POINTER_DOWN,
- FZ_POINTER_UP,
-};
-
-/*
- Interface supported by some types of documents,
- via which interactions (such as filling in forms)
- can be achieved.
-*/
-typedef struct fz_interactive_s fz_interactive;
-
-/*
- UI events that can be passed to an interactive document.
-*/
-typedef struct fz_ui_event_s
-{
- int etype;
- union
- {
- struct
- {
- int ptype;
- fz_point pt;
- } pointer;
- } event;
-} fz_ui_event;
-
-/*
- Widgets that may appear in PDF forms
-*/
-typedef struct fz_widget_s fz_widget;
-
-/*
- Obtain an interface for interaction from a document.
- For document types that don't support interaction, NULL
- is returned.
-*/
-fz_interactive *fz_interact(fz_document *doc);
-
-/*
- Determine whether changes have been made since the
- document was opened or last saved.
-*/
-int fz_has_unsaved_changes(fz_interactive *idoc);
-
-/*
- fz_pass_event: Pass a UI event to an interactive
- document.
-
- Returns a boolean indication of whether the ui_event was
- handled. Example of use for the return value: when considering
- passing the events that make up a drag, if the down event isn't
- accepted then don't send the move events or the up event.
-*/
-int fz_pass_event(fz_interactive *idoc, fz_page *page, fz_ui_event *ui_event);
-
-/*
- fz_update_page: update a page for the sake of changes caused by a call
- to fz_pass_event. fz_update_page regenerates any appearance streams that
- are out of date, checks for cases where different appearance streams
- should be selected because of state changes, and records internally
- each annotation that has changed appearance. The list of chagned annotations
- is then available via fz_poll_changed_annotation. Note that a call to
- fz_pass_event for one page may lead to changes on any other, so an app
- should call fz_update_page for every page it currently displays. Also
- it is important that the fz_page object is the one used to last render
- the page. If instead the app were to drop the page and reload it then
- a call to fz_update_page would not reliably be able to report all changed
- areas.
-*/
-void fz_update_page(fz_interactive *idoc, fz_page *page);
-
-/*
- fz_poll_changed_annot: enumerate the changed annotations recoreded
- by a call to fz_update_page.
-*/
-fz_annot *fz_poll_changed_annot(fz_interactive *idoc, fz_page *page);
-
-/*
- fz_init_ui_pointer_event: Set up a pointer event
-*/
-void fz_init_ui_pointer_event(fz_ui_event *event, int type, float x, float y);
-
-/*
- fz_focused_widget: returns the currently focussed widget
-
- Widgets can become focussed as a result of passing in ui events.
- NULL is returned if there is no currently focussed widget. An
- app may wish to create a native representative of the focussed
- widget, e.g., to collect the text for a text widget, rather than
- routing key strokes through fz_pass_event.
-*/
-fz_widget *fz_focused_widget(fz_interactive *idoc);
-
-/*
- fz_first_widget: get first widget when enumerating
-*/
-fz_widget *fz_first_widget(fz_interactive *idoc, fz_page *page);
-
-/*
- fz_next_widget: get next widget when enumerating
-*/
-fz_widget *fz_next_widget(fz_interactive *idoc, fz_widget *previous);
-
-/*
- fz_widget_get_type: find out the type of a widget.
-
- The type determines what widget subclass the widget
- can safely be cast to.
-*/
-int fz_widget_get_type(fz_widget *widget);
-
-/*
- fz_bound_widget: get the bounding box of a widget.
-*/
-fz_rect *fz_bound_widget(fz_widget *widget, fz_rect *);
-
-/*
- fz_text_widget_text: Get the text currently displayed in
- a text widget.
-*/
-char *fz_text_widget_text(fz_interactive *idoc, fz_widget *tw);
-
-/*
- fz_widget_text_max_len: get the maximum number of
- characters permitted in a text widget
-*/
-int fz_text_widget_max_len(fz_interactive *idoc, fz_widget *tw);
-
-/*
- fz_text_widget_content_type: get the type of content
- required by a text widget
-*/
-int fz_text_widget_content_type(fz_interactive *idoc, fz_widget *tw);
-
-/*
- fz_text_widget_set_text: Update the text of a text widget.
- The text is first validated and accepted only if it passes. The
- function returns whether validation passed.
-*/
-int fz_text_widget_set_text(fz_interactive *idoc, fz_widget *tw, char *text);
-
-/*
- fz_choice_widget_options: get the list of options for a list
- box or combo box. Returns the number of options and fills in their
- names within the supplied array. Should first be called with a
- NULL array to find out how big the array should be.
-*/
-int fz_choice_widget_options(fz_interactive *idoc, fz_widget *tw, char *opts[]);
-
-/*
- fz_choice_widget_is_multiselect: returns whether a list box or
- combo box supports selection of multiple options
-*/
-int fz_choice_widget_is_multiselect(fz_interactive *idoc, fz_widget *tw);
-
-/*
- fz_choice_widget_value: get the value of a choice widget.
- Returns the number of options curently selected and fills in
- the supplied array with their strings. Should first be called
- with NULL as the array to find out how big the array need to
- be. The filled in elements should not be freed by the caller.
-*/
-int fz_choice_widget_value(fz_interactive *idoc, fz_widget *tw, char *opts[]);
-
-/*
- fz_widget_set_value: set the value of a choice widget. The
- caller should pass the number of options selected and an
- array of their names
-*/
-void fz_choice_widget_set_value(fz_interactive *idoc, fz_widget *tw, int n, char *opts[]);
-
-/*
- fz_signature_widget_byte_range: retrieve the byte range for a signature widget
-*/
-int fz_signature_widget_byte_range(fz_interactive *idoc, fz_widget *widget, int (*byte_range)[2]);
-
-/*
- fz_signature_widget_contents: retrieve the contents for a signature widget
-*/
-int fz_signature_widget_contents(fz_interactive *idoc, fz_widget *widget, char **contents);
-
-/*
- fz_check_signature: check a signature's certificate chain and digest
-*/
-int fz_check_signature(fz_context *ctx, fz_interactive *idoc, fz_widget *widget, char *file, char *ebuf, int ebufsize);
-
-/*
- Document events: the objects via which MuPDF informs the calling app
- of occurrences emanating from the document, possibly from user interaction
- or javascript execution. MuPDF informs the app of document events via a
- callback.
-*/
-
-/*
- Document event structures are mostly opaque to the app. Only the type
- is visible to the app.
-*/
-typedef struct fz_doc_event_s fz_doc_event;
-
-struct fz_doc_event_s
-{
- int type;
-};
-
-/*
- The various types of document events
-*/
-enum
-{
- FZ_DOCUMENT_EVENT_ALERT,
- FZ_DOCUMENT_EVENT_PRINT,
- FZ_DOCUMENT_EVENT_LAUNCH_URL,
- FZ_DOCUMENT_EVENT_MAIL_DOC,
- FZ_DOCUMENT_EVENT_SUBMIT,
- FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM,
- FZ_DOCUMENT_EVENT_EXEC_DIALOG
-};
-
-/*
- fz_doc_event_cb: the type of function via which the app receives
- document events.
-*/
-typedef void (fz_doc_event_cb)(fz_doc_event *event, void *data);
-
-/*
- fz_set_doc_event_callback: set the function via which to receive
- document events.
-*/
-void fz_set_doc_event_callback(fz_interactive *idoc, fz_doc_event_cb *fn, void *data);
-
-/*
- fz_alert_event: details of an alert event. In response the app should
- display an alert dialog with the bittons specified by "button_type_group".
- If "check_box_message" is non-NULL, a checkbox should be displayed in
- the lower-left corned along with the messsage.
-
- "finally_checked" and "button_pressed" should be set by the app
- before returning from the callback. "finally_checked" need be set
- only if "check_box_message" is non-NULL.
-*/
-typedef struct
-{
- char *message;
- int icon_type;
- int button_group_type;
- char *title;
- char *check_box_message;
- int initially_checked;
- int finally_checked;
- int button_pressed;
-} fz_alert_event;
-
-/* Possible values of icon_type */
-enum
-{
- FZ_ALERT_ICON_ERROR,
- FZ_ALERT_ICON_WARNING,
- FZ_ALERT_ICON_QUESTION,
- FZ_ALERT_ICON_STATUS
-};
-
-/* Possible values of button_group_type */
-enum
-{
- FZ_ALERT_BUTTON_GROUP_OK,
- FZ_ALERT_BUTTON_GROUP_OK_CANCEL,
- FZ_ALERT_BUTTON_GROUP_YES_NO,
- FZ_ALERT_BUTTON_GROUP_YES_NO_CANCEL
-};
-
-/* Possible values of button_pressed */
-enum
-{
- FZ_ALERT_BUTTON_NONE,
- FZ_ALERT_BUTTON_OK,
- FZ_ALERT_BUTTON_CANCEL,
- FZ_ALERT_BUTTON_NO,
- FZ_ALERT_BUTTON_YES
-};
-
-/*
- fz_access_alert_event: access the details of an alert event
- The returned pointer and all the data referred to by the
- structire are owned by mupdf and need not be freed by the
- caller.
-*/
-fz_alert_event *fz_access_alert_event(fz_doc_event *event);
-
-/*
- fz_access_exec_menu_item_event: access the details of am execMenuItem
- event, which consists of just the name of the menu item
-*/
-char *fz_access_exec_menu_item_event(fz_doc_event *event);
-
-/*
- fz_submit_event: details of a submit event. The app should submit
- the specified data to the specified url. "get" determines whether
- to use the GET or POST method.
-*/
-typedef struct
-{
- char *url;
- char *data;
- int data_len;
- int get;
-} fz_submit_event;
-
-/*
- fz_access_submit_event: access the details of a submit event
- The returned pointer and all data referred to by the structure are
- owned by mupdf and need not be freed by the caller.
-*/
-fz_submit_event *fz_access_submit_event(fz_doc_event *event);
-
-/*
- fz_launch_url_event: details of a launch-url event. The app should
- open the url, either in a new frame or in the current window.
-*/
-typedef struct
-{
- char *url;
- int new_frame;
-} fz_launch_url_event;
-
-/*
- fz_access_launch_url_event: access the details of a launch-url
- event. The returned pointer and all data referred to by the structure
- are owned by mupdf and need not be freed by the caller.
-*/
-fz_launch_url_event *fz_access_launch_url_event(fz_doc_event *event);
-
-/*
- fz_mail_doc_event: details of a mail_doc event. The app should save
- the current state of the document and email it using the specified
- parameters.
-*/
-typedef struct
-{
- int ask_user;
- char *to;
- char *cc;
- char *bcc;
- char *subject;
- char *message;
-} fz_mail_doc_event;
-
-/*
- fz_acccess_mail_doc_event: access the details of a mail-doc event.
-*/
-fz_mail_doc_event *fz_access_mail_doc_event(fz_doc_event *event);
/*
fz_javascript_supported: test whether a version of mupdf with