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#include <vector>
13
14#include "fxjs/cjs_object.h"
15#include "fxjs/js_define.h"
16#include "third_party/base/containers/span.h"
17
18class CJS_Runtime;
19class GlobalTimer;
20
21class CJS_App final : public CJS_Object {
22 public:
23 static uint32_t GetObjDefnID();
24 static void DefineJSObjects(CFXJS_Engine* pEngine);
25
26 CJS_App(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime);
27 ~CJS_App() override;
28
29 void TimerProc(GlobalTimer* pTimer);
30 void CancelProc(GlobalTimer* pTimer);
31
32 static WideString SysPathToPDFPath(const WideString& sOldPath);
33
34 JS_STATIC_PROP(activeDocs, active_docs, CJS_App)
35 JS_STATIC_PROP(calculate, calculate, CJS_App)
36 JS_STATIC_PROP(formsVersion, forms_version, CJS_App)
37 JS_STATIC_PROP(fs, fs, CJS_App)
38 JS_STATIC_PROP(fullscreen, fullscreen, CJS_App)
39 JS_STATIC_PROP(language, language, CJS_App)
40 JS_STATIC_PROP(media, media, CJS_App)
41 JS_STATIC_PROP(platform, platform, CJS_App)
42 JS_STATIC_PROP(runtimeHighlight, runtime_highlight, CJS_App)
43 JS_STATIC_PROP(viewerType, viewer_type, CJS_App)
44 JS_STATIC_PROP(viewerVariation, viewer_variation, CJS_App)
45 JS_STATIC_PROP(viewerVersion, viewer_version, CJS_App)
46
47 JS_STATIC_METHOD(alert, CJS_App)
48 JS_STATIC_METHOD(beep, CJS_App)
49 JS_STATIC_METHOD(browseForDoc, CJS_App)
50 JS_STATIC_METHOD(clearInterval, CJS_App)
51 JS_STATIC_METHOD(clearTimeOut, CJS_App)
52 JS_STATIC_METHOD(execDialog, CJS_App)
53 JS_STATIC_METHOD(execMenuItem, CJS_App)
54 JS_STATIC_METHOD(findComponent, CJS_App)
55 JS_STATIC_METHOD(goBack, CJS_App)
56 JS_STATIC_METHOD(goForward, CJS_App)
57 JS_STATIC_METHOD(launchURL, CJS_App)
58 JS_STATIC_METHOD(mailMsg, CJS_App)
59 JS_STATIC_METHOD(newFDF, CJS_App)
60 JS_STATIC_METHOD(newDoc, CJS_App)
61 JS_STATIC_METHOD(openDoc, CJS_App)
62 JS_STATIC_METHOD(openFDF, CJS_App)
63 JS_STATIC_METHOD(popUpMenuEx, CJS_App)
64 JS_STATIC_METHOD(popUpMenu, CJS_App)
65 JS_STATIC_METHOD(response, CJS_App)
66 JS_STATIC_METHOD(setInterval, CJS_App)
67 JS_STATIC_METHOD(setTimeOut, CJS_App)
68
69 private:
70 static uint32_t ObjDefnID;
71 static const char kName[];
72 static const JSPropertySpec PropertySpecs[];
73 static const JSMethodSpec MethodSpecs[];
74
75 CJS_Result get_active_docs(CJS_Runtime* pRuntime);
76 CJS_Result set_active_docs(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
77
78 CJS_Result get_calculate(CJS_Runtime* pRuntime);
79 CJS_Result set_calculate(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
80
81 CJS_Result get_forms_version(CJS_Runtime* pRuntime);
82 CJS_Result set_forms_version(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
83
84 CJS_Result get_fs(CJS_Runtime* pRuntime);
85 CJS_Result set_fs(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
86
87 CJS_Result get_fullscreen(CJS_Runtime* pRuntime);
88 CJS_Result set_fullscreen(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
89
90 CJS_Result get_language(CJS_Runtime* pRuntime);
91 CJS_Result set_language(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
92
93 CJS_Result get_media(CJS_Runtime* pRuntime);
94 CJS_Result set_media(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
95
96 CJS_Result get_platform(CJS_Runtime* pRuntime);
97 CJS_Result set_platform(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
98
99 CJS_Result get_runtime_highlight(CJS_Runtime* pRuntime);
100 CJS_Result set_runtime_highlight(CJS_Runtime* pRuntime,
101 v8::Local<v8::Value> vp);
102
103 CJS_Result get_viewer_type(CJS_Runtime* pRuntime);
104 CJS_Result set_viewer_type(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
105
106 CJS_Result get_viewer_variation(CJS_Runtime* pRuntime);
107 CJS_Result set_viewer_variation(CJS_Runtime* pRuntime,
108 v8::Local<v8::Value> vp);
109
110 CJS_Result get_viewer_version(CJS_Runtime* pRuntime);
111 CJS_Result set_viewer_version(CJS_Runtime* pRuntime, v8::Local<v8::Value> vp);
112
113 CJS_Result alert(CJS_Runtime* pRuntime,
114 pdfium::span<v8::Local<v8::Value>> params);
115 CJS_Result beep(CJS_Runtime* pRuntime,
116 pdfium::span<v8::Local<v8::Value>> params);
117 CJS_Result browseForDoc(CJS_Runtime* pRuntime,
118 pdfium::span<v8::Local<v8::Value>> params);
119 CJS_Result clearInterval(CJS_Runtime* pRuntime,
120 pdfium::span<v8::Local<v8::Value>> params);
121 CJS_Result clearTimeOut(CJS_Runtime* pRuntime,
122 pdfium::span<v8::Local<v8::Value>> params);
123 CJS_Result execDialog(CJS_Runtime* pRuntime,
124 pdfium::span<v8::Local<v8::Value>> params);
125 CJS_Result execMenuItem(CJS_Runtime* pRuntime,
126 pdfium::span<v8::Local<v8::Value>> params);
127 CJS_Result findComponent(CJS_Runtime* pRuntime,
128 pdfium::span<v8::Local<v8::Value>> params);
129 CJS_Result goBack(CJS_Runtime* pRuntime,
130 pdfium::span<v8::Local<v8::Value>> params);
131 CJS_Result goForward(CJS_Runtime* pRuntime,
132 pdfium::span<v8::Local<v8::Value>> params);
133 CJS_Result launchURL(CJS_Runtime* pRuntime,
134 pdfium::span<v8::Local<v8::Value>> params);
135 CJS_Result mailMsg(CJS_Runtime* pRuntime,
136 pdfium::span<v8::Local<v8::Value>> params);
137 CJS_Result newFDF(CJS_Runtime* pRuntime,
138 pdfium::span<v8::Local<v8::Value>> params);
139 CJS_Result newDoc(CJS_Runtime* pRuntime,
140 pdfium::span<v8::Local<v8::Value>> params);
141 CJS_Result openDoc(CJS_Runtime* pRuntime,
142 pdfium::span<v8::Local<v8::Value>> params);
143 CJS_Result openFDF(CJS_Runtime* pRuntime,
144 pdfium::span<v8::Local<v8::Value>> params);
145 CJS_Result popUpMenuEx(CJS_Runtime* pRuntime,
146 pdfium::span<v8::Local<v8::Value>> params);
147 CJS_Result popUpMenu(CJS_Runtime* pRuntime,
148 pdfium::span<v8::Local<v8::Value>> params);
149 CJS_Result response(CJS_Runtime* pRuntime,
150 pdfium::span<v8::Local<v8::Value>> params);
151 CJS_Result setInterval(CJS_Runtime* pRuntime,
152 pdfium::span<v8::Local<v8::Value>> params);
153 CJS_Result setTimeOut(CJS_Runtime* pRuntime,
154 pdfium::span<v8::Local<v8::Value>> params);
155
156 void RunJsScript(CJS_Runtime* pRuntime, const WideString& wsScript);
157 void ClearTimerCommon(CJS_Runtime* pRuntime, v8::Local<v8::Value> param);
158
159 bool m_bCalculate = true;
160 bool m_bRuntimeHighLight = false;
161 std::set<std::unique_ptr<GlobalTimer>> m_Timers;
162};
163
164#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 void DefineProps(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSPropertySpec > consts)
static void DefineMethods(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSMethodSpec > consts)
static CJS_Result Success()
Definition cjs_result.h:27
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:34
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 void OnExternal_Exec()=0
IJS_EventContext * operator->() const
Definition ijs_runtime.h:42
WideString & operator=(WideString &&that) noexcept
WideString & operator+=(const wchar_t *str)
WideString & operator+=(wchar_t ch)
bool IsEmpty() const
Definition widestring.h:118
static WideString FromUTF16LE(pdfium::span< const uint8_t > data)
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:155
#define JS_STATIC_PROP(err_name, prop_name, class_name)
Definition js_define.h:141
JSMessage
@ kParamTooLongError
@ kObjectTypeError
@ kNotSupportedError
@ kInvalidInputError
WideString JSGetStringFromID(JSMessage msg)