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 18 matching lines...) Expand all Loading... |
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 ThrowException(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 = nullptr; |
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 ThrowException(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 = nullptr; |
62 CFX_WideString wsExpression; | 62 CFX_WideString wsExpression; |
63 CFX_WideString wsXMLIdent; | 63 CFX_WideString wsXMLIdent; |
64 if (iLength >= 1) { | 64 if (iLength >= 1) { |
65 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); | 65 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); |
66 } | 66 } |
67 if (iLength >= 2) { | 67 if (iLength >= 2) { |
68 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); | 68 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); |
69 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); | 69 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); |
70 } | 70 } |
71 if (iLength >= 3) { | 71 if (iLength >= 3) { |
(...skipping 30 matching lines...) Expand all Loading... |
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 ThrowException(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 = nullptr; |
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 |