summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffdocview.cpp18
-rw-r--r--xfa/fxfa/app/xfa_fffield.cpp4
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.cpp516
-rw-r--r--xfa/fxfa/app/xfa_ffnotify.h73
-rw-r--r--xfa/fxfa/app/xfa_ffwidgetacc.cpp48
-rw-r--r--xfa/fxfa/app/xfa_ffwidgethandler.cpp4
6 files changed, 237 insertions, 426 deletions
diff --git a/xfa/fxfa/app/xfa_ffdocview.cpp b/xfa/fxfa/app/xfa_ffdocview.cpp
index 4f818e0dd7..9bc1be0a04 100644
--- a/xfa/fxfa/app/xfa_ffdocview.cpp
+++ b/xfa/fxfa/app/xfa_ffdocview.cpp
@@ -215,16 +215,11 @@ FX_BOOL CXFA_FFDocView::ResetSingleWidgetAccData(CXFA_WidgetAcc* pWidgetAcc) {
if (eType != XFA_ELEMENT_Field && eType != XFA_ELEMENT_ExclGroup) {
return FALSE;
}
- FX_BOOL bNotify = IsStaticNotify();
pWidgetAcc->ResetData();
pWidgetAcc->UpdateUIDisplay();
- if (bNotify) {
- pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_PostContentChanged, NULL, NULL,
- NULL);
- }
if (CXFA_Validate validate = pWidgetAcc->GetValidate()) {
AddValidateWidget(pWidgetAcc);
- validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE);
+ validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, false);
}
return TRUE;
}
@@ -532,16 +527,9 @@ CXFA_WidgetAcc* CXFA_FFDocView::GetWidgetAccByName(
}
void CXFA_FFDocView::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- XFA_PAGEEVENT eEvent,
- int32_t iPageIndex) {
+ uint32_t dwEvent) {
CXFA_FFPageView* pFFPageView = static_cast<CXFA_FFPageView*>(pSender);
- if (eEvent == XFA_PAGEEVENT_PageRemoved) {
- m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView,
- XFA_PAGEVIEWEVENT_PostRemoved);
- return;
- }
- m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView,
- XFA_PAGEVIEWEVENT_PostAdded);
+ m_pDoc->GetDocProvider()->PageViewEvent(pFFPageView, dwEvent);
}
void CXFA_FFDocView::LockUpdate() {
diff --git a/xfa/fxfa/app/xfa_fffield.cpp b/xfa/fxfa/app/xfa_fffield.cpp
index e91dd96b95..745f44d7e3 100644
--- a/xfa/fxfa/app/xfa_fffield.cpp
+++ b/xfa/fxfa/app/xfa_fffield.cpp
@@ -766,7 +766,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
if (pAppProvider->MsgBox(wsMessage.AsStringC(), wsTitle.AsStringC(),
XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
+ pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
return 1;
}
}
@@ -775,7 +775,7 @@ int32_t CXFA_FFField::CalculateWidgetAcc(CXFA_WidgetAcc* pAcc) {
case XFA_ATTRIBUTEENUM_Ignore:
return 0;
case XFA_ATTRIBUTEENUM_Disabled:
- pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
+ pAcc->GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
default:
return 1;
}
diff --git a/xfa/fxfa/app/xfa_ffnotify.cpp b/xfa/fxfa/app/xfa_ffnotify.cpp
index ac4cc27f8d..571593fc63 100644
--- a/xfa/fxfa/app/xfa_ffnotify.cpp
+++ b/xfa/fxfa/app/xfa_ffnotify.cpp
@@ -39,224 +39,137 @@ static XFA_MAPDATABLOCKCALLBACKINFO gs_XFADeleteWidgetAcc = {
CXFA_FFNotify::CXFA_FFNotify(CXFA_FFDoc* pDoc) : m_pDoc(pDoc) {}
CXFA_FFNotify::~CXFA_FFNotify() {}
+
void CXFA_FFNotify::OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- XFA_PAGEEVENT eEvent,
- void* pParam) {
+ uint32_t dwEvent) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pSender->GetLayout());
- if (!pDocView) {
- return;
- }
- pDocView->OnPageEvent(pSender, eEvent, (int32_t)(uintptr_t)pParam);
+ if (pDocView)
+ pDocView->OnPageEvent(pSender, dwEvent);
}
-void CXFA_FFNotify::OnNodeEvent(CXFA_Node* pSender,
- XFA_NODEEVENT eEvent,
- void* pParam,
- void* pParam2,
- void* pParam3,
- void* pParam4) {
- switch (eEvent) {
- case XFA_NODEEVENT_Ready:
- OnNodeReady(pSender);
- break;
- case XFA_NODEEVENT_ValueChanging:
- OnValueChanging(pSender, pParam, pParam2);
- break;
- case XFA_NODEEVENT_ValueChanged:
- OnValueChanged(pSender, pParam, pParam2, pParam3, pParam4);
- break;
- case XFA_NODEEVENT_ChildAdded:
- OnChildAdded(pSender, pParam, pParam2);
- break;
- case XFA_NODEEVENT_ChildRemoved:
- OnChildRemoved(pSender, pParam, pParam2);
- break;
+
+void CXFA_FFNotify::OnWidgetListItemAdded(CXFA_WidgetData* pSender,
+ const FX_WCHAR* pLabel,
+ const FX_WCHAR* pValue,
+ int32_t iIndex) {
+ CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
+ if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList)
+ return;
+
+ CXFA_FFWidget* pWidget = nullptr;
+ while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
+ if (pWidget->IsLoaded()) {
+ if (pWidgetAcc->IsListBox()) {
+ static_cast<CXFA_FFListBox*>(pWidget)->InsertItem(pLabel, iIndex);
+ } else {
+ static_cast<CXFA_FFComboBox*>(pWidget)->InsertItem(pLabel, iIndex);
+ }
+ }
}
}
-void CXFA_FFNotify::OnWidgetDataEvent(CXFA_WidgetData* pSender,
- uint32_t dwEvent,
- void* pParam,
- void* pAdditional,
- void* pAdditional2) {
+
+void CXFA_FFNotify::OnWidgetListItemRemoved(CXFA_WidgetData* pSender,
+ int32_t iIndex) {
CXFA_WidgetAcc* pWidgetAcc = static_cast<CXFA_WidgetAcc*>(pSender);
- switch (dwEvent) {
- case XFA_WIDGETEVENT_ListItemAdded: {
- if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) {
- return;
- }
- FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify();
- CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL);
- if (!pWidget) {
- if (bStaticNotify) {
- pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent(
- pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded, pParam,
- pAdditional);
- }
- return;
- }
- while (pWidget) {
- if (pWidget->IsLoaded()) {
- if (pWidgetAcc->IsListBox()) {
- static_cast<CXFA_FFListBox*>(pWidget)
- ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam,
- (int32_t)(uintptr_t)pAdditional2);
- } else {
- static_cast<CXFA_FFComboBox*>(pWidget)
- ->InsertItem((const CFX_WideStringC&)(const FX_WCHAR*)pParam,
- (int32_t)(uintptr_t)pAdditional2);
- }
- }
- if (bStaticNotify) {
- pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent(
- pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemAdded, pParam,
- pAdditional);
- }
- pWidget = pWidgetAcc->GetNextWidget(pWidget);
- }
- } break;
- case XFA_WIDGETEVENT_ListItemRemoved: {
- if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList) {
- return;
- }
- FX_BOOL bStaticNotify = pWidgetAcc->GetDocView()->IsStaticNotify();
- CXFA_FFWidget* pWidget = pWidgetAcc->GetNextWidget(NULL);
- if (!pWidget) {
- if (bStaticNotify) {
- pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent(
- pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam,
- pAdditional);
- }
- return;
- }
- while (pWidget) {
- if (pWidget->IsLoaded()) {
- if (pWidgetAcc->IsListBox()) {
- static_cast<CXFA_FFListBox*>(pWidget)
- ->DeleteItem((int32_t)(uintptr_t)pParam);
- } else {
- static_cast<CXFA_FFComboBox*>(pWidget)
- ->DeleteItem((int32_t)(uintptr_t)pParam);
- }
- }
- if (bStaticNotify) {
- pWidgetAcc->GetDoc()->GetDocProvider()->WidgetEvent(
- pWidget, pWidgetAcc, XFA_WIDGETEVENT_ListItemRemoved, pParam,
- pAdditional);
- }
- pWidget = pWidgetAcc->GetNextWidget(pWidget);
+ if (pWidgetAcc->GetUIType() != XFA_ELEMENT_ChoiceList)
+ return;
+
+ CXFA_FFWidget* pWidget = nullptr;
+ while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
+ if (pWidget->IsLoaded()) {
+ if (pWidgetAcc->IsListBox()) {
+ static_cast<CXFA_FFListBox*>(pWidget)->DeleteItem(iIndex);
+ } else {
+ static_cast<CXFA_FFComboBox*>(pWidget)->DeleteItem(iIndex);
}
- } break;
+ }
}
}
+
CXFA_LayoutItem* CXFA_FFNotify::OnCreateLayoutItem(CXFA_Node* pNode) {
CXFA_LayoutProcessor* pLayout = m_pDoc->GetXFADoc()->GetDocLayout();
CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
XFA_ELEMENT eType = pNode->GetClassID();
- if (eType == XFA_ELEMENT_PageArea) {
+ if (eType == XFA_ELEMENT_PageArea)
return new CXFA_FFPageView(pDocView, pNode);
- }
- if (eType == XFA_ELEMENT_ContentArea) {
+
+ if (eType == XFA_ELEMENT_ContentArea)
return new CXFA_ContainerLayoutItem(pNode);
- }
+
CXFA_WidgetAcc* pAcc = static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData());
- if (!pAcc) {
+ if (!pAcc)
return new CXFA_ContentLayoutItem(pNode);
- }
- CXFA_FFPageView* pPageView = NULL;
- CXFA_FFWidget* pWidget = NULL;
+
+ CXFA_FFWidget* pWidget;
switch (pAcc->GetUIType()) {
case XFA_ELEMENT_Barcode:
- pWidget = new CXFA_FFBarcode(pPageView, pAcc);
+ pWidget = new CXFA_FFBarcode(nullptr, pAcc);
break;
case XFA_ELEMENT_Button:
- pWidget = new CXFA_FFPushButton(pPageView, pAcc);
+ pWidget = new CXFA_FFPushButton(nullptr, pAcc);
break;
case XFA_ELEMENT_CheckButton:
- pWidget = new CXFA_FFCheckButton(pPageView, pAcc);
+ pWidget = new CXFA_FFCheckButton(nullptr, pAcc);
break;
case XFA_ELEMENT_ChoiceList: {
if (pAcc->IsListBox()) {
- pWidget = new CXFA_FFListBox(pPageView, pAcc);
+ pWidget = new CXFA_FFListBox(nullptr, pAcc);
} else {
- pWidget = new CXFA_FFComboBox(pPageView, pAcc);
+ pWidget = new CXFA_FFComboBox(nullptr, pAcc);
}
} break;
case XFA_ELEMENT_DateTimeEdit:
- pWidget = new CXFA_FFDateTimeEdit(pPageView, pAcc);
+ pWidget = new CXFA_FFDateTimeEdit(nullptr, pAcc);
break;
case XFA_ELEMENT_ImageEdit:
- pWidget = new CXFA_FFImageEdit(pPageView, pAcc);
+ pWidget = new CXFA_FFImageEdit(nullptr, pAcc);
break;
case XFA_ELEMENT_NumericEdit:
- pWidget = new CXFA_FFNumericEdit(pPageView, pAcc);
+ pWidget = new CXFA_FFNumericEdit(nullptr, pAcc);
break;
case XFA_ELEMENT_PasswordEdit:
- pWidget = new CXFA_FFPasswordEdit(pPageView, pAcc);
+ pWidget = new CXFA_FFPasswordEdit(nullptr, pAcc);
break;
case XFA_ELEMENT_Signature:
- pWidget = new CXFA_FFSignature(pPageView, pAcc);
+ pWidget = new CXFA_FFSignature(nullptr, pAcc);
break;
case XFA_ELEMENT_TextEdit:
- pWidget = new CXFA_FFTextEdit(pPageView, pAcc);
+ pWidget = new CXFA_FFTextEdit(nullptr, pAcc);
break;
case XFA_ELEMENT_Arc:
- pWidget = new CXFA_FFArc(pPageView, pAcc);
+ pWidget = new CXFA_FFArc(nullptr, pAcc);
break;
case XFA_ELEMENT_Line:
- pWidget = new CXFA_FFLine(pPageView, pAcc);
+ pWidget = new CXFA_FFLine(nullptr, pAcc);
break;
case XFA_ELEMENT_Rectangle:
- pWidget = new CXFA_FFRectangle(pPageView, pAcc);
+ pWidget = new CXFA_FFRectangle(nullptr, pAcc);
break;
case XFA_ELEMENT_Text:
- pWidget = new CXFA_FFText(pPageView, pAcc);
+ pWidget = new CXFA_FFText(nullptr, pAcc);
break;
case XFA_ELEMENT_Image:
- pWidget = new CXFA_FFImage(pPageView, pAcc);
+ pWidget = new CXFA_FFImage(nullptr, pAcc);
break;
case XFA_ELEMENT_Draw:
- pWidget = new CXFA_FFDraw(pPageView, pAcc);
+ pWidget = new CXFA_FFDraw(nullptr, pAcc);
break;
case XFA_ELEMENT_Subform:
- pWidget = new CXFA_FFSubForm(pPageView, pAcc);
+ pWidget = new CXFA_FFSubForm(nullptr, pAcc);
break;
case XFA_ELEMENT_ExclGroup:
- pWidget = new CXFA_FFExclGroup(pPageView, pAcc);
+ pWidget = new CXFA_FFExclGroup(nullptr, pAcc);
break;
case XFA_ELEMENT_DefaultUi:
default:
- pWidget = NULL;
+ pWidget = nullptr;
break;
}
- if (!pWidget) {
- return NULL;
- }
- pWidget->SetDocView(pDocView);
+
+ if (pWidget)
+ pWidget->SetDocView(pDocView);
return pWidget;
}
-void CXFA_FFNotify::OnLayoutEvent(CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- XFA_LAYOUTEVENT eEvent,
- void* pParam,
- void* pParam2) {
- CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
- if (!pDocView || !XFA_GetWidgetFromLayoutItem(pSender)) {
- return;
- }
- switch (eEvent) {
- case XFA_LAYOUTEVENT_ItemAdded:
- OnLayoutItemAdd(pDocView, pLayout, pSender, pParam, pParam2);
- break;
- case XFA_LAYOUTEVENT_ItemRemoving:
- OnLayoutItemRemoving(pDocView, pLayout, pSender, pParam, pParam2);
- break;
- case XFA_LAYOUTEVENT_RectChanged:
- OnLayoutItemRectChanged(pDocView, pLayout, pSender, pParam, pParam2);
- break;
- case XFA_LAYOUTEVENT_StatusChanged:
- OnLayoutItemStatustChanged(pDocView, pLayout, pSender, pParam, pParam2);
- break;
- }
-}
+
void CXFA_FFNotify::StartFieldDrawLayout(CXFA_Node* pItem,
FX_FLOAT& fCalcWidth,
FX_FLOAT& fCalcHeight) {
@@ -400,6 +313,7 @@ void CXFA_FFNotify::SetFocusWidgetNode(CXFA_Node* pNode) {
pNode ? static_cast<CXFA_WidgetAcc*>(pNode->GetWidgetData()) : nullptr;
pDocView->SetFocusWidgetAcc(pAcc);
}
+
void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
if (!pDocView) {
@@ -416,131 +330,110 @@ void CXFA_FFNotify::OnNodeReady(CXFA_Node* pNode) {
pDocView->m_bindItems.Add(pNode);
break;
case XFA_ELEMENT_Validate: {
- pNode->SetFlag(XFA_NODEFLAG_NeedsInitApp, TRUE, FALSE);
+ pNode->SetFlag(XFA_NODEFLAG_NeedsInitApp, false);
} break;
default:
break;
}
}
-void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender,
- void* pParam,
- void* pParam2) {
+
+void CXFA_FFNotify::OnValueChanging(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr) {
+ if (eAttr != XFA_ATTRIBUTE_Presence)
+ return;
+
+ if (pSender->GetPacketID() & XFA_XDPPACKET_Datasets)
+ return;
+
+ if (!pSender->IsFormContainer())
+ return;
+
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End) {
+
+ if (pDocView->GetLayoutStatus() < XFA_DOCVIEW_LAYOUTSTATUS_End)
return;
- }
- uint32_t dwPacket = pSender->GetPacketID();
- if (dwPacket & XFA_XDPPACKET_Datasets) {
- } else if (pSender->IsFormContainer()) {
- XFA_ATTRIBUTE eAttr = (XFA_ATTRIBUTE)(uintptr_t)pParam;
- if (eAttr == XFA_ATTRIBUTE_Presence) {
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData());
- if (!pWidgetAcc) {
- return;
- }
- CXFA_FFWidget* pWidget = NULL;
- while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
- if (pWidget->IsLoaded()) {
- pWidget->AddInvalidateRect();
- }
- }
- }
+
+ CXFA_WidgetAcc* pWidgetAcc =
+ static_cast<CXFA_WidgetAcc*>(pSender->GetWidgetData());
+ if (!pWidgetAcc)
+ return;
+
+ CXFA_FFWidget* pWidget = nullptr;
+ while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
+ if (pWidget->IsLoaded())
+ pWidget->AddInvalidateRect();
}
}
+
void CXFA_FFNotify::OnValueChanged(CXFA_Node* pSender,
- void* pParam,
- void* pParam2,
- void* pParam3,
- void* pParam4) {
+ XFA_ATTRIBUTE eAttr,
+ CXFA_Node* pParentNode,
+ CXFA_Node* pWidgetNode) {
CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
- if (!pDocView) {
+ if (!pDocView)
return;
- }
- uint32_t dwPacket = pSender->GetPacketID();
- XFA_ATTRIBUTE eAttr = (XFA_ATTRIBUTE)(uintptr_t)pParam;
- if (dwPacket & XFA_XDPPACKET_Form) {
- CXFA_Node* pParentNode = static_cast<CXFA_Node*>(pParam3);
- CXFA_Node* pWidgetNode = static_cast<CXFA_Node*>(pParam4);
- XFA_ELEMENT ePType = pParentNode->GetClassID();
- FX_BOOL bIsContainerNode = pParentNode->IsContainerNode();
- CXFA_WidgetAcc* pWidgetAcc =
- static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
- if (!pWidgetAcc) {
- return;
- }
- FX_BOOL bUpdateProperty = FALSE;
- pDocView->SetChangeMark();
- switch (ePType) {
- case XFA_ELEMENT_Caption: {
- CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout();
- if (!pCapOut) {
- return;
- }
- pCapOut->Unload();
- } break;
- case XFA_ELEMENT_Ui:
- case XFA_ELEMENT_Para:
- bUpdateProperty = TRUE;
- break;
- case XFA_ELEMENT_Font:
- case XFA_ELEMENT_Margin:
- case XFA_ELEMENT_Value:
- case XFA_ELEMENT_Items:
- break;
- default:
- break;
- }
- if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access) {
- bUpdateProperty = TRUE;
- FX_BOOL bNotify = pDocView->IsStaticNotify();
- if (bNotify) {
- pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_AccessChanged, NULL, pParam2,
- NULL);
- }
- }
- if (eAttr == XFA_ATTRIBUTE_Value) {
+
+ if (!(pSender->GetPacketID() & XFA_XDPPACKET_Form)) {
+ if (eAttr == XFA_ATTRIBUTE_Value)
pDocView->AddCalculateNodeNotify(pSender);
- if (ePType == XFA_ELEMENT_Value || bIsContainerNode) {
- FX_BOOL bNotify = pDocView->IsStaticNotify();
- if (bIsContainerNode) {
- pWidgetAcc->UpdateUIDisplay();
- pDocView->AddCalculateWidgetAcc(pWidgetAcc);
- pDocView->AddValidateWidget(pWidgetAcc);
- } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent)
- ->GetClassID() == XFA_ELEMENT_ExclGroup) {
- pWidgetAcc->UpdateUIDisplay();
- }
- if (bNotify) {
- pWidgetAcc->NotifyEvent(XFA_WIDGETEVENT_PostContentChanged, NULL,
- NULL, NULL);
- }
+ return;
+ }
+
+ XFA_ELEMENT ePType = pParentNode->GetClassID();
+ FX_BOOL bIsContainerNode = pParentNode->IsContainerNode();
+ CXFA_WidgetAcc* pWidgetAcc =
+ static_cast<CXFA_WidgetAcc*>(pWidgetNode->GetWidgetData());
+ if (!pWidgetAcc)
+ return;
+
+ bool bUpdateProperty = false;
+ pDocView->SetChangeMark();
+ switch (ePType) {
+ case XFA_ELEMENT_Caption: {
+ CXFA_TextLayout* pCapOut = pWidgetAcc->GetCaptionTextLayout();
+ if (!pCapOut)
return;
+
+ pCapOut->Unload();
+ } break;
+ case XFA_ELEMENT_Ui:
+ case XFA_ELEMENT_Para:
+ bUpdateProperty = true;
+ break;
+ default:
+ break;
+ }
+ if (bIsContainerNode && eAttr == XFA_ATTRIBUTE_Access)
+ bUpdateProperty = true;
+
+ if (eAttr == XFA_ATTRIBUTE_Value) {
+ pDocView->AddCalculateNodeNotify(pSender);
+ if (ePType == XFA_ELEMENT_Value || bIsContainerNode) {
+ if (bIsContainerNode) {
+ pWidgetAcc->UpdateUIDisplay();
+ pDocView->AddCalculateWidgetAcc(pWidgetAcc);
+ pDocView->AddValidateWidget(pWidgetAcc);
+ } else if (pWidgetNode->GetNodeItem(XFA_NODEITEM_Parent)->GetClassID() ==
+ XFA_ELEMENT_ExclGroup) {
+ pWidgetAcc->UpdateUIDisplay();
}
+ return;
}
- CXFA_FFWidget* pWidget = NULL;
- while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
- if (!pWidget->IsLoaded()) {
- continue;
- }
- if (bUpdateProperty) {
- pWidget->UpdateWidgetProperty();
- }
- pWidget->PerformLayout();
- pWidget->AddInvalidateRect();
- }
- } else {
- if (eAttr == XFA_ATTRIBUTE_Value) {
- pDocView->AddCalculateNodeNotify(pSender);
- }
+ }
+ CXFA_FFWidget* pWidget = nullptr;
+ while ((pWidget = pWidgetAcc->GetNextWidget(pWidget))) {
+ if (!pWidget->IsLoaded())
+ continue;
+
+ if (bUpdateProperty)
+ pWidget->UpdateWidgetProperty();
+ pWidget->PerformLayout();
+ pWidget->AddInvalidateRect();
}
}
-void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender,
- void* pParam,
- void* pParam2) {
+
+void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender) {
if (!pSender->IsFormContainer()) {
return;
}
@@ -551,31 +444,35 @@ void CXFA_FFNotify::OnChildAdded(CXFA_Node* pSender,
FX_BOOL bLayoutReady =
!(pDocView->m_bInLayoutStatus) &&
(pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
- if (bLayoutReady) {
+ if (bLayoutReady)
m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc);
- }
}
-void CXFA_FFNotify::OnChildRemoved(CXFA_Node* pSender,
- void* pParam,
- void* pParam2) {
- if (CXFA_FFDocView* pDocView = m_pDoc->GetDocView()) {
- FX_BOOL bLayoutReady =
- !(pDocView->m_bInLayoutStatus) &&
- (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
- if (bLayoutReady) {
- m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc);
- }
- }
+
+void CXFA_FFNotify::OnChildRemoved() {
+ CXFA_FFDocView* pDocView = m_pDoc->GetDocView();
+ if (!pDocView)
+ return;
+
+ bool bLayoutReady =
+ !(pDocView->m_bInLayoutStatus) &&
+ (pDocView->GetLayoutStatus() == XFA_DOCVIEW_LAYOUTSTATUS_End);
+ if (bLayoutReady)
+ m_pDoc->GetDocProvider()->SetChangeMark(m_pDoc);
}
-void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
- int32_t iPageIdx = (int32_t)(uintptr_t)pParam;
+
+void CXFA_FFNotify::OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
+ CXFA_LayoutItem* pSender,
+ int32_t iPageIdx,
+ uint32_t dwStatus) {
+ CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
+ if (!pDocView)
+ return;
+
+ CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender);
+ if (!pWidget)
+ return;
+
CXFA_FFPageView* pNewPageView = pDocView->GetPageView(iPageIdx);
- uint32_t dwStatus = (uint32_t)(uintptr_t)pParam2;
uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable |
XFA_WIDGETSTATUS_Printable;
pWidget->ModifyStatus(dwStatus, dwFilter);
@@ -585,8 +482,7 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
(XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable)) {
pWidget->SetPageView(pNewPageView);
m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(),
- XFA_WIDGETEVENT_PostAdded,
- pNewPageView, pPrePageView);
+ XFA_WIDGETEVENT_PostAdded);
}
if (pDocView->GetLayoutStatus() != XFA_DOCVIEW_LAYOUTSTATUS_End ||
!(dwStatus & XFA_WIDGETSTATUS_Visible)) {
@@ -602,47 +498,19 @@ void CXFA_FFNotify::OnLayoutItemAdd(CXFA_FFDocView* pDocView,
}
pWidget->AddInvalidateRect(nullptr);
}
-void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
+
+void CXFA_FFNotify::OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout,
+ CXFA_LayoutItem* pSender) {
+ CXFA_FFDocView* pDocView = m_pDoc->GetDocView(pLayout);
+ if (!pDocView)
+ return;
+
+ CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pSender);
+ if (!pWidget)
+ return;
+
pDocView->DeleteLayoutItem(pWidget);
m_pDoc->GetDocProvider()->WidgetEvent(pWidget, pWidget->GetDataAcc(),
- XFA_WIDGETEVENT_PreRemoved, nullptr,
- pWidget->GetPageView());
+ XFA_WIDGETEVENT_PreRemoved);
pWidget->AddInvalidateRect(nullptr);
}
-void CXFA_FFNotify::OnLayoutItemRectChanged(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2) {}
-void CXFA_FFNotify::OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2) {
- CXFA_FFWidget* pWidget = static_cast<CXFA_FFWidget*>(pSender);
- if (!pWidget) {
- return;
- }
- uint32_t dwStatus = (uint32_t)(uintptr_t)pParam;
- if (dwStatus == 0) {
- CXFA_LayoutItem* pPreItem = pSender->GetPrev();
- if (pPreItem) {
- CXFA_FFWidget* pPreWidget = static_cast<CXFA_FFWidget*>(pPreItem);
- if (pPreWidget) {
- dwStatus = pPreWidget->GetStatus();
- }
- }
- }
- uint32_t dwOldStatus = pWidget->GetStatus();
- uint32_t dwFilter = XFA_WIDGETSTATUS_Visible | XFA_WIDGETSTATUS_Viewable |
- XFA_WIDGETSTATUS_Printable;
- if ((dwOldStatus & dwFilter) == dwStatus) {
- return;
- }
- pWidget->ModifyStatus(dwStatus, dwFilter);
-}
diff --git a/xfa/fxfa/app/xfa_ffnotify.h b/xfa/fxfa/app/xfa_ffnotify.h
index 6bf39ee6d2..6dd400859b 100644
--- a/xfa/fxfa/app/xfa_ffnotify.h
+++ b/xfa/fxfa/app/xfa_ffnotify.h
@@ -16,27 +16,31 @@ class CXFA_FFNotify {
CXFA_FFNotify(CXFA_FFDoc* pDoc);
~CXFA_FFNotify();
- void OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- XFA_PAGEEVENT eEvent,
- void* pParam = NULL);
+ void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
+
+ void OnWidgetListItemAdded(CXFA_WidgetData* pSender,
+ const FX_WCHAR* pLabel,
+ const FX_WCHAR* pValue,
+ int32_t iIndex);
+ void OnWidgetListItemRemoved(CXFA_WidgetData* pSender, int32_t iIndex);
+
+ // Node events
+ void OnNodeReady(CXFA_Node* pNode);
+ void OnValueChanging(CXFA_Node* pSender, XFA_ATTRIBUTE eAttr);
+ void OnValueChanged(CXFA_Node* pSender,
+ XFA_ATTRIBUTE eAttr,
+ CXFA_Node* pParentNode,
+ CXFA_Node* pWidgetNode);
+ void OnChildAdded(CXFA_Node* pSender);
+ void OnChildRemoved();
- void OnNodeEvent(CXFA_Node* pSender,
- XFA_NODEEVENT eEvent,
- void* pParam = NULL,
- void* pParam2 = NULL,
- void* pParam3 = NULL,
- void* pParam4 = NULL);
- void OnWidgetDataEvent(CXFA_WidgetData* pSender,
- uint32_t dwEvent,
- void* pParam = NULL,
- void* pAdditional = NULL,
- void* pAdditional2 = NULL);
CXFA_LayoutItem* OnCreateLayoutItem(CXFA_Node* pNode);
- void OnLayoutEvent(CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- XFA_LAYOUTEVENT eEvent,
- void* pParam = NULL,
- void* pParam2 = NULL);
+ void OnLayoutItemAdded(CXFA_LayoutProcessor* pLayout,
+ CXFA_LayoutItem* pSender,
+ int32_t iPageIdx,
+ uint32_t dwStatus);
+ void OnLayoutItemRemoving(CXFA_LayoutProcessor* pLayout,
+ CXFA_LayoutItem* pSender);
void StartFieldDrawLayout(CXFA_Node* pItem,
FX_FLOAT& fCalcWidth,
@@ -66,36 +70,7 @@ class CXFA_FFNotify {
void SetFocusWidgetNode(CXFA_Node* pNode);
protected:
- void OnNodeReady(CXFA_Node* pNode);
- void OnValueChanging(CXFA_Node* pSender, void* pParam, void* pParam2);
- void OnValueChanged(CXFA_Node* pSender,
- void* pParam,
- void* pParam2,
- void* pParam3,
- void* pParam4);
- void OnChildAdded(CXFA_Node* pSender, void* pParam, void* pParam2);
- void OnChildRemoved(CXFA_Node* pSender, void* pParam, void* pParam2);
- void OnLayoutItemAdd(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2);
- void OnLayoutItemRemoving(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2);
- void OnLayoutItemRectChanged(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2);
- void OnLayoutItemStatustChanged(CXFA_FFDocView* pDocView,
- CXFA_LayoutProcessor* pLayout,
- CXFA_LayoutItem* pSender,
- void* pParam,
- void* pParam2);
- CXFA_FFDoc* m_pDoc;
+ CXFA_FFDoc* const m_pDoc;
};
#endif // XFA_FXFA_APP_XFA_FFNOTIFY_H_
diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
index fba296cde7..b1214dd685 100644
--- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp
@@ -361,6 +361,7 @@ int32_t CXFA_WidgetAcc::ProcessEvent(CXFA_Event& event,
}
return XFA_EVENTERROR_NotExist;
}
+
int32_t CXFA_WidgetAcc::ProcessCalculate() {
if (GetClassID() == XFA_ELEMENT_Draw) {
return XFA_EVENTERROR_NotExist;
@@ -376,19 +377,16 @@ int32_t CXFA_WidgetAcc::ProcessCalculate() {
EventParam.m_eType = XFA_EVENT_Calculate;
CXFA_Script script = calc.GetScript();
int32_t iRet = ExecuteScript(script, &EventParam);
- if (iRet == XFA_EVENTERROR_Success) {
- if (GetRawValue() != EventParam.m_wsResult) {
- const bool bNotify = GetDoc()->GetDocType() == XFA_DOCTYPE_Static;
- SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw);
- UpdateUIDisplay();
- if (bNotify) {
- NotifyEvent(XFA_WIDGETEVENT_PostContentChanged, NULL, NULL, NULL);
- }
- iRet = XFA_EVENTERROR_Success;
- }
+ if (iRet != XFA_EVENTERROR_Success)
+ return iRet;
+
+ if (GetRawValue() != EventParam.m_wsResult) {
+ SetValue(EventParam.m_wsResult, XFA_VALUEPICTURE_Raw);
+ UpdateUIDisplay();
}
- return iRet;
+ return XFA_EVENTERROR_Success;
}
+
void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
int32_t iRet,
FXJSE_HVALUE pRetValue,
@@ -419,7 +417,7 @@ void CXFA_WidgetAcc::ProcessScriptTestValidate(CXFA_Validate validate,
if (pAppProvider->MsgBox(wsScriptMsg.AsStringC(), wsTitle.AsStringC(),
XFA_MBICON_Warning,
XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
+ GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
}
} else {
if (wsScriptMsg.IsEmpty()) {
@@ -476,7 +474,7 @@ int32_t CXFA_WidgetAcc::ProcessFormatTestValidate(CXFA_Validate validate,
}
if (pAppProvider->MsgBox(wsFormatMsg.AsStringC(), wsTitle.AsStringC(),
XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
+ GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
}
return XFA_EVENTERROR_Success;
}
@@ -547,7 +545,7 @@ int32_t CXFA_WidgetAcc::ProcessNullTestValidate(CXFA_Validate validate,
}
if (pAppProvider->MsgBox(wsNullMsg.AsStringC(), wsTitle.AsStringC(),
XFA_MBICON_Warning, XFA_MB_YesNo) == XFA_IDYes) {
- GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, TRUE, FALSE);
+ GetNode()->SetFlag(XFA_NODEFLAG_UserInteractive, false);
}
return XFA_EVENTERROR_Error;
}
@@ -627,7 +625,7 @@ int32_t CXFA_WidgetAcc::ProcessValidate(int32_t iFlags) {
bVersionFlag = TRUE;
}
if (bInitDoc) {
- validate.GetNode()->SetFlag(XFA_NODEFLAG_NeedsInitApp, FALSE, FALSE);
+ validate.GetNode()->ClearFlag(XFA_NODEFLAG_NeedsInitApp);
} else {
iFormat = ProcessFormatTestValidate(validate, bVersionFlag);
if (!bVersionFlag) {
@@ -751,25 +749,7 @@ void CXFA_WidgetAcc::UpdateUIDisplay(CXFA_FFWidget* pExcept) {
pWidget->AddInvalidateRect();
}
}
-void CXFA_WidgetAcc::NotifyEvent(uint32_t dwEvent,
- CXFA_FFWidget* pWidget,
- void* pParam,
- void* pAdditional) {
- IXFA_DocProvider* pDocProvider = GetDoc()->GetDocProvider();
- if (pWidget) {
- pDocProvider->WidgetEvent(pWidget, this, dwEvent, pParam, pAdditional);
- } else {
- pWidget = GetNextWidget(pWidget);
- if (pWidget == NULL) {
- pDocProvider->WidgetEvent(NULL, this, dwEvent, pParam, pAdditional);
- return;
- }
- while (pWidget) {
- pDocProvider->WidgetEvent(pWidget, this, dwEvent, pParam, pAdditional);
- pWidget = GetNextWidget(pWidget);
- }
- }
-}
+
void CXFA_WidgetAcc::CalcCaptionSize(CFX_SizeF& szCap) {
CXFA_Caption caption = GetCaption();
if (!caption || caption.GetPresence() != XFA_ATTRIBUTEENUM_Visible) {
diff --git a/xfa/fxfa/app/xfa_ffwidgethandler.cpp b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
index b4d268920c..df8e424662 100644
--- a/xfa/fxfa/app/xfa_ffwidgethandler.cpp
+++ b/xfa/fxfa/app/xfa_ffwidgethandler.cpp
@@ -264,8 +264,8 @@ CXFA_FFWidget* CXFA_FFWidgetHandler::CreateWidget(CXFA_FFWidget* hParent,
if (!pNewFormItem)
return nullptr;
- pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized);
- pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized);
+ pNewFormItem->GetTemplateNode()->SetFlag(XFA_NODEFLAG_Initialized, true);
+ pNewFormItem->SetFlag(XFA_NODEFLAG_Initialized, true);
m_pDocView->RunLayout();
CXFA_LayoutItem* pLayout =
m_pDocView->GetXFALayout()->GetLayoutItem(pNewFormItem);