| 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 "fxjse/include/cfxjse_arguments.h" | 9 #include "fxjse/include/cfxjse_arguments.h" |
| 10 #include "xfa/fxfa/app/xfa_ffnotify.h" | 10 #include "xfa/fxfa/app/xfa_ffnotify.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 pValue->SetInteger(bVerify); | 46 pValue->SetInteger(bVerify); |
| 47 } | 47 } |
| 48 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( | 48 void CScript_SignaturePseudoModel::Script_SignaturePseudoModel_Sign( |
| 49 CFXJSE_Arguments* pArguments) { | 49 CFXJSE_Arguments* pArguments) { |
| 50 int32_t iLength = pArguments->GetLength(); | 50 int32_t iLength = pArguments->GetLength(); |
| 51 if (iLength < 3 || iLength > 7) { | 51 if (iLength < 3 || iLength > 7) { |
| 52 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); | 52 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"sign"); |
| 53 return; | 53 return; |
| 54 } | 54 } |
| 55 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 55 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 56 if (!pNotify) { | 56 if (!pNotify) { |
| 57 return; | 57 return; |
| 58 } | 58 } |
| 59 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 59 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 60 CXFA_NodeList* pNodeList = NULL; | 60 CXFA_NodeList* pNodeList = nullptr; |
| 61 CFX_WideString wsExpression; | 61 CFX_WideString wsExpression; |
| 62 CFX_WideString wsXMLIdent; | 62 CFX_WideString wsXMLIdent; |
| 63 if (iLength >= 1) { | 63 if (iLength >= 1) { |
| 64 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); | 64 pNodeList = (CXFA_NodeList*)pArguments->GetObject(0); |
| 65 } | 65 } |
| 66 if (iLength >= 2) { | 66 if (iLength >= 2) { |
| 67 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); | 67 CFX_ByteString bsExpression = pArguments->GetUTF8String(1); |
| 68 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); | 68 wsExpression = CFX_WideString::FromUTF8(bsExpression.AsStringC()); |
| 69 } | 69 } |
| 70 if (iLength >= 3) { | 70 if (iLength >= 3) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 int32_t iLength = pArguments->GetLength(); | 100 int32_t iLength = pArguments->GetLength(); |
| 101 if (iLength < 1 || iLength > 2) { | 101 if (iLength < 1 || iLength > 2) { |
| 102 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); | 102 ThrowException(XFA_IDS_INCORRECT_NUMBER_OF_METHOD, L"clear"); |
| 103 return; | 103 return; |
| 104 } | 104 } |
| 105 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); | 105 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
| 106 if (!pNotify) { | 106 if (!pNotify) { |
| 107 return; | 107 return; |
| 108 } | 108 } |
| 109 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); | 109 CXFA_FFDoc* hDoc = pNotify->GetHDOC(); |
| 110 CXFA_Node* pNode = NULL; | 110 CXFA_Node* pNode = nullptr; |
| 111 FX_BOOL bClear = TRUE; | 111 FX_BOOL bClear = TRUE; |
| 112 if (iLength >= 1) { | 112 if (iLength >= 1) { |
| 113 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); | 113 pNode = static_cast<CXFA_Node*>(pArguments->GetObject(0)); |
| 114 } | 114 } |
| 115 if (iLength >= 2) { | 115 if (iLength >= 2) { |
| 116 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; | 116 bClear = pArguments->GetInt32(1) == 0 ? FALSE : TRUE; |
| 117 } | 117 } |
| 118 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); | 118 FX_BOOL bFlag = pNotify->GetDocProvider()->Clear(hDoc, pNode, bClear); |
| 119 CFXJSE_Value* pValue = pArguments->GetReturnValue(); | 119 CFXJSE_Value* pValue = pArguments->GetReturnValue(); |
| 120 if (pValue) | 120 if (pValue) |
| 121 pValue->SetBoolean(bFlag); | 121 pValue->SetBoolean(bFlag); |
| 122 } | 122 } |
| OLD | NEW |