OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
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 FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_APP_H_ | |
8 #define FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_APP_H_ | |
9 | |
10 #include "xfa/include/fxfa/fxfa.h" | |
11 | |
12 class CPDFDoc_Environment; | |
13 class IFXJS_Runtime; | |
14 | |
15 class CPDFXFA_App : public IXFA_AppProvider { | |
16 public: | |
17 static CPDFXFA_App* GetInstance(); | |
18 static void ReleaseInstance(); | |
19 | |
20 CPDFXFA_App(); | |
21 ~CPDFXFA_App() override; | |
22 | |
23 FX_BOOL Initialize(FXJSE_HRUNTIME hRuntime); | |
24 CXFA_FFApp* GetXFAApp() { return m_pXFAApp; } | |
25 | |
26 FX_BOOL AddFormFillEnv(CPDFDoc_Environment* pEnv); | |
27 FX_BOOL RemoveFormFillEnv(CPDFDoc_Environment* pEnv); | |
28 | |
29 FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } | |
30 void SetJavaScriptInitialized(FX_BOOL bInitialized) { | |
31 m_bJavaScriptInitialized = bInitialized; | |
32 } | |
33 | |
34 FXJSE_HRUNTIME GetJSERuntime() const { return m_hJSERuntime; } | |
35 | |
36 // IFXA_AppProvider: | |
37 void GetAppType(CFX_WideString& wsAppType) override; | |
38 void SetAppType(const CFX_WideStringC& wsAppType) override; | |
39 | |
40 void GetLanguage(CFX_WideString& wsLanguage) override; | |
41 void GetPlatform(CFX_WideString& wsPlatform) override; | |
42 void GetVariation(CFX_WideString& wsVariation) override; | |
43 void GetVersion(CFX_WideString& wsVersion) override; | |
44 void GetFoxitVersion(CFX_WideString& wsFoxitVersion) override { | |
45 wsFoxitVersion = L"7.0"; | |
46 } | |
47 | |
48 void GetAppName(CFX_WideString& wsName) override; | |
49 void GetFoxitAppName(CFX_WideString& wsFoxitName) override { | |
50 wsFoxitName = L"Foxit"; | |
51 } | |
52 | |
53 void Beep(uint32_t dwType) override; | |
54 int32_t MsgBox(const CFX_WideStringC& wsMessage, | |
55 const CFX_WideStringC& wsTitle, | |
56 uint32_t dwIconType, | |
57 uint32_t dwButtonType) override; | |
58 void Response(CFX_WideString& wsAnswer, | |
59 const CFX_WideStringC& wsQuestion, | |
60 const CFX_WideStringC& wsTitle, | |
61 const CFX_WideStringC& wsDefaultAnswer, | |
62 FX_BOOL bMark) override; | |
63 | |
64 int32_t GetDocumentCountInBatch() override; | |
65 int32_t GetCurDocumentInBatch() override; | |
66 | |
67 IFX_FileRead* DownloadURL(const CFX_WideStringC& wsURL) override; | |
68 FX_BOOL PostRequestURL(const CFX_WideStringC& wsURL, | |
69 const CFX_WideStringC& wsData, | |
70 const CFX_WideStringC& wsContentType, | |
71 const CFX_WideStringC& wsEncode, | |
72 const CFX_WideStringC& wsHeader, | |
73 CFX_WideString& wsResponse) override; | |
74 FX_BOOL PutRequestURL(const CFX_WideStringC& wsURL, | |
75 const CFX_WideStringC& wsData, | |
76 const CFX_WideStringC& wsEncode) override; | |
77 | |
78 void LoadString(int32_t iStringID, CFX_WideString& wsString) override; | |
79 FX_BOOL ShowFileDialog(const CFX_WideStringC& wsTitle, | |
80 const CFX_WideStringC& wsFilter, | |
81 CFX_WideStringArray& wsPathArr, | |
82 FX_BOOL bOpen) override; | |
83 IFWL_AdapterTimerMgr* GetTimerMgr() override; | |
84 | |
85 CFX_ArrayTemplate<CPDFDoc_Environment*> m_pEnvList; | |
86 | |
87 protected: | |
88 static CPDFXFA_App* g_pApp; | |
89 | |
90 FX_BOOL m_bJavaScriptInitialized; | |
91 CXFA_FFApp* m_pXFAApp; | |
92 FXJSE_HRUNTIME m_hJSERuntime; | |
93 IFXJS_Runtime* m_pJSRuntime; | |
94 CFX_WideString m_csAppType; | |
95 bool m_bOwnedRuntime; | |
96 }; | |
97 | |
98 #endif // FPDFSDK_INCLUDE_FPDFXFA_FPDFXFA_APP_H_ | |
OLD | NEW |