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 "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" | 7 #include "xfa/fxfa/parser/xfa_script_signaturepseudomodel.h" |
8 | 8 |
9 #include "xfa/fxfa/app/xfa_ffnotify.h" | 9 #include "xfa/fxfa/app/xfa_ffnotify.h" |
10 #include "xfa/fxfa/parser/xfa_doclayout.h" | 10 #include "xfa/fxfa/parser/xfa_doclayout.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( | 21 CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( |
22 CXFA_Document* pDocument) | 22 CXFA_Document* pDocument) |
23 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_SignaturePseudoModel) { | 23 : CXFA_OrdinaryObject(pDocument, XFA_ELEMENT_SignaturePseudoModel) { |
24 m_uScriptHash = XFA_HASHCODE_Signature; | 24 m_uScriptHash = XFA_HASHCODE_Signature; |
25 } | 25 } |
26 CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} | 26 CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} |
27 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( | 27 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Verify( |
28 CFXJSE_Arguments* pArguments) { | 28 CFXJSE_Arguments* pArguments) { |
29 int32_t iLength = pArguments->GetLength(); | 29 int32_t iLength = pArguments->GetLength(); |
30 if (iLength < 1 || iLength > 4) { | 30 if (iLength < 1 || iLength > 4) { |
31 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); | 31 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"verify"); |
32 return; | 32 return; |
33 } | 33 } |
34 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 34 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
35 if (!pNotify) { | 35 if (!pNotify) { |
36 return; | 36 return; |
37 } | 37 } |
38 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 38 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
39 CXFA_Node* pNode = NULL; | 39 CXFA_Node* pNode = NULL; |
40 if (iLength >= 1) { | 40 if (iLength >= 1) { |
41 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 41 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
42 } | 42 } |
43 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); | 43 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); |
44 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 44 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
45 if (pValue) { | 45 if (pValue) { |
46 FXJSE_Value_SetInteger(pValue, bVerify); | 46 FXJSE_Value_SetInteger(pValue, bVerify); |
47 } | 47 } |
48 } | 48 } |
49 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( | 49 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( |
50 CFXJSE_Arguments* pArguments) { | 50 CFXJSE_Arguments* pArguments) { |
51 int32_t iLength = pArguments->GetLength(); | 51 int32_t iLength = pArguments->GetLength(); |
52 if (iLength < 3 || iLength > 7) { | 52 if (iLength < 3 || iLength > 7) { |
53 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); | 53 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); |
54 return; | 54 return; |
55 } | 55 } |
56 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 56 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
57 if (!pNotify) { | 57 if (!pNotify) { |
58 return; | 58 return; |
59 } | 59 } |
60 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 60 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
61 CXFA_NodeList* pNodeList = NULL; | 61 CXFA_NodeList* pNodeList = NULL; |
62 CFX_WideString wsExpression; | 62 CFX_WideString wsExpression; |
63 CFX_WideString wsXMLIdent; | 63 CFX_WideString wsXMLIdent; |
(...skipping 12 matching lines...) Expand all Loading... |
76 hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); | 76 hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); |
77 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 77 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
78 if (pValue) { | 78 if (pValue) { |
79 FXJSE_Value_SetBoolean(pValue, bSign); | 79 FXJSE_Value_SetBoolean(pValue, bSign); |
80 } | 80 } |
81 } | 81 } |
82 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( | 82 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( |
83 CFXJSE_Arguments* pArguments) { | 83 CFXJSE_Arguments* pArguments) { |
84 int32_t iLength = pArguments->GetLength(); | 84 int32_t iLength = pArguments->GetLength(); |
85 if (iLength != 0) { | 85 if (iLength != 0) { |
86 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); | 86 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); |
87 return; | 87 return; |
88 } | 88 } |
89 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 89 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
90 if (!pNotify) { | 90 if (!pNotify) { |
91 return; | 91 return; |
92 } | 92 } |
93 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 93 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
94 CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); | 94 CXFA_NodeList* pList = pNotify->GetDocProvider()->Enumerate(hDoc); |
95 if (!pList) | 95 if (!pList) |
96 return; | 96 return; |
97 FXJSE_Value_Set(pArguments->GetReturnValue(), | 97 FXJSE_Value_Set(pArguments->GetReturnValue(), |
98 m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); | 98 m_pDocument->GetScriptContext()->GetJSValueFromMap(pList)); |
99 } | 99 } |
100 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( | 100 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Clear( |
101 CFXJSE_Arguments* pArguments) { | 101 CFXJSE_Arguments* pArguments) { |
102 int32_t iLength = pArguments->GetLength(); | 102 int32_t iLength = pArguments->GetLength(); |
103 if (iLength < 1 || iLength > 2) { | 103 if (iLength < 1 || iLength > 2) { |
104 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); | 104 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); |
105 return; | 105 return; |
106 } | 106 } |
107 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 107 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
108 if (!pNotify) { | 108 if (!pNotify) { |
109 return; | 109 return; |
110 } | 110 } |
111 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 111 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
112 CXFA_Node* pNode = NULL; | 112 CXFA_Node* pNode = NULL; |
113 FX_BOOL bClear = TRUE; | 113 FX_BOOL bClear = TRUE; |
114 if (iLength >= 1) { | 114 if (iLength >= 1) { |
115 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 115 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
116 } | 116 } |
117 if (iLength >= 2) { | 117 if (iLength >= 2) { |
118 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 118 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
119 } | 119 } |
120 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); | 120 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); |
121 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 121 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
122 if (pValue) { | 122 if (pValue) { |
123 FXJSE_Value_SetBoolean(pValue, bFlag); | 123 FXJSE_Value_SetBoolean(pValue, bFlag); |
124 } | 124 } |
125 } | 125 } |
OLD | NEW |