1 // Copyright 2017 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 "fxjs/xfa/cjx_occur.h" 8 9 #include <algorithm> 10 11 #include "fxjs/cfxjse_value.h" 12 #include "xfa/fxfa/parser/cxfa_occur.h" 13 14 CJX_Occur::CJX_Occur(CXFA_Occur* node) : CJX_Node(node) {} 15 16 CJX_Occur::~CJX_Occur() = default; 17 18 void CJX_Occur::max(CFXJSE_Value* pValue, 19 bool bSetting, 20 XFA_Attribute eAttribute) { 21 CXFA_Occur* occur = static_cast<CXFA_Occur*>(GetXFANode()); 22 if (!bSetting) { 23 pValue->SetInteger(occur->GetMax()); 24 return; 25 } 26 occur->SetMax(pValue->ToInteger()); 27 } 28 29 void CJX_Occur::min(CFXJSE_Value* pValue, 30 bool bSetting, 31 XFA_Attribute eAttribute) { 32 CXFA_Occur* occur = static_cast<CXFA_Occur*>(GetXFANode()); 33 if (!bSetting) { 34 pValue->SetInteger(occur->GetMin()); 35 return; 36 } 37 occur->SetMin(pValue->ToInteger()); 38 } 39 40 void CJX_Occur::use(CFXJSE_Value* pValue, 41 bool bSetting, 42 XFA_Attribute eAttribute) { 43 Script_Attribute_String(pValue, bSetting, eAttribute); 44 } 45 46 void CJX_Occur::initial(CFXJSE_Value* pValue, 47 bool bSetting, 48 XFA_Attribute eAttribute) { 49 Script_Attribute_String(pValue, bSetting, eAttribute); 50 } 51 52 void CJX_Occur::usehref(CFXJSE_Value* pValue, 53 bool bSetting, 54 XFA_Attribute eAttribute) { 55 Script_Attribute_String(pValue, bSetting, eAttribute); 56 } 57