summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/xfa/cjx_exclgroup.cpp9
-rw-r--r--fxjs/xfa/cjx_form.cpp16
-rw-r--r--fxjs/xfa/cjx_hostpseudomodel.cpp7
-rw-r--r--fxjs/xfa/cjx_subform.cpp10
-rw-r--r--xfa/fxfa/cxfa_ffdocview.cpp64
-rw-r--r--xfa/fxfa/cxfa_ffdocview.h7
-rw-r--r--xfa/fxfa/cxfa_ffnotify.cpp12
-rw-r--r--xfa/fxfa/cxfa_ffnotify.h7
8 files changed, 61 insertions, 71 deletions
diff --git a/fxjs/xfa/cjx_exclgroup.cpp b/fxjs/xfa/cjx_exclgroup.cpp
index 4facdcae47..6d9f5407de 100644
--- a/fxjs/xfa/cjx_exclgroup.cpp
+++ b/fxjs/xfa/cjx_exclgroup.cpp
@@ -50,7 +50,8 @@ CJS_Return CJX_ExclGroup::execInitialize(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
+ true);
return CJS_Return(true);
}
@@ -62,7 +63,8 @@ CJS_Return CJX_ExclGroup::execCalculate(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
+ true);
return CJS_Return(true);
}
@@ -76,7 +78,8 @@ CJS_Return CJX_ExclGroup::execValidate(
if (!notify)
return CJS_Return(runtime->NewBoolean(false));
- int32_t iRet = notify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate);
+ int32_t iRet = notify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate,
+ false, true);
return CJS_Return(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error));
}
diff --git a/fxjs/xfa/cjx_form.cpp b/fxjs/xfa/cjx_form.cpp
index 54f06fe966..6576df88d2 100644
--- a/fxjs/xfa/cjx_form.cpp
+++ b/fxjs/xfa/cjx_form.cpp
@@ -69,7 +69,8 @@ CJS_Return CJX_Form::execInitialize(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
+ true);
return CJS_Return(true);
}
@@ -89,9 +90,9 @@ CJS_Return CJX_Form::recalculate(
if (!pNotify || runtime->ToInt32(params[0]) != 0)
return CJS_Return(true);
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate);
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate);
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Ready, true);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false, true);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate, false, true);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Ready, true, true);
return CJS_Return(true);
}
@@ -103,7 +104,8 @@ CJS_Return CJX_Form::execCalculate(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
+ true);
return CJS_Return(true);
}
@@ -117,7 +119,7 @@ CJS_Return CJX_Form::execValidate(
if (!pNotify)
return CJS_Return(runtime->NewBoolean(false));
- int32_t iRet =
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate);
+ int32_t iRet = pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate,
+ false, true);
return CJS_Return(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error));
}
diff --git a/fxjs/xfa/cjx_hostpseudomodel.cpp b/fxjs/xfa/cjx_hostpseudomodel.cpp
index c607325a90..319761d19a 100644
--- a/fxjs/xfa/cjx_hostpseudomodel.cpp
+++ b/fxjs/xfa/cjx_hostpseudomodel.cpp
@@ -367,7 +367,7 @@ CJS_Return CJX_HostPseudoModel::resetData(
expression = runtime->ToWideString(params[0]);
if (expression.IsEmpty()) {
- pNotify->ResetData();
+ pNotify->ResetData(nullptr);
return CJS_Return(true);
}
@@ -394,11 +394,10 @@ CJS_Return CJX_HostPseudoModel::resetData(
continue;
pNode = resolveNodeRS.objects.front()->AsNode();
- pNotify->ResetData(pNode->IsWidgetReady() ? pNode->GetWidgetAcc()
- : nullptr);
+ pNotify->ResetData(pNode->IsWidgetReady() ? pNode : nullptr);
}
if (!pNode)
- pNotify->ResetData();
+ pNotify->ResetData(nullptr);
return CJS_Return(true);
}
diff --git a/fxjs/xfa/cjx_subform.cpp b/fxjs/xfa/cjx_subform.cpp
index 947d66db1d..f153fa2ba0 100644
--- a/fxjs/xfa/cjx_subform.cpp
+++ b/fxjs/xfa/cjx_subform.cpp
@@ -47,7 +47,8 @@ CJS_Return CJX_Subform::execInitialize(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Initialize, false,
+ true);
return CJS_Return(true);
}
@@ -59,7 +60,8 @@ CJS_Return CJX_Subform::execCalculate(
CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
if (pNotify)
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate);
+ pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Calculate, false,
+ true);
return CJS_Return(true);
}
@@ -73,8 +75,8 @@ CJS_Return CJX_Subform::execValidate(
if (!pNotify)
return CJS_Return(runtime->NewBoolean(false));
- int32_t iRet =
- pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate);
+ int32_t iRet = pNotify->ExecEventByDeepFirst(GetXFANode(), XFA_EVENT_Validate,
+ false, true);
return CJS_Return(runtime->NewBoolean(iRet != XFA_EVENTERROR_Error));
}
diff --git a/xfa/fxfa/cxfa_ffdocview.cpp b/xfa/fxfa/cxfa_ffdocview.cpp
index b13aa3a0ac..f55733fe94 100644
--- a/xfa/fxfa/cxfa_ffdocview.cpp
+++ b/xfa/fxfa/cxfa_ffdocview.cpp
@@ -72,10 +72,8 @@ CXFA_FFDocView::~CXFA_FFDocView() {
void CXFA_FFDocView::InitLayout(CXFA_Node* pNode) {
RunBindItems();
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange, false, true,
- nullptr);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Initialize, false, true);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_IndexChange, false, true);
}
int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
@@ -97,7 +95,7 @@ int32_t CXFA_FFDocView::StartLayout(int32_t iStartPage) {
InitCalculate(pRootItem);
InitValidate(pRootItem);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true, nullptr);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, true, true);
m_iStatus = XFA_DOCVIEW_LAYOUTSTATUS_Start;
return iStatus;
}
@@ -135,20 +133,15 @@ void CXFA_FFDocView::StopLayout() {
InitCalculate(pPageSetNode);
InitValidate(pPageSetNode);
- ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady, false, true,
- nullptr);
+ ExecEventActivityByDeepFirst(pPageSetNode, XFA_EVENT_Ready, true, true);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocReady, false, true);
RunCalculateWidgets();
RunValidate();
- if (RunLayout()) {
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
- }
+ if (RunLayout())
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true);
m_CalculateAccs.clear();
if (m_pFocusAcc && !m_pFocusWidget)
@@ -188,7 +181,7 @@ void CXFA_FFDocView::UpdateDocView() {
for (CXFA_Node* pNode : m_NewAddedNodes) {
InitCalculate(pNode);
InitValidate(pNode);
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true, nullptr);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Ready, true, true);
}
m_NewAddedNodes.clear();
@@ -221,30 +214,29 @@ CXFA_LayoutProcessor* CXFA_FFDocView::GetXFALayout() const {
return m_pDoc->GetXFADoc()->GetDocLayout();
}
-bool CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
- CXFA_Node* pNode = pWidgetAcc->GetNode();
+bool CXFA_FFDocView::ResetSingleNodeData(CXFA_Node* pNode) {
XFA_Element eType = pNode->GetElementType();
if (eType != XFA_Element::Field && eType != XFA_Element::ExclGroup)
return false;
- pWidgetAcc->ResetData();
- pWidgetAcc->UpdateUIDisplay(this, nullptr);
+ pNode->GetWidgetAcc()->ResetData();
+ pNode->GetWidgetAcc()->UpdateUIDisplay(this, nullptr);
CXFA_Validate* validate = pNode->GetValidateIfExists();
if (!validate)
return true;
- AddValidateWidget(pWidgetAcc);
+ AddValidateWidget(pNode->GetWidgetAcc());
validate->SetFlag(XFA_NodeFlag_NeedsInitApp, false);
return true;
}
-void CXFA_FFDocView::ResetWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
+void CXFA_FFDocView::ResetNode(CXFA_Node* pNode) {
m_bLayoutEvent = true;
bool bChanged = false;
CXFA_Node* pFormNode = nullptr;
- if (pWidgetAcc) {
- bChanged = ResetSingleWidgetAccData(pWidgetAcc);
- pFormNode = pWidgetAcc->GetNode();
+ if (pNode) {
+ bChanged = ResetSingleNodeData(pNode);
+ pFormNode = pNode;
} else {
pFormNode = GetRootSubform();
}
@@ -255,7 +247,7 @@ void CXFA_FFDocView::ResetWidgetAcc(CXFA_WidgetAcc* pWidgetAcc) {
pFormNode->GetElementType() != XFA_Element::ExclGroup) {
CXFA_WidgetAccIterator Iterator(pFormNode);
while (CXFA_WidgetAcc* pAcc = Iterator.MoveToNext()) {
- bChanged |= ResetSingleWidgetAccData(pAcc);
+ bChanged |= ResetSingleNodeData(pAcc->GetNode());
if (pAcc->GetNode()->GetElementType() == XFA_Element::ExclGroup)
Iterator.SkipTree();
}
@@ -306,7 +298,7 @@ int32_t CXFA_FFDocView::ProcessWidgetEvent(CXFA_EventParam* pParam,
}
ExecEventActivityByDeepFirst(pNode, pParam->m_eType, pParam->m_bIsFormReady,
- true, nullptr);
+ true);
return XFA_EVENTERROR_Success;
}
@@ -450,9 +442,8 @@ static int32_t XFA_ProcessEvent(CXFA_FFDocView* pDocView,
int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
bool bIsFormReady,
- bool bRecursive,
- CXFA_Node* pExclude) {
- if (pFormNode == pExclude)
+ bool bRecursive) {
+ if (!pFormNode)
return XFA_EVENTERROR_NotExist;
XFA_Element elementType = pFormNode->GetElementType();
@@ -479,7 +470,7 @@ int32_t CXFA_FFDocView::ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
if (elementType != XFA_Element::Variables &&
elementType != XFA_Element::Draw) {
iRet |= ExecEventActivityByDeepFirst(pNode, eEventType, bIsFormReady,
- bRecursive, pExclude);
+ bRecursive);
}
}
}
@@ -619,8 +610,7 @@ void CXFA_FFDocView::RunDocClose() {
if (!pRootItem)
return;
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose, false, true,
- nullptr);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_DocClose, false, true);
}
void CXFA_FFDocView::DestroyDocView() {
@@ -688,8 +678,7 @@ void CXFA_FFDocView::AddValidateWidget(CXFA_WidgetAcc* pWidget) {
}
void CXFA_FFDocView::InitCalculate(CXFA_Node* pNode) {
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate, false, true,
- nullptr);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_InitCalculate, false, true);
}
void CXFA_FFDocView::ProcessValueChanged(CXFA_WidgetAcc* widgetAcc) {
@@ -703,7 +692,7 @@ bool CXFA_FFDocView::InitValidate(CXFA_Node* pNode) {
if (!m_pDoc->GetDocEnvironment()->IsValidationsEnabled(m_pDoc.Get()))
return false;
- ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true, nullptr);
+ ExecEventActivityByDeepFirst(pNode, XFA_EVENT_Validate, false, true);
m_ValidateAccs.clear();
return true;
}
@@ -727,8 +716,7 @@ bool CXFA_FFDocView::RunEventLayoutReady() {
if (!pRootItem)
return false;
- ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true,
- nullptr);
+ ExecEventActivityByDeepFirst(pRootItem, XFA_EVENT_Ready, false, true);
RunLayout();
return true;
}
diff --git a/xfa/fxfa/cxfa_ffdocview.h b/xfa/fxfa/cxfa_ffdocview.h
index 5c8f0176d8..e80a0acdca 100644
--- a/xfa/fxfa/cxfa_ffdocview.h
+++ b/xfa/fxfa/cxfa_ffdocview.h
@@ -54,7 +54,7 @@ class CXFA_FFDocView {
int32_t CountPageViews() const;
CXFA_FFPageView* GetPageView(int32_t nIndex) const;
- void ResetWidgetAcc(CXFA_WidgetAcc* pWidgetAcc);
+ void ResetNode(CXFA_Node* pNode);
int32_t ProcessWidgetEvent(CXFA_EventParam* pParam,
CXFA_WidgetAcc* pWidgetAcc);
CXFA_FFWidgetHandler* GetWidgetHandler();
@@ -104,8 +104,7 @@ class CXFA_FFDocView {
int32_t ExecEventActivityByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
bool bIsFormReady,
- bool bRecursive,
- CXFA_Node* pExclude);
+ bool bRecursive);
void AddBindItem(CXFA_BindItems* item) { m_BindItems.push_back(item); }
@@ -121,7 +120,7 @@ class CXFA_FFDocView {
void InitLayout(CXFA_Node* pNode);
size_t RunCalculateRecursive(size_t index);
void ShowNullTestMsg();
- bool ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc);
+ bool ResetSingleNodeData(CXFA_Node* pNode);
CXFA_Subform* GetRootSubform();
UnownedPtr<CXFA_FFDoc> const m_pDoc;
diff --git a/xfa/fxfa/cxfa_ffnotify.cpp b/xfa/fxfa/cxfa_ffnotify.cpp
index 64acc5bfdc..0d9c8518eb 100644
--- a/xfa/fxfa/cxfa_ffnotify.cpp
+++ b/xfa/fxfa/cxfa_ffnotify.cpp
@@ -225,14 +225,12 @@ bool CXFA_FFNotify::RunScript(CXFA_Script* script, CXFA_Node* item) {
int32_t CXFA_FFNotify::ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
bool bIsFormReady,
- bool bRecursive,
- CXFA_WidgetAcc* pExclude) {
+ bool bRecursive) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
if (!pDocView)
return XFA_EVENTERROR_NotExist;
- return pDocView->ExecEventActivityByDeepFirst(
- pFormNode, eEventType, bIsFormReady, bRecursive,
- pExclude ? pExclude->GetNode() : nullptr);
+ return pDocView->ExecEventActivityByDeepFirst(pFormNode, eEventType,
+ bIsFormReady, bRecursive);
}
void CXFA_FFNotify::AddCalcValidate(CXFA_Node* pNode) {
@@ -288,12 +286,12 @@ WideString CXFA_FFNotify::GetCurrentDateTime() {
dataTime.GetSecond());
}
-void CXFA_FFNotify::ResetData(CXFA_WidgetAcc* pWidgetAcc) {
+void CXFA_FFNotify::ResetData(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
if (!pDocView)
return;
- pDocView->ResetWidgetAcc(pWidgetAcc);
+ pDocView->ResetNode(pNode);
}
int32_t CXFA_FFNotify::GetLayoutStatus() {
diff --git a/xfa/fxfa/cxfa_ffnotify.h b/xfa/fxfa/cxfa_ffnotify.h
index c9a97859b6..94d8ebd552 100644
--- a/xfa/fxfa/cxfa_ffnotify.h
+++ b/xfa/fxfa/cxfa_ffnotify.h
@@ -57,9 +57,8 @@ class CXFA_FFNotify {
bool RunScript(CXFA_Script* pScript, CXFA_Node* pFormItem);
int32_t ExecEventByDeepFirst(CXFA_Node* pFormNode,
XFA_EVENTTYPE eEventType,
- bool bIsFormReady = false,
- bool bRecursive = true,
- CXFA_WidgetAcc* pExclude = nullptr);
+ bool bIsFormReady,
+ bool bRecursive);
void AddCalcValidate(CXFA_Node* pNode);
CXFA_FFDoc* GetHDOC();
IXFA_DocEnvironment* GetDocEnvironment() const;
@@ -68,7 +67,7 @@ class CXFA_FFNotify {
CXFA_FFWidget* GetHWidget(CXFA_LayoutItem* pLayoutItem);
void OpenDropDownList(CXFA_FFWidget* hWidget);
WideString GetCurrentDateTime();
- void ResetData(CXFA_WidgetAcc* pWidgetAcc = nullptr);
+ void ResetData(CXFA_Node* pNode);
int32_t GetLayoutStatus();
void RunNodeInitialize(CXFA_Node* pNode);
void RunSubformIndexChange(CXFA_Node* pSubformNode);