1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "xfa/fxfa/parser/cscript_signaturepseudomodel.h" 8 9 #include "fxjs/cfxjse_arguments.h" 10 #include "xfa/fxfa/app/xfa_ffnotify.h" 11 #include "xfa/fxfa/parser/cxfa_document.h" 12 #include "xfa/fxfa/parser/cxfa_scriptcontext.h" 13 #include "xfa/fxfa/parser/xfa_localemgr.h" 14 #include "xfa/fxfa/parser/xfa_object.h" 15 #include "xfa/fxfa/parser/xfa_utils.h" 16 17 CScript_SignaturePseudoModel::CScript_SignaturePseudoModel( 18 CXFA_Document* pDocument) 19 : CXFA_Object(pDocument, 20 XFA_ObjectType::Object, 21 XFA_Element::SignaturePseudoModel, 22 CFX_WideStringC(L"signaturePseudoModel")) {} 23 24 CScript_SignaturePseudoModel::~CScript_SignaturePseudoModel() {} 25 26 void CScript_SignaturePseudoModel::Verify(CFXJSE_Arguments* pArguments) { 27 int32_t iLength = pArguments->GetLength(); 28 if (iLength < 1 || iLength > 4) { 29 ThrowParamCountMismatchException(L"verify"); 30 return; 31 } 32 33 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 34 if (pValue) 35 pValue->SetInteger(0); 36 } 37 38 void CScript_SignaturePseudoModel::Sign(CFXJSE_Arguments* pArguments) { 39 int32_t iLength = pArguments->GetLength(); 40 if (iLength < 3 || iLength > 7) { 41 ThrowParamCountMismatchException(L"sign"); 42 return; 43 } 44 45 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 46 if (pValue) 47 pValue->SetBoolean(false); 48 } 49 50 void CScript_SignaturePseudoModel::Enumerate(CFXJSE_Arguments* pArguments) { 51 if (pArguments->GetLength() != 0) { 52 ThrowParamCountMismatchException(L"enumerate"); 53 return; 54 } 55 return; 56 } 57 58 void CScript_SignaturePseudoModel::Clear(CFXJSE_Arguments* pArguments) { 59 int32_t iLength = pArguments->GetLength(); 60 if (iLength < 1 || iLength > 2) { 61 ThrowParamCountMismatchException(L"clear"); 62 return; 63 } 64 65 CFXJSE_Value* pValue = pArguments->GetReturnValue(); 66 if (pValue) 67 pValue->SetBoolean(false); 68 } 69