summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/jni/Core.mk1
-rw-r--r--android/jni/mupdf.c161
-rw-r--r--apps/jstest_main.c14
-rw-r--r--apps/mudraw.c39
-rw-r--r--apps/pdfapp.c80
-rw-r--r--apps/pdfapp.h3
-rw-r--r--apps/win_main.c28
-rw-r--r--apps/x11_main.c14
-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
-rw-r--r--pdf/mupdf-internal.h421
-rw-r--r--pdf/mupdf.h6
-rw-r--r--pdf/pdf_annot.c4
-rw-r--r--pdf/pdf_event.c90
-rw-r--r--pdf/pdf_field.c16
-rw-r--r--pdf/pdf_form.c88
-rw-r--r--pdf/pdf_js.c8
-rw-r--r--pdf/pdf_xref.c12
-rw-r--r--win32/libmupdf.vcproj4
-rw-r--r--winrt/libmupdf_winRT.vcxproj1
-rw-r--r--winrt/libmupdf_winRT.vcxproj.filters3
24 files changed, 694 insertions, 870 deletions
diff --git a/android/jni/Core.mk b/android/jni/Core.mk
index 68d75757..f53f679a 100644
--- a/android/jni/Core.mk
+++ b/android/jni/Core.mk
@@ -55,7 +55,6 @@ LOCAL_SRC_FILES := \
$(MY_ROOT)/fitz/dev_null.c \
$(MY_ROOT)/fitz/dev_trace.c \
$(MY_ROOT)/fitz/doc_document.c \
- $(MY_ROOT)/fitz/doc_interactive.c \
$(MY_ROOT)/fitz/doc_link.c \
$(MY_ROOT)/fitz/doc_outline.c \
$(MY_ROOT)/fitz/filt_basic.c \
diff --git a/android/jni/mupdf.c b/android/jni/mupdf.c
index b185f219..8edc8c41 100644
--- a/android/jni/mupdf.c
+++ b/android/jni/mupdf.c
@@ -15,6 +15,7 @@
#include "fitz.h"
#include "fitz-internal.h"
#include "mupdf.h"
+#include "mupdf-internal.h"
#define JNI_FN(A) Java_com_artifex_mupdfdemo_ ## A
#define PACKAGENAME "com/artifex/mupdfdemo"
@@ -96,7 +97,7 @@ struct globals_s
int alerts_active;
// Pointer to the alert struct passed in by show_alert, and valid while
// show_alert is blocked.
- fz_alert_event *current_alert;
+ pdf_alert_event *current_alert;
// Flag and condition varibles to signal a request is present and a reply
// is present, respectively. The condition variables alone are not sufficient
// because of the pthreads permit spurious signals.
@@ -154,7 +155,7 @@ static void dump_annotation_display_lists(globals *glo)
}
}
-static void show_alert(globals *glo, fz_alert_event *alert)
+static void show_alert(globals *glo, pdf_alert_event *alert)
{
pthread_mutex_lock(&glo->fin_lock2);
pthread_mutex_lock(&glo->alert_lock);
@@ -180,21 +181,21 @@ static void show_alert(globals *glo, fz_alert_event *alert)
pthread_mutex_unlock(&glo->fin_lock2);
}
-static void event_cb(fz_doc_event *event, void *data)
+static void event_cb(pdf_doc_event *event, void *data)
{
globals *glo = (globals *)data;
switch (event->type)
{
- case FZ_DOCUMENT_EVENT_ALERT:
- show_alert(glo, fz_access_alert_event(event));
+ case PDF_DOCUMENT_EVENT_ALERT:
+ show_alert(glo, pdf_access_alert_event(event));
break;
}
}
static void alerts_init(globals *glo)
{
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
if (!idoc || glo->alerts_initialised)
return;
@@ -208,20 +209,20 @@ static void alerts_init(globals *glo)
pthread_cond_init(&glo->alert_request_cond, NULL);
pthread_cond_init(&glo->alert_reply_cond, NULL);
- fz_set_doc_event_callback(idoc, event_cb, glo);
+ pdf_set_doc_event_callback(idoc, event_cb, glo);
LOGT("alert_init");
glo->alerts_initialised = 1;
}
static void alerts_fin(globals *glo)
{
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
if (!glo->alerts_initialised)
return;
LOGT("Enter alerts_fin");
if (idoc)
- fz_set_doc_event_callback(idoc, NULL, NULL);
+ pdf_set_doc_event_callback(idoc, NULL, NULL);
// Set alerts_active false and wake up show_alert and waitForAlertInternal,
pthread_mutex_lock(&glo->alert_lock);
@@ -573,12 +574,12 @@ JNI_FN(MuPDFCore_javascriptSupported)(JNIEnv *env, jobject thiz)
return fz_javascript_supported();
}
-static void update_changed_rects(globals *glo, page_cache *pc, fz_interactive *idoc)
+static void update_changed_rects(globals *glo, page_cache *pc, pdf_document *idoc)
{
fz_annot *annot;
- fz_update_page(idoc, pc->page);
- while ((annot = fz_poll_changed_annot(idoc, pc->page)) != NULL)
+ pdf_update_page(idoc, (pdf_page *)pc->page);
+ while ((annot = (fz_annot *)pdf_poll_changed_annot(idoc, (pdf_page *)pc->page)) != NULL)
{
/* FIXME: We bound the annot twice here */
rect_node *node = fz_malloc_struct(glo->ctx, rect_node);
@@ -644,7 +645,7 @@ JNI_FN(MuPDFCore_drawPage)(JNIEnv *env, jobject thiz, jobject bitmap,
fz_try(ctx)
{
- fz_interactive *idoc = fz_interact(doc);
+ pdf_document *idoc = pdf_specifics(doc);
if (idoc)
{
@@ -742,12 +743,12 @@ static char *widget_type_string(int t)
{
switch(t)
{
- case FZ_WIDGET_TYPE_PUSHBUTTON: return "pushbutton";
- case FZ_WIDGET_TYPE_CHECKBOX: return "checkbox";
- case FZ_WIDGET_TYPE_RADIOBUTTON: return "radiobutton";
- case FZ_WIDGET_TYPE_TEXT: return "text";
- case FZ_WIDGET_TYPE_LISTBOX: return "listbox";
- case FZ_WIDGET_TYPE_COMBOBOX: return "combobox";
+ case PDF_WIDGET_TYPE_PUSHBUTTON: return "pushbutton";
+ case PDF_WIDGET_TYPE_CHECKBOX: return "checkbox";
+ case PDF_WIDGET_TYPE_RADIOBUTTON: return "radiobutton";
+ case PDF_WIDGET_TYPE_TEXT: return "text";
+ case PDF_WIDGET_TYPE_LISTBOX: return "listbox";
+ case PDF_WIDGET_TYPE_COMBOBOX: return "combobox";
default: return "non-widget";
}
}
@@ -765,7 +766,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
fz_rect rect;
fz_pixmap *pix = NULL;
float xscale, yscale;
- fz_interactive *idoc;
+ pdf_document *idoc;
page_cache *pc = NULL;
int hq = (patchW < pageW || patchH < pageH);
int i;
@@ -792,7 +793,7 @@ JNI_FN(MuPDFCore_updatePageInternal)(JNIEnv *env, jobject thiz, jobject bitmap,
return JNI_FN(MuPDFCore_drawPage)(env, thiz, bitmap, pageW, pageH, patchX, patchY, patchW, patchH);
}
- idoc = fz_interact(doc);
+ idoc = pdf_specifics(doc);
fz_var(pix);
fz_var(dev);
@@ -1377,7 +1378,7 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
fz_document *doc = glo->doc;
- fz_interactive *idoc = fz_interact(doc);
+ pdf_document *idoc = pdf_specifics(doc);
page_cache *pc = &glo->pages[glo->current];
jclass pt_cls;
jfieldID x_fid, y_fid;
@@ -1449,10 +1450,10 @@ JNI_FN(MuPDFCore_addMarkupAnnotationInternal)(JNIEnv * env, jobject thiz, jobjec
fz_transform_point(&pts[i], &ctm);
}
- annot = fz_create_annot(idoc, pc->page, type);
+ annot = (fz_annot *)pdf_create_annot(idoc, (pdf_page *)pc->page, type);
- fz_set_markup_annot_quadpoints(idoc, annot, pts, n);
- fz_set_markup_appearance(idoc, annot, color, alpha, line_thickness, line_height);
+ pdf_set_markup_annot_quadpoints(idoc, (pdf_annot *)annot, pts, n);
+ pdf_set_markup_appearance(idoc, (pdf_annot *)annot, color, alpha, line_thickness, line_height);
dump_annotation_display_lists(glo);
}
@@ -1476,7 +1477,7 @@ JNI_FN(MuPDFCore_addInkAnnotationInternal)(JNIEnv * env, jobject thiz, jobjectAr
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
fz_document *doc = glo->doc;
- fz_interactive *idoc = fz_interact(doc);
+ pdf_document *idoc = pdf_specifics(doc);
page_cache *pc = &glo->pages[glo->current];
jclass pt_cls;
jfieldID x_fid, y_fid;
@@ -1542,9 +1543,9 @@ JNI_FN(MuPDFCore_addInkAnnotationInternal)(JNIEnv * env, jobject thiz, jobjectAr
}
}
- annot = fz_create_annot(idoc, pc->page, FZ_ANNOT_INK);
+ annot = (fz_annot *)pdf_create_annot(idoc, (pdf_page *)pc->page, FZ_ANNOT_INK);
- fz_set_ink_annot_list(idoc, annot, pts, counts, n, color, INK_THICKNESS);
+ pdf_set_ink_annot_list(idoc, (pdf_annot *)annot, pts, counts, n, color, INK_THICKNESS);
dump_annotation_display_lists(glo);
}
@@ -1569,7 +1570,7 @@ JNI_FN(MuPDFCore_deleteAnnotationInternal)(JNIEnv * env, jobject thiz, int annot
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
fz_document *doc = glo->doc;
- fz_interactive *idoc = fz_interact(doc);
+ pdf_document *idoc = pdf_specifics(doc);
page_cache *pc = &glo->pages[glo->current];
fz_annot *annot;
int i;
@@ -1585,7 +1586,7 @@ JNI_FN(MuPDFCore_deleteAnnotationInternal)(JNIEnv * env, jobject thiz, int annot
if (annot)
{
- fz_delete_annot(idoc, pc->page, annot);
+ pdf_delete_annot(idoc, (pdf_page *)pc->page, (pdf_annot *)annot);
dump_annotation_display_lists(glo);
}
}
@@ -1765,8 +1766,8 @@ JNI_FN(MuPDFCore_getWidgetAreasInternal)(JNIEnv * env, jobject thiz, int pageNum
jmethodID ctor;
jobjectArray arr;
jobject rectF;
- fz_interactive *idoc;
- fz_widget *widget;
+ pdf_document *idoc;
+ pdf_widget *widget;
fz_matrix ctm;
float zoom;
int count;
@@ -1783,7 +1784,7 @@ JNI_FN(MuPDFCore_getWidgetAreasInternal)(JNIEnv * env, jobject thiz, int pageNum
if (pc->number != pageNumber || pc->page == NULL)
return NULL;
- idoc = fz_interact(glo->doc);
+ idoc = pdf_specifics(glo->doc);
if (idoc == NULL)
return NULL;
@@ -1791,17 +1792,17 @@ JNI_FN(MuPDFCore_getWidgetAreasInternal)(JNIEnv * env, jobject thiz, int pageNum
fz_scale(&ctm, zoom, zoom);
count = 0;
- for (widget = fz_first_widget(idoc, pc->page); widget; widget = fz_next_widget(idoc, widget))
+ for (widget = pdf_first_widget(idoc, (pdf_page *)pc->page); widget; widget = pdf_next_widget(widget))
count ++;
arr = (*env)->NewObjectArray(env, count, rectFClass, NULL);
if (arr == NULL) return NULL;
count = 0;
- for (widget = fz_first_widget(idoc, pc->page); widget; widget = fz_next_widget(idoc, widget))
+ for (widget = pdf_first_widget(idoc, (pdf_page *)pc->page); widget; widget = pdf_next_widget(widget))
{
fz_rect rect;
- fz_bound_widget(widget, &rect);
+ pdf_bound_widget(widget, &rect);
fz_transform_rect(&rect, &ctm);
rectF = (*env)->NewObject(env, rectFClass, ctor,
@@ -1854,7 +1855,7 @@ JNI_FN(MuPDFCore_getAnnotationsInternal)(JNIEnv * env, jobject thiz, int pageNum
for (annot = fz_first_annot(glo->doc, pc->page); annot; annot = fz_next_annot(glo->doc, annot))
{
fz_rect rect;
- fz_annot_type type = fz_get_annot_type(annot);
+ fz_annot_type type = pdf_annot_type((pdf_annot *)annot);
fz_bound_annot(glo->doc, annot, &rect);
fz_transform_rect(&rect, &ctm);
@@ -1876,10 +1877,10 @@ JNI_FN(MuPDFCore_passClickEventInternal)(JNIEnv * env, jobject thiz, int pageNum
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
fz_matrix ctm;
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
float zoom;
fz_point p;
- fz_ui_event event;
+ pdf_ui_event event;
int changed = 0;
page_cache *pc;
@@ -1905,12 +1906,12 @@ JNI_FN(MuPDFCore_passClickEventInternal)(JNIEnv * env, jobject thiz, int pageNum
fz_try(ctx)
{
- event.etype = FZ_EVENT_TYPE_POINTER;
+ event.etype = PDF_EVENT_TYPE_POINTER;
event.event.pointer.pt = p;
- event.event.pointer.ptype = FZ_POINTER_DOWN;
- changed = fz_pass_event(idoc, pc->page, &event);
- event.event.pointer.ptype = FZ_POINTER_UP;
- changed |= fz_pass_event(idoc, pc->page, &event);
+ event.event.pointer.ptype = PDF_POINTER_DOWN;
+ changed = pdf_pass_event(idoc, (pdf_page *)pc->page, &event);
+ event.event.pointer.ptype = PDF_POINTER_UP;
+ changed |= pdf_pass_event(idoc, (pdf_page *)pc->page, &event);
if (changed) {
dump_annotation_display_lists(glo);
}
@@ -1932,14 +1933,14 @@ JNI_FN(MuPDFCore_getFocusedWidgetTextInternal)(JNIEnv * env, jobject thiz)
fz_try(ctx)
{
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
if (idoc)
{
- fz_widget *focus = fz_focused_widget(idoc);
+ pdf_widget *focus = pdf_focused_widget(idoc);
if (focus)
- text = fz_text_widget_text(idoc, focus);
+ text = pdf_text_widget_text(idoc, focus);
}
}
fz_catch(ctx)
@@ -1967,15 +1968,15 @@ JNI_FN(MuPDFCore_setFocusedWidgetTextInternal)(JNIEnv * env, jobject thiz, jstri
fz_try(ctx)
{
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
if (idoc)
{
- fz_widget *focus = fz_focused_widget(idoc);
+ pdf_widget *focus = pdf_focused_widget(idoc);
if (focus)
{
- result = fz_text_widget_set_text(idoc, focus, (char *)text);
+ result = pdf_text_widget_set_text(idoc, focus, (char *)text);
dump_annotation_display_lists(glo);
}
}
@@ -1995,8 +1996,8 @@ JNI_FN(MuPDFCore_getFocusedWidgetChoiceOptions)(JNIEnv * env, jobject thiz)
{
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
- fz_interactive *idoc = fz_interact(glo->doc);
- fz_widget *focus;
+ pdf_document *idoc = pdf_specifics(glo->doc);
+ pdf_widget *focus;
int type;
int nopts, i;
char **opts = NULL;
@@ -2006,20 +2007,20 @@ JNI_FN(MuPDFCore_getFocusedWidgetChoiceOptions)(JNIEnv * env, jobject thiz)
if (idoc == NULL)
return NULL;
- focus = fz_focused_widget(idoc);
+ focus = pdf_focused_widget(idoc);
if (focus == NULL)
return NULL;
- type = fz_widget_get_type(focus);
- if (type != FZ_WIDGET_TYPE_LISTBOX && type != FZ_WIDGET_TYPE_COMBOBOX)
+ type = pdf_widget_get_type(focus);
+ if (type != PDF_WIDGET_TYPE_LISTBOX && type != PDF_WIDGET_TYPE_COMBOBOX)
return NULL;
fz_var(opts);
fz_try(ctx)
{
- nopts = fz_choice_widget_options(idoc, focus, NULL);
+ nopts = pdf_choice_widget_options(idoc, focus, NULL);
opts = fz_malloc(ctx, nopts * sizeof(*opts));
- (void)fz_choice_widget_options(idoc, focus, opts);
+ (void)pdf_choice_widget_options(idoc, focus, opts);
}
fz_catch(ctx)
{
@@ -2051,8 +2052,8 @@ JNI_FN(MuPDFCore_getFocusedWidgetChoiceSelected)(JNIEnv * env, jobject thiz)
{
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
- fz_interactive *idoc = fz_interact(glo->doc);
- fz_widget *focus;
+ pdf_document *idoc = pdf_specifics(glo->doc);
+ pdf_widget *focus;
int type;
int nsel, i;
char **sel = NULL;
@@ -2062,20 +2063,20 @@ JNI_FN(MuPDFCore_getFocusedWidgetChoiceSelected)(JNIEnv * env, jobject thiz)
if (idoc == NULL)
return NULL;
- focus = fz_focused_widget(idoc);
+ focus = pdf_focused_widget(idoc);
if (focus == NULL)
return NULL;
- type = fz_widget_get_type(focus);
- if (type != FZ_WIDGET_TYPE_LISTBOX && type != FZ_WIDGET_TYPE_COMBOBOX)
+ type = pdf_widget_get_type(focus);
+ if (type != PDF_WIDGET_TYPE_LISTBOX && type != PDF_WIDGET_TYPE_COMBOBOX)
return NULL;
fz_var(sel);
fz_try(ctx)
{
- nsel = fz_choice_widget_value(idoc, focus, NULL);
+ nsel = pdf_choice_widget_value(idoc, focus, NULL);
sel = fz_malloc(ctx, nsel * sizeof(*sel));
- (void)fz_choice_widget_value(idoc, focus, sel);
+ (void)pdf_choice_widget_value(idoc, focus, sel);
}
fz_catch(ctx)
{
@@ -2107,8 +2108,8 @@ JNI_FN(MuPDFCore_setFocusedWidgetChoiceSelectedInternal)(JNIEnv * env, jobject t
{
globals *glo = get_globals(env, thiz);
fz_context *ctx = glo->ctx;
- fz_interactive *idoc = fz_interact(glo->doc);
- fz_widget *focus;
+ pdf_document *idoc = pdf_specifics(glo->doc);
+ pdf_widget *focus;
int type;
int nsel, i;
char **sel = NULL;
@@ -2117,12 +2118,12 @@ JNI_FN(MuPDFCore_setFocusedWidgetChoiceSelectedInternal)(JNIEnv * env, jobject t
if (idoc == NULL)
return;
- focus = fz_focused_widget(idoc);
+ focus = pdf_focused_widget(idoc);
if (focus == NULL)
return;
- type = fz_widget_get_type(focus);
- if (type != FZ_WIDGET_TYPE_LISTBOX && type != FZ_WIDGET_TYPE_COMBOBOX)
+ type = pdf_widget_get_type(focus);
+ if (type != PDF_WIDGET_TYPE_LISTBOX && type != PDF_WIDGET_TYPE_COMBOBOX)
return;
nsel = (*env)->GetArrayLength(env, arr);
@@ -2145,7 +2146,7 @@ JNI_FN(MuPDFCore_setFocusedWidgetChoiceSelectedInternal)(JNIEnv * env, jobject t
fz_try(ctx)
{
- fz_choice_widget_set_value(idoc, focus, nsel, sel);
+ pdf_choice_widget_set_value(idoc, focus, nsel, sel);
dump_annotation_display_lists(glo);
}
fz_catch(ctx)
@@ -2164,22 +2165,22 @@ JNIEXPORT int JNICALL
JNI_FN(MuPDFCore_getFocusedWidgetTypeInternal)(JNIEnv * env, jobject thiz)
{
globals *glo = get_globals(env, thiz);
- fz_interactive *idoc = fz_interact(glo->doc);
- fz_widget *focus;
+ pdf_document *idoc = pdf_specifics(glo->doc);
+ pdf_widget *focus;
if (idoc == NULL)
return NONE;
- focus = fz_focused_widget(idoc);
+ focus = pdf_focused_widget(idoc);
if (focus == NULL)
return NONE;
- switch (fz_widget_get_type(focus))
+ switch (pdf_widget_get_type(focus))
{
- case FZ_WIDGET_TYPE_TEXT: return TEXT;
- case FZ_WIDGET_TYPE_LISTBOX: return LISTBOX;
- case FZ_WIDGET_TYPE_COMBOBOX: return COMBOBOX;
+ case PDF_WIDGET_TYPE_TEXT: return TEXT;
+ case PDF_WIDGET_TYPE_LISTBOX: return LISTBOX;
+ case PDF_WIDGET_TYPE_COMBOBOX: return COMBOBOX;
}
return NONE;
@@ -2194,7 +2195,7 @@ JNI_FN(MuPDFCore_waitForAlertInternal)(JNIEnv * env, jobject thiz)
jstring title;
jstring message;
int alert_present;
- fz_alert_event alert;
+ pdf_alert_event alert;
LOGT("Enter waitForAlert");
pthread_mutex_lock(&glo->fin_lock);
@@ -2314,9 +2315,9 @@ JNIEXPORT jboolean JNICALL
JNI_FN(MuPDFCore_hasChangesInternal)(JNIEnv * env, jobject thiz)
{
globals *glo = get_globals(env, thiz);
- fz_interactive *idoc = fz_interact(glo->doc);
+ pdf_document *idoc = pdf_specifics(glo->doc);
- return (idoc && fz_has_unsaved_changes(idoc)) ? JNI_TRUE : JNI_FALSE;
+ return (idoc && pdf_has_unsaved_changes(idoc)) ? JNI_TRUE : JNI_FALSE;
}
static char *tmp_path(char *path)
diff --git a/apps/jstest_main.c b/apps/jstest_main.c
index 84d4dc9b..6c6a69b3 100644
--- a/apps/jstest_main.c
+++ b/apps/jstest_main.c
@@ -37,18 +37,18 @@ void winerror(pdfapp_t *app, char *msg)
exit(1);
}
-void winalert(pdfapp_t *app, fz_alert_event *alert)
+void winalert(pdfapp_t *app, pdf_alert_event *alert)
{
fprintf(stderr, "Alert %s: %s", alert->title, alert->message);
switch (alert->button_group_type)
{
- case FZ_ALERT_BUTTON_GROUP_OK:
- case FZ_ALERT_BUTTON_GROUP_OK_CANCEL:
- alert->button_pressed = FZ_ALERT_BUTTON_OK;
+ case PDF_ALERT_BUTTON_GROUP_OK:
+ case PDF_ALERT_BUTTON_GROUP_OK_CANCEL:
+ alert->button_pressed = PDF_ALERT_BUTTON_OK;
break;
- case FZ_ALERT_BUTTON_GROUP_YES_NO:
- case FZ_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
- alert->button_pressed = FZ_ALERT_BUTTON_YES;
+ case PDF_ALERT_BUTTON_GROUP_YES_NO:
+ case PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
+ alert->button_pressed = PDF_ALERT_BUTTON_YES;
break;
}
}
diff --git a/apps/mudraw.c b/apps/mudraw.c
index cab25ac0..3664cba5 100644
--- a/apps/mudraw.c
+++ b/apps/mudraw.c
@@ -3,6 +3,7 @@
*/
#include "fitz.h"
+#include "mupdf-internal.h"
#ifdef _MSC_VER
#include <winsock2.h>
@@ -274,24 +275,24 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
if (mujstest_file)
{
- fz_interactive *inter = fz_interact(doc);
- fz_widget *widget = NULL;
+ pdf_document *inter = pdf_specifics(doc);
+ pdf_widget *widget = NULL;
if (inter)
- widget = fz_first_widget(inter, page);
+ widget = pdf_first_widget(inter, (pdf_page *)page);
if (widget)
{
fprintf(mujstest_file, "GOTO %d\n", pagenum);
needshot = 1;
}
- for (;widget; widget = fz_next_widget(inter, widget))
+ for (;widget; widget = pdf_next_widget(widget))
{
fz_rect rect;
int w, h, len;
- int type = fz_widget_get_type(widget);
+ int type = pdf_widget_get_type(widget);
- fz_bound_widget(widget, &rect);
+ pdf_bound_widget(widget, &rect);
w = (rect.x1 - rect.x0);
h = (rect.y1 - rect.y0);
++mujstest_count;
@@ -300,19 +301,19 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
default:
fprintf(mujstest_file, "%% UNKNOWN %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
- case FZ_WIDGET_TYPE_PUSHBUTTON:
+ case PDF_WIDGET_TYPE_PUSHBUTTON:
fprintf(mujstest_file, "%% PUSHBUTTON %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
- case FZ_WIDGET_TYPE_CHECKBOX:
+ case PDF_WIDGET_TYPE_CHECKBOX:
fprintf(mujstest_file, "%% CHECKBOX %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
- case FZ_WIDGET_TYPE_RADIOBUTTON:
+ case PDF_WIDGET_TYPE_RADIOBUTTON:
fprintf(mujstest_file, "%% RADIOBUTTON %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
- case FZ_WIDGET_TYPE_TEXT:
+ case PDF_WIDGET_TYPE_TEXT:
{
- int maxlen = fz_text_widget_max_len(inter, widget);
- int texttype = fz_text_widget_content_type(inter, widget);
+ int maxlen = pdf_text_widget_max_len(inter, widget);
+ int texttype = pdf_text_widget_content_type(inter, widget);
/* If height is low, assume a single row, and base
* the width off that. */
@@ -341,31 +342,31 @@ static void drawpage(fz_context *ctx, fz_document *doc, int pagenum)
switch (texttype)
{
default:
- case FZ_WIDGET_CONTENT_UNRESTRAINED:
+ case PDF_WIDGET_CONTENT_UNRESTRAINED:
fprintf(mujstest_file, "TEXT %d ", mujstest_count);
escape_string(mujstest_file, len-3, lorem);
fprintf(mujstest_file, "\n");
break;
- case FZ_WIDGET_CONTENT_NUMBER:
+ case PDF_WIDGET_CONTENT_NUMBER:
fprintf(mujstest_file, "TEXT %d\n", mujstest_count);
break;
- case FZ_WIDGET_CONTENT_SPECIAL:
+ case PDF_WIDGET_CONTENT_SPECIAL:
fprintf(mujstest_file, "TEXT %lld\n", 46702919800LL + mujstest_count);
break;
- case FZ_WIDGET_CONTENT_DATE:
+ case PDF_WIDGET_CONTENT_DATE:
fprintf(mujstest_file, "TEXT Jun %d 1979\n", 1 + ((13 + mujstest_count) % 30));
break;
- case FZ_WIDGET_CONTENT_TIME:
+ case PDF_WIDGET_CONTENT_TIME:
++mujstest_count;
fprintf(mujstest_file, "TEXT %02d:%02d\n", ((mujstest_count/60) % 24), mujstest_count % 60);
break;
}
break;
}
- case FZ_WIDGET_TYPE_LISTBOX:
+ case PDF_WIDGET_TYPE_LISTBOX:
fprintf(mujstest_file, "%% LISTBOX %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
- case FZ_WIDGET_TYPE_COMBOBOX:
+ case PDF_WIDGET_TYPE_COMBOBOX:
fprintf(mujstest_file, "%% COMBOBOX %0.2f %0.2f %0.2f %0.2f\n", rect.x0, rect.y0, rect.x1, rect.y1);
break;
}
diff --git a/apps/pdfapp.c b/apps/pdfapp.c
index 33f222fc..50ecaf6f 100644
--- a/apps/pdfapp.c
+++ b/apps/pdfapp.c
@@ -101,26 +101,26 @@ void pdfapp_invert(pdfapp_t *app, const fz_rect *rect)
fz_invert_pixmap_rect(app->image, fz_round_rect(&b, rect));
}
-static void event_cb(fz_doc_event *event, void *data)
+static void event_cb(pdf_doc_event *event, void *data)
{
pdfapp_t *app = (pdfapp_t *)data;
switch (event->type)
{
- case FZ_DOCUMENT_EVENT_ALERT:
+ case PDF_DOCUMENT_EVENT_ALERT:
{
- fz_alert_event *alert = fz_access_alert_event(event);
+ pdf_alert_event *alert = pdf_access_alert_event(event);
winalert(app, alert);
}
break;
- case FZ_DOCUMENT_EVENT_PRINT:
+ case PDF_DOCUMENT_EVENT_PRINT:
winprint(app);
break;
- case FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM:
+ case PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM:
{
- char *item = fz_access_exec_menu_item_event(event);
+ char *item = pdf_access_exec_menu_item_event(event);
if (!strcmp(item, "Print"))
winprint(app);
@@ -129,21 +129,21 @@ static void event_cb(fz_doc_event *event, void *data)
}
break;
- case FZ_DOCUMENT_EVENT_EXEC_DIALOG:
+ case PDF_DOCUMENT_EVENT_EXEC_DIALOG:
pdfapp_warn(app, "The document attempted to open a dialog box. (Not supported)");
break;
- case FZ_DOCUMENT_EVENT_LAUNCH_URL:
+ case PDF_DOCUMENT_EVENT_LAUNCH_URL:
{
- fz_launch_url_event *launch_url = fz_access_launch_url_event(event);
+ pdf_launch_url_event *launch_url = pdf_access_launch_url_event(event);
pdfapp_warn(app, "The document attempted to open url: %s. (Not supported by app)", launch_url->url);
}
break;
- case FZ_DOCUMENT_EVENT_MAIL_DOC:
+ case PDF_DOCUMENT_EVENT_MAIL_DOC:
{
- fz_mail_doc_event *mail_doc = fz_access_mail_doc_event(event);
+ pdf_mail_doc_event *mail_doc = pdf_access_mail_doc_event(event);
pdfapp_warn(app, "The document attmepted to mail the document%s%s%s%s%s%s%s%s (Not supported)",
mail_doc->to[0]?", To: ":"", mail_doc->to,
@@ -162,14 +162,14 @@ void pdfapp_open(pdfapp_t *app, char *filename, int reload)
fz_try(ctx)
{
- fz_interactive *idoc;
+ pdf_document *idoc;
app->doc = fz_open_document(ctx, filename);
- idoc = fz_interact(app->doc);
+ idoc = pdf_specifics(app->doc);
if (idoc)
- fz_set_doc_event_callback(idoc, event_cb, app);
+ pdf_set_doc_event_callback(idoc, event_cb, app);
if (fz_needs_password(app->doc))
{
@@ -357,9 +357,9 @@ static int pdfapp_save(pdfapp_t *app)
int pdfapp_preclose(pdfapp_t *app)
{
- fz_interactive *idoc = fz_interact(app->doc);
+ pdf_document *idoc = pdf_specifics(app->doc);
- if (idoc && fz_has_unsaved_changes(idoc))
+ if (idoc && pdf_has_unsaved_changes(idoc))
{
switch (winsavequery(app))
{
@@ -540,16 +540,16 @@ static void pdfapp_recreate_annotationslist(pdfapp_t *app)
static void pdfapp_updatepage(pdfapp_t *app)
{
- fz_interactive *idoc = fz_interact(app->doc);
+ pdf_document *idoc = pdf_specifics(app->doc);
fz_device *idev;
fz_matrix ctm;
fz_annot *annot;
pdfapp_viewctm(&ctm, app);
- fz_update_page(idoc, app->page);
+ pdf_update_page(idoc, (pdf_page *)app->page);
pdfapp_recreate_annotationslist(app);
- while ((annot = fz_poll_changed_annot(idoc, app->page)) != NULL)
+ while ((annot = (fz_annot *)pdf_poll_changed_annot(idoc, (pdf_page *)app->page)) != NULL)
{
fz_rect bounds;
fz_irect ibounds;
@@ -1195,32 +1195,32 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
if (btn == 1 && (state == 1 || state == -1))
{
- fz_ui_event event;
- fz_interactive *idoc = fz_interact(app->doc);
+ pdf_ui_event event;
+ pdf_document *idoc = pdf_specifics(app->doc);
- event.etype = FZ_EVENT_TYPE_POINTER;
+ event.etype = PDF_EVENT_TYPE_POINTER;
event.event.pointer.pt = p;
if (state == 1)
- event.event.pointer.ptype = FZ_POINTER_DOWN;
+ event.event.pointer.ptype = PDF_POINTER_DOWN;
else /* state == -1 */
- event.event.pointer.ptype = FZ_POINTER_UP;
+ event.event.pointer.ptype = PDF_POINTER_UP;
- if (idoc && fz_pass_event(idoc, app->page, &event))
+ if (idoc && pdf_pass_event(idoc, (pdf_page *)app->page, &event))
{
- fz_widget *widget;
+ pdf_widget *widget;
- widget = fz_focused_widget(idoc);
+ widget = pdf_focused_widget(idoc);
app->nowaitcursor = 1;
pdfapp_updatepage(app);
if (widget)
{
- switch (fz_widget_get_type(widget))
+ switch (pdf_widget_get_type(widget))
{
- case FZ_WIDGET_TYPE_TEXT:
+ case PDF_WIDGET_TYPE_TEXT:
{
- char *text = fz_text_widget_text(idoc, widget);
+ char *text = pdf_text_widget_text(idoc, widget);
char *current_text = text;
int retry = 0;
@@ -1229,15 +1229,15 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
current_text = wintextinput(app, current_text, retry);
retry = 1;
}
- while (current_text && !fz_text_widget_set_text(idoc, widget, current_text));
+ while (current_text && !pdf_text_widget_set_text(idoc, widget, current_text));
fz_free(app->ctx, text);
pdfapp_updatepage(app);
}
break;
- case FZ_WIDGET_TYPE_LISTBOX:
- case FZ_WIDGET_TYPE_COMBOBOX:
+ case PDF_WIDGET_TYPE_LISTBOX:
+ case PDF_WIDGET_TYPE_COMBOBOX:
{
int nopts;
int nvals;
@@ -1249,17 +1249,17 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
fz_try(ctx)
{
- nopts = fz_choice_widget_options(idoc, widget, NULL);
+ nopts = pdf_choice_widget_options(idoc, widget, NULL);
opts = fz_malloc(ctx, nopts * sizeof(*opts));
- (void)fz_choice_widget_options(idoc, widget, opts);
+ (void)pdf_choice_widget_options(idoc, widget, opts);
- nvals = fz_choice_widget_value(idoc, widget, NULL);
+ nvals = pdf_choice_widget_value(idoc, widget, NULL);
vals = fz_malloc(ctx, MAX(nvals,nopts) * sizeof(*vals));
- (void)fz_choice_widget_value(idoc, widget, vals);
+ (void)pdf_choice_widget_value(idoc, widget, vals);
if (winchoiceinput(app, nopts, opts, &nvals, vals))
{
- fz_choice_widget_set_value(idoc, widget, nvals, vals);
+ pdf_choice_widget_set_value(idoc, widget, nvals, vals);
pdfapp_updatepage(app);
}
}
@@ -1275,12 +1275,12 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
}
break;
- case FZ_WIDGET_TYPE_SIGNATURE:
+ case PDF_WIDGET_TYPE_SIGNATURE:
{
char ebuf[256];
ebuf[0] = 0;
- if (fz_check_signature(ctx, idoc, widget, app->docpath, ebuf, sizeof(ebuf)))
+ if (pdf_check_signature(ctx, idoc, widget, app->docpath, ebuf, sizeof(ebuf)))
{
winwarn(app, "Signature is valid");
}
diff --git a/apps/pdfapp.h b/apps/pdfapp.h
index a788e253..9c8a0ee9 100644
--- a/apps/pdfapp.h
+++ b/apps/pdfapp.h
@@ -2,6 +2,7 @@
#define PDFAPP_H
#include "fitz.h"
+#include "mupdf-internal.h"
/*
* Utility object for handling a pdf application / view
@@ -37,7 +38,7 @@ extern void winhelp(pdfapp_t*);
extern void winfullscreen(pdfapp_t*, int state);
extern int winsavequery(pdfapp_t*);
extern int wingetsavepath(pdfapp_t*, char *buf, int len);
-extern void winalert(pdfapp_t *, fz_alert_event *alert);
+extern void winalert(pdfapp_t *, pdf_alert_event *alert);
extern void winprint(pdfapp_t *);
extern void winadvancetimer(pdfapp_t *, float duration);
extern void winreplacefile(char *source, char *target);
diff --git a/apps/win_main.c b/apps/win_main.c
index d19f29ba..bf765d6b 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -100,40 +100,40 @@ void winerror(pdfapp_t *app, char *msg)
exit(1);
}
-void winalert(pdfapp_t *app, fz_alert_event *alert)
+void winalert(pdfapp_t *app, pdf_alert_event *alert)
{
int buttons = MB_OK;
int icon = MB_ICONWARNING;
- int pressed = FZ_ALERT_BUTTON_NONE;
+ int pressed = PDF_ALERT_BUTTON_NONE;
switch (alert->icon_type)
{
- case FZ_ALERT_ICON_ERROR:
+ case PDF_ALERT_ICON_ERROR:
icon = MB_ICONERROR;
break;
- case FZ_ALERT_ICON_WARNING:
+ case PDF_ALERT_ICON_WARNING:
icon = MB_ICONWARNING;
break;
- case FZ_ALERT_ICON_QUESTION:
+ case PDF_ALERT_ICON_QUESTION:
icon = MB_ICONQUESTION;
break;
- case FZ_ALERT_ICON_STATUS:
+ case PDF_ALERT_ICON_STATUS:
icon = MB_ICONINFORMATION;
break;
}
switch (alert->button_group_type)
{
- case FZ_ALERT_BUTTON_GROUP_OK:
+ case PDF_ALERT_BUTTON_GROUP_OK:
buttons = MB_OK;
break;
- case FZ_ALERT_BUTTON_GROUP_OK_CANCEL:
+ case PDF_ALERT_BUTTON_GROUP_OK_CANCEL:
buttons = MB_OKCANCEL;
break;
- case FZ_ALERT_BUTTON_GROUP_YES_NO:
+ case PDF_ALERT_BUTTON_GROUP_YES_NO:
buttons = MB_YESNO;
break;
- case FZ_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
+ case PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
buttons = MB_YESNOCANCEL;
break;
}
@@ -143,16 +143,16 @@ void winalert(pdfapp_t *app, fz_alert_event *alert)
switch (pressed)
{
case IDOK:
- alert->button_pressed = FZ_ALERT_BUTTON_OK;
+ alert->button_pressed = PDF_ALERT_BUTTON_OK;
break;
case IDCANCEL:
- alert->button_pressed = FZ_ALERT_BUTTON_CANCEL;
+ alert->button_pressed = PDF_ALERT_BUTTON_CANCEL;
break;
case IDNO:
- alert->button_pressed = FZ_ALERT_BUTTON_NO;
+ alert->button_pressed = PDF_ALERT_BUTTON_NO;
break;
case IDYES:
- alert->button_pressed = FZ_ALERT_BUTTON_YES;
+ alert->button_pressed = PDF_ALERT_BUTTON_YES;
}
}
diff --git a/apps/x11_main.c b/apps/x11_main.c
index 1c0ca0b0..270f15df 100644
--- a/apps/x11_main.c
+++ b/apps/x11_main.c
@@ -116,18 +116,18 @@ void winwarn(pdfapp_t *app, char *msg)
fprintf(stderr, "mupdf: warning: %s\n", msg);
}
-void winalert(pdfapp_t *app, fz_alert_event *alert)
+void winalert(pdfapp_t *app, pdf_alert_event *alert)
{
fprintf(stderr, "Alert %s: %s", alert->title, alert->message);
switch (alert->button_group_type)
{
- case FZ_ALERT_BUTTON_GROUP_OK:
- case FZ_ALERT_BUTTON_GROUP_OK_CANCEL:
- alert->button_pressed = FZ_ALERT_BUTTON_OK;
+ case PDF_ALERT_BUTTON_GROUP_OK:
+ case PDF_ALERT_BUTTON_GROUP_OK_CANCEL:
+ alert->button_pressed = PDF_ALERT_BUTTON_OK;
break;
- case FZ_ALERT_BUTTON_GROUP_YES_NO:
- case FZ_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
- alert->button_pressed = FZ_ALERT_BUTTON_YES;
+ case PDF_ALERT_BUTTON_GROUP_YES_NO:
+ case PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL:
+ alert->button_pressed = PDF_ALERT_BUTTON_YES;
break;
}
}
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
diff --git a/pdf/mupdf-internal.h b/pdf/mupdf-internal.h
index a0c8f599..95931352 100644
--- a/pdf/mupdf-internal.h
+++ b/pdf/mupdf-internal.h
@@ -126,6 +126,18 @@ typedef struct pdf_xref_s
pdf_obj *trailer;
} pdf_xref;
+/*
+ Document event structures are mostly opaque to the app. Only the type
+ is visible to the app.
+*/
+typedef struct pdf_doc_event_s pdf_doc_event;
+
+/*
+ pdf_doc_event_cb: the type of function via which the app receives
+ document events.
+*/
+typedef void (pdf_doc_event_cb)(pdf_doc_event *event, void *data);
+
struct pdf_document_s
{
fz_document super;
@@ -160,7 +172,7 @@ struct pdf_document_s
int dirty;
void (*update_appearance)(pdf_document *xref, pdf_obj *annot);
- fz_doc_event_cb *event_cb;
+ pdf_doc_event_cb *event_cb;
void *event_cb_data;
};
@@ -579,40 +591,413 @@ void pdf_remove_item(fz_context *ctx, fz_store_free_fn *free, pdf_obj *key);
/*
* PDF interaction interface
*/
+
+/* Types of widget */
+enum
+{
+ PDF_WIDGET_TYPE_NOT_WIDGET = -1,
+ PDF_WIDGET_TYPE_PUSHBUTTON,
+ PDF_WIDGET_TYPE_CHECKBOX,
+ PDF_WIDGET_TYPE_RADIOBUTTON,
+ PDF_WIDGET_TYPE_TEXT,
+ PDF_WIDGET_TYPE_LISTBOX,
+ PDF_WIDGET_TYPE_COMBOBOX,
+ PDF_WIDGET_TYPE_SIGNATURE
+};
+
+/* Types of text widget content */
+enum
+{
+ PDF_WIDGET_CONTENT_UNRESTRAINED,
+ PDF_WIDGET_CONTENT_NUMBER,
+ PDF_WIDGET_CONTENT_SPECIAL,
+ PDF_WIDGET_CONTENT_DATE,
+ PDF_WIDGET_CONTENT_TIME
+};
+
+/* Types of UI event */
+enum
+{
+ PDF_EVENT_TYPE_POINTER,
+};
+
+/* Types of pointer event */
+enum
+{
+ PDF_POINTER_DOWN,
+ PDF_POINTER_UP,
+};
+
+
+/*
+ UI events that can be passed to an interactive document.
+*/
+typedef struct pdf_ui_event_s
+{
+ int etype;
+ union
+ {
+ struct
+ {
+ int ptype;
+ fz_point pt;
+ } pointer;
+ } event;
+} pdf_ui_event;
+
+/*
+ pdf_init_ui_pointer_event: Set up a pointer event
+*/
+void pdf_init_ui_pointer_event(pdf_ui_event *event, int type, float x, float y);
+
+/*
+ Widgets that may appear in PDF forms
+*/
+typedef struct pdf_widget_s pdf_widget;
+
+/*
+ Determine whether changes have been made since the
+ document was opened or last saved.
+*/
int pdf_has_unsaved_changes(pdf_document *doc);
-int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event);
+
+/*
+ pdf_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 pdf_pass_event(pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event);
+
+/*
+ pdf_update_page: update a page for the sake of changes caused by a call
+ to pdf_pass_event. pdf_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 pdf_poll_changed_annotation. Note that a call to
+ pdf_pass_event for one page may lead to changes on any other, so an app
+ should call pdf_update_page for every page it currently displays. Also
+ it is important that the pdf_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 pdf_update_page would not reliably be able to report all changed
+ areas.
+*/
void pdf_update_page(pdf_document *doc, pdf_page *page);
+
fz_annot_type pdf_annot_obj_type(pdf_obj *obj);
+
+/*
+ pdf_poll_changed_annot: enumerate the changed annotations recoreded
+ by a call to pdf_update_page.
+*/
pdf_annot *pdf_poll_changed_annot(pdf_document *idoc, pdf_page *page);
-fz_widget *pdf_focused_widget(pdf_document *doc);
-fz_widget *pdf_first_widget(pdf_document *doc, pdf_page *page);
-fz_widget *pdf_next_widget(fz_widget *previous);
-char *pdf_text_widget_text(pdf_document *doc, fz_widget *tw);
-int pdf_text_widget_max_len(pdf_document *doc, fz_widget *tw);
-int pdf_text_widget_content_type(pdf_document *doc, fz_widget *tw);
-int pdf_text_widget_set_text(pdf_document *doc, fz_widget *tw, char *text);
-int pdf_choice_widget_options(pdf_document *doc, fz_widget *tw, char *opts[]);
-int pdf_choice_widget_is_multiselect(pdf_document *doc, fz_widget *tw);
-int pdf_choice_widget_value(pdf_document *doc, fz_widget *tw, char *opts[]);
-void pdf_choice_widget_set_value(pdf_document *doc, fz_widget *tw, int n, char *opts[]);
-int pdf_signature_widget_byte_range(pdf_document *doc, fz_widget *widget, int (*byte_range)[2]);
-int pdf_signature_widget_contents(pdf_document *doc, fz_widget *widget, char **contents);
+
+/*
+ pdf_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 pdf_pass_event.
+*/
+pdf_widget *pdf_focused_widget(pdf_document *doc);
+
+/*
+ pdf_first_widget: get first widget when enumerating
+*/
+pdf_widget *pdf_first_widget(pdf_document *doc, pdf_page *page);
+
+/*
+ pdf_next_widget: get next widget when enumerating
+*/
+pdf_widget *pdf_next_widget(pdf_widget *previous);
+
+/*
+ pdf_widget_get_type: find out the type of a widget.
+
+ The type determines what widget subclass the widget
+ can safely be cast to.
+*/
+int pdf_widget_get_type(pdf_widget *widget);
+
+/*
+ pdf_bound_widget: get the bounding box of a widget.
+*/
+fz_rect *pdf_bound_widget(pdf_widget *widget, fz_rect *);
+
+/*
+ pdf_text_widget_text: Get the text currently displayed in
+ a text widget.
+*/
+char *pdf_text_widget_text(pdf_document *doc, pdf_widget *tw);
+
+/*
+ pdf_widget_text_max_len: get the maximum number of
+ characters permitted in a text widget
+*/
+int pdf_text_widget_max_len(pdf_document *doc, pdf_widget *tw);
+
+/*
+ pdf_text_widget_content_type: get the type of content
+ required by a text widget
+*/
+int pdf_text_widget_content_type(pdf_document *doc, pdf_widget *tw);
+
+/*
+ pdf_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 pdf_text_widget_set_text(pdf_document *doc, pdf_widget *tw, char *text);
+
+/*
+ pdf_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 pdf_choice_widget_options(pdf_document *doc, pdf_widget *tw, char *opts[]);
+
+/*
+ pdf_choice_widget_is_multiselect: returns whether a list box or
+ combo box supports selection of multiple options
+*/
+int pdf_choice_widget_is_multiselect(pdf_document *doc, pdf_widget *tw);
+
+/*
+ pdf_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 pdf_choice_widget_value(pdf_document *doc, pdf_widget *tw, char *opts[]);
+
+/*
+ pdf_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 pdf_choice_widget_set_value(pdf_document *doc, pdf_widget *tw, int n, char *opts[]);
+
+/*
+ pdf_signature_widget_byte_range: retrieve the byte range for a signature widget
+*/
+int pdf_signature_widget_byte_range(pdf_document *doc, pdf_widget *widget, int (*byte_range)[2]);
+
+/*
+ pdf_signature_widget_contents: retrieve the contents for a signature widget
+*/
+int pdf_signature_widget_contents(pdf_document *doc, pdf_widget *widget, char **contents);
+
+/*
+ fz_check_signature: check a signature's certificate chain and digest
+*/
+int pdf_check_signature(fz_context *ctx, pdf_document *doc, pdf_widget *widget, char *file, char *ebuf, int ebufsize);
+
+/*
+ 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.
+*/
pdf_annot *pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type);
+
+/*
+ fz_delete_annot: delete an annotation
+*/
void pdf_delete_annot(pdf_document *doc, pdf_page *page, pdf_annot *annot);
+
+/*
+ fz_set_annot_appearance: update the appearance of an annotation based
+ on a display list.
+*/
void pdf_set_annot_appearance(pdf_document *doc, pdf_annot *annot, fz_rect *rect, fz_display_list *disp_list);
+
+/*
+ fz_set_markup_annot_quadpoints: set the quadpoints for a text-markup annotation.
+*/
void pdf_set_markup_annot_quadpoints(pdf_document *doc, pdf_annot *annot, fz_point *qp, int n);
+
void pdf_set_markup_obj_appearance(pdf_document *doc, pdf_obj *annot, float color[3], float alpha, float line_thickness, float line_height);
+
+/*
+ fz_set_markup_appearance: set the appearance stream of a text markup annotations, basing it on
+ its QuadPoints array
+*/
void pdf_set_markup_appearance(pdf_document *doc, pdf_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 pdf_set_ink_annot_list(pdf_document *doc, pdf_annot *annot, fz_point *pts, int *counts, int ncount, float color[3], float thickness);
void pdf_set_ink_obj_appearance(pdf_document *doc, pdf_obj *annot);
-void pdf_set_doc_event_callback(pdf_document *doc, fz_doc_event_cb *event_cb, void *data);
-void pdf_event_issue_alert(pdf_document *doc, fz_alert_event *event);
+/*
+ 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.
+*/
+
+struct pdf_doc_event_s
+{
+ int type;
+};
+
+enum
+{
+ PDF_DOCUMENT_EVENT_ALERT,
+ PDF_DOCUMENT_EVENT_PRINT,
+ PDF_DOCUMENT_EVENT_LAUNCH_URL,
+ PDF_DOCUMENT_EVENT_MAIL_DOC,
+ PDF_DOCUMENT_EVENT_SUBMIT,
+ PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM,
+ PDF_DOCUMENT_EVENT_EXEC_DIALOG
+};
+
+/*
+ pdf_set_doc_event_callback: set the function via which to receive
+ document events.
+*/
+void pdf_set_doc_event_callback(pdf_document *doc, pdf_doc_event_cb *event_cb, void *data);
+
+/*
+ The various types of document events
+*/
+
+/*
+ pdf_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;
+} pdf_alert_event;
+
+/* Possible values of icon_type */
+enum
+{
+ PDF_ALERT_ICON_ERROR,
+ PDF_ALERT_ICON_WARNING,
+ PDF_ALERT_ICON_QUESTION,
+ PDF_ALERT_ICON_STATUS
+};
+
+/* Possible values of button_group_type */
+enum
+{
+ PDF_ALERT_BUTTON_GROUP_OK,
+ PDF_ALERT_BUTTON_GROUP_OK_CANCEL,
+ PDF_ALERT_BUTTON_GROUP_YES_NO,
+ PDF_ALERT_BUTTON_GROUP_YES_NO_CANCEL
+};
+
+/* Possible values of button_pressed */
+enum
+{
+ PDF_ALERT_BUTTON_NONE,
+ PDF_ALERT_BUTTON_OK,
+ PDF_ALERT_BUTTON_CANCEL,
+ PDF_ALERT_BUTTON_NO,
+ PDF_ALERT_BUTTON_YES
+};
+
+/*
+ pdf_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.
+*/
+pdf_alert_event *pdf_access_alert_event(pdf_doc_event *event);
+
+/*
+ pdf_access_exec_menu_item_event: access the details of am execMenuItem
+ event, which consists of just the name of the menu item
+*/
+char *pdf_access_exec_menu_item_event(pdf_doc_event *event);
+
+/*
+ pdf_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;
+} pdf_submit_event;
+
+/*
+ pdf_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.
+*/
+pdf_submit_event *pdf_access_submit_event(pdf_doc_event *event);
+
+/*
+ pdf_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;
+} pdf_launch_url_event;
+
+/*
+ pdf_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.
+*/
+pdf_launch_url_event *pdf_access_launch_url_event(pdf_doc_event *event);
+
+/*
+ pdf_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;
+} pdf_mail_doc_event;
+
+/*
+ pdf_acccess_mail_doc_event: access the details of a mail-doc event.
+*/
+pdf_mail_doc_event *pdf_access_mail_doc_event(pdf_doc_event *event);
+
+void pdf_event_issue_alert(pdf_document *doc, pdf_alert_event *event);
void pdf_event_issue_print(pdf_document *doc);
void pdf_event_issue_exec_menu_item(pdf_document *doc, char *item);
void pdf_event_issue_exec_dialog(pdf_document *doc);
void pdf_event_issue_launch_url(pdf_document *doc, char *url, int new_frame);
-void pdf_event_issue_mail_doc(pdf_document *doc, fz_mail_doc_event *event);
+void pdf_event_issue_mail_doc(pdf_document *doc, pdf_mail_doc_event *event);
/*
* Javascript handler
diff --git a/pdf/mupdf.h b/pdf/mupdf.h
index 301f8a8a..3546daed 100644
--- a/pdf/mupdf.h
+++ b/pdf/mupdf.h
@@ -192,6 +192,12 @@ pdf_document *pdf_open_document_with_stream(fz_context *ctx, fz_stream *file);
*/
void pdf_close_document(pdf_document *doc);
+/*
+ pdf_specific: down-cast an fz_document to a pdf_document.
+ Returns NULL if underlying document is not PDF
+*/
+pdf_document *pdf_specifics(fz_document *doc);
+
int pdf_needs_password(pdf_document *doc);
int pdf_authenticate_password(pdf_document *doc, const char *pw);
diff --git a/pdf/pdf_annot.c b/pdf/pdf_annot.c
index 1d7ca98d..4407616a 100644
--- a/pdf/pdf_annot.c
+++ b/pdf/pdf_annot.c
@@ -539,7 +539,7 @@ pdf_load_annots(pdf_document *xref, pdf_obj *annots, pdf_page *page)
fz_transform_rect(&annot->pagerect, &page->ctm);
annot->ap = NULL;
annot->annot_type = pdf_annot_obj_type(obj);
- annot->widget_type = annot->annot_type == FZ_ANNOT_WIDGET ? pdf_field_type(xref, obj) : FZ_WIDGET_TYPE_NOT_WIDGET;
+ annot->widget_type = annot->annot_type == FZ_ANNOT_WIDGET ? pdf_field_type(xref, obj) : PDF_WIDGET_TYPE_NOT_WIDGET;
if (pdf_is_stream(xref, pdf_to_num(n), pdf_to_gen(n)))
{
@@ -688,7 +688,7 @@ pdf_create_annot(pdf_document *doc, pdf_page *page, fz_annot_type type)
annot->rect = rect;
annot->pagerect = rect;
annot->ap = NULL;
- annot->widget_type = FZ_WIDGET_TYPE_NOT_WIDGET;
+ annot->widget_type = PDF_WIDGET_TYPE_NOT_WIDGET;
annot->annot_type = type;
/*
diff --git a/pdf/pdf_event.c b/pdf/pdf_event.c
index 8923b942..0573140c 100644
--- a/pdf/pdf_event.c
+++ b/pdf/pdf_event.c
@@ -3,29 +3,29 @@
typedef struct
{
- fz_doc_event base;
- fz_alert_event alert;
-} fz_alert_event_internal;
+ pdf_doc_event base;
+ pdf_alert_event alert;
+} pdf_alert_event_internal;
-fz_alert_event *fz_access_alert_event(fz_doc_event *event)
+pdf_alert_event *pdf_access_alert_event(pdf_doc_event *event)
{
- fz_alert_event *alert = NULL;
+ pdf_alert_event *alert = NULL;
- if (event->type == FZ_DOCUMENT_EVENT_ALERT)
- alert = &((fz_alert_event_internal *)event)->alert;
+ if (event->type == PDF_DOCUMENT_EVENT_ALERT)
+ alert = &((pdf_alert_event_internal *)event)->alert;
return alert;
}
-void pdf_event_issue_alert(pdf_document *doc, fz_alert_event *alert)
+void pdf_event_issue_alert(pdf_document *doc, pdf_alert_event *alert)
{
if (doc->event_cb)
{
- fz_alert_event_internal ievent;
- ievent.base.type = FZ_DOCUMENT_EVENT_ALERT;
+ pdf_alert_event_internal ievent;
+ ievent.base.type = PDF_DOCUMENT_EVENT_ALERT;
ievent.alert = *alert;
- doc->event_cb((fz_doc_event *)&ievent, doc->event_cb_data);
+ doc->event_cb((pdf_doc_event *)&ievent, doc->event_cb_data);
*alert = ievent.alert;
}
@@ -33,9 +33,9 @@ void pdf_event_issue_alert(pdf_document *doc, fz_alert_event *alert)
void pdf_event_issue_print(pdf_document *doc)
{
- fz_doc_event e;
+ pdf_doc_event e;
- e.type = FZ_DOCUMENT_EVENT_PRINT;
+ e.type = PDF_DOCUMENT_EVENT_PRINT;
if (doc->event_cb)
doc->event_cb(&e, doc->event_cb_data);
@@ -43,16 +43,16 @@ void pdf_event_issue_print(pdf_document *doc)
typedef struct
{
- fz_doc_event base;
+ pdf_doc_event base;
char *item;
-} fz_exec_menu_item_event_internal;
+} pdf_exec_menu_item_event_internal;
-char *fz_access_exec_menu_item_event(fz_doc_event *event)
+char *pdf_access_exec_menu_item_event(pdf_doc_event *event)
{
char *item = NULL;
- if (event->type == FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM)
- item = ((fz_exec_menu_item_event_internal *)event)->item;
+ if (event->type == PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM)
+ item = ((pdf_exec_menu_item_event_internal *)event)->item;
return item;
}
@@ -61,19 +61,19 @@ void pdf_event_issue_exec_menu_item(pdf_document *doc, char *item)
{
if (doc->event_cb)
{
- fz_exec_menu_item_event_internal ievent;
- ievent.base.type = FZ_DOCUMENT_EVENT_EXEC_MENU_ITEM;
+ pdf_exec_menu_item_event_internal ievent;
+ ievent.base.type = PDF_DOCUMENT_EVENT_EXEC_MENU_ITEM;
ievent.item = item;
- doc->event_cb((fz_doc_event *)&ievent, doc->event_cb_data);
+ doc->event_cb((pdf_doc_event *)&ievent, doc->event_cb_data);
}
}
void pdf_event_issue_exec_dialog(pdf_document *doc)
{
- fz_doc_event e;
+ pdf_doc_event e;
- e.type = FZ_DOCUMENT_EVENT_EXEC_DIALOG;
+ e.type = PDF_DOCUMENT_EVENT_EXEC_DIALOG;
if (doc->event_cb)
doc->event_cb(&e, doc->event_cb_data);
@@ -81,16 +81,16 @@ void pdf_event_issue_exec_dialog(pdf_document *doc)
typedef struct
{
- fz_doc_event base;
- fz_launch_url_event launch_url;
-} fz_launch_url_event_internal;
+ pdf_doc_event base;
+ pdf_launch_url_event launch_url;
+} pdf_launch_url_event_internal;
-fz_launch_url_event *fz_access_launch_url_event(fz_doc_event *event)
+pdf_launch_url_event *pdf_access_launch_url_event(pdf_doc_event *event)
{
- fz_launch_url_event *launch_url = NULL;
+ pdf_launch_url_event *launch_url = NULL;
- if (event->type == FZ_DOCUMENT_EVENT_LAUNCH_URL)
- launch_url = &((fz_launch_url_event_internal *)event)->launch_url;
+ if (event->type == PDF_DOCUMENT_EVENT_LAUNCH_URL)
+ launch_url = &((pdf_launch_url_event_internal *)event)->launch_url;
return launch_url;
}
@@ -99,45 +99,45 @@ void pdf_event_issue_launch_url(pdf_document *doc, char *url, int new_frame)
{
if (doc->event_cb)
{
- fz_launch_url_event_internal e;
+ pdf_launch_url_event_internal e;
- e.base.type = FZ_DOCUMENT_EVENT_LAUNCH_URL;
+ e.base.type = PDF_DOCUMENT_EVENT_LAUNCH_URL;
e.launch_url.url = url;
e.launch_url.new_frame = new_frame;
- doc->event_cb((fz_doc_event *)&e, doc->event_cb_data);
+ doc->event_cb((pdf_doc_event *)&e, doc->event_cb_data);
}
}
typedef struct
{
- fz_doc_event base;
- fz_mail_doc_event mail_doc;
-} fz_mail_doc_event_internal;
+ pdf_doc_event base;
+ pdf_mail_doc_event mail_doc;
+} pdf_mail_doc_event_internal;
-fz_mail_doc_event *fz_access_mail_doc_event(fz_doc_event *event)
+pdf_mail_doc_event *pdf_access_mail_doc_event(pdf_doc_event *event)
{
- fz_mail_doc_event *mail_doc = NULL;
+ pdf_mail_doc_event *mail_doc = NULL;
- if (event->type == FZ_DOCUMENT_EVENT_MAIL_DOC)
- mail_doc = &((fz_mail_doc_event_internal *)event)->mail_doc;
+ if (event->type == PDF_DOCUMENT_EVENT_MAIL_DOC)
+ mail_doc = &((pdf_mail_doc_event_internal *)event)->mail_doc;
return mail_doc;
}
-void pdf_event_issue_mail_doc(pdf_document *doc, fz_mail_doc_event *event)
+void pdf_event_issue_mail_doc(pdf_document *doc, pdf_mail_doc_event *event)
{
if (doc->event_cb)
{
- fz_mail_doc_event_internal e;
+ pdf_mail_doc_event_internal e;
- e.base.type = FZ_DOCUMENT_EVENT_MAIL_DOC;
+ e.base.type = PDF_DOCUMENT_EVENT_MAIL_DOC;
e.mail_doc = *event;
- doc->event_cb((fz_doc_event *)&e, doc->event_cb_data);
+ doc->event_cb((pdf_doc_event *)&e, doc->event_cb_data);
}
}
-void pdf_set_doc_event_callback(pdf_document *doc, fz_doc_event_cb *fn, void *data)
+void pdf_set_doc_event_callback(pdf_document *doc, pdf_doc_event_cb *fn, void *data)
{
doc->event_cb = fn;
doc->event_cb_data = data;
diff --git a/pdf/pdf_field.c b/pdf/pdf_field.c
index d68fd9bf..699f4acb 100644
--- a/pdf/pdf_field.c
+++ b/pdf/pdf_field.c
@@ -35,23 +35,23 @@ int pdf_field_type(pdf_document *doc, pdf_obj *obj)
if (!strcmp(type, "Btn"))
{
if (flags & Ff_Pushbutton)
- return FZ_WIDGET_TYPE_PUSHBUTTON;
+ return PDF_WIDGET_TYPE_PUSHBUTTON;
else if (flags & Ff_Radio)
- return FZ_WIDGET_TYPE_RADIOBUTTON;
+ return PDF_WIDGET_TYPE_RADIOBUTTON;
else
- return FZ_WIDGET_TYPE_CHECKBOX;
+ return PDF_WIDGET_TYPE_CHECKBOX;
}
else if (!strcmp(type, "Tx"))
- return FZ_WIDGET_TYPE_TEXT;
+ return PDF_WIDGET_TYPE_TEXT;
else if (!strcmp(type, "Ch"))
{
if (flags & Ff_Combo)
- return FZ_WIDGET_TYPE_COMBOBOX;
+ return PDF_WIDGET_TYPE_COMBOBOX;
else
- return FZ_WIDGET_TYPE_LISTBOX;
+ return PDF_WIDGET_TYPE_LISTBOX;
}
else if (!strcmp(type, "Sig"))
- return FZ_WIDGET_TYPE_SIGNATURE;
+ return PDF_WIDGET_TYPE_SIGNATURE;
else
- return FZ_WIDGET_TYPE_NOT_WIDGET;
+ return PDF_WIDGET_TYPE_NOT_WIDGET;
}
diff --git a/pdf/pdf_form.c b/pdf/pdf_form.c
index d91aed19..37413caf 100644
--- a/pdf/pdf_form.c
+++ b/pdf/pdf_form.c
@@ -1497,8 +1497,8 @@ static void reset_field(pdf_document *doc, pdf_obj *field)
* the appearance stream will be regenerated. */
switch (pdf_field_type(doc, field))
{
- case FZ_WIDGET_TYPE_RADIOBUTTON:
- case FZ_WIDGET_TYPE_CHECKBOX:
+ case PDF_WIDGET_TYPE_RADIOBUTTON:
+ case PDF_WIDGET_TYPE_CHECKBOX:
{
pdf_obj *leafv = pdf_get_inheritable(doc, field, "V");
@@ -1522,7 +1522,7 @@ static void reset_field(pdf_document *doc, pdf_obj *field)
}
break;
- case FZ_WIDGET_TYPE_PUSHBUTTON:
+ case PDF_WIDGET_TYPE_PUSHBUTTON:
break;
default:
@@ -1768,7 +1768,7 @@ void pdf_update_appearance(pdf_document *doc, pdf_obj *obj)
case FZ_ANNOT_WIDGET:
switch (pdf_field_type(doc, obj))
{
- case FZ_WIDGET_TYPE_TEXT:
+ case PDF_WIDGET_TYPE_TEXT:
{
pdf_obj *formatting = pdf_dict_getp(obj, "AA/F");
if (formatting && doc->js)
@@ -1790,11 +1790,11 @@ void pdf_update_appearance(pdf_document *doc, pdf_obj *obj)
}
}
break;
- case FZ_WIDGET_TYPE_PUSHBUTTON:
+ case PDF_WIDGET_TYPE_PUSHBUTTON:
update_pushbutton_appearance(doc, obj);
break;
- case FZ_WIDGET_TYPE_LISTBOX:
- case FZ_WIDGET_TYPE_COMBOBOX:
+ case PDF_WIDGET_TYPE_LISTBOX:
+ case PDF_WIDGET_TYPE_COMBOBOX:
/* Treating listbox and combobox identically for now,
* and the behaviour is most appropriate for a combobox */
update_combobox_appearance(doc, obj);
@@ -2057,7 +2057,7 @@ int pdf_has_unsaved_changes(pdf_document *doc)
return doc->dirty;
}
-int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event)
+int pdf_pass_event(pdf_document *doc, pdf_page *page, pdf_ui_event *ui_event)
{
pdf_annot *annot;
pdf_hotspot *hp = &doc->hotspot;
@@ -2081,11 +2081,11 @@ int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event)
switch (ui_event->etype)
{
- case FZ_EVENT_TYPE_POINTER:
+ case PDF_EVENT_TYPE_POINTER:
{
switch (ui_event->event.pointer.ptype)
{
- case FZ_POINTER_DOWN:
+ case PDF_POINTER_DOWN:
if (doc->focus_obj)
{
/* Execute the blur action */
@@ -2110,7 +2110,7 @@ int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event)
}
break;
- case FZ_POINTER_UP:
+ case PDF_POINTER_UP:
if (hp->state != 0)
changed = 1;
@@ -2122,8 +2122,8 @@ int pdf_pass_event(pdf_document *doc, pdf_page *page, fz_ui_event *ui_event)
{
switch (annot->widget_type)
{
- case FZ_WIDGET_TYPE_RADIOBUTTON:
- case FZ_WIDGET_TYPE_CHECKBOX:
+ case PDF_WIDGET_TYPE_RADIOBUTTON:
+ case PDF_WIDGET_TYPE_CHECKBOX:
/* FIXME: treating radio buttons like check boxes, for now */
toggle_check_box(doc, annot->obj);
changed = 1;
@@ -2217,35 +2217,35 @@ pdf_annot *pdf_poll_changed_annot(pdf_document *idoc, pdf_page *page)
return annot;
}
-fz_widget *pdf_focused_widget(pdf_document *doc)
+pdf_widget *pdf_focused_widget(pdf_document *doc)
{
- return (fz_widget *)doc->focus;
+ return (pdf_widget *)doc->focus;
}
-fz_widget *pdf_first_widget(pdf_document *doc, pdf_page *page)
+pdf_widget *pdf_first_widget(pdf_document *doc, pdf_page *page)
{
pdf_annot *annot = page->annots;
- while (annot && annot->widget_type == FZ_WIDGET_TYPE_NOT_WIDGET)
+ while (annot && annot->widget_type == PDF_WIDGET_TYPE_NOT_WIDGET)
annot = annot->next;
- return (fz_widget *)annot;
+ return (pdf_widget *)annot;
}
-fz_widget *pdf_next_widget(fz_widget *previous)
+pdf_widget *pdf_next_widget(pdf_widget *previous)
{
pdf_annot *annot = (pdf_annot *)previous;
if (annot)
annot = annot->next;
- while (annot && annot->widget_type == FZ_WIDGET_TYPE_NOT_WIDGET)
+ while (annot && annot->widget_type == PDF_WIDGET_TYPE_NOT_WIDGET)
annot = annot->next;
- return (fz_widget *)annot;
+ return (pdf_widget *)annot;
}
-int fz_widget_get_type(fz_widget *widget)
+int pdf_widget_get_type(pdf_widget *widget)
{
pdf_annot *annot = (pdf_annot *)widget;
return annot->widget_type;
@@ -2332,12 +2332,12 @@ int pdf_field_set_value(pdf_document *doc, pdf_obj *field, char *text)
switch (pdf_field_type(doc, field))
{
- case FZ_WIDGET_TYPE_TEXT:
+ case PDF_WIDGET_TYPE_TEXT:
res = set_text_field_value(doc, field, text);
break;
- case FZ_WIDGET_TYPE_CHECKBOX:
- case FZ_WIDGET_TYPE_RADIOBUTTON:
+ case PDF_WIDGET_TYPE_CHECKBOX:
+ case PDF_WIDGET_TYPE_RADIOBUTTON:
res = set_checkbox_value(doc, field, text);
break;
@@ -2409,7 +2409,7 @@ void pdf_field_set_button_caption(pdf_document *doc, pdf_obj *field, char *text)
fz_try(ctx);
{
- if (pdf_field_type(doc, field) == FZ_WIDGET_TYPE_PUSHBUTTON)
+ if (pdf_field_type(doc, field) == PDF_WIDGET_TYPE_PUSHBUTTON)
{
pdf_dict_putp(field, "MK/CA", val);
pdf_field_mark_dirty(ctx, field);
@@ -2607,7 +2607,7 @@ void pdf_field_set_text_color(pdf_document *doc, pdf_obj *field, pdf_obj *col)
}
}
-fz_rect *fz_bound_widget(fz_widget *widget, fz_rect *rect)
+fz_rect *pdf_bound_widget(pdf_widget *widget, fz_rect *rect)
{
pdf_annot *annot = (pdf_annot *)widget;
@@ -2618,7 +2618,7 @@ fz_rect *fz_bound_widget(fz_widget *widget, fz_rect *rect)
return rect;
}
-char *pdf_text_widget_text(pdf_document *doc, fz_widget *tw)
+char *pdf_text_widget_text(pdf_document *doc, pdf_widget *tw)
{
pdf_annot *annot = (pdf_annot *)tw;
fz_context *ctx = doc->ctx;
@@ -2637,19 +2637,19 @@ char *pdf_text_widget_text(pdf_document *doc, fz_widget *tw)
return text;
}
-int pdf_text_widget_max_len(pdf_document *doc, fz_widget *tw)
+int pdf_text_widget_max_len(pdf_document *doc, pdf_widget *tw)
{
pdf_annot *annot = (pdf_annot *)tw;
return pdf_to_int(pdf_get_inheritable(doc, annot->obj, "MaxLen"));
}
-int pdf_text_widget_content_type(pdf_document *doc, fz_widget *tw)
+int pdf_text_widget_content_type(pdf_document *doc, pdf_widget *tw)
{
pdf_annot *annot = (pdf_annot *)tw;
fz_context *ctx = doc->ctx;
char *code = NULL;
- int type = FZ_WIDGET_CONTENT_UNRESTRAINED;
+ int type = PDF_WIDGET_CONTENT_UNRESTRAINED;
fz_var(code);
fz_try(ctx)
@@ -2658,13 +2658,13 @@ int pdf_text_widget_content_type(pdf_document *doc, fz_widget *tw)
if (code)
{
if (strstr(code, "AFNumber_Format"))
- type = FZ_WIDGET_CONTENT_NUMBER;
+ type = PDF_WIDGET_CONTENT_NUMBER;
else if (strstr(code, "AFSpecial_Format"))
- type = FZ_WIDGET_CONTENT_SPECIAL;
+ type = PDF_WIDGET_CONTENT_SPECIAL;
else if (strstr(code, "AFDate_FormatEx"))
- type = FZ_WIDGET_CONTENT_DATE;
+ type = PDF_WIDGET_CONTENT_DATE;
else if (strstr(code, "AFTime_FormatEx"))
- type = FZ_WIDGET_CONTENT_TIME;
+ type = PDF_WIDGET_CONTENT_TIME;
}
}
fz_always(ctx)
@@ -2701,7 +2701,7 @@ static int run_keystroke(pdf_document *doc, pdf_obj *field, char **text)
return 1;
}
-int pdf_text_widget_set_text(pdf_document *doc, fz_widget *tw, char *text)
+int pdf_text_widget_set_text(pdf_document *doc, pdf_widget *tw, char *text)
{
pdf_annot *annot = (pdf_annot *)tw;
fz_context *ctx = doc->ctx;
@@ -2721,7 +2721,7 @@ int pdf_text_widget_set_text(pdf_document *doc, fz_widget *tw, char *text)
return accepted;
}
-int pdf_choice_widget_options(pdf_document *doc, fz_widget *tw, char *opts[])
+int pdf_choice_widget_options(pdf_document *doc, pdf_widget *tw, char *opts[])
{
pdf_annot *annot = (pdf_annot *)tw;
pdf_obj *optarr;
@@ -2744,7 +2744,7 @@ int pdf_choice_widget_options(pdf_document *doc, fz_widget *tw, char *opts[])
return n;
}
-int pdf_choice_widget_is_multiselect(pdf_document *doc, fz_widget *tw)
+int pdf_choice_widget_is_multiselect(pdf_document *doc, pdf_widget *tw)
{
pdf_annot *annot = (pdf_annot *)tw;
@@ -2752,15 +2752,15 @@ int pdf_choice_widget_is_multiselect(pdf_document *doc, fz_widget *tw)
switch (pdf_field_type(doc, annot->obj))
{
- case FZ_WIDGET_TYPE_LISTBOX:
- case FZ_WIDGET_TYPE_COMBOBOX:
+ case PDF_WIDGET_TYPE_LISTBOX:
+ case PDF_WIDGET_TYPE_COMBOBOX:
return (pdf_get_field_flags(doc, annot->obj) & Ff_MultiSelect) != 0;
default:
return 0;
}
}
-int pdf_choice_widget_value(pdf_document *doc, fz_widget *tw, char *opts[])
+int pdf_choice_widget_value(pdf_document *doc, pdf_widget *tw, char *opts[])
{
pdf_annot *annot = (pdf_annot *)tw;
pdf_obj *optarr;
@@ -2799,7 +2799,7 @@ int pdf_choice_widget_value(pdf_document *doc, fz_widget *tw, char *opts[])
}
}
-void pdf_choice_widget_set_value(pdf_document *doc, fz_widget *tw, int n, char *opts[])
+void pdf_choice_widget_set_value(pdf_document *doc, pdf_widget *tw, int n, char *opts[])
{
fz_context *ctx = doc->ctx;
pdf_annot *annot = (pdf_annot *)tw;
@@ -2849,7 +2849,7 @@ void pdf_choice_widget_set_value(pdf_document *doc, fz_widget *tw, int n, char *
}
}
-int pdf_signature_widget_byte_range(pdf_document *doc, fz_widget *widget, int (*byte_range)[2])
+int pdf_signature_widget_byte_range(pdf_document *doc, pdf_widget *widget, int (*byte_range)[2])
{
pdf_annot *annot = (pdf_annot *)widget;
pdf_obj *br = pdf_dict_getp(annot->obj, "V/ByteRange");
@@ -2867,7 +2867,7 @@ int pdf_signature_widget_byte_range(pdf_document *doc, fz_widget *widget, int (*
return n;
}
-int pdf_signature_widget_contents(pdf_document *doc, fz_widget *widget, char **contents)
+int pdf_signature_widget_contents(pdf_document *doc, pdf_widget *widget, char **contents)
{
pdf_annot *annot = (pdf_annot *)widget;
pdf_obj *c = pdf_dict_getp(annot->obj, "V/Contents");
diff --git a/pdf/pdf_js.c b/pdf/pdf_js.c
index 266bc1c7..cbaf9081 100644
--- a/pdf/pdf_js.c
+++ b/pdf/pdf_js.c
@@ -22,15 +22,15 @@ static pdf_jsimp_obj *app_alert(void *jsctx, void *obj, int argc, pdf_jsimp_obj
pdf_jsimp_obj *nType_obj = NULL;
pdf_jsimp_obj *cTitle_obj = NULL;
pdf_jsimp_obj *nButton_obj = NULL;
- fz_alert_event event;
+ pdf_alert_event event;
int arg_is_obj = 0;
if (argc < 1 || argc > 6)
return NULL;
event.message = "";
- event.icon_type = FZ_ALERT_ICON_ERROR;
- event.button_group_type = FZ_ALERT_BUTTON_GROUP_OK;
+ event.icon_type = PDF_ALERT_ICON_ERROR;
+ event.button_group_type = PDF_ALERT_BUTTON_GROUP_OK;
event.title = "MuPDF";
event.check_box_message = NULL;
event.button_pressed = 0;
@@ -617,7 +617,7 @@ static pdf_jsimp_obj *doc_mailDoc(void *jsctx, void *obj, int argc, pdf_jsimp_ob
pdf_jsimp_obj *cBcc_obj = NULL;
pdf_jsimp_obj *cSubject_obj = NULL;
pdf_jsimp_obj *cMessage_obj = NULL;
- fz_mail_doc_event event;
+ pdf_mail_doc_event event;
int arg_is_obj = 0;
if (argc < 1 || argc > 6)
diff --git a/pdf/pdf_xref.c b/pdf/pdf_xref.c
index 14b8ee5b..92f93352 100644
--- a/pdf/pdf_xref.c
+++ b/pdf/pdf_xref.c
@@ -1468,12 +1468,6 @@ pdf_page_presentation(pdf_document *doc, pdf_page *page, float *duration)
return &page->transition;
}
-static fz_interactive *
-pdf_interact(pdf_document *doc)
-{
- return (fz_interactive *)doc;
-}
-
/*
Initializers for the fz_document interface.
@@ -1505,7 +1499,6 @@ pdf_new_document(fz_context *ctx, fz_stream *file)
doc->super.free_page = (void*)pdf_free_page;
doc->super.meta = (void*)pdf_meta;
doc->super.page_presentation = (void*)pdf_page_presentation;
- doc->super.interact = (void*)pdf_interact;
doc->super.write = (void*)pdf_write_document;
pdf_lexbuf_init(ctx, &doc->lexbuf.base, PDF_LEXBUF_LARGE);
@@ -1547,3 +1540,8 @@ pdf_open_document_no_run(fz_context *ctx, const char *filename)
}
return doc;
}
+
+pdf_document *pdf_specifics(fz_document *doc)
+{
+ return (pdf_document *)(doc->close == (void *)pdf_close_document ? doc : NULL);
+}
diff --git a/win32/libmupdf.vcproj b/win32/libmupdf.vcproj
index ea39bb26..016e345f 100644
--- a/win32/libmupdf.vcproj
+++ b/win32/libmupdf.vcproj
@@ -449,10 +449,6 @@
>
</File>
<File
- RelativePath="..\fitz\doc_interactive.c"
- >
- </File>
- <File
RelativePath="..\fitz\doc_link.c"
>
</File>
diff --git a/winrt/libmupdf_winRT.vcxproj b/winrt/libmupdf_winRT.vcxproj
index 5e3bf2bb..02147b9f 100644
--- a/winrt/libmupdf_winRT.vcxproj
+++ b/winrt/libmupdf_winRT.vcxproj
@@ -69,7 +69,6 @@
<ClCompile Include="..\fitz\dev_null.c" />
<ClCompile Include="..\fitz\dev_trace.c" />
<ClCompile Include="..\fitz\doc_document.c" />
- <ClCompile Include="..\fitz\doc_interactive.c" />
<ClCompile Include="..\fitz\doc_link.c" />
<ClCompile Include="..\fitz\doc_outline.c" />
<ClCompile Include="..\fitz\filt_basic.c" />
diff --git a/winrt/libmupdf_winRT.vcxproj.filters b/winrt/libmupdf_winRT.vcxproj.filters
index 0224d33a..109c2c0c 100644
--- a/winrt/libmupdf_winRT.vcxproj.filters
+++ b/winrt/libmupdf_winRT.vcxproj.filters
@@ -114,9 +114,6 @@
<ClCompile Include="..\fitz\doc_document.c">
<Filter>fitz</Filter>
</ClCompile>
- <ClCompile Include="..\fitz\doc_interactive.c">
- <Filter>fitz</Filter>
- </ClCompile>
<ClCompile Include="..\fitz\doc_link.c">
<Filter>fitz</Filter>
</ClCompile>