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 #include "fpdfsdk/javascript/resource.h" | 7 #include "fpdfsdk/javascript/resource.h" |
8 | 8 |
9 CFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id) { | 9 CFX_WideString JSGetStringFromID(FX_UINT id) { |
10 switch (id) { | 10 switch (id) { |
11 case IDS_STRING_JSALERT: | 11 case IDS_STRING_JSALERT: |
12 return L"Alert"; | 12 return L"Alert"; |
13 case IDS_STRING_JSPARAMERROR: | 13 case IDS_STRING_JSPARAMERROR: |
14 return L"Incorrect number of parameters passed to function."; | 14 return L"Incorrect number of parameters passed to function."; |
15 case IDS_STRING_JSAFNUMBER_KEYSTROKE: | 15 case IDS_STRING_JSAFNUMBER_KEYSTROKE: |
16 return L"The input value is invalid."; | 16 return L"The input value is invalid."; |
17 case IDS_STRING_JSPARAM_TOOLONG: | 17 case IDS_STRING_JSPARAM_TOOLONG: |
18 return L"The input value is too long."; | 18 return L"The input value is too long."; |
19 case IDS_STRING_JSPARSEDATE: | 19 case IDS_STRING_JSPARSEDATE: |
20 return L"The input value can't be parsed as a valid date/time (%s)."; | 20 return L"The input value can't be parsed as a valid date/time (%s)."; |
21 case IDS_STRING_JSRANGE1: | 21 case IDS_STRING_JSRANGE1: |
22 return L"The input value must be greater than or equal to %s" | 22 return L"The input value must be greater than or equal to %s" |
23 L" and less than or equal to %s."; | 23 L" and less than or equal to %s."; |
24 case IDS_STRING_JSRANGE2: | 24 case IDS_STRING_JSRANGE2: |
25 return L"The input value must be greater than or equal to %s."; | 25 return L"The input value must be greater than or equal to %s."; |
26 case IDS_STRING_JSRANGE3: | 26 case IDS_STRING_JSRANGE3: |
27 return L"The input value must be less than or equal to %s."; | 27 return L"The input value must be less than or equal to %s."; |
28 case IDS_STRING_NOTSUPPORT: | 28 case IDS_STRING_JSNOTSUPPORT: |
29 return L"Operation not supported."; | 29 return L"Operation not supported."; |
30 case IDS_STRING_JSBUSY: | 30 case IDS_STRING_JSBUSY: |
31 return L"System is busy."; | 31 return L"System is busy."; |
32 case IDS_STRING_JSEVENT: | 32 case IDS_STRING_JSEVENT: |
33 return L"Duplicate formfield event found."; | 33 return L"Duplicate formfield event found."; |
34 case IDS_STRING_RUN: | 34 case IDS_STRING_RUN: |
35 return L"Script ran successfully."; | 35 return L"Script ran successfully."; |
36 case IDS_STRING_JSPRINT1: | 36 case IDS_STRING_JSPRINT1: |
37 return L"The second parameter can't be converted to a Date."; | 37 return L"The second parameter can't be converted to a Date."; |
38 case IDS_STRING_JSPRINT2: | 38 case IDS_STRING_JSPRINT2: |
39 return L"The second parameter is an invalid Date!"; | 39 return L"The second parameter is an invalid Date!"; |
40 case IDS_STRING_JSNOGLOBAL: | 40 case IDS_STRING_JSNOGLOBAL: |
41 return L"Global value not found."; | 41 return L"Global value not found."; |
42 case IDS_STRING_JSREADONLY: | 42 case IDS_STRING_JSREADONLY: |
43 return L"Cannot assign to readonly property."; | 43 return L"Cannot assign to readonly property."; |
44 case IDS_STRING_JSTYPEERROR: | 44 case IDS_STRING_JSTYPEERROR: |
45 return L"Incorrect parameter type."; | 45 return L"Incorrect parameter type."; |
46 case IDS_STRING_JSVALUEERROR: | 46 case IDS_STRING_JSVALUEERROR: |
47 return L"Incorrect parameter value."; | 47 return L"Incorrect parameter value."; |
| 48 case IDS_STRING_JSNOPERMISSION: |
| 49 return L"Permission denied."; |
| 50 case IDS_STRING_JSBADOBJECT: |
| 51 return L"Object no longer exists."; |
48 default: | 52 default: |
49 return L""; | 53 return L""; |
50 } | 54 } |
51 } | 55 } |
52 | 56 |
53 CFX_WideString JSFormatErrorString(const char* class_name, | 57 CFX_WideString JSFormatErrorString(const char* class_name, |
54 const char* property_name, | 58 const char* property_name, |
55 const CFX_WideString& details) { | 59 const CFX_WideString& details) { |
56 CFX_WideString result = CFX_WideString::FromLocal(class_name); | 60 CFX_WideString result = CFX_WideString::FromLocal(class_name); |
57 if (property_name) { | 61 if (property_name) { |
58 result += L"."; | 62 result += L"."; |
59 result += CFX_WideString::FromLocal(property_name); | 63 result += CFX_WideString::FromLocal(property_name); |
60 } | 64 } |
61 result += L": "; | 65 result += L": "; |
62 result += details; | 66 result += details; |
63 return result; | 67 return result; |
64 } | 68 } |
OLD | NEW |