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
cjx_template.cpp
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#include "fxjs/xfa/cjx_template.h"
8
9#include <vector>
10
11#include "fxjs/cfx_v8.h"
12#include "fxjs/js_resources.h"
13#include "fxjs/xfa/cfxjse_value.h"
14#include "third_party/base/containers/span.h"
15#include "v8/include/v8-primitive.h"
16#include "xfa/fxfa/parser/cxfa_document.h"
17#include "xfa/fxfa/parser/cxfa_template.h"
18
19const CJX_MethodSpec CJX_Template::MethodSpecs[] = {
20 {"execCalculate", execCalculate_static},
21 {"execInitialize", execInitialize_static},
22 {"execValidate", execValidate_static},
23 {"formNodes", formNodes_static},
24 {"recalculate", recalculate_static},
25 {"remerge", remerge_static}};
26
27CJX_Template::CJX_Template(CXFA_Template* tmpl) : CJX_Model(tmpl) {
28 DefineMethods(MethodSpecs);
29}
30
31CJX_Template::~CJX_Template() = default;
32
33bool CJX_Template::DynamicTypeIs(TypeTag eType) const {
34 return eType == static_type__ || ParentType__::DynamicTypeIs(eType);
35}
36
37CJS_Result CJX_Template::formNodes(CFXJSE_Engine* runtime,
38 pdfium::span<v8::Local<v8::Value>> params) {
39 if (params.size() != 1)
41
42 return CJS_Result::Success(runtime->NewBoolean(true));
43}
44
45CJS_Result CJX_Template::remerge(CFXJSE_Engine* runtime,
46 pdfium::span<v8::Local<v8::Value>> params) {
47 if (!params.empty())
49
50 GetDocument()->DoDataRemerge();
52}
53
54CJS_Result CJX_Template::execInitialize(
55 CFXJSE_Engine* runtime,
56 pdfium::span<v8::Local<v8::Value>> params) {
57 if (!params.empty())
59
61 runtime->NewBoolean(GetXFANode()->IsWidgetReady()));
62}
63
64CJS_Result CJX_Template::recalculate(
65 CFXJSE_Engine* runtime,
66 pdfium::span<v8::Local<v8::Value>> params) {
67 if (params.size() != 1)
69
70 return CJS_Result::Success(runtime->NewBoolean(true));
71}
72
73CJS_Result CJX_Template::execCalculate(
74 CFXJSE_Engine* runtime,
75 pdfium::span<v8::Local<v8::Value>> params) {
76 if (!params.empty())
78
80 runtime->NewBoolean(GetXFANode()->IsWidgetReady()));
81}
82
83CJS_Result CJX_Template::execValidate(
84 CFXJSE_Engine* runtime,
85 pdfium::span<v8::Local<v8::Value>> params) {
86 if (!params.empty())
88
90 runtime->NewBoolean(GetXFANode()->IsWidgetReady()));
91}
friend class EventParamScope
static CJS_Result Success()
Definition cjs_result.h:27
static CJS_Result Failure(JSMessage id)
Definition cjs_result.h:34
bool DynamicTypeIs(TypeTag eType) const override
Definition cjx_model.cpp:31
void DefineMethods(pdfium::span< const CJX_MethodSpec > methods)
CXFA_Document * GetDocument() const
CXFA_Node * GetXFANode() const
bool DynamicTypeIs(TypeTag eType) const override
~CJX_Template() override
JSMessage