1e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Copyright 2014 PDFium Authors. All rights reserved. 2e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Use of this source code is governed by a BSD-style license that can be 3e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// found in the LICENSE file. 4e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 5e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 7ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann#include "resource.h" 8e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 9ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. MoltmannCFX_WideString JSGetStringFromID(CJS_Context* pContext, FX_UINT id) { 10ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann switch (id) { 11e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSALERT: 12ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Alert"; 13e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSPARAMERROR: 14ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Incorrect number of parameters passed to function."; 15e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSAFNUMBER_KEYSTROKE: 16ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value is invalid."; 17e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSPARAM_TOOLONG: 18ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value is too long."; 19e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSPARSEDATE: 20ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value can't be parsed as a valid date/time (%s)."; 21e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSRANGE1: 22ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value must be greater than or equal to %s" 23ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann L" and less than or equal to %s."; 24e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSRANGE2: 25ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value must be greater than or equal to %s."; 26e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSRANGE3: 27ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The input value must be less than or equal to %s."; 28e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_NOTSUPPORT: 29ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Operation not supported."; 30e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSBUSY: 31ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"System is busy."; 32e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSEVENT: 33ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Duplicate formfield event found."; 34e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_RUN: 35ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Script ran successfully."; 36e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSPRINT1: 37ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The second parameter can't be converted to a Date."; 38e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSPRINT2: 39ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"The second parameter is an invalid Date!"; 40e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSNOGLOBAL: 41ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Global value not found."; 42e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSREADONLY: 43ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Cannot assign to readonly property."; 44e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSTYPEERROR: 45ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Incorrect parameter type."; 46e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov case IDS_STRING_JSVALUEERROR: 47ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L"Incorrect parameter value."; 48e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov default: 49ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return L""; 50ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann } 51e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} 52e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov 53e6986e1e8d4a57987f47c215490cb080a65ee29aSvet GanovCFX_WideString JSFormatErrorString(const char* class_name, 54e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov const char* property_name, 55e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov const CFX_WideString& details) { 56ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann CFX_WideString result = CFX_WideString::FromLocal(class_name); 57ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann if (property_name) { 58ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann result += L"."; 59ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann result += CFX_WideString::FromLocal(property_name); 60ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann } 61ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann result += L": "; 62ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann result += details; 63ac3d58cff7c80b0ef56bf55130d91da17cbaa3c4Philip P. Moltmann return result; 64e6986e1e8d4a57987f47c215490cb080a65ee29aSvet Ganov} 65