Chromium Code Reviews| 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/fpdfxfa/include/fpdfxfa_app.h" | 7 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_app.h" |
| 8 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" | 8 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h" |
| 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" | 9 #include "fpdfsdk/fpdfxfa/include/fpdfxfa_util.h" |
| 10 #include "fpdfsdk/include/fsdk_define.h" | 10 #include "fpdfsdk/include/fsdk_define.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 250 | 250 |
| 251 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, | 251 FX_BOOL CPDFXFA_App::PutRequestURL(const CFX_WideString& wsURL, |
| 252 const CFX_WideString& wsData, | 252 const CFX_WideString& wsData, |
| 253 const CFX_WideString& wsEncode) { | 253 const CFX_WideString& wsEncode) { |
| 254 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); | 254 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 255 return pEnv && | 255 return pEnv && |
| 256 pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), | 256 pEnv->FFI_PutRequestURL(wsURL.c_str(), wsData.c_str(), |
| 257 wsEncode.c_str()); | 257 wsEncode.c_str()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { | 260 void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { |
|
Tom Sepez
2016/06/01 17:58:18
follow-up: return string as value.
dsinclair
2016/06/01 19:30:41
Acknowledged.
| |
| 261 switch (iStringID) { | 261 switch (iStringID) { |
| 262 case XFA_IDS_ValidateFailed: | 262 case XFA_IDS_ValidateFailed: |
| 263 wsString = L"%s validate failed"; | 263 wsString = L"%s validation failed"; |
| 264 return; | 264 return; |
| 265 case XFA_IDS_CalcOverride: | 265 case XFA_IDS_CalcOverride: |
| 266 wsString = L"Calculate Override"; | 266 wsString = L"Calculate Override"; |
| 267 return; | 267 return; |
| 268 case XFA_IDS_ModifyField: | 268 case XFA_IDS_ModifyField: |
| 269 wsString = L"Are you sure you want to modify this field?"; | 269 wsString = L"Are you sure you want to modify this field?"; |
| 270 return; | 270 return; |
| 271 case XFA_IDS_NotModifyField: | 271 case XFA_IDS_NotModifyField: |
| 272 wsString = L"You are not allowed to modify this field."; | 272 wsString = L"You are not allowed to modify this field."; |
| 273 return; | 273 return; |
| 274 case XFA_IDS_AppName: | 274 case XFA_IDS_AppName: |
| 275 wsString = L"Foxit"; | 275 wsString = L"PDFium"; |
|
dsinclair
2016/06/01 15:30:50
I renamed this to PDFium as I thought it made more
Tom Sepez
2016/06/01 17:58:18
Acknowledged.
Lei Zhang
2016/06/01 18:10:17
BTW, JS_STR_VIEWERTYPE is "pdfium"
dsinclair
2016/06/01 19:30:41
Switched to pdfium.
| |
| 276 return; | |
| 277 case XFA_IDS_ImageFilter: | |
| 278 wsString = | |
| 279 L"Image " | |
| 280 L"Files(*.bmp;*.jpg;*.png;*.gif;*.tif)|*.bmp;*.jpg;*.png;*.gif;*.tif|" | |
| 281 L"All Files(*.*)|*.*||"; | |
| 282 return; | |
| 283 case XFA_IDS_UNKNOW_CATCHED: | |
| 284 wsString = L"unknown error is catched!"; | |
| 285 return; | 276 return; |
| 286 case XFA_IDS_Unable_TO_SET: | 277 case XFA_IDS_Unable_TO_SET: |
| 287 wsString = L"Unable to set "; | 278 wsString = L"Unable to set "; |
| 288 return; | 279 return; |
| 289 case XFA_IDS_VALUE_EXCALMATORY: | |
| 290 wsString = L" value!"; | |
| 291 return; | |
| 292 case XFA_IDS_INVALID_ENUM_VALUE: | |
| 293 wsString = L"Invalid enumerated value: "; | |
| 294 return; | |
| 295 case XFA_IDS_UNSUPPORT_METHOD: | |
| 296 wsString = L"unsupport %s method."; | |
| 297 return; | |
| 298 case XFA_IDS_UNSUPPORT_PROP: | |
| 299 wsString = L"unsupport %s property."; | |
| 300 return; | |
| 301 case XFA_IDS_INVAlID_PROP_SET: | 280 case XFA_IDS_INVAlID_PROP_SET: |
| 302 wsString = L"Invalid property set operation;"; | 281 wsString = L"Invalid property set operation."; |
| 303 return; | 282 return; |
| 304 case XFA_IDS_NOT_DEFAUL_VALUE: | 283 case XFA_IDS_NOT_DEFAUL_VALUE: |
| 305 wsString = L" doesn't have a default property"; | 284 wsString = L" doesn't have a default property."; |
| 306 return; | 285 return; |
| 307 case XFA_IDS_UNABLE_SET_LANGUAGE: | 286 case XFA_IDS_UNABLE_SET_LANGUAGE: |
| 308 wsString = L"Unable to set language value!"; | 287 wsString = L"Unable to set language value."; |
| 309 return; | 288 return; |
| 310 case XFA_IDS_UNABLE_SET_NUMPAGES: | 289 case XFA_IDS_UNABLE_SET_NUMPAGES: |
| 311 wsString = L"Unable to set numPages value!"; | 290 wsString = L"Unable to set numPages value."; |
| 312 return; | 291 return; |
| 313 case XFA_IDS_UNABLE_SET_PLATFORM: | 292 case XFA_IDS_UNABLE_SET_PLATFORM: |
| 314 wsString = L"Unable to set platform value!"; | 293 wsString = L"Unable to set platform value."; |
| 315 return; | |
| 316 case XFA_IDS_UNABLE_SET_VALIDATIONENABLE: | |
| 317 wsString = L"Unable to set validationsEnabled value!"; | |
| 318 return; | 294 return; |
| 319 case XFA_IDS_UNABLE_SET_VARIATION: | 295 case XFA_IDS_UNABLE_SET_VARIATION: |
| 320 wsString = L"Unable to set variation value!"; | 296 wsString = L"Unable to set variation value."; |
| 321 return; | 297 return; |
| 322 case XFA_IDS_UNABLE_SET_VERSION: | 298 case XFA_IDS_UNABLE_SET_VERSION: |
| 323 wsString = L"Unable to set version value!"; | 299 wsString = L"Unable to set version value."; |
| 324 return; | 300 return; |
| 325 case XFA_IDS_UNABLE_SET_READY: | 301 case XFA_IDS_UNABLE_SET_READY: |
| 326 wsString = L"Unable to set ready value!"; | 302 wsString = L"Unable to set ready value."; |
| 327 return; | |
| 328 case XFA_IDS_NUMBER_OF_OCCUR: | |
| 329 wsString = | |
| 330 L"The element [%s] has violated its allowable number of occurrences"; | |
| 331 return; | |
| 332 case XFA_IDS_UNABLE_SET_CLASS_NAME: | |
| 333 wsString = L"Unable to set className value!"; | |
| 334 return; | |
| 335 case XFA_IDS_UNABLE_SET_LENGTH_VALUE: | |
| 336 wsString = L"Unable to set length value!"; | |
| 337 return; | |
| 338 case XFA_IDS_UNSUPPORT_CHAR: | |
| 339 wsString = L"unsupported char '%c'"; | |
| 340 return; | |
| 341 case XFA_IDS_BAD_SUFFIX: | |
| 342 wsString = L"bad suffix on number"; | |
| 343 return; | |
| 344 case XFA_IDS_EXPECTED_IDENT: | |
| 345 wsString = L"expected identifier instead of '%s'"; | |
| 346 return; | |
| 347 case XFA_IDS_EXPECTED_STRING: | |
| 348 wsString = L"expected '%s' instead of '%s'"; | |
| 349 return; | |
| 350 case XFA_IDS_INVALIDATE_CHAR: | |
| 351 wsString = L"invalidate char '%c'"; | |
| 352 return; | |
| 353 case XFA_IDS_REDEFINITION: | |
| 354 wsString = L"'%s' redefinition "; | |
| 355 return; | |
| 356 case XFA_IDS_INVALIDATE_TOKEN: | |
| 357 wsString = L"invalidate token '%s'"; | |
| 358 return; | |
| 359 case XFA_IDS_INVALIDATE_EXPRESSION: | |
| 360 wsString = L"invalidate expression '%s'"; | |
| 361 return; | |
| 362 case XFA_IDS_UNDEFINE_IDENTIFIER: | |
| 363 wsString = L"undefined identifier '%s'"; | |
| 364 return; | |
| 365 case XFA_IDS_INVALIDATE_LEFTVALUE: | |
| 366 wsString = L"invalidate left-value '%s'"; | |
| 367 return; | 303 return; |
| 368 case XFA_IDS_COMPILER_ERROR: | 304 case XFA_IDS_COMPILER_ERROR: |
| 369 wsString = L"compiler error"; | 305 wsString = L"Compiler error."; |
| 370 return; | |
| 371 case XFA_IDS_CANNOT_MODIFY_VALUE: | |
| 372 wsString = L"can't modify the '%s' value"; | |
| 373 return; | |
| 374 case XFA_IDS_ERROR_PARAMETERS: | |
| 375 wsString = L"function '%s' has not %d parameters"; | |
| 376 return; | |
| 377 case XFA_IDS_EXPECT_ENDIF: | |
| 378 wsString = L"expected 'endif' instead of '%s'"; | |
| 379 return; | |
| 380 case XFA_IDS_UNEXPECTED_EXPRESSION: | |
| 381 wsString = L"unexpected expression '%s'"; | |
| 382 return; | |
| 383 case XFA_IDS_CONDITION_IS_NULL: | |
| 384 wsString = L"condition is null"; | |
| 385 return; | |
| 386 case XFA_IDS_ILLEGALBREAK: | |
| 387 wsString = L"illegal break"; | |
| 388 return; | |
| 389 case XFA_IDS_ILLEGALCONTINUE: | |
| 390 wsString = L"illegal continue"; | |
| 391 return; | |
| 392 case XFA_IDS_EXPECTED_OPERATOR: | |
| 393 wsString = L"expected operator '%s' instead of '%s'"; | |
| 394 return; | 306 return; |
| 395 case XFA_IDS_DIVIDE_ZERO: | 307 case XFA_IDS_DIVIDE_ZERO: |
| 396 wsString = L"divide by zero"; | 308 wsString = L"Divide by zero."; |
| 397 return; | |
| 398 case XFA_IDS_CANNOT_COVERT_OBJECT: | |
| 399 wsString = L"%s.%s can not covert to object"; | |
| 400 return; | |
| 401 case XFA_IDS_NOT_FOUND_CONTAINER: | |
| 402 wsString = L"can not found container '%s'"; | |
| 403 return; | |
| 404 case XFA_IDS_NOT_FOUND_PROPERTY: | |
| 405 wsString = L"can not found property '%s'"; | |
| 406 return; | |
| 407 case XFA_IDS_NOT_FOUND_METHOD: | |
| 408 wsString = L"can not found method '%s'"; | |
| 409 return; | |
| 410 case XFA_IDS_NOT_FOUND_CONST: | |
| 411 wsString = L"can not found const '%s'"; | |
| 412 return; | |
| 413 case XFA_IDS_NOT_ASSIGN_OBJECT: | |
| 414 wsString = L"can not direct assign value to object"; | |
| 415 return; | |
| 416 case XFA_IDS_IVALIDATE_INSTRUCTION: | |
| 417 wsString = L"invalidate instruction"; | |
| 418 return; | |
| 419 case XFA_IDS_EXPECT_NUMBER: | |
| 420 wsString = L"expected number instead of '%s'"; | |
| 421 return; | |
| 422 case XFA_IDS_VALIDATE_OUT_ARRAY: | |
| 423 wsString = L"validate access index '%s' out of array"; | |
| 424 return; | |
| 425 case XFA_IDS_CANNOT_ASSIGN_IDENT: | |
| 426 wsString = L"can not assign to %s"; | |
| 427 return; | |
| 428 case XFA_IDS_NOT_FOUNT_FUNCTION: | |
| 429 wsString = L"can not found '%s' function"; | |
| 430 return; | |
| 431 case XFA_IDS_NOT_ARRAY: | |
| 432 wsString = L"'%s' doesn't an array"; | |
| 433 return; | |
| 434 case XFA_IDS_OUT_ARRAY: | |
| 435 wsString = L"out of range of '%s' array"; | |
| 436 return; | |
| 437 case XFA_IDS_NOT_SUPPORT_CALC: | |
| 438 wsString = L"'%s' operator can not support array calculate"; | |
| 439 return; | |
| 440 case XFA_IDS_ARGUMENT_NOT_ARRAY: | |
| 441 wsString = L"'%s' function's %d argument can not be array"; | |
| 442 return; | |
| 443 case XFA_IDS_ARGUMENT_EXPECT_CONTAINER: | |
| 444 wsString = L"'%s' argument expected a container"; | |
| 445 return; | 309 return; |
| 446 case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT: | 310 case XFA_IDS_ACCESS_PROPERTY_IN_NOT_OBJECT: |
| 447 wsString = | 311 wsString = |
| 448 L"an attempt was made to reference property '%s' of a non-object in " | 312 L"An attempt was made to reference property '%s' of a non-object in " |
| 449 L"SOM expression %s"; | 313 L"SOM expression %s."; |
| 450 return; | |
| 451 case XFA_IDS_FUNCTION_IS_BUILDIN: | |
| 452 wsString = L"function '%s' is buildin"; | |
| 453 return; | |
| 454 case XFA_IDS_ERROR_MSG: | |
| 455 wsString = L"%s : %s"; | |
| 456 return; | 314 return; |
| 457 case XFA_IDS_INDEX_OUT_OF_BOUNDS: | 315 case XFA_IDS_INDEX_OUT_OF_BOUNDS: |
| 458 wsString = L"Index value is out of bounds"; | 316 wsString = L"Index value is out of bounds."; |
| 459 return; | 317 return; |
| 460 case XFA_IDS_INCORRECT_NUMBER_OF_METHOD: | 318 case XFA_IDS_INCORRECT_NUMBER_OF_METHOD: |
| 461 wsString = L"Incorrect number of parameters calling method '%s'"; | 319 wsString = L"Incorrect number of parameters calling method '%s'."; |
| 462 return; | 320 return; |
| 463 case XFA_IDS_ARGUMENT_MISMATCH: | 321 case XFA_IDS_ARGUMENT_MISMATCH: |
| 464 wsString = L"Argument mismatch in property or function argument"; | 322 wsString = L"Argument mismatch in property or function argument."; |
| 465 return; | |
| 466 case XFA_IDS_INVALID_ENUMERATE: | |
| 467 wsString = L"Invalid enumerated value: %s"; | |
| 468 return; | |
| 469 case XFA_IDS_INVALID_APPEND: | |
| 470 wsString = | |
| 471 L"Invalid append operation: %s cannot have a child element of %s"; | |
| 472 return; | |
| 473 case XFA_IDS_SOM_EXPECTED_LIST: | |
| 474 wsString = | |
| 475 L"SOM expression returned list when single result was expected"; | |
| 476 return; | 323 return; |
| 477 case XFA_IDS_NOT_HAVE_PROPERTY: | 324 case XFA_IDS_NOT_HAVE_PROPERTY: |
| 478 wsString = L"'%s' doesn't have property '%s'"; | 325 wsString = L"'%s' doesn't have property '%s'."; |
| 479 return; | |
| 480 case XFA_IDS_INVALID_NODE_TYPE: | |
| 481 wsString = L"Invalid node type : '%s'"; | |
| 482 return; | 326 return; |
| 483 case XFA_IDS_VIOLATE_BOUNDARY: | 327 case XFA_IDS_VIOLATE_BOUNDARY: |
| 484 wsString = | 328 wsString = |
| 485 L"The element [%s] has violated its allowable number of occurrences"; | 329 L"The element [%s] has violated its allowable number of occurrences."; |
| 486 return; | 330 return; |
| 487 case XFA_IDS_SERVER_DENY: | 331 case XFA_IDS_SERVER_DENY: |
| 488 wsString = L"Server does not permit"; | 332 wsString = L"Server does not permit."; |
| 489 return; | 333 return; |
| 490 case XFA_IDS_ValidateLimit: | 334 case XFA_IDS_ValidateLimit: |
| 491 wsString = FX_WSTRC( | 335 wsString = FX_WSTRC( |
|
Tom Sepez
2016/06/01 17:58:18
pointless WSTRC (several places).
dsinclair
2016/06/01 19:30:41
Done.
| |
| 492 L"Message limit exceeded. Remaining %d validation errors not " | 336 L"Message limit exceeded. Remaining %d validation errors not " |
| 493 L"reported."); | 337 L"reported."); |
| 494 return; | 338 return; |
| 495 case XFA_IDS_ValidateNullWarning: | 339 case XFA_IDS_ValidateNullWarning: |
| 496 wsString = FX_WSTRC( | 340 wsString = FX_WSTRC( |
| 497 L"%s cannot be left blank. To ignore validations for %s, click " | 341 L"%s cannot be blank. To ignore validations for %s, click Ignore."); |
| 498 L"Ignore."); | |
| 499 return; | 342 return; |
| 500 case XFA_IDS_ValidateNullError: | 343 case XFA_IDS_ValidateNullError: |
| 501 wsString = FX_WSTRC(L"%s cannot be left blank."); | 344 wsString = FX_WSTRC(L"%s cannot be blank."); |
| 502 return; | 345 return; |
| 503 case XFA_IDS_ValidateWarning: | 346 case XFA_IDS_ValidateWarning: |
| 504 wsString = FX_WSTRC( | 347 wsString = FX_WSTRC( |
| 505 L"The value you entered for %s is invalid. To ignore validations for " | 348 L"The value you entered for %s is invalid. To ignore validations for " |
| 506 L"%s, click Ignore."); | 349 L"%s, click Ignore."); |
| 507 return; | 350 return; |
| 508 case XFA_IDS_ValidateError: | 351 case XFA_IDS_ValidateError: |
| 509 wsString = FX_WSTRC(L"The value you entered for %s is invalid."); | 352 wsString = FX_WSTRC(L"The value you entered for %s is invalid."); |
| 510 return; | 353 return; |
| 511 } | 354 } |
| 512 } | 355 } |
| 513 | 356 |
| 514 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { | 357 IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() { |
| 515 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; | 358 CXFA_FWLAdapterTimerMgr* pAdapter = NULL; |
| 516 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); | 359 CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0); |
| 517 if (pEnv) | 360 if (pEnv) |
| 518 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); | 361 pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv); |
| 519 return pAdapter; | 362 return pAdapter; |
| 520 } | 363 } |
| OLD | NEW |