7#ifndef FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_
8#define FPDFSDK_CPDFSDK_FORMFILLENVIRONMENT_H_
18#include "core/fpdfapi/page/cpdf_occontext.h"
19#include "core/fpdfapi/parser/cpdf_document.h"
20#include "core/fpdfdoc/cpdf_aaction.h"
21#include "core/fxcrt/cfx_timer.h"
22#include "core/fxcrt/mask.h"
23#include "core/fxcrt/observed_ptr.h"
24#include "core/fxcrt/retain_ptr.h"
25#include "core/fxcrt/unowned_ptr.h"
26#include "fpdfsdk/cpdfsdk_annot.h"
27#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
28#include "fpdfsdk/pwl/cpwl_wnd.h"
29#include "fpdfsdk/pwl/ipwl_fillernotify.h"
30#include "public/fpdf_formfill.h"
31#include "third_party/base/containers/span.h"
35class CPDFSDK_InteractiveForm;
36class CPDFSDK_PageView;
57class CPDFSDK_FormFillEnvironment
final
66 int32_t
SetTimer(int32_t uElapse, TimerCallback lpTimerFunc)
override;
67 void KillTimer(int32_t nTimerID)
override;
105 void DoURIAction(
const ByteString& bsURI,
Mask<FWL_EVENTFLAG> modifiers);
108 pdfium::span<
float> fPosArray);
112 return m_pCPDFDoc->GetExtension();
117 return m_pInfo ? m_pInfo->m_pJsPlatform :
nullptr;
136 Mask<FWL_EVENTFLAG> modifiers);
148 CPDFSDK_PageView* GetCurrentView();
149 IPDF_Page* GetCurrentPage()
const;
151 WideString GetLanguage();
152 WideString GetPlatform();
154 int JS_appAlert(
const WideString& Msg,
155 const WideString& Title,
158 int JS_appResponse(
const WideString& Question,
159 const WideString& Title,
160 const WideString& Default,
161 const WideString& cLabel,
163 pdfium::span<uint8_t> response);
164 void JS_appBeep(
int nType);
165 WideString JS_fieldBrowse();
166 void JS_docmailForm(pdfium::span<
const uint8_t> mailData,
168 const WideString& To,
169 const WideString& Subject,
170 const WideString& CC,
171 const WideString& BCC,
172 const WideString& Msg);
173 void JS_docprint(FPDF_BOOL bUI,
177 FPDF_BOOL bShrinkToFit,
178 FPDF_BOOL bPrintAsImage,
180 FPDF_BOOL bAnnotations);
181 void JS_docgotoPage(
int nPageNum);
182 WideString JS_docGetFilePath();
185 int GetPageViewCount()
const;
186 void DisplayCaret(IPDF_Page* page,
192 int GetCurrentPageIndex()
const;
193 void SetCurrentPage(
int iCurPage);
196 WideString FFI_GetAppName()
const {
return WideString(L"Acrobat"); }
198 void GotoURL(
const WideString& wsURL);
199 FS_RECTF GetPageViewRect(IPDF_Page* page);
200 bool PopupMenu(IPDF_Page* page,
int menuFlag,
const CFX_PointF& pt);
201 void EmailTo(FPDF_FILEHANDLER* fileHandler,
203 FPDF_WIDESTRING pSubject,
205 FPDF_WIDESTRING pBcc,
206 FPDF_WIDESTRING pMsg);
207 void UploadTo(FPDF_FILEHANDLER* fileHandler,
209 FPDF_WIDESTRING uploadTo);
210 FPDF_FILEHANDLER* OpenFile(
int fileType,
211 FPDF_WIDESTRING wsURL,
213 RetainPtr<IFX_SeekableReadStream> DownloadFromURL(
const WideString& url);
214 WideString PostRequestURL(
const WideString& wsURL,
215 const WideString& wsData,
216 const WideString& wsContentType,
217 const WideString& wsEncode,
218 const WideString& wsHeader);
219 FPDF_BOOL PutRequestURL(
const WideString& wsURL,
220 const WideString& wsData,
221 const WideString& wsEncode);
223 void PageEvent(
int iPageCount, uint32_t dwEventType)
const;
230 void SubmitForm(pdfium::span<
const uint8_t> form_data,
const WideString& URL);
233 const std::vector<CPDF_Annot::Subtype>& focusableAnnotTypes) {
234 m_FocusableAnnotTypes = focusableAnnotTypes;
237 return m_FocusableAnnotTypes;
242 return m_pInteractiveFormFiller.get();
252 void OnSetFieldInputFocusInternal(
const WideString& text,
bool bFocus);
256 void RunScript(
const WideString& script,
const RunScriptCallback& cb);
257 bool ExecuteDocumentOpenAction(
const CPDF_Action& action,
258 std::set<
const CPDF_Dictionary*>* visited);
259 bool ExecuteDocumentPageAction(
const CPDF_Action& action,
261 std::set<
const CPDF_Dictionary*>* visited);
266 std::set<
const CPDF_Dictionary*>* visited);
268 const WideString& script);
269 void RunDocumentOpenJavaScript(
const WideString& sScriptName,
270 const WideString& script);
274 const WideString& script);
275 bool IsValidField(
const CPDF_Dictionary* pFieldDict);
278 std::unique_ptr<IJS_Runtime> m_pIJSRuntime;
281 std::map<IPDF_Page*, std::unique_ptr<CPDFSDK_PageView>> m_PageMap;
283 std::unique_ptr<CPDFSDK_InteractiveForm> m_pInteractiveForm;
286 std::unique_ptr<CFFL_InteractiveFormFiller> m_pInteractiveFormFiller;
287 bool m_bChangeMask =
false;
288 bool m_bBeingDestroyed =
false;
292 std::vector<CPDF_Annot::Subtype> m_FocusableAnnotTypes = {
293 CPDF_Annot::Subtype::WIDGET};
constexpr CFX_FloatRect(float l, float b, float r, float t)
CPDFSDK_Annot * GetFirstAnnot()
CPDFSDK_Annot * GetLastAnnot()
CPDFSDK_Annot * GetNextAnnot(CPDFSDK_Annot *pAnnot)
CPDFSDK_Annot * GetPrevAnnot(CPDFSDK_Annot *pAnnot)
virtual CFX_FloatRect GetRect() const =0
TEST_F(CPDFSDK_AnnotIteratorTest, CPDFSDK_AnnotIterator)