summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser/cxfa_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser/cxfa_node.cpp')
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp31
1 files changed, 29 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;
+}