#include "public/fpdf_formfill.h"
#include <memory>
#include <utility>
#include "constants/form_fields.h"
#include "core/fpdfapi/page/cpdf_annotcontext.h"
#include "core/fpdfapi/page/cpdf_occontext.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/render/cpdf_renderoptions.h"
#include "core/fpdfdoc/cpdf_formcontrol.h"
#include "core/fpdfdoc/cpdf_formfield.h"
#include "core/fpdfdoc/cpdf_interactiveform.h"
#include "core/fxge/cfx_defaultrenderdevice.h"
#include "core/fxge/dib/cfx_dibitmap.h"
#include "fpdfsdk/cpdfsdk_annot.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
#include "fpdfsdk/cpdfsdk_pageview.h"
#include "public/fpdfview.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/cpdfxfa_context.h"
#include "fpdfsdk/fpdfxfa/cpdfxfa_page.h"
#endif
#if defined(PDF_USE_SKIA)
class SkCanvas;
#endif
#ifdef PDF_ENABLE_XFA
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
#endif
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
#ifdef PDF_ENABLE_XFA
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
#endif
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
namespace {
CPDFSDK_PageView* FormHandleToPageView(FPDF_FORMHANDLE hHandle,
FPDF_PAGE fpdf_page) { … }
#if defined(PDF_USE_SKIA)
BitmapOrCanvas;
#else
using BitmapOrCanvas = absl::variant<CFX_DIBitmap*>;
#endif
void FFLCommon(FPDF_FORMHANDLE hHandle,
FPDF_PAGE fpdf_page,
BitmapOrCanvas dest,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags) { … }
bool CheckFormfillVersion(FPDF_FORMFILLINFO* formInfo) { … }
}
FPDF_EXPORT int FPDF_CALLCONV
FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
double page_x,
double page_y) { … }
FPDF_EXPORT int FPDF_CALLCONV
FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_FORMHANDLE FPDF_CALLCONV
FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document,
FPDF_FORMFILLINFO* formInfo) { … }
FPDF_EXPORT void FPDF_CALLCONV
FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnMouseMove(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_OnMouseWheel(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
const FS_POINTF* page_coord,
int delta_x,
int delta_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnFocus(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_OnLButtonDoubleClick(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int modifier,
double page_x,
double page_y) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyDown(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int nKeyCode,
int modifier) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnKeyUp(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int nKeyCode,
int modifier) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_OnChar(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int nChar,
int modifier) { … }
FPDF_EXPORT unsigned long FPDF_CALLCONV
FORM_GetFocusedText(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
void* buffer,
unsigned long buflen) { … }
FPDF_EXPORT unsigned long FPDF_CALLCONV
FORM_GetSelectedText(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
void* buffer,
unsigned long buflen) { … }
FPDF_EXPORT void FPDF_CALLCONV
FORM_ReplaceAndKeepSelection(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
FPDF_WIDESTRING wsText) { … }
FPDF_EXPORT void FPDF_CALLCONV FORM_ReplaceSelection(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
FPDF_WIDESTRING wsText) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_SelectAllText(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanUndo(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_CanRedo(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Undo(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FORM_Redo(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_GetFocusedAnnot(FPDF_FORMHANDLE handle,
int* page_index,
FPDF_ANNOTATION* annot) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_SetFocusedAnnot(FPDF_FORMHANDLE handle, FPDF_ANNOTATION annot) { … }
FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDraw(FPDF_FORMHANDLE hHandle,
FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags) { … }
#if defined(PDF_USE_SKIA)
FPDF_EXPORT void FPDF_CALLCONV FPDF_FFLDrawSkia(FPDF_FORMHANDLE hHandle,
FPDF_SKIA_CANVAS canvas,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags) { … }
#endif
FPDF_EXPORT void FPDF_CALLCONV
FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle,
int fieldType,
unsigned long color) { … }
FPDF_EXPORT void FPDF_CALLCONV
FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, unsigned char alpha) { … }
FPDF_EXPORT void FPDF_CALLCONV
FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT void FPDF_CALLCONV FORM_OnAfterLoadPage(FPDF_PAGE page,
FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT void FPDF_CALLCONV FORM_OnBeforeClosePage(FPDF_PAGE page,
FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT void FPDF_CALLCONV
FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT void FPDF_CALLCONV
FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle) { … }
FPDF_EXPORT void FPDF_CALLCONV FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
int aaType) { … }
FPDF_EXPORT void FPDF_CALLCONV FORM_DoPageAAction(FPDF_PAGE page,
FPDF_FORMHANDLE hHandle,
int aaType) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_SetIndexSelected(FPDF_FORMHANDLE hHandle,
FPDF_PAGE page,
int index,
FPDF_BOOL selected) { … }
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV
FORM_IsIndexSelected(FPDF_FORMHANDLE hHandle, FPDF_PAGE page, int index) { … }