summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp31
-rw-r--r--xfa/fxfa/parser/cxfa_node.h3
2 files changed, 32 insertions, 2 deletions
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 026e013dae..6d670c462d 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -1840,8 +1840,8 @@ int32_t CXFA_Node::ProcessEvent(CXFA_FFDocView* docView,
if (GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
- std::vector<CXFA_Event*> eventArray = GetWidgetAcc()->GetEventByActivity(
- iActivity, pEventParam->m_bIsFormReady);
+ std::vector<CXFA_Event*> eventArray =
+ GetEventByActivity(iActivity, pEventParam->m_bIsFormReady);
bool first = true;
int32_t iRet = XFA_EVENTERROR_NotExist;
for (CXFA_Event* event : eventArray) {
@@ -2430,3 +2430,30 @@ CFX_RectF CXFA_Node::GetUIMargin() {
return CFX_RectF(left.value_or(0.0), top.value_or(0.0), right.value_or(0.0),
bottom.value_or(0.0));
}
+
+std::vector<CXFA_Event*> CXFA_Node::GetEventByActivity(
+ XFA_AttributeEnum iActivity,
+ bool bIsFormReady) {
+ std::vector<CXFA_Event*> events;
+ for (CXFA_Node* node : GetNodeList(0, XFA_Element::Event)) {
+ auto* event = static_cast<CXFA_Event*>(node);
+ if (event->GetActivity() != iActivity)
+ continue;
+
+ if (iActivity != XFA_AttributeEnum::Ready) {
+ events.push_back(event);
+ continue;
+ }
+
+ WideString wsRef = event->GetRef();
+ if (bIsFormReady) {
+ if (wsRef == WideStringView(L"$form"))
+ events.push_back(event);
+ continue;
+ }
+
+ if (wsRef == WideStringView(L"$layout"))
+ events.push_back(event);
+ }
+ return events;
+}
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index 9cda17c527..0991a533c8 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -312,6 +312,9 @@ class CXFA_Node : public CXFA_Object {
return acc_.get();
}
+ std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
+ bool bIsFormReady);
+
protected:
CXFA_Node(CXFA_Document* pDoc,
XFA_PacketType ePacket,