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
cxfa_event.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 "xfa/fxfa/parser/cxfa_event.h"
8
9#include "fxjs/xfa/cjx_node.h"
10#include "xfa/fxfa/parser/cxfa_document.h"
11#include "xfa/fxfa/parser/cxfa_script.h"
12#include "xfa/fxfa/parser/cxfa_submit.h"
13
14namespace {
15
16const CXFA_Node::PropertyData kEventPropertyData[] = {
20 {XFA_Element::Extras, 1, {}},
22};
23
24const CXFA_Node::AttributeData kEventAttributeData[] = {
30 (void*)XFA_AttributeValue::RefOnly},
31 {XFA_Attribute::Usehref, XFA_AttributeType::CData, nullptr},
33 (void*)XFA_AttributeValue::Click},
34};
35
36} // namespace
37
38CXFA_Event::CXFA_Event(CXFA_Document* doc, XFA_PacketType packet)
39 : CXFA_Node(doc,
40 packet,
41 {XFA_XDPPACKET::kTemplate, XFA_XDPPACKET::kForm},
42 XFA_ObjectType::Node,
43 XFA_Element::Event,
44 kEventPropertyData,
45 kEventAttributeData,
46 cppgc::MakeGarbageCollected<CJX_Node>(
47 doc->GetHeap()->GetAllocationHandle(),
48 this)) {}
49
50CXFA_Event::~CXFA_Event() = default;
51
53 return JSObject()->GetEnum(XFA_Attribute::Activity);
54}
55
56XFA_Element CXFA_Event::GetEventType() const {
57 CXFA_Node* pChild = GetFirstChild();
58 while (pChild) {
59 XFA_Element eType = pChild->GetElementType();
60 if (eType != XFA_Element::Extras)
61 return eType;
62
63 pChild = pChild->GetNextSibling();
64 }
66}
67
68WideString CXFA_Event::GetRef() {
69 return JSObject()->GetCData(XFA_Attribute::Ref);
70}
71
72CXFA_Script* CXFA_Event::GetScriptIfExists() {
73 return GetChild<CXFA_Script>(0, XFA_Element::Script, false);
74}
75
76#ifdef PDF_XFA_ELEMENT_SUBMIT_ENABLED
77CXFA_Submit* CXFA_Event::GetSubmitIfExists() {
78 return GetChild<CXFA_Submit>(0, XFA_Element::Submit, false);
79}
80#endif // PDF_XFA_ELEMENT_SUBMIT_ENABLED
XFA_AttributeValue GetActivity()
XFA_Element GetEventType() const
WideString GetRef()
~CXFA_Event() override
CXFA_Script * GetScriptIfExists()
XFA_Element GetElementType() const
Definition cxfa_object.h:91
XFA_PropertyFlag
Definition cxfa_node.h:88
XFA_AttributeType
Definition fxfa_basic.h:83
XFA_Attribute
Definition fxfa_basic.h:67
XFA_Element
Definition fxfa_basic.h:75
XFA_AttributeValue
Definition fxfa_basic.h:60
XFA_PacketType
Definition fxfa_basic.h:44