| 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 #ifndef FPDFSDK_JAVASCRIPT_FIELD_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_FIELD_H_ |
| 8 #define FPDFSDK_JAVASCRIPT_FIELD_H_ | 8 #define FPDFSDK_JAVASCRIPT_FIELD_H_ |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 CPDF_FormControl* pFormControl, | 428 CPDF_FormControl* pFormControl, |
| 429 bool createIfNeeded); | 429 bool createIfNeeded); |
| 430 static std::vector<CPDF_FormField*> GetFormFields( | 430 static std::vector<CPDF_FormField*> GetFormFields( |
| 431 CPDFSDK_Document* pDocument, | 431 CPDFSDK_Document* pDocument, |
| 432 const CFX_WideString& csFieldName); | 432 const CFX_WideString& csFieldName); |
| 433 | 433 |
| 434 static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData); | 434 static void DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData); |
| 435 | 435 |
| 436 FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName); | 436 FX_BOOL AttachField(Document* pDocument, const CFX_WideString& csFieldName); |
| 437 void SetDelay(FX_BOOL bDelay); | 437 void SetDelay(FX_BOOL bDelay); |
| 438 void SetIsolate(v8::Isolate* isolate) { m_isolate = isolate; } | |
| 439 | 438 |
| 440 protected: | 439 protected: |
| 441 void ParseFieldName(const std::wstring& strFieldNameParsed, | 440 void ParseFieldName(const std::wstring& strFieldNameParsed, |
| 442 std::wstring& strFieldName, | 441 std::wstring& strFieldName, |
| 443 int& iControlNo); | 442 int& iControlNo); |
| 444 std::vector<CPDF_FormField*> GetFormFields( | 443 std::vector<CPDF_FormField*> GetFormFields( |
| 445 const CFX_WideString& csFieldName) const; | 444 const CFX_WideString& csFieldName) const; |
| 446 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); | 445 CPDF_FormControl* GetSmartFieldControl(CPDF_FormField* pFormField); |
| 447 FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); | 446 FX_BOOL ValueIsOccur(CPDF_FormField* pFormField, CFX_WideString csOptLabel); |
| 448 | 447 |
| 449 void AddDelay_Int(FIELD_PROP prop, int32_t n); | 448 void AddDelay_Int(FIELD_PROP prop, int32_t n); |
| 450 void AddDelay_Bool(FIELD_PROP prop, bool b); | 449 void AddDelay_Bool(FIELD_PROP prop, bool b); |
| 451 void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string); | 450 void AddDelay_String(FIELD_PROP prop, const CFX_ByteString& string); |
| 452 void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string); | 451 void AddDelay_WideString(FIELD_PROP prop, const CFX_WideString& string); |
| 453 void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect); | 452 void AddDelay_Rect(FIELD_PROP prop, const CFX_FloatRect& rect); |
| 454 void AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color); | 453 void AddDelay_Color(FIELD_PROP prop, const CPWL_Color& color); |
| 455 void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array); | 454 void AddDelay_WordArray(FIELD_PROP prop, const std::vector<uint32_t>& array); |
| 456 void AddDelay_WideStringArray(FIELD_PROP prop, | 455 void AddDelay_WideStringArray(FIELD_PROP prop, |
| 457 const std::vector<CFX_WideString>& array); | 456 const std::vector<CFX_WideString>& array); |
| 458 | 457 |
| 459 void DoDelay(); | 458 void DoDelay(); |
| 460 | 459 |
| 461 public: | 460 public: |
| 462 Document* m_pJSDoc; | 461 Document* m_pJSDoc; |
| 463 CPDFSDK_Document* m_pDocument; | 462 CPDFSDK_Document* m_pDocument; |
| 464 CFX_WideString m_FieldName; | 463 CFX_WideString m_FieldName; |
| 465 int m_nFormControlIndex; | 464 int m_nFormControlIndex; |
| 466 FX_BOOL m_bCanSet; | 465 FX_BOOL m_bCanSet; |
| 467 | |
| 468 FX_BOOL m_bDelay; | 466 FX_BOOL m_bDelay; |
| 469 v8::Isolate* m_isolate; | |
| 470 }; | 467 }; |
| 471 | 468 |
| 472 class CJS_Field : public CJS_Object { | 469 class CJS_Field : public CJS_Object { |
| 473 public: | 470 public: |
| 474 explicit CJS_Field(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | 471 explicit CJS_Field(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
| 475 ~CJS_Field() override {} | 472 ~CJS_Field() override {} |
| 476 | 473 |
| 477 void InitInstance(IJS_Runtime* pIRuntime) override; | 474 void InitInstance(IJS_Runtime* pIRuntime) override; |
| 478 | 475 |
| 479 DECLARE_JS_CLASS(); | 476 DECLARE_JS_CLASS(); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 JS_STATIC_METHOD(setLock, Field); | 549 JS_STATIC_METHOD(setLock, Field); |
| 553 JS_STATIC_METHOD(signatureGetModifications, Field); | 550 JS_STATIC_METHOD(signatureGetModifications, Field); |
| 554 JS_STATIC_METHOD(signatureGetSeedValue, Field); | 551 JS_STATIC_METHOD(signatureGetSeedValue, Field); |
| 555 JS_STATIC_METHOD(signatureInfo, Field); | 552 JS_STATIC_METHOD(signatureInfo, Field); |
| 556 JS_STATIC_METHOD(signatureSetSeedValue, Field); | 553 JS_STATIC_METHOD(signatureSetSeedValue, Field); |
| 557 JS_STATIC_METHOD(signatureSign, Field); | 554 JS_STATIC_METHOD(signatureSign, Field); |
| 558 JS_STATIC_METHOD(signatureValidate, Field); | 555 JS_STATIC_METHOD(signatureValidate, Field); |
| 559 }; | 556 }; |
| 560 | 557 |
| 561 #endif // FPDFSDK_JAVASCRIPT_FIELD_H_ | 558 #endif // FPDFSDK_JAVASCRIPT_FIELD_H_ |
| OLD | NEW |