Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: fpdfsdk/src/fpdfxfa/fpdfxfa_app.cpp

Issue 1153553003: Make CPDFXFA_App / IXFA_AppProvider saner (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Address comments. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "../../../public/fpdf_formfill.h" 7 #include "../../../public/fpdf_formfill.h"
8 #include "../../include/fsdk_define.h" 8 #include "../../include/fsdk_define.h"
9 #include "../../include/fsdk_mgr.h" 9 #include "../../include/fsdk_mgr.h"
10 #include "../../include/fpdfxfa/fpdfxfa_doc.h" 10 #include "../../include/fpdfxfa/fpdfxfa_doc.h"
11 #include "../../include/fpdfxfa/fpdfxfa_util.h" 11 #include "../../include/fpdfxfa/fpdfxfa_util.h"
12 #include "../../include/jsapi/fxjs_v8.h" 12 #include "../../include/jsapi/fxjs_v8.h"
13 #include "../../include/javascript/IJavaScript.h" 13 #include "../../include/javascript/IJavaScript.h"
14 #include "../../include/fpdfxfa/fpdfxfa_app.h" 14 #include "../../include/fpdfxfa/fpdfxfa_app.h"
15 CPDFXFA_App* CPDFXFA_App::m_pApp = NULL; 15
16 16 CPDFXFA_App* CPDFXFA_App::g_pApp = NULL;
17 CPDFXFA_App* FPDFXFA_GetApp() 17
18 { 18 CPDFXFA_App* CPDFXFA_App::GetInstance()
19 » if (!CPDFXFA_App::m_pApp) 19 {
20 » » CPDFXFA_App::m_pApp = FX_NEW CPDFXFA_App(); 20 if (!g_pApp) {
21 21 g_pApp = FX_NEW CPDFXFA_App();
22 » return CPDFXFA_App::m_pApp; 22 }
23 } 23 return g_pApp;
24 24 }
25 void FPDFXFA_ReleaseApp() 25
26 { 26 void CPDFXFA_App::ReleaseInstance()
27 » if (CPDFXFA_App::m_pApp) 27 {
28 » » delete CPDFXFA_App::m_pApp; 28 delete g_pApp;
29 » CPDFXFA_App::m_pApp = NULL; 29 g_pApp = NULL;
30 } 30 }
31 31
32 CJS_RuntimeFactory* g_GetJSRuntimeFactory() 32 CJS_RuntimeFactory* g_GetJSRuntimeFactory()
33 { 33 {
34 » static CJS_RuntimeFactory g_JSRuntimeFactory; 34 static CJS_RuntimeFactory g_JSRuntimeFactory;
35 » return &g_JSRuntimeFactory; 35 return &g_JSRuntimeFactory;
36 } 36 }
37 37
38 CPDFXFA_App::CPDFXFA_App() : 38 CPDFXFA_App::CPDFXFA_App() :
39 » m_pXFAApp(NULL), 39 m_bInitRuntime(FALSE),
40 » m_pFontMgr(NULL), 40 m_pXFAApp(NULL),
41 » m_hJSERuntime(NULL), 41 m_pFontMgr(NULL),
42 » //m_pJSRuntime(NULL), 42 m_hJSERuntime(NULL),
43 » //m_pEnv(NULL), 43 m_csAppType(JS_STR_VIEWERTYPE_STANDARD)
44 » m_csAppType(JS_STR_VIEWERTYPE_STANDARD) 44 {
45 { 45 m_pJSRuntimeFactory = g_GetJSRuntimeFactory();
46 » m_pJSRuntimeFactory = NULL; 46 m_pJSRuntimeFactory->AddRef();
47 » m_pJSRuntimeFactory = g_GetJSRuntimeFactory(); 47 m_pEnvList.RemoveAll();
48 » m_pJSRuntimeFactory->AddRef(); 48 }
49 » m_pEnvList.RemoveAll();»
50 » m_bInitRuntime = FALSE;
51 }
52 //IFXJS_Runtime* CPDFXFA_App::GetJSRuntime()
53 //{
54 //» FXSYS_assert(m_pJSRuntimeFactory);
55 //» if(!m_pJSRuntime)
56 //» » m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this);
57 //» return m_pJSRuntime;
58 //}
59 49
60 CPDFXFA_App::~CPDFXFA_App() 50 CPDFXFA_App::~CPDFXFA_App()
61 { 51 {
62 » if (m_pFontMgr) 52 delete m_pFontMgr;
63 » { 53 m_pFontMgr = NULL;
64 » » m_pFontMgr->Release(); 54
65 » » m_pFontMgr = NULL; 55 delete m_pXFAApp;
66 » } 56 m_pXFAApp = NULL;
67 57
68 » if (m_pXFAApp) 58 m_pJSRuntimeFactory->Release();
69 » { 59 FXJSE_Runtime_Release(m_hJSERuntime);
70 » » m_pXFAApp->Release(); 60 m_hJSERuntime = NULL;
71 » » m_pXFAApp = NULL; 61
72 » } 62 FXJSE_Finalize();
73 63 BC_Library_Destory();
74 » //if (m_pJSRuntime && m_pJSRuntimeFactory)
75 » //» m_pJSRuntimeFactory->DeleteJSRuntime(m_pJSRuntime);
76 » m_pJSRuntimeFactory->Release();
77
78
79 » if (m_hJSERuntime)
80 » {
81 » » FXJSE_Runtime_Release(m_hJSERuntime);
82 » » m_hJSERuntime = NULL;
83 » }
84
85 » FXJSE_Finalize();
86
87 » BC_Library_Destory();
88 } 64 }
89 65
90 FX_BOOL CPDFXFA_App::Initialize() 66 FX_BOOL CPDFXFA_App::Initialize()
91 { 67 {
92 » BC_Library_Init(); 68 BC_Library_Init();
93 69 FXJSE_Initialize();
94 » FXJSE_Initialize(); 70
95 » m_hJSERuntime = FXJSE_Runtime_Create(); 71 m_hJSERuntime = FXJSE_Runtime_Create();
96 72 if (!m_hJSERuntime)
97 » if (!m_hJSERuntime) 73 return FALSE;
98 » » return FALSE; 74
99 75 m_pXFAApp = IXFA_App::Create(this);
100 » //m_pJSRuntime = m_pJSRuntimeFactory->NewJSRuntime(this); 76 if (!m_pXFAApp)
101 » 77 return FALSE;
102 » m_pXFAApp = IXFA_App::Create(this); 78
103 » if (!m_pXFAApp) 79 m_pFontMgr = IXFA_FontMgr::CreateDefault();
104 » » return FALSE; 80 if (!m_pFontMgr)
105 81 return FALSE;
106 » m_pFontMgr = XFA_GetDefaultFontMgr(); 82
107 » if (!m_pFontMgr) 83 m_pXFAApp->SetDefaultFontMgr(m_pFontMgr);
108 » » return FALSE; 84 return TRUE;
109 85 }
110 » m_pXFAApp->SetDefaultFontMgr(m_pFontMgr); 86
111 87 FX_BOOL CPDFXFA_App::InitRuntime(FX_BOOL bReset) {
112 » return TRUE; 88 if (bReset) {
89 m_bInitRuntime = FALSE;
90 return TRUE;
91 }
92 if (m_bInitRuntime) {
93 return TRUE;
94 }
95 m_bInitRuntime = TRUE;
96 return FALSE;
113 } 97 }
114 98
115 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv) 99 FX_BOOL CPDFXFA_App::AddFormFillEnv(CPDFDoc_Environment* pEnv)
116 { 100 {
117 » if (!pEnv) return FALSE; 101 if (!pEnv) return FALSE;
118 102
119 » m_pEnvList.Add(pEnv); 103 m_pEnvList.Add(pEnv);
120 » return TRUE; 104 return TRUE;
121 } 105 }
122 106
123 FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFDoc_Environment* pEnv) 107 FX_BOOL CPDFXFA_App::RemoveFormFillEnv(CPDFDoc_Environment* pEnv)
124 { 108 {
125 » if (!pEnv) return FALSE; 109 if (!pEnv) return FALSE;
126 110
127 » int nFind = m_pEnvList.Find(pEnv); 111 int nFind = m_pEnvList.Find(pEnv);
128 » if (nFind != -1) { 112 if (nFind != -1) {
129 » » m_pEnvList.RemoveAt(nFind); 113 m_pEnvList.RemoveAt(nFind);
130 » » return TRUE; 114 return TRUE;
131 » } 115 }
132 116
133 » return FALSE; 117 return FALSE;
134 } 118 }
135 void CPDFXFA_App::ReleaseRuntime() 119 void CPDFXFA_App::ReleaseRuntime()
136 { 120 {
137 » v8::Global<v8::Context> context; 121 v8::Global<v8::Context> context;
138 » JS_ReleaseRuntime((IJS_Runtime*)m_hJSERuntime, context); 122 JS_ReleaseRuntime((IJS_Runtime*)m_hJSERuntime, context);
139 } 123 }
140 124
141 void CPDFXFA_App::GetAppType(CFX_WideString &wsAppType) 125 void CPDFXFA_App::GetAppType(CFX_WideString &wsAppType)
142 { 126 {
143 » wsAppType = m_csAppType; 127 wsAppType = m_csAppType;
144 } 128 }
145 129
146 void CPDFXFA_App::GetAppName(CFX_WideString& wsName) 130 void CPDFXFA_App::GetAppName(CFX_WideString& wsName)
147 { 131 {
148 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 132 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
149 » if (pEnv) 133 if (pEnv)
150 » { 134 {
151 » » wsName = pEnv->FFI_GetAppName(); 135 wsName = pEnv->FFI_GetAppName();
152 » } 136 }
153 } 137 }
154 138
155 void CPDFXFA_App::SetAppType(FX_WSTR wsAppType) 139 void CPDFXFA_App::SetAppType(FX_WSTR wsAppType)
156 { 140 {
157 » m_csAppType = wsAppType; 141 m_csAppType = wsAppType;
158 } 142 }
159 143
160 void CPDFXFA_App::GetLanguage(CFX_WideString &wsLanguage) 144 void CPDFXFA_App::GetLanguage(CFX_WideString &wsLanguage)
161 { 145 {
162 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 146 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
163 » if (pEnv) 147 if (pEnv)
164 » { 148 {
165 » » wsLanguage = pEnv->FFI_GetLanguage(); 149 wsLanguage = pEnv->FFI_GetLanguage();
166 » } 150 }
167 } 151 }
168 152
169 void CPDFXFA_App::GetPlatform(CFX_WideString &wsPlatform) 153 void CPDFXFA_App::GetPlatform(CFX_WideString &wsPlatform)
170 { 154 {
171 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 155 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
172 » if (pEnv) 156 if (pEnv)
173 » { 157 {
174 » » wsPlatform = pEnv->FFI_GetPlatform(); 158 wsPlatform = pEnv->FFI_GetPlatform();
175 » } 159 }
176 } 160 }
177 161
178 void CPDFXFA_App::GetVariation(CFX_WideString &wsVariation) 162 void CPDFXFA_App::GetVariation(CFX_WideString &wsVariation)
179 { 163 {
180 » wsVariation = JS_STR_VIEWERVARIATION; 164 wsVariation = JS_STR_VIEWERVARIATION;
181 } 165 }
182 166
183 void CPDFXFA_App::GetVersion(CFX_WideString &wsVersion) 167 void CPDFXFA_App::GetVersion(CFX_WideString &wsVersion)
184 { 168 {
185 » wsVersion = JS_STR_VIEWERVERSION_XFA; 169 wsVersion = JS_STR_VIEWERVERSION_XFA;
186 } 170 }
187 171
188 void CPDFXFA_App::Beep(FX_DWORD dwType) 172 void CPDFXFA_App::Beep(FX_DWORD dwType)
189 { 173 {
190 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 174 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
191 » if (pEnv) 175 if (pEnv)
192 » { 176 {
193 » » pEnv->JS_appBeep(dwType); 177 pEnv->JS_appBeep(dwType);
194 » } 178 }
195 } 179 }
196 180
197 FX_INT32 CPDFXFA_App::MsgBox(FX_WSTR wsMessage, FX_WSTR wsTitle, FX_DWORD dwIcon Type, FX_DWORD dwButtonType) 181 FX_INT32 CPDFXFA_App::MsgBox(FX_WSTR wsMessage, FX_WSTR wsTitle, FX_DWORD dwIcon Type, FX_DWORD dwButtonType)
198 { 182 {
199 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 183 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
200 » if (!pEnv) 184 if (!pEnv)
201 » » return -1; 185 return -1;
202 186
203 » FX_DWORD iconType = 0; 187 FX_DWORD iconType = 0;
204 » int iButtonType = 0; 188 int iButtonType = 0;
205 » switch (dwIconType) 189 switch (dwIconType)
206 » { 190 {
207 » case XFA_MBICON_Error: 191 case XFA_MBICON_Error:
208 » » iconType |= 0; 192 iconType |= 0;
209 » » break; 193 break;
210 » case XFA_MBICON_Warning: 194 case XFA_MBICON_Warning:
211 » » iconType |= 1; 195 iconType |= 1;
212 » » break; 196 break;
213 » case XFA_MBICON_Question: 197 case XFA_MBICON_Question:
214 » » iconType |= 2; 198 iconType |= 2;
215 » » break; 199 break;
216 » case XFA_MBICON_Status: 200 case XFA_MBICON_Status:
217 » » iconType |= 3; 201 iconType |= 3;
218 » » break; 202 break;
219 » } 203 }
220 » switch (dwButtonType) 204 switch (dwButtonType)
221 » { 205 {
222 » case XFA_MB_OK: 206 case XFA_MB_OK:
223 » » iButtonType |= 0; 207 iButtonType |= 0;
224 » » break; 208 break;
225 » case XFA_MB_OKCancel: 209 case XFA_MB_OKCancel:
226 » » iButtonType |= 1; 210 iButtonType |= 1;
227 » » break; 211 break;
228 » case XFA_MB_YesNo: 212 case XFA_MB_YesNo:
229 » » iButtonType |= 2; 213 iButtonType |= 2;
230 » » break; 214 break;
231 » case XFA_MB_YesNoCancel: 215 case XFA_MB_YesNoCancel:
232 » » iButtonType |= 3; 216 iButtonType |= 3;
233 » » break; 217 break;
234 » } 218 }
235 » FX_INT32 iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), iButtonType, iconType); 219 FX_INT32 iRet = pEnv->JS_appAlert(wsMessage.GetPtr(), wsTitle.GetPtr(), iBut tonType, iconType);
236 » switch (iRet) 220 switch (iRet)
237 » { 221 {
238 » case 1: 222 case 1:
239 » » return XFA_IDOK; 223 return XFA_IDOK;
240 » case 2: 224 case 2:
241 » » return XFA_IDCancel; 225 return XFA_IDCancel;
242 » case 3: 226 case 3:
243 » » return XFA_IDNo; 227 return XFA_IDNo;
244 » case 4: 228 case 4:
245 » » return XFA_IDYes; 229 return XFA_IDYes;
246 » } 230 }
247 » return XFA_IDYes; 231 return XFA_IDYes;
248 } 232 }
249 233
250 void CPDFXFA_App::Response(CFX_WideString &wsAnswer, FX_WSTR wsQuestion, FX_WSTR wsTitle, FX_WSTR wsDefaultAnswer, FX_BOOL bMark) 234 void CPDFXFA_App::Response(CFX_WideString &wsAnswer, FX_WSTR wsQuestion, FX_WSTR wsTitle, FX_WSTR wsDefaultAnswer, FX_BOOL bMark)
251 { 235 {
252 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 236 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
253 » if (pEnv) 237 if (pEnv)
254 » { 238 {
255 » » int nLength = 2048; 239 int nLength = 2048;
256 » » char* pBuff = new char[nLength]; 240 char* pBuff = new char[nLength];
257 » » nLength = pEnv->JS_appResponse(wsQuestion.GetPtr(), wsTitle.GetP tr(), wsDefaultAnswer.GetPtr(), NULL, bMark, pBuff, nLength); 241 nLength = pEnv->JS_appResponse(wsQuestion.GetPtr(), wsTitle.GetPtr(), ws DefaultAnswer.GetPtr(), NULL, bMark, pBuff, nLength);
258 » » if(nLength > 0) 242 if(nLength > 0)
259 » » { 243 {
260 » » » nLength = nLength>2046?2046:nLength; 244 nLength = nLength>2046?2046:nLength;
261 » » » pBuff[nLength] = 0; 245 pBuff[nLength] = 0;
262 » » » pBuff[nLength+1] = 0; 246 pBuff[nLength+1] = 0;
263 » » » wsAnswer = CFX_WideString::FromUTF16LE((unsigned short*) pBuff, nLength); 247 wsAnswer = CFX_WideString::FromUTF16LE((unsigned short*)pBuff, nLeng th);
264 » » } 248 }
265 » » delete[] pBuff; 249 delete[] pBuff;
266 » } 250 }
267 } 251 }
268 252
269 FX_INT32 CPDFXFA_App::GetCurDocumentInBatch() 253 FX_INT32 CPDFXFA_App::GetCurDocumentInBatch()
270 { 254 {
271 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 255 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
272 » if (pEnv) 256 if (pEnv)
273 » { 257 {
274 » » return pEnv->FFI_GetCurDocument(); 258 return pEnv->FFI_GetCurDocument();
275 » } 259 }
276 » return 0; 260 return 0;
277 } 261 }
278 262
279 FX_INT32 CPDFXFA_App::GetDocumentCountInBatch() 263 FX_INT32 CPDFXFA_App::GetDocumentCountInBatch()
280 { 264 {
281 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 265 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
282 » if (pEnv) 266 if (pEnv)
283 » { 267 {
284 » » return pEnv->FFI_GetDocumentCount(); 268 return pEnv->FFI_GetDocumentCount();
285 » } 269 }
286 270
287 » return 0; 271 return 0;
288 } 272 }
289 273
290 IFX_FileRead* CPDFXFA_App::DownloadURL(FX_WSTR wsURL) 274 IFX_FileRead* CPDFXFA_App::DownloadURL(FX_WSTR wsURL)
291 { 275 {
292 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 276 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
293 » if (pEnv) 277 if (pEnv)
294 » { 278 {
295 » » return pEnv->FFI_DownloadFromURL(wsURL.GetPtr()); 279 return pEnv->FFI_DownloadFromURL(wsURL.GetPtr());
296 » } 280 }
297 » return NULL; 281 return NULL;
298 } 282 }
299 283
300 FX_BOOL CPDFXFA_App::PostRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsCon tentType, 284 FX_BOOL CPDFXFA_App::PostRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsCon tentType,
301 » FX_WSTR wsEncode, FX_WSTR wsHeader, CFX_WideString &wsResponse) 285 FX_WSTR wsEncode, FX_WSTR wsHeader, CFX_WideString &wsResponse)
302 { 286 {
303 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 287 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
304 » if (pEnv) 288 if (pEnv)
305 » { 289 {
306 » » wsResponse = pEnv->FFI_PostRequestURL(wsURL.GetPtr(), wsData.Get Ptr(), wsContentType.GetPtr(), wsEncode.GetPtr(), wsHeader.GetPtr()); 290 wsResponse = pEnv->FFI_PostRequestURL(wsURL.GetPtr(), wsData.GetPtr(), w sContentType.GetPtr(), wsEncode.GetPtr(), wsHeader.GetPtr());
307 » » return TRUE; 291 return TRUE;
308 » } 292 }
309 » return FALSE; 293 return FALSE;
310 } 294 }
311 295
312 FX_BOOL CPDFXFA_App::PutRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsEnco de) 296 FX_BOOL CPDFXFA_App::PutRequestURL(FX_WSTR wsURL, FX_WSTR wsData, FX_WSTR wsEnco de)
313 { 297 {
314 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 298 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
315 » if (pEnv) 299 if (pEnv)
316 » { 300 {
317 » » return pEnv->FFI_PutRequestURL(wsURL.GetPtr(), wsData.GetPtr(), wsEncode.GetPtr()); 301 return pEnv->FFI_PutRequestURL(wsURL.GetPtr(), wsData.GetPtr(), wsEncode .GetPtr());
318 » } 302 }
319 » return FALSE; 303 return FALSE;
320 } 304 }
321 305
322 void CPDFXFA_App::LoadString(FX_INT32 iStringID, CFX_WideString &wsString) 306 void CPDFXFA_App::LoadString(FX_INT32 iStringID, CFX_WideString &wsString)
323 { 307 {
324 switch (iStringID) 308 switch (iStringID)
325 { 309 {
326 case XFA_IDS_ValidateFailed: 310 case XFA_IDS_ValidateFailed:
327 wsString = L"%s validate failed"; 311 wsString = L"%s validate failed";
328 return; 312 return;
329 case XFA_IDS_CalcOverride: 313 case XFA_IDS_CalcOverride:
330 wsString = L"Calculate Override"; 314 wsString = L"Calculate Override";
331 return; 315 return;
332 case XFA_IDS_ModifyField: 316 case XFA_IDS_ModifyField:
333 wsString = L"Are you sure you want to modify this field?"; 317 wsString = L"Are you sure you want to modify this field?";
334 return; 318 return;
335 case XFA_IDS_NotModifyField: 319 case XFA_IDS_NotModifyField:
336 wsString = L"You are not allowed to modify this field."; 320 wsString = L"You are not allowed to modify this field.";
337 return; 321 return;
338 case XFA_IDS_AppName: 322 case XFA_IDS_AppName:
339 wsString = L"Foxit"; 323 wsString = L"Foxit";
340 return; 324 return;
341 case XFA_IDS_ImageFilter: 325 case XFA_IDS_ImageFilter:
342 wsString = L"Image Files(*.bmp;*.jpg;*.png;*.gif;*.tif)|*.bmp;*. jpg;*.png;*.gif;*.tif|All Files(*.*)|*.*||"; 326 wsString = L"Image Files(*.bmp;*.jpg;*.png;*.gif;*.tif)|*.bmp;*.jpg;*.pn g;*.gif;*.tif|All Files(*.*)|*.*||";
343 return; 327 return;
344 case XFA_IDS_UNKNOW_CATCHED: 328 case XFA_IDS_UNKNOW_CATCHED:
345 wsString = L"unknown error is catched!"; 329 wsString = L"unknown error is catched!";
346 return; 330 return;
347 case XFA_IDS_Unable_TO_SET: 331 case XFA_IDS_Unable_TO_SET:
348 wsString = L"Unable to set "; 332 wsString = L"Unable to set ";
349 return; 333 return;
350 case XFA_IDS_VALUE_EXCALMATORY: 334 case XFA_IDS_VALUE_EXCALMATORY:
351 wsString = L" value!"; 335 wsString = L" value!";
352 return; 336 return;
353 case XFA_IDS_INVALID_ENUM_VALUE: 337 case XFA_IDS_INVALID_ENUM_VALUE:
354 wsString = L"Invalid enumerated value: "; 338 wsString = L"Invalid enumerated value: ";
355 return; 339 return;
356 case XFA_IDS_UNSUPPORT_METHOD: 340 case XFA_IDS_UNSUPPORT_METHOD:
357 wsString = L"unsupport %s method."; 341 wsString = L"unsupport %s method.";
358 return; 342 return;
359 case XFA_IDS_UNSUPPORT_PROP: 343 case XFA_IDS_UNSUPPORT_PROP:
360 wsString = L"unsupport %s property."; 344 wsString = L"unsupport %s property.";
361 return; 345 return;
362 case XFA_IDS_INVAlID_PROP_SET: 346 case XFA_IDS_INVAlID_PROP_SET:
363 wsString = L"Invalid property set operation;"; 347 wsString = L"Invalid property set operation;";
364 return; 348 return;
365 case XFA_IDS_NOT_DEFAUL_VALUE: 349 case XFA_IDS_NOT_DEFAUL_VALUE:
366 wsString = L" doesn't have a default property"; 350 wsString = L" doesn't have a default property";
367 return; 351 return;
368 case XFA_IDS_UNABLE_SET_LANGUAGE: 352 case XFA_IDS_UNABLE_SET_LANGUAGE:
369 wsString = L"Unable to set language value!"; 353 wsString = L"Unable to set language value!";
370 return; 354 return;
371 case XFA_IDS_UNABLE_SET_NUMPAGES: 355 case XFA_IDS_UNABLE_SET_NUMPAGES:
372 wsString = L"Unable to set numPages value!"; 356 wsString = L"Unable to set numPages value!";
373 return; 357 return;
374 case XFA_IDS_UNABLE_SET_PLATFORM: 358 case XFA_IDS_UNABLE_SET_PLATFORM:
375 wsString = L"Unable to set platform value!"; 359 wsString = L"Unable to set platform value!";
376 return; 360 return;
377 case XFA_IDS_UNABLE_SET_VALIDATIONENABLE: 361 case XFA_IDS_UNABLE_SET_VALIDATIONENABLE:
378 wsString = L"Unable to set validationsEnabled value!"; 362 wsString = L"Unable to set validationsEnabled value!";
379 return; 363 return;
380 case XFA_IDS_UNABLE_SET_VARIATION: 364 case XFA_IDS_UNABLE_SET_VARIATION:
381 wsString = L"Unable to set variation value!"; 365 wsString = L"Unable to set variation value!";
382 return; 366 return;
383 case XFA_IDS_UNABLE_SET_VERSION: 367 case XFA_IDS_UNABLE_SET_VERSION:
384 wsString = L"Unable to set version value!"; 368 wsString = L"Unable to set version value!";
385 return; 369 return;
386 case XFA_IDS_UNABLE_SET_READY: 370 case XFA_IDS_UNABLE_SET_READY:
387 wsString = L"Unable to set ready value!"; 371 wsString = L"Unable to set ready value!";
388 return; 372 return;
389 case XFA_IDS_NUMBER_OF_OCCUR: 373 case XFA_IDS_NUMBER_OF_OCCUR:
390 wsString = L"The element [%s] has violated its allowable number of occurrences"; 374 wsString = L"The element [%s] has violated its allowable number of occur rences";
391 return; 375 return;
392 case XFA_IDS_UNABLE_SET_CLASS_NAME: 376 case XFA_IDS_UNABLE_SET_CLASS_NAME:
393 wsString = L"Unable to set className value!"; 377 wsString = L"Unable to set className value!";
394 return; 378 return;
395 case XFA_IDS_UNABLE_SET_LENGTH_VALUE: 379 case XFA_IDS_UNABLE_SET_LENGTH_VALUE:
396 wsString = L"Unable to set length value!"; 380 wsString = L"Unable to set length value!";
397 return; 381 return;
398 case XFA_IDS_UNSUPPORT_CHAR: 382 case XFA_IDS_UNSUPPORT_CHAR:
399 wsString = L"unsupported char '%c'"; 383 wsString = L"unsupported char '%c'";
400 return; 384 return;
401 case XFA_IDS_BAD_SUFFIX: 385 case XFA_IDS_BAD_SUFFIX:
402 wsString = L"bad suffix on number"; 386 wsString = L"bad suffix on number";
403 return; 387 return;
404 case XFA_IDS_EXPECTED_IDENT: 388 case XFA_IDS_EXPECTED_IDENT:
405 wsString = L"expected identifier instead of '%s'"; 389 wsString = L"expected identifier instead of '%s'";
406 return; 390 return;
407 case XFA_IDS_EXPECTED_STRING: 391 case XFA_IDS_EXPECTED_STRING:
408 wsString = L"expected '%s' instead of '%s'"; 392 wsString = L"expected '%s' instead of '%s'";
409 return; 393 return;
410 case XFA_IDS_INVALIDATE_CHAR: 394 case XFA_IDS_INVALIDATE_CHAR:
411 wsString = L"invalidate char '%c'"; 395 wsString = L"invalidate char '%c'";
412 return; 396 return;
413 case XFA_IDS_REDEFINITION: 397 case XFA_IDS_REDEFINITION:
414 wsString = L"'%s' redefinition "; 398 wsString = L"'%s' redefinition ";
415 return; 399 return;
416 case XFA_IDS_INVALIDATE_TOKEN: 400 case XFA_IDS_INVALIDATE_TOKEN:
417 wsString = L"invalidate token '%s'"; 401 wsString = L"invalidate token '%s'";
418 return; 402 return;
419 case XFA_IDS_INVALIDATE_EXPRESSION: 403 case XFA_IDS_INVALIDATE_EXPRESSION:
420 wsString = L"invalidate expression '%s'"; 404 wsString = L"invalidate expression '%s'";
421 return; 405 return;
422 case XFA_IDS_UNDEFINE_IDENTIFIER: 406 case XFA_IDS_UNDEFINE_IDENTIFIER:
423 wsString = L"undefined identifier '%s'"; 407 wsString = L"undefined identifier '%s'";
424 return; 408 return;
425 case XFA_IDS_INVALIDATE_LEFTVALUE: 409 case XFA_IDS_INVALIDATE_LEFTVALUE:
426 wsString = L"invalidate left-value '%s'"; 410 wsString = L"invalidate left-value '%s'";
427 return; 411 return;
428 case XFA_IDS_COMPILER_ERROR: 412 case XFA_IDS_COMPILER_ERROR:
429 wsString = L"compiler error"; 413 wsString = L"compiler error";
430 return; 414 return;
431 case XFA_IDS_CANNOT_MODIFY_VALUE: 415 case XFA_IDS_CANNOT_MODIFY_VALUE:
432 wsString = L"can't modify the '%s' value"; 416 wsString = L"can't modify the '%s' value";
433 return; 417 return;
434 case XFA_IDS_ERROR_PARAMETERS: 418 case XFA_IDS_ERROR_PARAMETERS:
435 wsString = L"function '%s' has not %d parameters"; 419 wsString = L"function '%s' has not %d parameters";
436 return; 420 return;
437 case XFA_IDS_EXPECT_ENDIF: 421 case XFA_IDS_EXPECT_ENDIF:
438 wsString = L"expected 'endif' instead of '%s'"; 422 wsString = L"expected 'endif' instead of '%s'";
439 return; 423 return;
440 case XFA_IDS_UNEXPECTED_EXPRESSION: 424 case XFA_IDS_UNEXPECTED_EXPRESSION:
441 wsString = L"unexpected expression '%s'"; 425 wsString = L"unexpected expression '%s'";
442 return; 426 return;
443 case XFA_IDS_CONDITION_IS_NULL: 427 case XFA_IDS_CONDITION_IS_NULL:
444 wsString = L"condition is null"; 428 wsString = L"condition is null";
445 return; 429 return;
446 case XFA_IDS_ILLEGALBREAK: 430 case XFA_IDS_ILLEGALBREAK:
447 wsString = L"illegal break"; 431 wsString = L"illegal break";
448 return; 432 return;
449 case XFA_IDS_ILLEGALCONTINUE: 433 case XFA_IDS_ILLEGALCONTINUE:
450 wsString = L"illegal continue"; 434 wsString = L"illegal continue";
451 return; 435 return;
452 case XFA_IDS_EXPECTED_OPERATOR: 436 case XFA_IDS_EXPECTED_OPERATOR:
453 wsString = L"expected operator '%s' instead of '%s'"; 437 wsString = L"expected operator '%s' instead of '%s'";
454 return; 438 return;
455 case XFA_IDS_DIVIDE_ZERO: 439 case XFA_IDS_DIVIDE_ZERO:
456 wsString = L"divide by zero"; 440 wsString = L"divide by zero";
457 return; 441 return;
458 case XFA_IDS_CANNOT_COVERT_OBJECT: 442 case XFA_IDS_CANNOT_COVERT_OBJECT:
459 wsString = L"%s.%s can not covert to object"; 443 wsString = L"%s.%s can not covert to object";
460 return; 444 return;
461 case XFA_IDS_NOT_FOUND_CONTAINER: 445 case XFA_IDS_NOT_FOUND_CONTAINER:
462 wsString = L"can not found container '%s'"; 446 wsString = L"can not found container '%s'";
463 return; 447 return;
464 case XFA_IDS_NOT_FOUND_PROPERTY: 448 case XFA_IDS_NOT_FOUND_PROPERTY:
465 wsString = L"can not found property '%s'"; 449 wsString = L"can not found property '%s'";
466 return; 450 return;
467 case XFA_IDS_NOT_FOUND_METHOD: 451 case XFA_IDS_NOT_FOUND_METHOD:
468 wsString = L"can not found method '%s'"; 452 wsString = L"can not found method '%s'";
469 return; 453 return;
470 case XFA_IDS_NOT_FOUND_CONST: 454 case XFA_IDS_NOT_FOUND_CONST:
471 wsString = L"can not found const '%s'"; 455 wsString = L"can not found const '%s'";
472 return; 456 return;
473 case XFA_IDS_NOT_ASSIGN_OBJECT: 457 case XFA_IDS_NOT_ASSIGN_OBJECT:
474 wsString = L"can not direct assign value to object"; 458 wsString = L"can not direct assign value to object";
475 return; 459 return;
476 case XFA_IDS_IVALIDATE_INSTRUCTION: 460 case XFA_IDS_IVALIDATE_INSTRUCTION:
477 wsString = L"invalidate instruction"; 461 wsString = L"invalidate instruction";
478 return; 462 return;
479 case XFA_IDS_EXPECT_NUMBER: 463 case XFA_IDS_EXPECT_NUMBER:
480 wsString = L"expected number instead of '%s'"; 464 wsString = L"expected number instead of '%s'";
481 return; 465 return;
482 case XFA_IDS_VALIDATE_OUT_ARRAY: 466 case XFA_IDS_VALIDATE_OUT_ARRAY:
483 wsString = L"validate access index '%s' out of array"; 467 wsString = L"validate access index '%s' out of array";
484 return; 468 return;
485 case XFA_IDS_CANNOT_ASSIGN_IDENT: 469 case XFA_IDS_CANNOT_ASSIGN_IDENT:
486 wsString = L"can not assign to %s"; 470 wsString = L"can not assign to %s";
487 return; 471 return;
488 case XFA_IDS_NOT_FOUNT_FUNCTION: 472 case XFA_IDS_NOT_FOUNT_FUNCTION:
489 wsString = L"can not found '%s' function"; 473 wsString = L"can not found '%s' function";
490 return; 474 return;
491 case XFA_IDS_NOT_ARRAY: 475 case XFA_IDS_NOT_ARRAY:
492 wsString = L"'%s' doesn't an array"; 476 wsString = L"'%s' doesn't an array";
493 return; 477 return;
494 case XFA_IDS_OUT_ARRAY: 478 case XFA_IDS_OUT_ARRAY:
495 wsString = L"out of range of '%s' array"; 479 wsString = L"out of range of '%s' array";
496 return; 480 return;
497 case XFA_IDS_NOT_SUPPORT_CALC: 481 case XFA_IDS_NOT_SUPPORT_CALC:
498 wsString = L"'%s' operator can not support array calculate"; 482 wsString = L"'%s' operator can not support array calculate";
499 return; 483 return;
500 case XFA_IDS_ARGUMENT_NOT_ARRAY: 484 case XFA_IDS_ARGUMENT_NOT_ARRAY:
501 wsString = L"'%s' function's %d argument can not be array"; 485 wsString = L"'%s' function's %d argument can not be array";
502 return; 486 return;
503 case XFA_IDS_ARGUMENT_EXPECT_CONTAINER: 487 case XFA_IDS_ARGUMENT_EXPECT_CONTAINER:
504 wsString = L"'%s' argument expected a container"; 488 wsString = L"'%s' argument expected a container";
505 return; 489 return;
506 case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT: 490 case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT:
507 wsString = L"an attempt was made to reference property '%s' of a non-object in SOM expression %s"; 491 wsString = L"an attempt was made to reference property '%s' of a non-obj ect in SOM expression %s";
508 return; 492 return;
509 case XFA_IDS_FUNCTION_IS_BUILDIN: 493 case XFA_IDS_FUNCTION_IS_BUILDIN:
510 wsString = L"function '%s' is buildin"; 494 wsString = L"function '%s' is buildin";
511 return; 495 return;
512 case XFA_IDS_ERROR_MSG: 496 case XFA_IDS_ERROR_MSG:
513 wsString = L"%s : %s"; 497 wsString = L"%s : %s";
514 return; 498 return;
515 case XFA_IDS_INDEX_OUT_OF_BOUNDS: 499 case XFA_IDS_INDEX_OUT_OF_BOUNDS:
516 wsString = L"Index value is out of bounds"; 500 wsString = L"Index value is out of bounds";
517 return; 501 return;
518 case XFA_IDS_INCORRECT_NUMBER_OF_METHOD: 502 case XFA_IDS_INCORRECT_NUMBER_OF_METHOD:
519 wsString = L"Incorrect number of parameters calling method '%s'" ; 503 wsString = L"Incorrect number of parameters calling method '%s'";
520 return; 504 return;
521 case XFA_IDS_ARGUMENT_MISMATCH: 505 case XFA_IDS_ARGUMENT_MISMATCH:
522 wsString = L"Argument mismatch in property or function argument" ; 506 wsString = L"Argument mismatch in property or function argument";
523 return; 507 return;
524 case XFA_IDS_INVALID_ENUMERATE: 508 case XFA_IDS_INVALID_ENUMERATE:
525 wsString = L"Invalid enumerated value: %s"; 509 wsString = L"Invalid enumerated value: %s";
526 return; 510 return;
527 case XFA_IDS_INVALID_APPEND: 511 case XFA_IDS_INVALID_APPEND:
528 wsString = L"Invalid append operation: %s cannot have a child el ement of %s"; 512 wsString = L"Invalid append operation: %s cannot have a child element of %s";
529 return; 513 return;
530 case XFA_IDS_SOM_EXPECTED_LIST: 514 case XFA_IDS_SOM_EXPECTED_LIST:
531 wsString = L"SOM expression returned list when single result was expected"; 515 wsString = L"SOM expression returned list when single result was expecte d";
532 return; 516 return;
533 case XFA_IDS_NOT_HAVE_PROPERTY: 517 case XFA_IDS_NOT_HAVE_PROPERTY:
534 wsString = L"'%s' doesn't have property '%s'"; 518 wsString = L"'%s' doesn't have property '%s'";
535 return; 519 return;
536 case XFA_IDS_INVALID_NODE_TYPE: 520 case XFA_IDS_INVALID_NODE_TYPE:
537 wsString = L"Invalid node type : '%s'"; 521 wsString = L"Invalid node type : '%s'";
538 return; 522 return;
539 case XFA_IDS_VIOLATE_BOUNDARY: 523 case XFA_IDS_VIOLATE_BOUNDARY:
540 wsString = L"The element [%s] has violated its allowable number of occurrences"; 524 wsString = L"The element [%s] has violated its allowable number of occur rences";
541 return; 525 return;
542 case XFA_IDS_SERVER_DENY: 526 case XFA_IDS_SERVER_DENY:
543 wsString = L"Server does not permit"; 527 wsString = L"Server does not permit";
544 return; 528 return;
545 /*case XFA_IDS_StringWeekDay_Sun: 529 case XFA_IDS_ValidateLimit:
546 wsString = L"?¨¹¨¨?"; 530 wsString = FX_WSTRC(L"Message limit exceeded. Remaining %d validation er rors not reported.");
547 return; 531 return;
548 case XFA_IDS_StringWeekDay_Mon: 532 case XFA_IDS_ValidateNullWarning:
549 wsString = L"?¨¹¨°?"; 533 wsString = FX_WSTRC(L"%s cannot be left blank. To ignore validations for %s, click Ignore.");
550 return; 534 return;
551 case XFA_IDS_StringWeekDay_Tue: 535 case XFA_IDS_ValidateNullError:
552 wsString = L"?¨¹?t"; 536 wsString = FX_WSTRC(L"%s cannot be left blank.");
553 return; 537 return;
554 case XFA_IDS_StringWeekDay_Wed: 538 case XFA_IDS_ValidateWarning:
555 wsString = L"?¨¹¨¨y"; 539 wsString = FX_WSTRC(L"The value you entered for %s is invalid. To ignore validations for %s, click Ignore.");
556 return; 540 return;
557 case XFA_IDS_StringWeekDay_Thu: 541 case XFA_IDS_ValidateError:
558 wsString = L"?¨¹??"; 542 wsString = FX_WSTRC(L"The value you entered for %s is invalid.");
559 return; 543 return;
560 case XFA_IDS_StringWeekDay_Fri: 544 }
561 wsString = L"?¨¹??";
562 return;
563 case XFA_IDS_StringWeekDay_Sat:
564 wsString = L"?¨¹¨¢¨´";
565 return;
566 case XFA_IDS_StringMonth_Jan:
567 wsString = L"1??";
568 return;
569 case XFA_IDS_StringMonth_Feb:
570 wsString = L"2??";
571 return;
572 case XFA_IDS_StringMonth_March:
573 wsString = L"3??";
574 return;
575 case XFA_IDS_StringMonth_April:
576 wsString = L"4??";
577 return;
578 case XFA_IDS_StringMonth_May:
579 wsString = L"5??";
580 return;
581 case XFA_IDS_StringMonth_June:
582 wsString = L"6??";
583 return;
584 case XFA_IDS_StringMonth_July:
585 wsString = L"7??";
586 return;
587 case XFA_IDS_StringMonth_Aug:
588 wsString = L"8??";
589 return;
590 case XFA_IDS_StringMonth_Sept:
591 wsString = L"9??";
592 return;
593 case XFA_IDS_StringMonth_Oct:
594 wsString = L"10??";
595 return;
596 case XFA_IDS_StringMonth_Nov:
597 wsString = L"11??";
598 return;
599 case XFA_IDS_StringMonth_Dec:
600 wsString = L"12??";
601 return;
602 case XFA_IDS_String_Today:
603 wsString = L"??¨¬¨¬";
604 return;*/
605 case XFA_IDS_ValidateLimit:
606 wsString = FX_WSTRC(L"Message limit exceeded. Remaining %d valid ation errors not reported.");
607 return;
608 case XFA_IDS_ValidateNullWarning:
609 wsString = FX_WSTRC(L"%s cannot be left blank. To ignore validat ions for %s, click Ignore.");
610 return;
611 case XFA_IDS_ValidateNullError:
612 wsString = FX_WSTRC(L"%s cannot be left blank.");
613 return;
614 case XFA_IDS_ValidateWarning:
615 wsString = FX_WSTRC(L"The value you entered for %s is invalid. T o ignore validations for %s, click Ignore.");
616 return;
617 case XFA_IDS_ValidateError:
618 wsString = FX_WSTRC(L"The value you entered for %s is invalid.") ;
619 return;
620 }
621 545
622 } 546 }
623 547
624 FX_BOOL CPDFXFA_App::ShowFileDialog(FX_WSTR wsTitle, FX_WSTR wsFilter, CFX_WideS tringArray &wsPathArr, FX_BOOL bOpen) 548 FX_BOOL CPDFXFA_App::ShowFileDialog(FX_WSTR wsTitle, FX_WSTR wsFilter, CFX_WideS tringArray &wsPathArr, FX_BOOL bOpen)
625 { 549 {
626 » //if (m_pEnv) 550 return FALSE;
627 » //{
628 » //» return m_pEnv->FFI_ShowFileDialog(wsTitle.GetPtr(), wsFilter.Get Ptr(), wsPathArr, bOpen);
629 » //}
630 » return FALSE;
631 } 551 }
632 552
633 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() 553 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr()
634 { 554 {
635 » CXFA_FWLAdapterTimerMgr* pAdapter = NULL; 555 CXFA_FWLAdapterTimerMgr* pAdapter = NULL;
636 » CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); 556 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
637 » if (pEnv) 557 if (pEnv)
638 » » pAdapter = FX_NEW CXFA_FWLAdapterTimerMgr(pEnv); 558 pAdapter = FX_NEW CXFA_FWLAdapterTimerMgr(pEnv);
639 » return pAdapter; 559 return pAdapter;
640 } 560 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdfview.cpp ('k') | fpdfsdk/src/fsdk_mgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698