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

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

Powered by Google App Engine
This is Rietveld 408576698