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_script.h"
8
9 #include "fxjs/cfxjse_value.h"
10 #include "xfa/fxfa/parser/cxfa_script.h"
11
CJX_Script(CXFA_Script * node)12 CJX_Script::CJX_Script(CXFA_Script* node) : CJX_Node(node) {}
13
14 CJX_Script::~CJX_Script() = default;
15
use(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)16 void CJX_Script::use(CFXJSE_Value* pValue,
17 bool bSetting,
18 XFA_Attribute eAttribute) {
19 Script_Attribute_String(pValue, bSetting, eAttribute);
20 }
21
contentType(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)22 void CJX_Script::contentType(CFXJSE_Value* pValue,
23 bool bSetting,
24 XFA_Attribute eAttribute) {
25 Script_Attribute_String(pValue, bSetting, eAttribute);
26 }
27
runAt(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)28 void CJX_Script::runAt(CFXJSE_Value* pValue,
29 bool bSetting,
30 XFA_Attribute eAttribute) {
31 Script_Attribute_String(pValue, bSetting, eAttribute);
32 }
33
stateless(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)34 void CJX_Script::stateless(CFXJSE_Value* pValue,
35 bool bSetting,
36 XFA_Attribute eAttribute) {
37 if (bSetting) {
38 ThrowInvalidPropertyException();
39 return;
40 }
41 pValue->SetString(FX_UTF8Encode(WideStringView(L"0", 1)).AsStringView());
42 }
43
defaultValue(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)44 void CJX_Script::defaultValue(CFXJSE_Value* pValue,
45 bool bSetting,
46 XFA_Attribute eAttribute) {
47 Script_Som_DefaultValue(pValue, bSetting, eAttribute);
48 }
49
binding(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)50 void CJX_Script::binding(CFXJSE_Value* pValue,
51 bool bSetting,
52 XFA_Attribute eAttribute) {
53 Script_Attribute_String(pValue, bSetting, eAttribute);
54 }
55
usehref(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)56 void CJX_Script::usehref(CFXJSE_Value* pValue,
57 bool bSetting,
58 XFA_Attribute eAttribute) {
59 Script_Attribute_String(pValue, bSetting, eAttribute);
60 }
61
value(CFXJSE_Value * pValue,bool bSetting,XFA_Attribute eAttribute)62 void CJX_Script::value(CFXJSE_Value* pValue,
63 bool bSetting,
64 XFA_Attribute eAttribute) {
65 defaultValue(pValue, bSetting, eAttribute);
66 }
67