summaryrefslogtreecommitdiff
path: root/xfa/fxfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa')
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.cpp38
-rw-r--r--xfa/fxfa/cxfa_ffwidgethandler.h4
-rw-r--r--xfa/fxfa/cxfa_widgetacc.cpp24
-rw-r--r--xfa/fxfa/cxfa_widgetacc.h3
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp31
-rw-r--r--xfa/fxfa/parser/cxfa_node.h3
6 files changed, 49 insertions, 54 deletions
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.cpp b/xfa/fxfa/cxfa_ffwidgethandler.cpp
index 74ded4b5ae..66885e02b2 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/cxfa_ffwidgethandler.cpp
@@ -14,7 +14,6 @@
#include "xfa/fxfa/cxfa_fffield.h"
#include "xfa/fxfa/cxfa_ffwidget.h"
#include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h"
-#include "xfa/fxfa/cxfa_widgetacc.h"
#include "xfa/fxfa/parser/cxfa_calculate.h"
#include "xfa/fxfa/parser/cxfa_checkbutton.h"
#include "xfa/fxfa/parser/cxfa_layoutprocessor.h"
@@ -183,66 +182,59 @@ void CXFA_FFWidgetHandler::RenderWidget(CXFA_FFWidget* hWidget,
bHighlight ? XFA_WidgetStatus_Highlight : 0);
}
-bool CXFA_FFWidgetHandler::HasEvent(CXFA_WidgetAcc* pWidgetAcc,
+bool CXFA_FFWidgetHandler::HasEvent(CXFA_Node* pNode,
XFA_EVENTTYPE eEventType) {
if (eEventType == XFA_EVENT_Unknown)
return false;
- if (!pWidgetAcc)
- return false;
-
- CXFA_Node* node = pWidgetAcc->GetNode();
- if (!node || node->GetElementType() == XFA_Element::Draw)
+ if (!pNode || pNode->GetElementType() == XFA_Element::Draw)
return false;
switch (eEventType) {
case XFA_EVENT_Calculate: {
- CXFA_Calculate* calc = node->GetCalculateIfExists();
+ CXFA_Calculate* calc = pNode->GetCalculateIfExists();
return calc && calc->GetScriptIfExists();
}
case XFA_EVENT_Validate: {
- CXFA_Validate* validate = node->GetValidateIfExists();
+ CXFA_Validate* validate = pNode->GetValidateIfExists();
return validate && validate->GetScriptIfExists();
}
default:
break;
}
- return !pWidgetAcc->GetEventByActivity(gs_EventActivity[eEventType], false)
+ return !pNode->GetEventByActivity(gs_EventActivity[eEventType], false)
.empty();
}
-int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_WidgetAcc* pWidgetAcc,
+int32_t CXFA_FFWidgetHandler::ProcessEvent(CXFA_Node* pNode,
CXFA_EventParam* pParam) {
if (!pParam || pParam->m_eType == XFA_EVENT_Unknown)
return XFA_EVENTERROR_NotExist;
- if (!pWidgetAcc)
- return XFA_EVENTERROR_NotExist;
-
- CXFA_Node* node = pWidgetAcc->GetNode();
- if (!node || node->GetElementType() == XFA_Element::Draw)
+ if (!pNode || pNode->GetElementType() == XFA_Element::Draw)
return XFA_EVENTERROR_NotExist;
switch (pParam->m_eType) {
case XFA_EVENT_Calculate:
- return node->ProcessCalculate(m_pDocView);
+ return pNode->ProcessCalculate(m_pDocView);
case XFA_EVENT_Validate:
if (m_pDocView->GetDoc()->GetDocEnvironment()->IsValidationsEnabled(
m_pDocView->GetDoc())) {
- return node->ProcessValidate(m_pDocView, 0);
+ return pNode->ProcessValidate(m_pDocView, 0);
}
return XFA_EVENTERROR_Disabled;
case XFA_EVENT_InitCalculate: {
- CXFA_Calculate* calc = node->GetCalculateIfExists();
+ CXFA_Calculate* calc = pNode->GetCalculateIfExists();
if (!calc)
return XFA_EVENTERROR_NotExist;
- if (node->IsUserInteractive())
+ if (pNode->IsUserInteractive())
return XFA_EVENTERROR_Disabled;
- return node->ExecuteScript(m_pDocView, calc->GetScriptIfExists(), pParam);
+ return pNode->ExecuteScript(m_pDocView, calc->GetScriptIfExists(),
+ pParam);
}
default:
break;
}
- int32_t iRet =
- node->ProcessEvent(m_pDocView, gs_EventActivity[pParam->m_eType], pParam);
+ int32_t iRet = pNode->ProcessEvent(m_pDocView,
+ gs_EventActivity[pParam->m_eType], pParam);
return iRet;
}
diff --git a/xfa/fxfa/cxfa_ffwidgethandler.h b/xfa/fxfa/cxfa_ffwidgethandler.h
index 1ef8854310..378a442409 100644
--- a/xfa/fxfa/cxfa_ffwidgethandler.h
+++ b/xfa/fxfa/cxfa_ffwidgethandler.h
@@ -66,8 +66,8 @@ class CXFA_FFWidgetHandler {
CXFA_Graphics* pGS,
const CFX_Matrix& matrix,
bool bHighlight);
- bool HasEvent(CXFA_WidgetAcc* pWidgetAcc, XFA_EVENTTYPE eEventType);
- int32_t ProcessEvent(CXFA_WidgetAcc* pWidgetAcc, CXFA_EventParam* pParam);
+ bool HasEvent(CXFA_Node* pNode, XFA_EVENTTYPE eEventType);
+ int32_t ProcessEvent(CXFA_Node* pNode, CXFA_EventParam* pParam);
private:
CXFA_Node* CreateWidgetFormItem(XFA_WIDGETTYPE eType,
diff --git a/xfa/fxfa/cxfa_widgetacc.cpp b/xfa/fxfa/cxfa_widgetacc.cpp
index 9c61697307..0e73dfb4e8 100644
--- a/xfa/fxfa/cxfa_widgetacc.cpp
+++ b/xfa/fxfa/cxfa_widgetacc.cpp
@@ -1295,30 +1295,6 @@ bool CXFA_WidgetAcc::IsOpenAccess() const {
return m_pNode && m_pNode->IsOpenAccess();
}
-std::vector<CXFA_Event*> CXFA_WidgetAcc::GetEventByActivity(
- XFA_AttributeEnum iActivity,
- bool bIsFormReady) {
- std::vector<CXFA_Event*> events;
- for (CXFA_Node* node : m_pNode->GetNodeList(0, XFA_Element::Event)) {
- auto* event = static_cast<CXFA_Event*>(node);
- if (event->GetActivity() == iActivity) {
- if (iActivity == XFA_AttributeEnum::Ready) {
- WideString wsRef = event->GetRef();
- if (bIsFormReady) {
- if (wsRef == WideStringView(L"$form"))
- events.push_back(event);
- } else {
- if (wsRef == WideStringView(L"$layout"))
- events.push_back(event);
- }
- } else {
- events.push_back(event);
- }
- }
- }
- return events;
-}
-
XFA_AttributeEnum CXFA_WidgetAcc::GetButtonHighlight() {
CXFA_Node* pUIChild = m_pNode->GetUIChild();
if (pUIChild)
diff --git a/xfa/fxfa/cxfa_widgetacc.h b/xfa/fxfa/cxfa_widgetacc.h
index ca018ed655..8e0301865d 100644
--- a/xfa/fxfa/cxfa_widgetacc.h
+++ b/xfa/fxfa/cxfa_widgetacc.h
@@ -100,9 +100,6 @@ class CXFA_WidgetAcc {
bool IsChoiceListAllowTextEntry();
bool IsMultiLine();
- std::vector<CXFA_Event*> GetEventByActivity(XFA_AttributeEnum iActivity,
- bool bIsFormReady);
-
XFA_AttributeEnum GetButtonHighlight();
bool HasButtonRollover() const;
bool HasButtonDown() const;
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,