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/fm2js/xfa_fm2jsapi.h" | 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 35 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
36 if (!pNotify) { | 36 if (!pNotify) { |
37 return; | 37 return; |
38 } | 38 } |
39 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 39 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
40 CXFA_Node* pNode = NULL; | 40 CXFA_Node* pNode = NULL; |
41 if (iLength >= 1) { | 41 if (iLength >= 1) { |
42 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 42 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
43 } | 43 } |
44 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); | 44 int32_t bVerify = pNotify->GetDocProvider()->Verify(hDoc, pNode); |
45 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 45 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
46 if (hValue) { | 46 if (pValue) { |
47 FXJSE_Value_SetInteger(hValue, bVerify); | 47 FXJSE_Value_SetInteger(pValue, bVerify); |
48 } | 48 } |
49 } | 49 } |
50 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( | 50 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( |
51 CFXJSE_Arguments* pArguments) { | 51 CFXJSE_Arguments* pArguments) { |
52 int32_t iLength = pArguments->GetLength(); | 52 int32_t iLength = pArguments->GetLength(); |
53 if (iLength < 3 || iLength > 7) { | 53 if (iLength < 3 || iLength > 7) { |
54 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); | 54 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); |
55 return; | 55 return; |
56 } | 56 } |
57 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 57 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
(...skipping 10 matching lines...) Expand all Loading... |
68 if (iLength >= 2) { | 68 if (iLength >= 2) { |
69 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); | 69 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); |
70 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); | 70 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); |
71 } | 71 } |
72 if (iLength >= 3) { | 72 if (iLength >= 3) { |
73 CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); | 73 CFX_ByteString bsXMLIdent = pArguments->GetUTF8String(2); |
74 wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent.AsStringC()); | 74 wsXMLIdent = CFX_WideString::FromUTF8(bsXMLIdent.AsStringC()); |
75 } | 75 } |
76 FX_BOOL bSign = pNotify->GetDocProvider()->Sign( | 76 FX_BOOL bSign = pNotify->GetDocProvider()->Sign( |
77 hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); | 77 hDoc, pNodeList, wsExpression.AsStringC(), wsXMLIdent.AsStringC()); |
78 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 78 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
79 if (hValue) { | 79 if (pValue) { |
80 FXJSE_Value_SetBoolean(hValue, bSign); | 80 FXJSE_Value_SetBoolean(pValue, bSign); |
81 } | 81 } |
82 } | 82 } |
83 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( | 83 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Enumerate( |
84 CFXJSE_Arguments* pArguments) { | 84 CFXJSE_Arguments* pArguments) { |
85 int32_t iLength = pArguments->GetLength(); | 85 int32_t iLength = pArguments->GetLength(); |
86 if (iLength != 0) { | 86 if (iLength != 0) { |
87 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); | 87 ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"enumerate"); |
88 return; | 88 return; |
89 } | 89 } |
90 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 90 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
(...skipping 21 matching lines...) Expand all Loading... |
112 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 112 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
113 CXFA_Node* pNode = NULL; | 113 CXFA_Node* pNode = NULL; |
114 FX_BOOL bClear = TRUE; | 114 FX_BOOL bClear = TRUE; |
115 if (iLength >= 1) { | 115 if (iLength >= 1) { |
116 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 116 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
117 } | 117 } |
118 if (iLength >= 2) { | 118 if (iLength >= 2) { |
119 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 119 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
120 } | 120 } |
121 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); | 121 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); |
122 FXJSE_HVALUE hValue = pArguments->GetReturnValue(); | 122 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
123 if (hValue) { | 123 if (pValue) { |
124 FXJSE_Value_SetBoolean(hValue, bFlag); | 124 FXJSE_Value_SetBoolean(pValue, bFlag); |
125 } | 125 } |
126 } | 126 } |
OLD | NEW |