#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include <stdint.h>
#include <memory>
#include <utility>
#include <vector>
#include "core/fpdfapi/page/cpdf_annotcontext.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfdoc/cpdf_nametree.h"
#include "core/fxcrt/check.h"
#include "core/fxcrt/containers/contains.h"
#include "core/fxcrt/data_vector.h"
#include "core/fxcrt/notreached.h"
#include "core/fxcrt/numerics/safe_conversions.h"
#include "core/fxcrt/stl_util.h"
#include "fpdfsdk/cpdfsdk_helpers.h"
#include "fpdfsdk/cpdfsdk_interactiveform.h"
#include "fpdfsdk/cpdfsdk_pageview.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cffl_formfield.h"
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fxjs/ijs_event_context.h"
#include "fxjs/ijs_runtime.h"
#ifdef PDF_ENABLE_XFA
#include "fpdfsdk/fpdfxfa/cpdfxfa_widget.h"
#endif
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
static_assert …;
FPDF_WIDESTRING AsFPDFWideString(ByteString* bsUTF16LE) { … }
CPDFSDK_FormFillEnvironment::CPDFSDK_FormFillEnvironment(
CPDF_Document* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
: … { … }
CPDFSDK_FormFillEnvironment::~CPDFSDK_FormFillEnvironment() { … }
void CPDFSDK_FormFillEnvironment::InvalidateRect(CPDFSDK_Widget* widget,
const CFX_FloatRect& rect) { … }
void CPDFSDK_FormFillEnvironment::OutputSelectedRect(
CFFL_FormField* pFormField,
const CFX_FloatRect& rect) { … }
bool CPDFSDK_FormFillEnvironment::IsSelectionImplemented() const { … }
#ifdef PDF_ENABLE_V8
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetCurrentView() { … }
IPDF_Page* CPDFSDK_FormFillEnvironment::GetCurrentPage() const { … }
WideString CPDFSDK_FormFillEnvironment::GetLanguage() { … }
WideString CPDFSDK_FormFillEnvironment::GetPlatform() { … }
int CPDFSDK_FormFillEnvironment::JS_appAlert(const WideString& Msg,
const WideString& Title,
int Type,
int Icon) { … }
int CPDFSDK_FormFillEnvironment::JS_appResponse(
const WideString& Question,
const WideString& Title,
const WideString& Default,
const WideString& Label,
FPDF_BOOL bPassword,
pdfium::span<uint8_t> response) { … }
void CPDFSDK_FormFillEnvironment::JS_appBeep(int nType) { … }
WideString CPDFSDK_FormFillEnvironment::JS_fieldBrowse() { … }
void CPDFSDK_FormFillEnvironment::JS_docmailForm(
pdfium::span<const uint8_t> mailData,
FPDF_BOOL bUI,
const WideString& To,
const WideString& Subject,
const WideString& CC,
const WideString& BCC,
const WideString& Msg) { … }
void CPDFSDK_FormFillEnvironment::JS_docprint(FPDF_BOOL bUI,
int nStart,
int nEnd,
FPDF_BOOL bSilent,
FPDF_BOOL bShrinkToFit,
FPDF_BOOL bPrintAsImage,
FPDF_BOOL bReverse,
FPDF_BOOL bAnnotations) { … }
void CPDFSDK_FormFillEnvironment::JS_docgotoPage(int nPageNum) { … }
WideString CPDFSDK_FormFillEnvironment::JS_docGetFilePath() { … }
#endif
WideString CPDFSDK_FormFillEnvironment::GetFilePath() const { … }
void CPDFSDK_FormFillEnvironment::SubmitForm(
pdfium::span<const uint8_t> form_data,
const WideString& URL) { … }
IJS_Runtime* CPDFSDK_FormFillEnvironment::GetIJSRuntime() { … }
void CPDFSDK_FormFillEnvironment::Invalidate(IPDF_Page* page,
const FX_RECT& rect) { … }
void CPDFSDK_FormFillEnvironment::SetCursor(
IPWL_FillerNotify::CursorStyle nCursorType) { … }
int CPDFSDK_FormFillEnvironment::SetTimer(int uElapse,
TimerCallback lpTimerFunc) { … }
void CPDFSDK_FormFillEnvironment::KillTimer(int nTimerID) { … }
void CPDFSDK_FormFillEnvironment::OnChange() { … }
void CPDFSDK_FormFillEnvironment::ExecuteNamedAction(
const ByteString& namedAction) { … }
void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocus(const WideString& text) { … }
void CPDFSDK_FormFillEnvironment::OnSetFieldInputFocusInternal(
const WideString& text,
bool bFocus) { … }
void CPDFSDK_FormFillEnvironment::OnCalculate(
ObservedPtr<CPDFSDK_Annot>& pAnnot) { … }
void CPDFSDK_FormFillEnvironment::OnFormat(ObservedPtr<CPDFSDK_Annot>& pAnnot) { … }
void CPDFSDK_FormFillEnvironment::DoURIAction(const ByteString& bsURI,
Mask<FWL_EVENTFLAG> modifiers) { … }
void CPDFSDK_FormFillEnvironment::DoGoToAction(int nPageIndex,
int zoomMode,
pdfium::span<float> fPosArray) { … }
#ifdef PDF_ENABLE_XFA
int CPDFSDK_FormFillEnvironment::GetPageViewCount() const { … }
void CPDFSDK_FormFillEnvironment::DisplayCaret(IPDF_Page* page,
FPDF_BOOL bVisible,
double left,
double top,
double right,
double bottom) { … }
int CPDFSDK_FormFillEnvironment::GetCurrentPageIndex() const { … }
void CPDFSDK_FormFillEnvironment::SetCurrentPage(int iCurPage) { … }
void CPDFSDK_FormFillEnvironment::GotoURL(const WideString& wsURL) { … }
FS_RECTF CPDFSDK_FormFillEnvironment::GetPageViewRect(IPDF_Page* page) { … }
bool CPDFSDK_FormFillEnvironment::PopupMenu(IPDF_Page* page,
int menuFlag,
const CFX_PointF& pt) { … }
void CPDFSDK_FormFillEnvironment::EmailTo(FPDF_FILEHANDLER* fileHandler,
FPDF_WIDESTRING pTo,
FPDF_WIDESTRING pSubject,
FPDF_WIDESTRING pCC,
FPDF_WIDESTRING pBcc,
FPDF_WIDESTRING pMsg) { … }
void CPDFSDK_FormFillEnvironment::UploadTo(FPDF_FILEHANDLER* fileHandler,
int fileFlag,
FPDF_WIDESTRING uploadTo) { … }
FPDF_FILEHANDLER* CPDFSDK_FormFillEnvironment::OpenFile(int fileType,
FPDF_WIDESTRING wsURL,
const char* mode) { … }
RetainPtr<IFX_SeekableReadStream> CPDFSDK_FormFillEnvironment::DownloadFromURL(
const WideString& url) { … }
WideString CPDFSDK_FormFillEnvironment::PostRequestURL(
const WideString& wsURL,
const WideString& wsData,
const WideString& wsContentType,
const WideString& wsEncode,
const WideString& wsHeader) { … }
FPDF_BOOL CPDFSDK_FormFillEnvironment::PutRequestURL(
const WideString& wsURL,
const WideString& wsData,
const WideString& wsEncode) { … }
void CPDFSDK_FormFillEnvironment::PageEvent(int iPageCount,
uint32_t dwEventType) const { … }
#endif
void CPDFSDK_FormFillEnvironment::ClearAllFocusedAnnots() { … }
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetOrCreatePageView(
IPDF_Page* pUnderlyingPage) { … }
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(
IPDF_Page* pUnderlyingPage) { … }
CFX_Timer::HandlerIface* CPDFSDK_FormFillEnvironment::GetTimerHandler() { … }
CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageViewAtIndex(int nIndex) { … }
void CPDFSDK_FormFillEnvironment::ProcJavascriptAction() { … }
bool CPDFSDK_FormFillEnvironment::ProcOpenAction() { … }
void CPDFSDK_FormFillEnvironment::RemovePageView(IPDF_Page* pUnderlyingPage) { … }
IPDF_Page* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) const { … }
CPDFSDK_InteractiveForm* CPDFSDK_FormFillEnvironment::GetInteractiveForm() { … }
void CPDFSDK_FormFillEnvironment::UpdateAllViews(CPDFSDK_Annot* pAnnot) { … }
CPDFSDK_Annot* CPDFSDK_FormFillEnvironment::GetFocusAnnot() const { … }
bool CPDFSDK_FormFillEnvironment::SetFocusAnnot(
ObservedPtr<CPDFSDK_Annot>& pAnnot) { … }
bool CPDFSDK_FormFillEnvironment::KillFocusAnnot(Mask<FWL_EVENTFLAG> nFlags) { … }
int CPDFSDK_FormFillEnvironment::GetPageCount() const { … }
bool CPDFSDK_FormFillEnvironment::HasPermissions(uint32_t flags) const { … }
void CPDFSDK_FormFillEnvironment::SendOnFocusChange(
ObservedPtr<CPDFSDK_Annot>& pAnnot) { … }
bool CPDFSDK_FormFillEnvironment::DoActionDocOpen(const CPDF_Action& action) { … }
bool CPDFSDK_FormFillEnvironment::DoActionJavaScript(
const CPDF_Action& JsAction,
WideString csJSName) { … }
bool CPDFSDK_FormFillEnvironment::DoActionFieldJavaScript(
const CPDF_Action& JsAction,
CPDF_AAction::AActionType type,
CPDF_FormField* pFormField,
CFFL_FieldAction* data) { … }
bool CPDFSDK_FormFillEnvironment::DoActionLink(const CPDF_Action& action,
CPDF_AAction::AActionType type,
Mask<FWL_EVENTFLAG> modifiers) { … }
bool CPDFSDK_FormFillEnvironment::DoActionDestination(const CPDF_Dest& dest) { … }
bool CPDFSDK_FormFillEnvironment::DoActionPage(
const CPDF_Action& action,
CPDF_AAction::AActionType eType) { … }
bool CPDFSDK_FormFillEnvironment::DoActionDocument(
const CPDF_Action& action,
CPDF_AAction::AActionType eType) { … }
bool CPDFSDK_FormFillEnvironment::DoActionField(const CPDF_Action& action,
CPDF_AAction::AActionType type,
CPDF_FormField* pFormField,
CFFL_FieldAction* data) { … }
bool CPDFSDK_FormFillEnvironment::ExecuteDocumentOpenAction(
const CPDF_Action& action,
std::set<const CPDF_Dictionary*>* visited) { … }
bool CPDFSDK_FormFillEnvironment::ExecuteDocumentPageAction(
const CPDF_Action& action,
CPDF_AAction::AActionType type,
std::set<const CPDF_Dictionary*>* visited) { … }
bool CPDFSDK_FormFillEnvironment::IsValidField(
const CPDF_Dictionary* pFieldDict) { … }
bool CPDFSDK_FormFillEnvironment::ExecuteFieldAction(
const CPDF_Action& action,
CPDF_AAction::AActionType type,
CPDF_FormField* pFormField,
CFFL_FieldAction* data,
std::set<const CPDF_Dictionary*>* visited) { … }
void CPDFSDK_FormFillEnvironment::DoActionNoJs(const CPDF_Action& action,
CPDF_AAction::AActionType type) { … }
void CPDFSDK_FormFillEnvironment::DoActionGoTo(const CPDF_Action& action) { … }
void CPDFSDK_FormFillEnvironment::DoActionURI(const CPDF_Action& action,
Mask<FWL_EVENTFLAG> modifiers) { … }
void CPDFSDK_FormFillEnvironment::DoActionNamed(const CPDF_Action& action) { … }
void CPDFSDK_FormFillEnvironment::RunFieldJavaScript(
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
CFFL_FieldAction* data,
const WideString& script) { … }
void CPDFSDK_FormFillEnvironment::RunDocumentOpenJavaScript(
const WideString& sScriptName,
const WideString& script) { … }
void CPDFSDK_FormFillEnvironment::RunDocumentPageJavaScript(
CPDF_AAction::AActionType type,
const WideString& script) { … }
bool CPDFSDK_FormFillEnvironment::DoActionHide(const CPDF_Action& action) { … }
bool CPDFSDK_FormFillEnvironment::DoActionSubmitForm(
const CPDF_Action& action) { … }
void CPDFSDK_FormFillEnvironment::DoActionResetForm(const CPDF_Action& action) { … }
void CPDFSDK_FormFillEnvironment::RunScript(const WideString& script,
const RunScriptCallback& cb) { … }