Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
14
namespace
{
15
16
const
CXFA_Node
::
PropertyData
kEventPropertyData[] = {
17
{
XFA_Element
::Execute, 1,
XFA_PropertyFlag
::
kOneOf
},
18
{
XFA_Element
::Script, 1,
XFA_PropertyFlag
::
kOneOf
},
19
{
XFA_Element
::SignData, 1,
XFA_PropertyFlag
::
kOneOf
},
20
{
XFA_Element
::Extras, 1, {}},
21
{
XFA_Element
::Submit, 1,
XFA_PropertyFlag
::
kOneOf
},
22
};
23
24
const
CXFA_Node
::
AttributeData
kEventAttributeData[] = {
25
{
XFA_Attribute
::Id,
XFA_AttributeType
::
CData
,
nullptr
},
26
{
XFA_Attribute
::Name,
XFA_AttributeType
::
CData
,
nullptr
},
27
{
XFA_Attribute
::Ref,
XFA_AttributeType
::
CData
,
nullptr
},
28
{
XFA_Attribute
::Use,
XFA_AttributeType
::
CData
,
nullptr
},
29
{
XFA_Attribute
::Listen,
XFA_AttributeType
::
Enum
,
30
(
void
*)
XFA_AttributeValue
::RefOnly},
31
{
XFA_Attribute
::Usehref,
XFA_AttributeType
::
CData
,
nullptr
},
32
{
XFA_Attribute
::Activity,
XFA_AttributeType
::
Enum
,
33
(
void
*)
XFA_AttributeValue
::Click},
34
};
35
36
}
// namespace
37
38
CXFA_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
50
CXFA_Event::~
CXFA_Event
() =
default
;
51
52
XFA_AttributeValue
CXFA_Event::
GetActivity
() {
53
return
JSObject()->GetEnum(
XFA_Attribute
::Activity);
54
}
55
56
XFA_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
}
65
return
XFA_Element
::
Unknown
;
66
}
67
68
WideString
CXFA_Event::
GetRef
() {
69
return
JSObject()->GetCData(
XFA_Attribute
::Ref);
70
}
71
72
CXFA_Script* CXFA_Event::
GetScriptIfExists
() {
73
return
GetChild<CXFA_Script>(0,
XFA_Element
::Script,
false
);
74
}
75
76
#
ifdef
PDF_XFA_ELEMENT_SUBMIT_ENABLED
77
CXFA_Submit* CXFA_Event::GetSubmitIfExists() {
78
return
GetChild<CXFA_Submit>(0, XFA_Element::Submit,
false
);
79
}
80
#
endif
// PDF_XFA_ELEMENT_SUBMIT_ENABLED
CXFA_Event::GetActivity
XFA_AttributeValue GetActivity()
Definition
cxfa_event.cpp:52
CXFA_Event::GetEventType
XFA_Element GetEventType() const
Definition
cxfa_event.cpp:56
CXFA_Event::GetRef
WideString GetRef()
Definition
cxfa_event.cpp:68
CXFA_Event::~CXFA_Event
~CXFA_Event() override
CXFA_Event::GetScriptIfExists
CXFA_Script * GetScriptIfExists()
Definition
cxfa_event.cpp:72
CXFA_Node
Definition
cxfa_node.h:94
CXFA_Object::GetElementType
XFA_Element GetElementType() const
Definition
cxfa_object.h:91
XFA_PropertyFlag
XFA_PropertyFlag
Definition
cxfa_node.h:89
XFA_PropertyFlag::kOneOf
@ kOneOf
Definition
cxfa_node.h:90
XFA_AttributeType
XFA_AttributeType
Definition
fxfa_basic.h:83
XFA_AttributeType::Enum
@ Enum
Definition
fxfa_basic.h:84
XFA_AttributeType::CData
@ CData
Definition
fxfa_basic.h:85
XFA_Attribute
XFA_Attribute
Definition
fxfa_basic.h:67
XFA_Element
XFA_Element
Definition
fxfa_basic.h:75
XFA_Element::Unknown
@ Unknown
Definition
fxfa_basic.h:76
XFA_AttributeValue
XFA_AttributeValue
Definition
fxfa_basic.h:60
XFA_PacketType
XFA_PacketType
Definition
fxfa_basic.h:44
CXFA_Node::AttributeData
Definition
cxfa_node.h:110
CXFA_Node::PropertyData
Definition
cxfa_node.h:96
WideString
fxcrt::WideString WideString
Definition
widestring.h:207
qtwebengine
src
3rdparty
chromium
third_party
pdfium
xfa
fxfa
parser
cxfa_event.cpp
Generated on
for Qt by
1.18.0