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