OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef _FPDFXFA_APP_H_ | 7 #ifndef FPDFXFA_APP_H_ |
8 #define _FPDFXFA_APP_H_ | 8 #define FPDFXFA_APP_H_ |
9 | 9 |
10 class CPDFXFA_App; | |
11 class IFXJS_Runtime; | 10 class IFXJS_Runtime; |
12 class CJS_RuntimeFactory; | 11 class CJS_RuntimeFactory; |
13 | 12 |
14 class CPDFXFA_App : public IXFA_AppProvider | 13 class CPDFXFA_App : public IXFA_AppProvider |
15 { | 14 { |
16 public: | 15 public: |
17 » CPDFXFA_App(); | 16 static CPDFXFA_App* GetInstance(); |
18 » ~CPDFXFA_App(); | 17 static void ReleaseInstance(); |
19 | 18 |
20 » FX_BOOL»» » » Initialize(); | 19 CPDFXFA_App(); |
| 20 ~CPDFXFA_App() override; |
21 | 21 |
22 » IXFA_App*» » » GetXFAApp() { return m_pXFAApp; } | 22 FX_BOOL Initialize(); |
| 23 IXFA_App* GetXFAApp() { return m_pXFAApp; } |
23 | 24 |
24 » » » » » » | 25 FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv); |
25 » /*CPDFDoc_Environment*GetFormFillEnv(){ return m_pEnv; }*/ | 26 FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv); |
26 » FX_BOOL»» » » AddFormFillEnv(CPDFDoc_Environment* pEnv
); | |
27 » FX_BOOL»» » » RemoveFormFillEnv(CPDFDoc_Environment* p
Env); | |
28 | 27 |
29 » FXJSE_HRUNTIME» » GetJSERuntime() { return m_hJSERuntime; } | 28 FXJSE_HRUNTIME GetJSERuntime() { return m_hJSERuntime; } |
| 29 void ReleaseRuntime(); |
| 30 FX_BOOL InitRuntime(FX_BOOL bReset=FALSE); |
30 | 31 |
31 » void» » » » ReleaseRuntime(); | 32 CJS_RuntimeFactory* GetRuntimeFactory() { return m_pJSRuntimeFactory; } |
32 | 33 |
33 » FX_BOOL»» » » InitRuntime(FX_BOOL bReset = FALSE) { | 34 // IFXA_AppProvider: |
34 » » if (bReset) { | 35 void GetAppType(CFX_WideString &wsAppType) override; |
35 » » » m_bInitRuntime = FALSE; | 36 void SetAppType(FX_WSTR wsAppType) override; |
36 » » » return TRUE; | |
37 » » } | |
38 » » if (m_bInitRuntime) | |
39 » » » return TRUE; | |
40 » » m_bInitRuntime = TRUE; | |
41 » » return FALSE; | |
42 » } | |
43 | 37 |
44 » //IFXJS_Runtime*» » GetJSRuntime(); | 38 void GetLanguage(CFX_WideString &wsLanguage) override; |
| 39 void GetPlatform(CFX_WideString &wsPlatform) override; |
| 40 void GetVariation(CFX_WideString &wsVariation) override; |
| 41 void GetVersion(CFX_WideString &wsVersion) override; |
| 42 void GetFoxitVersion(CFX_WideString &wsFoxitVersion) override { |
| 43 wsFoxitVersion = L"7.0"; |
| 44 } |
45 | 45 |
46 » CJS_RuntimeFactory* GetRuntimeFactory() {return m_pJSRuntimeFactory;} | 46 void GetAppName(CFX_WideString& wsName) override; |
| 47 void GetFoxitAppName(CFX_WideString& wsFoxitName) override { |
| 48 wsFoxitName = L"Foxit"; |
| 49 } |
47 | 50 |
48 public: | 51 void Beep(FX_DWORD dwType) override; |
49 » /** | 52 FX_INT32 MsgBox(FX_WSTR wsMessage, FX_WSTR wsTitle, FX_DWORD dwIconType, FX_
DWORD dwButtonType) override; |
50 » *Specifies the name of the client application in which a form currently
exists. Such as Exchange-Pro. | 53 void Response(CFX_WideString &wsAnswer, FX_WSTR wsQuestion, FX_WSTR wsTitle, |
51 » */ | 54 FX_WSTR wsDefaultAnswer, FX_BOOL bMark) override; |
52 » virtual void» » GetAppType(CFX_WideString &wsAppType); | |
53 » virtual void» » SetAppType(FX_WSTR wsAppType) ; | |
54 » virtual void» » SetFoxitAppType(FX_WSTR wsFoxitAppType) { return
; } | |
55 » virtual void» » GetFoxitAppType(CFX_WideString &wsFoxitAppType)
{ return; } | |
56 » virtual void» » GetFoxitAppName(CFX_WideString& wsFoxitName) {ws
FoxitName = L"Foxit";} | |
57 » virtual void» » GetFoxitVersion(CFX_WideString &wsFoxitVersion)
{wsFoxitVersion = L"7.0";} | |
58 » /** | |
59 » *Returns the language of the running host application. Such as zh_CN | |
60 » */ | |
61 » virtual void» » GetLanguage(CFX_WideString &wsLanguage); | |
62 » /** | |
63 » » *Returns the platform of the machine running the script. Such as
WIN | |
64 » */ | |
65 » virtual void» » GetPlatform(CFX_WideString &wsPlatform); | |
66 » /** | |
67 » * Indicates the packaging of the application that is running the script
. Such as Full | |
68 » */ | |
69 » virtual void» » GetVariation(CFX_WideString &wsVariation); | |
70 » /** | |
71 » * Indicates the version number of the current application. Such as 9 | |
72 » */ | |
73 » virtual void» » GetVersion(CFX_WideString &wsVersion); | |
74 » //Get application name, such as Phantom | |
75 » virtual void» » GetAppName(CFX_WideString& wsName); | |
76 » /** | |
77 » *Causes the system to play a sound.» | |
78 » * @param[in] dwType The system code for the appropriate sound.0 (Error)
1 (Warning)2 (Question)3 (Status)4 (Default) | |
79 » */ | |
80 » virtual void» » Beep(FX_DWORD dwType); | |
81 » /** | |
82 » * Displays a message box. | |
83 » * @param[in] dwIconType» Icon type, refer to XFA_MBICON. | |
84 » * @param[in] dwButtonType» Button type, refer to XFA_MESSAGEBUTTON. | |
85 » * @return A valid integer representing the value of the button pressed
by the user, refer to XFA_ID. | |
86 » */ | |
87 » virtual FX_INT32» MsgBox(FX_WSTR wsMessage, FX_WSTR wsTitle = FX_W
STRC(L""), FX_DWORD dwIconType = 0, FX_DWORD dwButtonType = 0); | |
88 » //bMark True (default) Masks the user¡¯s answer with * (asterisks). Fals
e Does not mask the user¡¯s answer. | |
89 » virtual void» » Response(CFX_WideString &wsAnswer, FX_WSTR wsQue
stion, FX_WSTR wsTitle = FX_WSTRC(L""), FX_WSTR wsDefaultAnswer = FX_WSTRC(L""),
FX_BOOL bMark = TRUE); | |
90 » virtual FX_INT32» GetDocumentCountInBatch(); | |
91 » virtual FX_INT32» GetCurDocumentInBatch(); | |
92 » //wsURL http, ftp, such as "http://www.w3.org/TR/REC-xml-names/". | |
93 » virtual IFX_FileRead* DownloadURL(FX_WSTR wsURL); | |
94 » /* | |
95 » * Post data to the given url. | |
96 » * @param[in] wsURL» » » the URL being uploaded. | |
97 » * @param[in] wsData» » » the data being uploaded. | |
98 » * @param[in] wsContentType» the content type of data including text/
html, text/xml, text/plain, multipart/form-data, | |
99 » *» » » » » » » application/x-ww
w-form-urlencoded, application/octet-stream, any valid MIME type. | |
100 » * @param[in] wsEncode» » the encode of data including UTF-8, UTF-
16, ISO8859-1, any recognized [IANA]character encoding | |
101 » * @param[in] wsHeader» » any additional HTTP headers to be includ
ed in the post. | |
102 » * @param[out] wsResponse» decoded response from server. | |
103 » * @return TRUE Server permitted the post request, FALSE otherwise. | |
104 » */ | |
105 » virtual FX_BOOL»» PostRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX
_WSTR wsContentType, | |
106 » » » » » » » » » FX_W
STR wsEncode, FX_WSTR wsHeader, CFX_WideString &wsResponse); | |
107 | 55 |
108 » /* | 56 FX_INT32 GetDocumentCountInBatch() override; |
109 » * Put data to the given url. | 57 FX_INT32 GetCurDocumentInBatch() override; |
110 » * @param[in] wsURL» » » the URL being uploaded. | |
111 » * @param[in] wsData» » » the data being uploaded. | |
112 » * @param[in] wsEncode» » the encode of data including UTF-8, UTF-
16, ISO8859-1, any recognized [IANA]character encoding | |
113 » * @return TRUE Server permitted the post request, FALSE otherwise. | |
114 » */ | |
115 » virtual FX_BOOL»» PutRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_
WSTR wsEncode); | |
116 | 58 |
117 » virtual void» » LoadString(FX_INT32 iStringID, CFX_WideString &w
sString); | 59 IFX_FileRead* DownloadURL(FX_WSTR wsURL) override; |
118 » virtual»FX_BOOL»» ShowFileDialog(FX_WSTR wsTitle, FX_WSTR wsFilter
, CFX_WideStringArray &wsPathArr, FX_BOOL bOpen = TRUE); | 60 FX_BOOL PostRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsContentType, |
119 » virtual IFWL_AdapterTimerMgr* GetTimerMgr(); | 61 FX_WSTR wsEncode, FX_WSTR wsHeader, CFX_WideString &w
sResponse) override; |
| 62 FX_BOOL PutRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsEncode) overr
ide; |
120 | 63 |
121 » CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList; | 64 void LoadString(FX_INT32 iStringID, CFX_WideString &wsString) override; |
| 65 FX_BOOL ShowFileDialog(FX_WSTR wsTitle, FX_WSTR wsFilter, CFX_WideStringArra
y &wsPathArr, FX_BOOL bOpen) override; |
| 66 IFWL_AdapterTimerMgr* GetTimerMgr() override; |
122 | 67 |
123 public: | 68 CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList; |
124 » static CPDFXFA_App* m_pApp; | |
125 | 69 |
126 private: | 70 protected: |
127 » IXFA_App* m_pXFAApp; | 71 static CPDFXFA_App* g_pApp; |
128 » IXFA_FontMgr* m_pFontMgr; | |
129 » FXJSE_HRUNTIME m_hJSERuntime; | |
130 » IFXJS_Runtime* m_pJSRuntime; | |
131 » CJS_RuntimeFactory* m_pJSRuntimeFactory; | |
132 | 72 |
133 » CFX_WideString» m_csAppType; | 73 FX_BOOL m_bInitRuntime; |
134 » FX_BOOL»» » m_bInitRuntime; | 74 IXFA_App* m_pXFAApp; |
| 75 IXFA_FontMgr* m_pFontMgr; |
| 76 FXJSE_HRUNTIME m_hJSERuntime; |
| 77 IFXJS_Runtime* m_pJSRuntime; |
| 78 CJS_RuntimeFactory* m_pJSRuntimeFactory; |
| 79 CFX_WideString m_csAppType; |
135 }; | 80 }; |
136 | 81 |
137 CPDFXFA_App* FPDFXFA_GetApp(); | 82 #endif // FPDFXFA_APP_H_ |
138 void FPDFXFA_ReleaseApp(); | |
139 | |
140 #endif | |
OLD | NEW |