Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cxfa_ffapp.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef XFA_FXFA_CXFA_FFAPP_H_
8#define XFA_FXFA_CXFA_FFAPP_H_
9
10#include "core/fxcrt/unowned_ptr.h"
11#include "core/fxcrt/widestring.h"
12#include "fxjs/gc/heap.h"
13#include "v8/include/cppgc/garbage-collected.h"
14#include "v8/include/cppgc/member.h"
15#include "xfa/fwl/cfwl_app.h"
16
17class CXFA_FFDoc;
18class CXFA_FWLAdapterWidgetMgr;
19class CXFA_FontMgr;
21
22namespace pdfium {
23class CXFA_FWLTheme;
24} // namespace pdfium
25
26class CXFA_FFApp final : public cppgc::GarbageCollected<CXFA_FFApp>,
27 public CFWL_App::AdapterIface {
28 public:
30 public:
31 virtual ~CallbackIface() = default;
32
33 /**
34 * Returns the language of the running host application. Such as zh_CN
35 */
36 virtual WideString GetLanguage() = 0;
37
38 /**
39 * Returns the platform of the machine running the script. Such as WIN
40 */
41 virtual WideString GetPlatform() = 0;
42
43 /**
44 * Get application name, such as Phantom.
45 */
46 virtual WideString GetAppName() = 0;
47
48 /**
49 * Get application message box title.
50 */
51 virtual WideString GetAppTitle() const = 0;
52
53 /**
54 * Causes the system to play a sound.
55 * @param[in] dwType The system code for the appropriate sound.0 (Error)1
56 * (Warning)2 (Question)3 (Status)4 (Default)
57 */
58 virtual void Beep(uint32_t dwType) = 0;
59
60 /**
61 * Displays a message box.
62 * @param[in] wsMessage - Message string to display in box.
63 * @param[in] wsTitle - Title string for box.
64 * @param[in] dwIconType - Icon type, refer to XFA_MBICON.
65 * @param[in] dwButtonType - Button type, refer to XFA_MESSAGEBUTTON.
66 * @return A valid integer representing the value of the button pressed by
67 * the user, refer to XFA_ID.
68 */
69 virtual int32_t MsgBox(const WideString& wsMessage,
70 const WideString& wsTitle,
71 uint32_t dwIconType,
72 uint32_t dwButtonType) = 0;
73
74 /**
75 * Get a response from the user.
76 * @param[in] wsQuestion - Message string to display in box.
77 * @param[in] wsTitle - Title string for box.
78 * @param[in] wsDefaultAnswer - Initial contents for answer.
79 * @param[in] bMask - Mask the user input with asterisks when
80 * true,
81 * @return A string containing the user's response.
82 */
83 virtual WideString Response(const WideString& wsQuestion,
84 const WideString& wsTitle,
85 const WideString& wsDefaultAnswer,
86 bool bMask) = 0;
87
88 /**
89 * Download something from somewhere.
90 * @param[in] wsURL - http, ftp, such as
91 * "http://www.w3.org/TR/REC-xml-names/".
92 */
94 const WideString& wsURL) = 0;
95
96 /**
97 * POST data to the given url.
98 * @param[in] wsURL the URL being uploaded.
99 * @param[in] wsData the data being uploaded.
100 * @param[in] wsContentType the content type of data including text/html,
101 * text/xml, text/plain, multipart/form-data,
102 * application/x-www-form-urlencoded,
103 * application/octet-stream, any valid MIME type.
104 * @param[in] wsEncode the encode of data including UTF-8, UTF-16,
105 * ISO8859-1, any recognized [IANA]character encoding
106 * @param[in] wsHeader any additional HTTP headers to be included in
107 * the post.
108 * @param[out] wsResponse decoded response from server.
109 * @return true Server permitted the post request, false otherwise.
110 */
111 virtual bool PostRequestURL(const WideString& wsURL,
112 const WideString& wsData,
113 const WideString& wsContentType,
114 const WideString& wsEncode,
115 const WideString& wsHeader,
116 WideString& wsResponse) = 0;
117
118 /**
119 * PUT data to the given url.
120 * @param[in] wsURL the URL being uploaded.
121 * @param[in] wsData the data being uploaded.
122 * @param[in] wsEncode the encode of data including UTF-8, UTF-16,
123 * ISO8859-1, any recognized [IANA]character encoding
124 * @return true Server permitted the post request, false otherwise.
125 */
126 virtual bool PutRequestURL(const WideString& wsURL,
127 const WideString& wsData,
128 const WideString& wsEncode) = 0;
129
131 virtual cppgc::Heap* GetGCHeap() const = 0;
132 };
133
135 ~CXFA_FFApp() override;
136
137 // CFWL_App::AdapterIface:
138 void Trace(cppgc::Visitor* visitor) const override;
139 CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() override;
142 cppgc::Heap* GetHeap() override;
143
144 bool LoadFWLTheme(CXFA_FFDoc* doc);
145 CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); }
146 CallbackIface* GetAppProvider() const { return m_pProvider; }
147 CFWL_App* GetFWLApp() const { return m_pFWLApp; }
148 CXFA_FontMgr* GetXFAFontMgr() const { return m_pXFAFontMgr; }
149
150 private:
151 explicit CXFA_FFApp(CallbackIface* pProvider);
152
153 UnownedPtr<CallbackIface> const m_pProvider;
154 cppgc::Member<CXFA_FontMgr> m_pXFAFontMgr;
155 cppgc::Member<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr;
156 cppgc::Member<pdfium::CXFA_FWLTheme> m_pFWLTheme;
157 cppgc::Member<CFWL_App> m_pFWLApp;
158};
159
160#endif // XFA_FXFA_CXFA_FFAPP_H_
void BC_Library_Init()
void BC_Library_Destroy()
#define DCHECK
Definition check.h:33
static void Destroy()
static void Create()
WideString GetPlatform() override
RetainPtr< IFX_SeekableReadStream > DownloadURL(const WideString &wsURL) override
bool PostRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsContentType, const WideString &wsEncode, const WideString &wsHeader, WideString &wsResponse) override
RetainPtr< CPDFXFA_Page > GetXFAPage(CXFA_FFPageView *pPage) const
void SetOriginalPageCount(int count)
FormType GetFormType() const
WideString GetAppTitle() const override
WideString Response(const WideString &wsQuestion, const WideString &wsTitle, const WideString &wsDefaultAnswer, bool bMark) override
bool SaveDatasetsPackage(const RetainPtr< IFX_SeekableStream > &pStream)
~CPDFXFA_Context() override
void SetFormFillEnv(CPDFSDK_FormFillEnvironment *pFormFillEnv)
bool PutRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsEncode) override
void SendPreSaveToXFADoc(std::vector< RetainPtr< IFX_SeekableStream > > *fileList)
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const
CXFA_FFDocView * GetXFADocView() const
WideString GetAppName() override
bool SaveFormPackage(const RetainPtr< IFX_SeekableStream > &pStream)
CFX_Timer::HandlerIface * GetTimerHandler() const override
CXFA_FFDoc * GetXFADoc()
void Beep(uint32_t dwType) override
bool ContainsExtensionForegroundForm() const override
CPDFXFA_Context(CPDF_Document *pPDFDoc)
uint32_t DeletePage(int page_index) override
RetainPtr< CPDFXFA_Page > GetOrCreateXFAPage(int page_index)
bool ContainsExtensionForm() const override
int GetOriginalPageCount() const
WideString GetLanguage() override
RetainPtr< CPDFXFA_Page > GetXFAPage(int page_index)
LoadStatus GetLoadStatus() const
bool ContainsExtensionFullForm() const override
int GetPageCount() const override
cppgc::Heap * GetGCHeap() const override
CFX_XMLDocument * GetXMLDoc()
int32_t MsgBox(const WideString &wsMessage, const WideString &wsTitle, uint32_t dwIconType, uint32_t dwButtonType) override
CPDF_Document * GetPDFDoc() const
CXFA_FFPageView * GetXFAPageView() const
CPDF_Document * GetDocument() const override
CFX_Matrix GetDisplayMatrix(const FX_RECT &rect, int iRotate) const override
CPDFXFA_Page * AsXFAPage() override
CPDF_Page * AsPDFPage() override
float GetPageWidth() const override
~CPDFXFA_Page() override
CPDFSDK_Annot * GetLastXFAAnnot(CPDFSDK_PageView *page_view) const
std::optional< CFX_PointF > DeviceToPage(const FX_RECT &rect, int rotate, const CFX_PointF &device_point) const override
int GetPageIndex() const
std::optional< CFX_PointF > PageToDevice(const FX_RECT &rect, int rotate, const CFX_PointF &page_point) const override
void SetXFAPageViewIndex(int index)
CPDFSDK_Annot * GetPrevXFAAnnot(CPDFSDK_Annot *pSDKAnnot) const
CPDFSDK_Annot * GetFirstXFAAnnot(CPDFSDK_PageView *page_view) const
CPDFSDK_Annot * GetNextXFAAnnot(CPDFSDK_Annot *pSDKAnnot) const
void DrawFocusAnnot(CFX_RenderDevice *pDevice, CPDFSDK_Annot *pAnnot, const CFX_Matrix &mtUser2Device, const FX_RECT &rtClip)
int HasFormFieldAtPoint(const CFX_PointF &point) const
float GetPageHeight() const override
void LoadPDFPageFromDict(RetainPtr< CPDF_Dictionary > pPageDict)
std::vector< RetainPtr< CPDF_Object > >::const_iterator const_iterator
Definition cpdf_array.h:29
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
const CPDF_Dictionary * GetRoot() const
CXFA_Object * GetXFAObject(XFA_HashCode wsNodeNameHash)
CXFA_EventParam(XFA_EVENTTYPE type)
virtual WideString GetAppName()=0
virtual ~CallbackIface()=default
virtual WideString GetAppTitle() const =0
virtual WideString GetPlatform()=0
virtual void Beep(uint32_t dwType)=0
virtual int32_t MsgBox(const WideString &wsMessage, const WideString &wsTitle, uint32_t dwIconType, uint32_t dwButtonType)=0
virtual CFX_Timer::HandlerIface * GetTimerHandler() const =0
virtual bool PostRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsContentType, const WideString &wsEncode, const WideString &wsHeader, WideString &wsResponse)=0
virtual bool PutRequestURL(const WideString &wsURL, const WideString &wsData, const WideString &wsEncode)=0
virtual RetainPtr< IFX_SeekableReadStream > DownloadURL(const WideString &wsURL)=0
virtual WideString Response(const WideString &wsQuestion, const WideString &wsTitle, const WideString &wsDefaultAnswer, bool bMask)=0
virtual WideString GetLanguage()=0
virtual cppgc::Heap * GetGCHeap() const =0
CallbackIface * GetAppProvider() const
Definition cxfa_ffapp.h:146
void Trace(cppgc::Visitor *visitor) const override
bool LoadFWLTheme(CXFA_FFDoc *doc)
CFWL_WidgetMgr * GetFWLWidgetMgr() const
Definition cxfa_ffapp.h:145
CFX_Timer::HandlerIface * GetTimerHandler() override
CFWL_App * GetFWLApp() const
Definition cxfa_ffapp.h:147
CFWL_WidgetMgr::AdapterIface * GetWidgetMgrAdapter() override
pdfium::IFWL_ThemeProvider * GetThemeProvider() override
~CXFA_FFApp() override
CXFA_FontMgr * GetXFAFontMgr() const
Definition cxfa_ffapp.h:148
cppgc::Heap * GetHeap() override
CXFA_FFWidgetHandler * GetWidgetHandler()
CXFA_FFDoc * GetDoc() const
CXFA_Node * GetRootSubform()
bool SavePackage(CXFA_Node *pNode, const RetainPtr< IFX_SeekableStream > &pFile)
CXFA_Document * GetXFADoc() const
Definition cxfa_ffdoc.h:167
XFA_EventError ProcessEvent(CXFA_Node *pNode, CXFA_EventParam *pParam)
CXFA_ReadyNodeIterator(CXFA_Node *pTravelRoot)
WideString()=default
static WideString FromASCII(ByteStringView str)
void CPDFXFA_ModuleInit()
void CPDFXFA_ModuleDestroy()
@ XFA_EVENT_PostSave
@ XFA_EVENT_PreSave
CXFA_Node * ToNode(CXFA_Object *pObj)
#define JSPLATFORM_ALERT_BUTTON_DEFAULT
#define JSPLATFORM_ALERT_ICON_ASTERISK
#define JSPLATFORM_ALERT_BUTTON_OKCANCEL
#define JSPLATFORM_ALERT_ICON_ERROR
#define JSPLATFORM_ALERT_BUTTON_YESNO
#define JSPLATFORM_ALERT_ICON_DEFAULT
#define JSPLATFORM_ALERT_ICON_WARNING
#define JSPLATFORM_ALERT_BUTTON_OK
#define JSPLATFORM_ALERT_ICON_QUESTION
#define JSPLATFORM_ALERT_ICON_STATUS
#define JSPLATFORM_ALERT_BUTTON_YESNOCANCEL
CFX_PTemplate< float > CFX_PointF
FormType
Definition fxfa.h:38
@ kXFAForeground
Definition fxfa.h:42
@ kNone
Definition fxfa.h:39
@ kXFAFull
Definition fxfa.h:41
XFA_HashCode
Definition fxfa_basic.h:12
@ XFA_HASHCODE_Datasets
Definition fxfa_basic.h:19
@ XFA_HASHCODE_Form
Definition fxfa_basic.h:22
FXGCScopedHeap FXGC_CreateHeap()
Definition heap.cpp:66
void FXGC_Release()
Definition heap.cpp:59
void FXGC_Initialize(v8::Platform *platform, v8::Isolate *isolate)
Definition heap.cpp:51
void FXGC_ForceGarbageCollection(cppgc::Heap *heap)
Definition heap.cpp:86
#define CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED
Definition heap.h:32
std::unique_ptr< cppgc::Heap, FXGCHeapDeleter > FXGCScopedHeap
Definition heap.h:25
Definition heap.h:12
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:222
void operator()(cppgc::Heap *heap)
Definition heap.cpp:91
fxcrt::WideString WideString
Definition widestring.h:207