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
global_timer.h
Go to the documentation of this file.
1// Copyright 2017 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_GLOBAL_TIMER_H_
8#define FXJS_GLOBAL_TIMER_H_
9
10#include "core/fxcrt/unowned_ptr.h"
11#include "fxjs/cjs_runtime.h"
12
13class CJS_App;
14
16 public:
17 enum class Type : bool {
18 kRepeating = false,
19 kOneShot = true,
20 };
21
22 static void InitializeGlobals();
23 static void DestroyGlobals();
24
25 GlobalTimer(CJS_App* pObj,
26 CJS_Runtime* pRuntime,
27 Type nType,
28 const WideString& script,
29 uint32_t dwElapse,
30 uint32_t dwTimeOut);
31 ~GlobalTimer();
32
33 static void Trigger(int32_t nTimerID);
34 static void Cancel(int32_t nTimerID);
35
36 bool IsOneShot() const { return m_nType == Type::kOneShot; }
37 uint32_t GetTimeOut() const { return m_dwTimeOut; }
38 int32_t GetTimerID() const { return m_nTimerID; }
39 CJS_Runtime* GetRuntime() const { return m_pRuntime.Get(); }
40 WideString GetJScript() const { return m_swJScript; }
41
42 private:
43 bool HasValidID() const;
44
45 const Type m_nType;
46 bool m_bProcessing = false;
47 const int32_t m_nTimerID;
48 const uint32_t m_dwTimeOut;
49 const WideString m_swJScript;
50 ObservedPtr<CJS_Runtime> m_pRuntime;
51 UnownedPtr<CJS_App> const m_pEmbedApp;
52};
53
54#endif // FXJS_GLOBAL_TIMER_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
void DoFieldDelay(const WideString &sFieldName, int nControlIndex)
CJS_Document(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
void SetFormFillEnv(CPDFSDK_FormFillEnvironment *pFormFillEnv)
~CJS_Document() override
void AddDelayData(std::unique_ptr< CJS_DelayData > pData)
static uint32_t GetObjDefnID()
CPDFSDK_FormFillEnvironment * GetFormFillEnv() const
static void DefineJSObjects(CFXJS_Engine *pEngine)
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
static uint32_t GetObjDefnID()
static void DefineJSObjects(CFXJS_Engine *pEngine)
CJS_TimerObj(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
~CJS_TimerObj() override
int GetTimerID() const
void SetTimer(GlobalTimer *pTimer)
CPDFSDK_InteractiveForm * GetInteractiveForm()
CPDF_Document::Extension * GetDocExtension() const
bool KillFocusAnnot(Mask< FWL_EVENTFLAG > nFlags)
virtual bool ContainsExtensionForm() const =0
uint32_t GetTimeOut() const
static void DestroyGlobals()
static void InitializeGlobals()
CJS_Runtime * GetRuntime() const
GlobalTimer(CJS_App *pObj, CJS_Runtime *pRuntime, Type nType, const WideString &script, uint32_t dwElapse, uint32_t dwTimeOut)
int32_t GetTimerID() const
WideString GetJScript() const
static void Trigger(int32_t nTimerID)
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)