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 #ifndef XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_
8 #define XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_
9 
10 #include "fxjs/cfxjse_arguments.h"
11 #include "xfa/fxfa/parser/cxfa_document.h"
12 #include "xfa/fxfa/parser/xfa_object.h"
13 
14 class CScript_HostPseudoModel : public CXFA_Object {
15  public:
16   explicit CScript_HostPseudoModel(CXFA_Document* pDocument);
17   ~CScript_HostPseudoModel() override;
18 
19   void AppType(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
20   void CalculationsEnabled(CFXJSE_Value* pValue,
21                            bool bSetting,
22                            XFA_ATTRIBUTE eAttribute);
23   void CurrentPage(CFXJSE_Value* pValue,
24                    bool bSetting,
25                    XFA_ATTRIBUTE eAttribute);
26   void Language(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
27   void NumPages(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
28   void Platform(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
29   void Title(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
30   void ValidationsEnabled(CFXJSE_Value* pValue,
31                           bool bSetting,
32                           XFA_ATTRIBUTE eAttribute);
33   void Variation(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
34   void Version(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
35   void Name(CFXJSE_Value* pValue, bool bSetting, XFA_ATTRIBUTE eAttribute);
36   void GotoURL(CFXJSE_Arguments* pArguments);
37   void OpenList(CFXJSE_Arguments* pArguments);
38   void Response(CFXJSE_Arguments* pArguments);
39   void DocumentInBatch(CFXJSE_Arguments* pArguments);
40   void ResetData(CFXJSE_Arguments* pArguments);
41   void Beep(CFXJSE_Arguments* pArguments);
42   void SetFocus(CFXJSE_Arguments* pArguments);
43   void GetFocus(CFXJSE_Arguments* pArguments);
44   void MessageBox(CFXJSE_Arguments* pArguments);
45   void DocumentCountInBatch(CFXJSE_Arguments* pArguments);
46   void Print(CFXJSE_Arguments* pArguments);
47   void ImportData(CFXJSE_Arguments* pArguments);
48   void ExportData(CFXJSE_Arguments* pArguments);
49   void PageUp(CFXJSE_Arguments* pArguments);
50   void PageDown(CFXJSE_Arguments* pArguments);
51   void CurrentDateTime(CFXJSE_Arguments* pArguments);
52 
53  protected:
54   bool ValidateArgsForMsg(CFXJSE_Arguments* pArguments,
55                           int32_t iArgIndex,
56                           CFX_WideString& wsValue);
57 
58  private:
59   void ThrowSetLanguageException() const;
60   void ThrowSetNumPagesException() const;
61   void ThrowSetPlatformException() const;
62   void ThrowSetVariationException() const;
63   void ThrowSetVersionException() const;
64 };
65 
66 #endif  // XFA_FXFA_PARSER_CSCRIPT_HOSTPSEUDOMODEL_H_
67