Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cjs_app.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 FXJS_CJS_APP_H_
8#define FXJS_CJS_APP_H_
9
10#include <memory>
11#include <set>
12
13#include "core/fxcrt/span.h"
14#include "fxjs/cjs_object.h"
15#include "fxjs/js_define.h"
16
17class CJS_Runtime;
18class GlobalTimer;
19
20class CJS_App final : public CJS_Object {
21 public:
22 static uint32_t GetObjDefnID();
23 static void DefineJSObjects(CFXJS_Engine* pEngine);
24
25 CJS_App(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
26 ~CJS_App() override;
27
28 void TimerProc(GlobalTimer* pTimer);
29 void CancelProc(GlobalTimer* pTimer);
30
31 static WideString SysPathToPDFPath(const WideString& sOldPath);
32
33 JS_STATIC_PROP(activeDocs, active_docs, CJS_App)
34 JS_STATIC_PROP(calculate, calculate, CJS_App)
35 JS_STATIC_PROP(formsVersion, forms_version, CJS_App)
36 JS_STATIC_PROP(fs, fs, CJS_App)
37 JS_STATIC_PROP(fullscreen, fullscreen, CJS_App)
38 JS_STATIC_PROP(language, language, CJS_App)
39 JS_STATIC_PROP(media, media, CJS_App)
40 JS_STATIC_PROP(platform, platform, CJS_App)
41 JS_STATIC_PROP(runtimeHighlight, runtime_highlight, CJS_App)
42 JS_STATIC_PROP(viewerType, viewer_type, CJS_App)
43 JS_STATIC_PROP(viewerVariation, viewer_variation, CJS_App)
44 JS_STATIC_PROP(viewerVersion, viewer_version, CJS_App)
45
46 JS_STATIC_METHOD(alert, CJS_App)
47 JS_STATIC_METHOD(beep, CJS_App)
48 JS_STATIC_METHOD(browseForDoc, CJS_App)
49 JS_STATIC_METHOD(clearInterval, CJS_App)
50 JS_STATIC_METHOD(clearTimeOut, CJS_App)
51 JS_STATIC_METHOD(execDialog, CJS_App)
52 JS_STATIC_METHOD(execMenuItem, CJS_App)
53 JS_STATIC_METHOD(findComponent, CJS_App)
54 JS_STATIC_METHOD(goBack, CJS_App)
55 JS_STATIC_METHOD(goForward, CJS_App)
56 JS_STATIC_METHOD(launchURL, CJS_App)
57 JS_STATIC_METHOD(mailMsg, CJS_App)
58 JS_STATIC_METHOD(newFDF, CJS_App)
59 JS_STATIC_METHOD(newDoc, CJS_App)
60 JS_STATIC_METHOD(openDoc, CJS_App)
61 JS_STATIC_METHOD(openFDF, CJS_App)
62 JS_STATIC_METHOD(popUpMenuEx, CJS_App)
63 JS_STATIC_METHOD(popUpMenu, CJS_App)
64 JS_STATIC_METHOD(response, CJS_App)
65 JS_STATIC_METHOD(setInterval, CJS_App)
66 JS_STATIC_METHOD(setTimeOut, CJS_App)
67
68 private:
69 static uint32_t ObjDefnID;
70 static const char kName[];
71 static const JSPropertySpec PropertySpecs[];
72 static const JSMethodSpec MethodSpecs[];
73
74 CJS_Result get_active_docs(CJS_Runtime* pRuntime);
75 CJS_Result set_active_docs(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
76
77 CJS_Result get_calculate(CJS_Runtime* pRuntime);
78 CJS_Result set_calculate(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
79
80 CJS_Result get_forms_version(CJS_Runtime* pRuntime);
81 CJS_Result set_forms_version(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
82
83 CJS_Result get_fs(CJS_Runtime* pRuntime);
84 CJS_Result set_fs(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
85
86 CJS_Result get_fullscreen(CJS_Runtime* pRuntime);
87 CJS_Result set_fullscreen(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
88
89 CJS_Result get_language(CJS_Runtime* pRuntime);
90 CJS_Result set_language(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
91
92 CJS_Result get_media(CJS_Runtime* pRuntime);
93 CJS_Result set_media(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
94
95 CJS_Result get_platform(CJS_Runtime* pRuntime);
96 CJS_Result set_platform(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
97
98 CJS_Result get_runtime_highlight(CJS_Runtime* pRuntime);
99 CJS_Result set_runtime_highlight(CJS_Runtime* pRuntime,
100 v8::Local<v8::Value> vp);
101
102 CJS_Result get_viewer_type(CJS_Runtime* pRuntime);
103 CJS_Result set_viewer_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
104
105 CJS_Result get_viewer_variation(CJS_Runtime* pRuntime);
106 CJS_Result set_viewer_variation(CJS_Runtime* pRuntime,
107 v8::Local<v8::Value> vp);
108
109 CJS_Result get_viewer_version(CJS_Runtime* pRuntime);
110 CJS_Result set_viewer_version(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
111
112 CJS_Result alert(CJS_Runtime* pRuntime,
113 pdfium::span<v8::Local<v8::Value>> params);
114 CJS_Result beep(CJS_Runtime* pRuntime,
115 pdfium::span<v8::Local<v8::Value>> params);
116 CJS_Result browseForDoc(CJS_Runtime* pRuntime,
117 pdfium::span<v8::Local<v8::Value>> params);
118 CJS_Result clearInterval(CJS_Runtime* pRuntime,
119 pdfium::span<v8::Local<v8::Value>> params);
120 CJS_Result clearTimeOut(CJS_Runtime* pRuntime,
121 pdfium::span<v8::Local<v8::Value>> params);
122 CJS_Result execDialog(CJS_Runtime* pRuntime,
123 pdfium::span<v8::Local<v8::Value>> params);
124 CJS_Result execMenuItem(CJS_Runtime* pRuntime,
125 pdfium::span<v8::Local<v8::Value>> params);
126 CJS_Result findComponent(CJS_Runtime* pRuntime,
127 pdfium::span<v8::Local<v8::Value>> params);
128 CJS_Result goBack(CJS_Runtime* pRuntime,
129 pdfium::span<v8::Local<v8::Value>> params);
130 CJS_Result goForward(CJS_Runtime* pRuntime,
131 pdfium::span<v8::Local<v8::Value>> params);
132 CJS_Result launchURL(CJS_Runtime* pRuntime,
133 pdfium::span<v8::Local<v8::Value>> params);
134 CJS_Result mailMsg(CJS_Runtime* pRuntime,
135 pdfium::span<v8::Local<v8::Value>> params);
136 CJS_Result newFDF(CJS_Runtime* pRuntime,
137 pdfium::span<v8::Local<v8::Value>> params);
138 CJS_Result newDoc(CJS_Runtime* pRuntime,
139 pdfium::span<v8::Local<v8::Value>> params);
140 CJS_Result openDoc(CJS_Runtime* pRuntime,
141 pdfium::span<v8::Local<v8::Value>> params);
142 CJS_Result openFDF(CJS_Runtime* pRuntime,
143 pdfium::span<v8::Local<v8::Value>> params);
144 CJS_Result popUpMenuEx(CJS_Runtime* pRuntime,
145 pdfium::span<v8::Local<v8::Value>> params);
146 CJS_Result popUpMenu(CJS_Runtime* pRuntime,
147 pdfium::span<v8::Local<v8::Value>> params);
148 CJS_Result response(CJS_Runtime* pRuntime,
149 pdfium::span<v8::Local<v8::Value>> params);
150 CJS_Result setInterval(CJS_Runtime* pRuntime,
151 pdfium::span<v8::Local<v8::Value>> params);
152 CJS_Result setTimeOut(CJS_Runtime* pRuntime,
153 pdfium::span<v8::Local<v8::Value>> params);
154
155 void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript);
156 void ClearTimerCommon(CJS_Runtime* pRuntime, v8::Local<v8::Value> param);
157
158 bool m_bCalculate = true;
159 bool m_bRuntimeHighLight = false;
160 std::set<std::unique_ptr<GlobalTimer>> m_Timers;
161};
162
163#endif // FXJS_CJS_APP_H_
@ FXJSOBJTYPE_STATIC
static void DefineJSObjects(CFXJS_Engine *pEngine)
Definition cjs_app.cpp:87
static WideString SysPathToPDFPath(const WideString &sOldPath)
Definition cjs_app.cpp:501
void CancelProc(GlobalTimer *pTimer)
Definition cjs_app.cpp:399
static uint32_t GetObjDefnID()
Definition cjs_app.cpp:82
~CJS_App() override
void TimerProc(GlobalTimer *pTimer)
Definition cjs_app.cpp:393
CJS_App(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
Definition cjs_app.cpp:94
static CJS_Result Success()
Definition cjs_result.h:28
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:35
void BeginBlock()
Definition cjs_runtime.h:47
void EndBlock()
Definition cjs_runtime.h:48
bool IsBlocking() const
Definition cjs_runtime.h:49
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const override
CPDFSDK_InteractiveForm * GetInteractiveForm()
CPDF_Document::Extension * GetDocExtension() const
bool KillFocusAnnot(Mask< FWL_EVENTFLAG > nFlags)
virtual bool ContainsExtensionForm() const =0
uint32_t GetTimeOut() const
CJS_Runtime * GetRuntime() const
WideString GetJScript() const
bool IsOneShot() const
static void Cancel(int32_t nTimerID)
virtual std::optional< IJS_Runtime::JS_Error > RunScript(const WideString &script)=0
virtual void OnExternal_Exec()=0
IJS_EventContext * operator->() const
Definition ijs_runtime.h:42
WideString & operator=(WideString &&that) noexcept
WideString & operator+=(const wchar_t *str)
static WideString FromASCII(ByteStringView str)
WideString & operator=(const wchar_t *str)
#define JSPLATFORM_BEEP_DEFAULT
#define JSPLATFORM_ALERT_BUTTON_DEFAULT
#define JSPLATFORM_ALERT_ICON_DEFAULT
#define JS_STATIC_METHOD(method_name, class_name)
Definition js_define.h:159
#define JS_STATIC_PROP(err_name, prop_name, class_name)
Definition js_define.h:145
JSMessage
@ kParamTooLongError
@ kNotSupportedError
@ kInvalidInputError
WideString JSGetStringFromID(JSMessage msg)
fxcrt::WideString WideString
Definition widestring.h:207