summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp4
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h4
-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
-rw-r--r--xfa/fxfa/include/fxfa.h9
-rw-r--r--xfa/fxfa/include/fxfa_widget.h4
-rw-r--r--xfa/fxfa/include/xfa_ffdocview.h4
-rw-r--r--xfa/fxfa/parser/cxfa_widgetdata.cpp12
-rw-r--r--xfa/fxfa/parser/xfa_document.h18
-rw-r--r--xfa/fxfa/parser/xfa_document_datadescription_imp.cpp4
-rw-r--r--xfa/fxfa/parser/xfa_document_datamerger_imp.cpp18
-rw-r--r--xfa/fxfa/parser/xfa_document_imp.cpp6
-rw-r--r--xfa/fxfa/parser/xfa_layout_appadapter.cpp8
-rw-r--r--xfa/fxfa/parser/xfa_layout_itemlayout.cpp8
-rw-r--r--xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp65
-rw-r--r--xfa/fxfa/parser/xfa_object.h54
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp549
-rw-r--r--xfa/fxfa/parser/xfa_parser_imp.cpp18
22 files changed, 601 insertions, 847 deletions
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index 53068d345d..d55183751e 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -521,9 +521,7 @@ void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView,
void CPDFXFA_Document::WidgetEvent(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData,
- uint32_t dwEvent,
- void* pParam,
- void* pAdditional) {
+ uint32_t dwEvent) {
if (m_iDocType != DOCTYPE_DYNAMIC_XFA || !hWidget)
return;
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
index 2d4311f55f..5ffeb21022 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
@@ -73,9 +73,7 @@ class CPDFXFA_Document : public IXFA_DocProvider {
// dwEvent refer to XFA_WIDGETEVENT_XXX
virtual void WidgetEvent(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData,
- uint32_t dwEvent,
- void* pParam = NULL,
- void* pAdditional = NULL);
+ uint32_t dwEvent);
// return true if render it.
virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget,
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);
diff --git a/xfa/fxfa/include/fxfa.h b/xfa/fxfa/include/fxfa.h
index 1f2b00b4ec..6c07370a29 100644
--- a/xfa/fxfa/include/fxfa.h
+++ b/xfa/fxfa/include/fxfa.h
@@ -279,10 +279,7 @@ class IXFA_AppProvider {
#define XFA_PAGEVIEWEVENT_StopLayout 4
#define XFA_WIDGETEVENT_PostAdded 2
#define XFA_WIDGETEVENT_PreRemoved 3
-#define XFA_WIDGETEVENT_PostContentChanged 6
-#define XFA_WIDGETEVENT_ListItemRemoved 7
-#define XFA_WIDGETEVENT_ListItemAdded 8
-#define XFA_WIDGETEVENT_AccessChanged 9
+
class IXFA_DocProvider {
public:
virtual ~IXFA_DocProvider() {}
@@ -305,9 +302,7 @@ class IXFA_DocProvider {
virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags) = 0;
virtual void WidgetEvent(CXFA_FFWidget* hWidget,
CXFA_WidgetAcc* pWidgetData,
- uint32_t dwEvent,
- void* pParam = NULL,
- void* pAdditional = NULL) = 0;
+ uint32_t dwEvent) = 0;
virtual FX_BOOL RenderCustomWidget(CXFA_FFWidget* hWidget,
CFX_Graphics* pGS,
CFX_Matrix* pMatrix,
diff --git a/xfa/fxfa/include/fxfa_widget.h b/xfa/fxfa/include/fxfa_widget.h
index 0f1de8526b..acd800dcd4 100644
--- a/xfa/fxfa/include/fxfa_widget.h
+++ b/xfa/fxfa/include/fxfa_widget.h
@@ -73,10 +73,6 @@ class CXFA_WidgetAcc : public CXFA_WidgetData {
void SetImageImage(CFX_DIBitmap* newImage);
void SetImageEditImage(CFX_DIBitmap* newImage);
void UpdateUIDisplay(CXFA_FFWidget* pExcept = NULL);
- void NotifyEvent(uint32_t dwEvent,
- CXFA_FFWidget* pWidget = NULL,
- void* pParam = NULL,
- void* pAdditional = NULL);
CXFA_Node* GetDatasets();
IFX_Font* GetFDEFont();
diff --git a/xfa/fxfa/include/xfa_ffdocview.h b/xfa/fxfa/include/xfa_ffdocview.h
index dc9598850a..539100116c 100644
--- a/xfa/fxfa/include/xfa_ffdocview.h
+++ b/xfa/fxfa/include/xfa_ffdocview.h
@@ -60,9 +60,7 @@ class CXFA_FFDocView {
CXFA_WidgetAcc* GetWidgetAccByName(const CFX_WideString& wsName,
CXFA_WidgetAcc* pRefWidgetAcc = nullptr);
CXFA_LayoutProcessor* GetXFALayout() const;
- void OnPageEvent(CXFA_ContainerLayoutItem* pSender,
- XFA_PAGEEVENT eEvent,
- int32_t iPageIndex);
+ void OnPageEvent(CXFA_ContainerLayoutItem* pSender, uint32_t dwEvent);
void LockUpdate();
void UnlockUpdate();
FX_BOOL IsUpdateLocked();
diff --git a/xfa/fxfa/parser/cxfa_widgetdata.cpp b/xfa/fxfa/parser/cxfa_widgetdata.cpp
index e75eef8916..a702527347 100644
--- a/xfa/fxfa/parser/cxfa_widgetdata.cpp
+++ b/xfa/fxfa/parser/cxfa_widgetdata.cpp
@@ -927,9 +927,8 @@ void CXFA_WidgetData::InsertItem(const CFX_WideString& wsLabel,
if (!bNotify)
return;
- m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent(
- this, XFA_WIDGETEVENT_ListItemAdded, (void*)wsLabel.c_str(),
- (void*)wsValue.c_str(), (void*)(uintptr_t)nIndex);
+ m_pNode->GetDocument()->GetNotify()->OnWidgetListItemAdded(
+ this, wsLabel.c_str(), wsValue.c_str(), nIndex);
}
void CXFA_WidgetData::GetItemLabel(const CFX_WideStringC& wsValue,
@@ -1053,11 +1052,8 @@ FX_BOOL CXFA_WidgetData::DeleteItem(int32_t nIndex,
}
}
}
- if (!bNotify)
- return TRUE;
-
- m_pNode->GetDocument()->GetNotify()->OnWidgetDataEvent(
- this, XFA_WIDGETEVENT_ListItemRemoved, (void*)(uintptr_t)nIndex);
+ if (bNotify)
+ m_pNode->GetDocument()->GetNotify()->OnWidgetListItemRemoved(this, nIndex);
return TRUE;
}
diff --git a/xfa/fxfa/parser/xfa_document.h b/xfa/fxfa/parser/xfa_document.h
index 4e98813b95..dc50646868 100644
--- a/xfa/fxfa/parser/xfa_document.h
+++ b/xfa/fxfa/parser/xfa_document.h
@@ -42,23 +42,7 @@ enum XFA_VERSION {
#define XFA_LAYOUTSTATUS_Visible 0x0001
#define XFA_LAYOUTSTATUS_Viewable 0x0010
#define XFA_LAYOUTSTATUS_Printable 0x0020
-enum XFA_NODEEVENT {
- XFA_NODEEVENT_Ready,
- XFA_NODEEVENT_ValueChanging,
- XFA_NODEEVENT_ValueChanged,
- XFA_NODEEVENT_ChildAdded,
- XFA_NODEEVENT_ChildRemoved,
-};
-enum XFA_PAGEEVENT {
- XFA_PAGEEVENT_PageAdded,
- XFA_PAGEEVENT_PageRemoved,
-};
-enum XFA_LAYOUTEVENT {
- XFA_LAYOUTEVENT_ItemAdded,
- XFA_LAYOUTEVENT_ItemRemoving,
- XFA_LAYOUTEVENT_RectChanged,
- XFA_LAYOUTEVENT_StatusChanged,
-};
+
enum XFA_LAYOUTRESULT {
XFA_LAYOUTRESULT_Continue,
XFA_LAYOUTRESULT_Done,
diff --git a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
index 1a6ca1b5fe..b267fce339 100644
--- a/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datadescription_imp.cpp
@@ -82,7 +82,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode(
pDataNode->SetCData(XFA_ATTRIBUTE_Name, wsName);
pDataNode->CreateXMLMappingNode();
pDataParent->InsertChild(pDataNode);
- pDataNode->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pDataNode->SetFlag(XFA_NODEFLAG_Initialized, false);
return pDataNode;
} else {
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_DDGroup>
@@ -118,7 +118,7 @@ CXFA_Node* XFA_DataDescription_MaybeCreateDataNode(
}
pDataParent->InsertChild(pDataNode);
pDataNode->SetDataDescriptionNode(pDDNode);
- pDataNode->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pDataNode->SetFlag(XFA_NODEFLAG_Initialized, false);
return pDataNode;
}
return NULL;
diff --git a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
index f0c2d7645a..6ee4ec8d9a 100644
--- a/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_datamerger_imp.cpp
@@ -524,7 +524,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument,
pFormParent->RemoveChild(pExistingNode);
pFormParent->InsertChild(pExistingNode);
}
- pExistingNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pExistingNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
pExistingNode->SetTemplateNode(pTemplateNode);
if (bRecursive && pExistingNode->GetClassID() != XFA_ELEMENT_Items) {
for (CXFA_Node* pTemplateChild =
@@ -537,7 +537,7 @@ CXFA_Node* XFA_NodeMerge_CloneOrMergeContainer(CXFA_Document* pDocument,
}
}
}
- pExistingNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pExistingNode->SetFlag(XFA_NODEFLAG_Initialized, true);
return pExistingNode;
}
CXFA_Node* pNewNode = pTemplateNode->CloneTemplateToForm(FALSE);
@@ -590,7 +590,7 @@ static CXFA_Node* XFA_NodeMerge_CloneOrMergeInstanceManager(
}
pFormParent->RemoveChild(pExistingNode);
pFormParent->InsertChild(pExistingNode);
- pExistingNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pExistingNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
pExistingNode->SetTemplateNode(pTemplateNode);
return pExistingNode;
}
@@ -784,11 +784,11 @@ static CXFA_Node* XFA_DataMerge_CopyContainer_SubformSet(
} else if (pInstMgrNode) {
pOccurNode = pInstMgrNode->GetFirstChildByClass(XFA_ELEMENT_Occur);
if (pOccurNode) {
- pOccurNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pOccurNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
}
}
if (pInstMgrNode) {
- pInstMgrNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pInstMgrNode->SetFlag(XFA_NODEFLAG_Initialized, true);
pSearchArray = &subformArray;
if (pFormParentNode->GetClassID() == XFA_ELEMENT_PageArea) {
bOneInstance = TRUE;
@@ -1347,7 +1347,7 @@ void CXFA_Document::DoDataMerge() {
sIterator(pFormRoot);
for (CXFA_Node* pNode = sIterator.MoveToNext(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true);
}
}
CXFA_Node* pSubformSetNode = XFA_NodeMerge_CloneOrMergeContainer(
@@ -1405,12 +1405,12 @@ void CXFA_Document::DoDataMerge() {
pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode);
pNode = pNext;
} else {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
- pNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_Initialized, true);
pNode = sIterator.MoveToNext();
}
} else {
- pNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNode->SetFlag(XFA_NODEFLAG_Initialized, true);
pNode = sIterator.MoveToNext();
}
}
diff --git a/xfa/fxfa/parser/xfa_document_imp.cpp b/xfa/fxfa/parser/xfa_document_imp.cpp
index 2b848ab1b3..8ea2ebb1cb 100644
--- a/xfa/fxfa/parser/xfa_document_imp.cpp
+++ b/xfa/fxfa/parser/xfa_document_imp.cpp
@@ -312,7 +312,7 @@ static void XFA_ProtoMerge_MergeNodeRecurse(CXFA_Document* pDocument,
if (pFormChild->GetClassID() == pProtoNode->GetClassID() &&
pFormChild->GetNameHash() == pProtoNode->GetNameHash() &&
pFormChild->HasFlag(XFA_NODEFLAG_UnusedNode)) {
- pFormChild->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pFormChild->ClearFlag(XFA_NODEFLAG_UnusedNode);
pExistingNode = pFormChild;
break;
}
@@ -338,7 +338,7 @@ static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument,
CXFA_NodeIterator sIterator(pDestNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true);
}
}
pDestNode->SetTemplateNode(pProtoNode);
@@ -352,7 +352,7 @@ static void XFA_ProtoMerge_MergeNode(CXFA_Document* pDocument,
CXFA_NodeIterator sIterator(pDestNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
}
}
}
diff --git a/xfa/fxfa/parser/xfa_layout_appadapter.cpp b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
index e223ab8ce7..56ef086f82 100644
--- a/xfa/fxfa/parser/xfa_layout_appadapter.cpp
+++ b/xfa/fxfa/parser/xfa_layout_appadapter.cpp
@@ -50,15 +50,15 @@ void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem) {
while (pNode) {
CXFA_LayoutItem* pNext = pNode->m_pNextSibling;
pNode->m_pParent = nullptr;
- pNotify->OnLayoutEvent(pDocLayout, static_cast<CXFA_LayoutItem*>(pNode),
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout,
+ static_cast<CXFA_LayoutItem*>(pNode));
XFA_ReleaseLayoutItem(pNode);
pNode = pNext;
}
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem, XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageArea) {
pNotify->OnPageEvent(static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem),
- XFA_PAGEEVENT_PageRemoved);
+ XFA_PAGEVIEWEVENT_PostRemoved);
}
delete pLayoutItem;
}
diff --git a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
index 6553dc07cc..17f97da779 100644
--- a/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
+++ b/xfa/fxfa/parser/xfa_layout_itemlayout.cpp
@@ -561,8 +561,7 @@ CXFA_ContentLayoutItem* CXFA_ItemLayoutProcessor::ExtractLayoutItem() {
CXFA_ContentLayoutItem* pOldLayoutItem = m_pOldLayoutItem;
while (pOldLayoutItem) {
CXFA_ContentLayoutItem* pNextOldLayoutItem = pOldLayoutItem->m_pNext;
- pNotify->OnLayoutEvent(pDocLayout, pOldLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pOldLayoutItem);
delete pOldLayoutItem;
pOldLayoutItem = pNextOldLayoutItem;
}
@@ -630,8 +629,7 @@ static void XFA_DeleteLayoutGeneratedNode(CXFA_Node* pGenerateNode) {
CXFA_ContentLayoutItem* pNextLayoutItem = NULL;
while (pCurLayoutItem) {
pNextLayoutItem = pCurLayoutItem->m_pNext;
- pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
}
@@ -1868,7 +1866,7 @@ void CXFA_ItemLayoutProcessor::ProcessUnUseBinds(CXFA_Node* pFormNode) {
pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
}
}
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true);
}
}
void CXFA_ItemLayoutProcessor::ProcessUnUseOverFlow(
diff --git a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
index 78492c2702..c1f7514bcf 100644
--- a/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
+++ b/xfa/fxfa/parser/xfa_layout_pagemgr_new.cpp
@@ -94,7 +94,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return FALSE;
}
m_pTemplatePageSetRoot->InsertChild(pPageArea, NULL);
- pPageArea->SetFlag(XFA_NODEFLAG_Initialized);
+ pPageArea->SetFlag(XFA_NODEFLAG_Initialized, true);
}
CXFA_Node* pContentArea = pPageArea->GetChild(0, XFA_ELEMENT_ContentArea);
if (!pContentArea) {
@@ -104,7 +104,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return FALSE;
}
pPageArea->InsertChild(pContentArea, NULL);
- pContentArea->SetFlag(XFA_NODEFLAG_Initialized);
+ pContentArea->SetFlag(XFA_NODEFLAG_Initialized, true);
pContentArea->SetMeasure(XFA_ATTRIBUTE_X,
CXFA_Measurement(0.25f, XFA_UNIT_In));
pContentArea->SetMeasure(XFA_ATTRIBUTE_Y,
@@ -122,7 +122,7 @@ FX_BOOL CXFA_LayoutPageMgr::InitLayoutPage(CXFA_Node* pFormNode) {
return FALSE;
}
pPageArea->InsertChild(pMedium, NULL);
- pMedium->SetFlag(XFA_NODEFLAG_Initialized);
+ pMedium->SetFlag(XFA_NODEFLAG_Initialized, true);
pMedium->SetMeasure(XFA_ATTRIBUTE_Short,
CXFA_Measurement(8.5f, XFA_UNIT_In));
pMedium->SetMeasure(XFA_ATTRIBUTE_Long,
@@ -415,8 +415,7 @@ void CXFA_LayoutPageMgr::AddPageAreaLayoutItem(CXFA_ContainerRecord* pNewRecord,
(CXFA_ContainerLayoutItem*)pNotify->OnCreateLayoutItem(pNewPageArea);
m_PageArray.Add(pContainerItem);
m_nAvailPages++;
- pNotify->OnPageEvent(pContainerItem, XFA_PAGEEVENT_PageAdded,
- (void*)(uintptr_t)m_nAvailPages);
+ pNotify->OnPageEvent(pContainerItem, XFA_PAGEVIEWEVENT_PostRemoved);
pNewPageAreaLayoutItem = pContainerItem;
}
pNewRecord->pCurPageSet->AddChild(pNewPageAreaLayoutItem);
@@ -745,8 +744,8 @@ FX_BOOL CXFA_LayoutPageMgr::ExecuteBreakBeforeOrAfter(
return FALSE;
}
static void XFA_SetLayoutGeneratedNodeFlag(CXFA_Node* pNode) {
- pNode->SetFlag(XFA_NODEFLAG_LayoutGeneratedNode, TRUE, FALSE);
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE, FALSE);
+ pNode->SetFlag(XFA_NODEFLAG_LayoutGeneratedNode, false);
+ pNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
}
FX_BOOL CXFA_LayoutPageMgr::ProcessBreakBeforeOrAfter(
CXFA_Node* pBreakNode,
@@ -1507,8 +1506,7 @@ static void XFA_SyncRemoveLayoutItem(CXFA_LayoutItem* pParentLayoutItem,
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
}
@@ -1528,8 +1526,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
if (pCurLayoutItem->m_pFirstChild) {
XFA_SyncRemoveLayoutItem(pCurLayoutItem, pNotify, pDocLayout);
}
- pNotify->OnLayoutEvent(pDocLayout, pCurLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pCurLayoutItem);
delete pCurLayoutItem;
pCurLayoutItem = pNextLayoutItem;
continue;
@@ -1539,7 +1536,7 @@ void CXFA_LayoutPageMgr::SaveLayoutItem(CXFA_LayoutItem* pParentLayoutItem) {
sIterator(pCurLayoutItem->m_pFormNode);
for (CXFA_Node* pNode = sIterator.GetCurrent(); pNode;
pNode = sIterator.MoveToNext()) {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode, TRUE, FALSE);
+ pNode->SetFlag(XFA_NODEFLAG_UnusedNode, false);
}
}
}
@@ -1579,6 +1576,7 @@ CXFA_Node* CXFA_LayoutPageMgr::QueryOverflow(
}
return NULL;
}
+
void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_Document* pDocument = m_pTemplatePageSetRoot->GetDocument();
CXFA_FFNotify* pNotify = pDocument->GetParser()->GetNotify();
@@ -1598,15 +1596,14 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pNode->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
}
}
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_UnusedNode, true);
}
}
}
int32_t iIndex = 0;
- CXFA_Node* pPendingPageSet = NULL;
for (; pRootLayout;
pRootLayout = (CXFA_ContainerLayoutItem*)pRootLayout->m_pNextSibling) {
- pPendingPageSet = NULL;
+ CXFA_Node* pPendingPageSet = nullptr;
CXFA_NodeIteratorTemplate<
CXFA_ContainerLayoutItem,
CXFA_TraverseStrategy_ContentAreaContainerLayoutItem>
@@ -1633,7 +1630,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
NULL);
}
pRootPageSetContainerItem->m_pFormNode = pPendingPageSet;
- pPendingPageSet->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
+ pPendingPageSet->ClearFlag(XFA_NODEFLAG_UnusedNode);
for (CXFA_ContainerLayoutItem* pContainerItem = iterator.MoveToNext();
pContainerItem; pContainerItem = iterator.MoveToNext()) {
CXFA_Node* pNode = pContainerItem->m_pFormNode;
@@ -1679,8 +1676,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1720,14 +1716,14 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pFormToplevelSubform->InsertChild(pPendingPageSet);
}
pDocument->DataMerge_UpdateBindingRelations(pPendingPageSet);
- pPendingPageSet->SetFlag(XFA_NODEFLAG_Initialized);
+ pPendingPageSet->SetFlag(XFA_NODEFLAG_Initialized, true);
}
- pPendingPageSet = GetRootLayoutItem()->m_pFormNode;
- while (pPendingPageSet) {
- CXFA_Node* pNextPendingPageSet =
- pPendingPageSet->GetNextSameClassSibling(XFA_ELEMENT_PageSet);
+ CXFA_Node* pPageSet = GetRootLayoutItem()->m_pFormNode;
+ while (pPageSet) {
+ CXFA_Node* pNextPageSet =
+ pPageSet->GetNextSameClassSibling(XFA_ELEMENT_PageSet);
CXFA_NodeIteratorTemplate<CXFA_Node, CXFA_TraverseStrategy_XFANode>
- sIterator(pPendingPageSet);
+ sIterator(pPageSet);
CXFA_Node* pNode = sIterator.GetCurrent();
while (pNode) {
if (pNode->HasFlag(XFA_NODEFLAG_UnusedNode)) {
@@ -1740,8 +1736,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pChildNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1749,8 +1744,7 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
CXFA_LayoutItem* pLayoutItem = static_cast<CXFA_LayoutItem*>(
pNode->GetUserData(XFA_LAYOUTITEMKEY));
if (pLayoutItem) {
- pNotify->OnLayoutEvent(pDocLayout, pLayoutItem,
- XFA_LAYOUTEVENT_ItemRemoving);
+ pNotify->OnLayoutItemRemoving(pDocLayout, pLayoutItem);
delete pLayoutItem;
}
}
@@ -1758,18 +1752,19 @@ void CXFA_LayoutPageMgr::MergePageSetContents() {
pNode->GetNodeItem(XFA_NODEITEM_Parent)->RemoveChild(pNode);
pNode = pNext;
} else {
- pNode->SetFlag(XFA_NODEFLAG_UnusedNode, FALSE);
- pNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNode->ClearFlag(XFA_NODEFLAG_UnusedNode);
+ pNode->SetFlag(XFA_NODEFLAG_Initialized, true);
pNode = sIterator.MoveToNext();
}
} else {
- pNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNode->SetFlag(XFA_NODEFLAG_Initialized, true);
pNode = sIterator.MoveToNext();
}
}
- pPendingPageSet = pNextPendingPageSet;
+ pPageSet = pNextPageSet;
}
}
+
void CXFA_LayoutPageMgr::LayoutPageSetContents() {
CXFA_ContainerLayoutItem* pRootLayoutItem = GetRootLayoutItem();
for (; pRootLayoutItem;
@@ -1814,9 +1809,7 @@ void XFA_SyncContainer(CXFA_FFNotify* pNotify,
dwStatus =
(bVisibleItem ? XFA_LAYOUTSTATUS_Visible : 0) | dwRelevantContainer;
}
- pNotify->OnLayoutEvent(pDocLayout, pContainerItem, XFA_LAYOUTEVENT_ItemAdded,
- (void*)(uintptr_t)nPageIndex,
- (void*)(uintptr_t)dwStatus);
+ pNotify->OnLayoutItemAdded(pDocLayout, pContainerItem, nPageIndex, dwStatus);
for (CXFA_LayoutItem* pChild = pContainerItem->m_pFirstChild; pChild;
pChild = pChild->m_pNextSibling) {
if (pChild->IsContentLayoutItem()) {
@@ -1876,7 +1869,7 @@ void CXFA_LayoutPageMgr::SyncLayoutData() {
for (int32_t i = nPage - 1; i >= m_nAvailPages; i--) {
CXFA_ContainerLayoutItem* pPage = m_PageArray[i];
m_PageArray.RemoveAt(i);
- pNotify->OnPageEvent(pPage, XFA_PAGEEVENT_PageRemoved);
+ pNotify->OnPageEvent(pPage, XFA_PAGEVIEWEVENT_PostRemoved);
delete pPage;
}
ClearRecordList();
diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h
index 4361eb7f4a..e796b96326 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -48,22 +48,22 @@ class CXFA_Object {
return (XFA_OBJECTTYPE)(m_uFlags & XFA_OBJECTTYPEMASK);
}
- FX_BOOL IsNode() const {
+ bool IsNode() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) >= XFA_OBJECTTYPE_Node;
}
- FX_BOOL IsOrdinaryObject() const {
+ bool IsOrdinaryObject() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryObject;
}
- FX_BOOL IsNodeList() const {
+ bool IsNodeList() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_NodeList;
}
- FX_BOOL IsOrdinaryList() const {
+ bool IsOrdinaryList() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_OrdinaryList;
}
- FX_BOOL IsContentNode() const {
+ bool IsContentNode() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContentNode;
}
- FX_BOOL IsContainerNode() const {
+ bool IsContainerNode() const {
return (m_uFlags & XFA_OBJECTTYPEMASK) == XFA_OBJECTTYPE_ContainerNode;
}
@@ -134,9 +134,11 @@ class CXFA_Node : public CXFA_Object {
XFA_ELEMENT GetClassID() const { return (XFA_ELEMENT)m_eNodeClass; }
uint32_t GetPacketID() const { return m_ePacket; }
FX_BOOL HasFlag(uint32_t dwFlag) const;
- void SetFlag(uint32_t dwFlag, FX_BOOL bOn = TRUE, FX_BOOL bNotify = TRUE);
+ void SetFlag(uint32_t dwFlag, bool bNotify);
+ void ClearFlag(uint32_t dwFlag);
+
FX_BOOL IsAttributeInXML();
- FX_BOOL IsFormContainer() {
+ bool IsFormContainer() const {
return m_ePacket == XFA_XDPPACKET_Form && IsContainerNode();
}
void SetXMLMappingNode(CFDE_XMLNode* pXMLNode) { m_pXMLNode = pXMLNode; }
@@ -150,20 +152,20 @@ class CXFA_Node : public CXFA_Object {
FX_BOOL HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit = FALSE);
FX_BOOL SetAttribute(XFA_ATTRIBUTE eAttr,
const CFX_WideStringC& wsValue,
- FX_BOOL bNotify = FALSE);
+ bool bNotify = false);
FX_BOOL GetAttribute(XFA_ATTRIBUTE eAttr,
CFX_WideString& wsValue,
FX_BOOL bUseDefault = TRUE);
FX_BOOL SetAttribute(const CFX_WideStringC& wsAttr,
const CFX_WideStringC& wsValue,
- FX_BOOL bNotify = FALSE);
+ bool bNotify = false);
FX_BOOL GetAttribute(const CFX_WideStringC& wsAttr,
CFX_WideString& wsValue,
FX_BOOL bUseDefault = TRUE);
FX_BOOL RemoveAttribute(const CFX_WideStringC& wsAttr);
FX_BOOL SetContent(const CFX_WideString& wsContent,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify = FALSE,
+ bool bNotify = false,
FX_BOOL bScriptModify = FALSE,
FX_BOOL bSyncData = TRUE);
FX_BOOL TryContent(CFX_WideString& wsContent,
@@ -175,7 +177,7 @@ class CXFA_Node : public CXFA_Object {
FX_BOOL SetBoolean(XFA_ATTRIBUTE eAttr,
FX_BOOL bValue,
- FX_BOOL bNotify = FALSE) {
+ bool bNotify = false) {
return SetValue(eAttr, XFA_ATTRIBUTETYPE_Boolean, (void*)(uintptr_t)bValue,
bNotify);
}
@@ -188,7 +190,7 @@ class CXFA_Node : public CXFA_Object {
}
FX_BOOL SetInteger(XFA_ATTRIBUTE eAttr,
int32_t iValue,
- FX_BOOL bNotify = FALSE) {
+ bool bNotify = false) {
return SetValue(eAttr, XFA_ATTRIBUTETYPE_Integer, (void*)(uintptr_t)iValue,
bNotify);
}
@@ -201,7 +203,7 @@ class CXFA_Node : public CXFA_Object {
}
FX_BOOL SetEnum(XFA_ATTRIBUTE eAttr,
XFA_ATTRIBUTEENUM eValue,
- FX_BOOL bNotify = FALSE) {
+ bool bNotify = false) {
return SetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, (void*)(uintptr_t)eValue,
bNotify);
}
@@ -214,11 +216,11 @@ class CXFA_Node : public CXFA_Object {
}
FX_BOOL SetCData(XFA_ATTRIBUTE eAttr,
const CFX_WideString& wsValue,
- FX_BOOL bNotify = FALSE,
+ bool bNotify = false,
FX_BOOL bScriptModify = FALSE);
FX_BOOL SetAttributeValue(const CFX_WideString& wsValue,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify = FALSE,
+ bool bNotify = false,
FX_BOOL bScriptModify = FALSE);
FX_BOOL TryCData(XFA_ATTRIBUTE eAttr,
CFX_WideString& wsValue,
@@ -234,7 +236,7 @@ class CXFA_Node : public CXFA_Object {
}
FX_BOOL SetMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement mValue,
- FX_BOOL bNotify = FALSE);
+ bool bNotify = false);
FX_BOOL TryMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement& mValue,
FX_BOOL bUseDefault = TRUE) const;
@@ -264,7 +266,7 @@ class CXFA_Node : public CXFA_Object {
FX_BOOL bOnlyChild = FALSE);
int32_t InsertChild(int32_t index, CXFA_Node* pNode);
FX_BOOL InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode = NULL);
- FX_BOOL RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify = TRUE);
+ FX_BOOL RemoveChild(CXFA_Node* pNode, bool bNotify = true);
CXFA_Node* Clone(FX_BOOL bRecursive);
CXFA_Node* GetNodeItem(XFA_NODEITEM eItem) const;
CXFA_Node* GetNodeItem(XFA_NODEITEM eItem, XFA_OBJECTTYPE eType) const;
@@ -376,8 +378,7 @@ class CXFA_Node : public CXFA_Object {
void Script_Delta_Target(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_SendAttributeChangeMessage(void* eAttribute,
- void* eValue,
+ void Script_Attribute_SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
FX_BOOL bScriptModify);
void Script_Attribute_Integer(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
@@ -593,22 +594,19 @@ class CXFA_Node : public CXFA_Object {
FX_BOOL SetValue(XFA_ATTRIBUTE eAttr,
XFA_ATTRIBUTETYPE eType,
void* pValue,
- FX_BOOL bNotify);
+ bool bNotify);
FX_BOOL GetValue(XFA_ATTRIBUTE eAttr,
XFA_ATTRIBUTETYPE eType,
FX_BOOL bUseDefault,
void*& pValue);
- void OnRemoved(CXFA_Node* pParent, CXFA_Node* pRemoved, FX_BOOL bNotify);
- void OnChanging(XFA_ATTRIBUTE eAttr, void* pNewValue, FX_BOOL bNotify);
- void OnChanged(XFA_ATTRIBUTE eAttr,
- void* pNewValue,
- FX_BOOL bNotify,
- FX_BOOL bScriptModify = FALSE);
+ void OnRemoved(bool bNotify);
+ void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
+ void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, FX_BOOL bScriptModify);
int32_t execSingleEventByName(const CFX_WideStringC& wsEventName,
XFA_ELEMENT eElementType);
FX_BOOL SetScriptContent(const CFX_WideString& wsContent,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify = TRUE,
+ bool bNotify = true,
FX_BOOL bScriptModify = FALSE,
FX_BOOL bSyncData = TRUE);
CFX_WideString GetScriptContent(FX_BOOL bScriptModify = FALSE);
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 4428b67302..156aa6f29b 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -147,7 +147,7 @@ CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
pCloneXML = m_pXMLNode->Clone(FALSE);
}
pClone->SetXMLMappingNode(pCloneXML);
- pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
}
if (bRecursive) {
for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
@@ -155,7 +155,7 @@ CXFA_Node* CXFA_Node::Clone(FX_BOOL bRecursive) {
pClone->InsertChild(pChild->Clone(bRecursive));
}
}
- pClone->SetFlag(XFA_NODEFLAG_Initialized);
+ pClone->SetFlag(XFA_NODEFLAG_Initialized, true);
pClone->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
return pClone;
}
@@ -300,7 +300,7 @@ int32_t CXFA_Node::GetNodeList(CXFA_NodeArray& nodes,
break;
}
InsertChild(pNewNode, NULL);
- pNewNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true);
nodes.Add(pNewNode);
break;
}
@@ -313,7 +313,7 @@ CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement,
uint32_t dwFlags) {
CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement);
- pNode->SetFlag(dwFlags);
+ pNode->SetFlag(dwFlags, true);
return pNode;
}
CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) {
@@ -332,7 +332,7 @@ CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) {
pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive));
}
}
- pClone->SetFlag(XFA_NODEFLAG_Initialized);
+ pClone->SetFlag(XFA_NODEFLAG_Initialized, true);
return pClone;
}
@@ -1018,7 +1018,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
pFakeRoot->RemoveChild(pNewChild);
InsertChild(index++, pNewChild);
- pNewChild->SetFlag(XFA_NODEFLAG_Initialized);
+ pNewChild->SetFlag(XFA_NODEFLAG_Initialized, true);
pNewChild = pItem;
}
while (pChild) {
@@ -1031,7 +1031,7 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
GetClassID() == XFA_ELEMENT_ExData) {
CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
SetXMLMappingNode(pFakeXMLRoot);
- SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
if (pTempXMLNode &&
pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL) {
pFakeXMLRoot = pTempXMLNode;
@@ -1046,15 +1046,15 @@ void CXFA_Node::Script_NodeClass_LoadXML(CFXJSE_Arguments* pArguments) {
CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
pFakeRoot->RemoveChild(pChild);
InsertChild(pChild);
- pChild->SetFlag(XFA_NODEFLAG_Initialized);
+ pChild->SetFlag(XFA_NODEFLAG_Initialized, true);
pChild = pItem;
}
}
if (pFakeXMLRoot) {
pFakeRoot->SetXMLMappingNode(pFakeXMLRoot);
- pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
}
- pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, TRUE, FALSE);
+ pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false);
} else {
if (pFakeXMLRoot) {
pFakeXMLRoot->Release();
@@ -1266,7 +1266,7 @@ void CXFA_Node::Script_Attribute_Integer(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- SetInteger(eAttribute, FXJSE_Value_ToInteger(hValue), TRUE);
+ SetInteger(eAttribute, FXJSE_Value_ToInteger(hValue), true);
} else {
FXJSE_Value_SetInteger(hValue, GetInteger(eAttribute));
}
@@ -1284,7 +1284,7 @@ void CXFA_Node::Script_Attribute_BOOL(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {
if (bSetting) {
- SetBoolean(eAttribute, FXJSE_Value_ToBoolean(hValue), TRUE);
+ SetBoolean(eAttribute, FXJSE_Value_ToBoolean(hValue), true);
} else {
FXJSE_Value_SetUTF8String(hValue, GetBoolean(eAttribute) ? "1" : "0");
}
@@ -1298,172 +1298,161 @@ void CXFA_Node::Script_Attribute_BOOLRead(FXJSE_HVALUE hValue,
ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
}
}
+
void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
- void* eAttribute,
- void* eValue,
+ XFA_ATTRIBUTE eAttribute,
FX_BOOL bScriptModify) {
CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
- if (!pLayoutPro) {
+ if (!pLayoutPro)
return;
- }
+
CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
- if (!pNotify) {
+ if (!pNotify)
return;
- }
+
uint32_t dwPacket = GetPacketID();
- if (dwPacket & XFA_XDPPACKET_Form) {
- FX_BOOL bNeedFindContainer = FALSE;
- XFA_ELEMENT eType = GetClassID();
- switch (eType) {
- case XFA_ELEMENT_Caption:
- bNeedFindContainer = TRUE;
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, this, GetNodeItem(XFA_NODEITEM_Parent));
- break;
- case XFA_ELEMENT_Font:
- case XFA_ELEMENT_Para: {
- bNeedFindContainer = TRUE;
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
- if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pParentNode,
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
- } else {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, this, pParentNode);
- }
- } break;
- case XFA_ELEMENT_Margin: {
- bNeedFindContainer = TRUE;
- CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
- XFA_ELEMENT eParentType = pParentNode->GetClassID();
- if (pParentNode->IsContainerNode()) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, this, pParentNode);
- } else if (eParentType == XFA_ELEMENT_Caption) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pParentNode,
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
- } else {
- CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pNode,
- pNode->GetNodeItem(XFA_NODEITEM_Parent));
- }
- }
- } break;
- case XFA_ELEMENT_Comb: {
- CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
- XFA_ELEMENT eUIType = pEditNode->GetClassID();
- if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit ||
- eUIType == XFA_ELEMENT_NumericEdit ||
- eUIType == XFA_ELEMENT_TextEdit)) {
- CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pUINode) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
- }
- }
- } break;
- case XFA_ELEMENT_Button:
- case XFA_ELEMENT_Barcode:
- case XFA_ELEMENT_ChoiceList:
- case XFA_ELEMENT_DateTimeEdit:
- case XFA_ELEMENT_NumericEdit:
- case XFA_ELEMENT_PasswordEdit:
- case XFA_ELEMENT_TextEdit: {
- CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
- if (pUINode) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ if (!(dwPacket & XFA_XDPPACKET_Form)) {
+ pNotify->OnValueChanged(this, eAttribute, this, this);
+ return;
+ }
+
+ bool bNeedFindContainer = false;
+ XFA_ELEMENT eType = GetClassID();
+ switch (eType) {
+ case XFA_ELEMENT_Caption:
+ bNeedFindContainer = true;
+ pNotify->OnValueChanged(this, eAttribute, this,
+ GetNodeItem(XFA_NODEITEM_Parent));
+ break;
+ case XFA_ELEMENT_Font:
+ case XFA_ELEMENT_Para: {
+ bNeedFindContainer = true;
+ CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) {
+ pNotify->OnValueChanged(this, eAttribute, pParentNode,
+ pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
+ } else {
+ pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
+ }
+ } break;
+ case XFA_ELEMENT_Margin: {
+ bNeedFindContainer = true;
+ CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
+ XFA_ELEMENT eParentType = pParentNode->GetClassID();
+ if (pParentNode->IsContainerNode()) {
+ pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
+ } else if (eParentType == XFA_ELEMENT_Caption) {
+ pNotify->OnValueChanged(this, eAttribute, pParentNode,
+ pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
+ } else {
+ CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
+ if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) {
+ pNotify->OnValueChanged(this, eAttribute, pNode,
+ pNode->GetNodeItem(XFA_NODEITEM_Parent));
}
- } break;
- case XFA_ELEMENT_CheckButton: {
- bNeedFindContainer = TRUE;
- CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
+ }
+ } break;
+ case XFA_ELEMENT_Comb: {
+ CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
+ XFA_ELEMENT eUIType = pEditNode->GetClassID();
+ if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit ||
+ eUIType == XFA_ELEMENT_NumericEdit ||
+ eUIType == XFA_ELEMENT_TextEdit)) {
+ CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
if (pUINode) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pUINode,
- pUINode->GetNodeItem(XFA_NODEITEM_Parent));
- }
- } break;
- case XFA_ELEMENT_Keep:
- case XFA_ELEMENT_Bookend:
- case XFA_ELEMENT_Break:
- case XFA_ELEMENT_BreakAfter:
- case XFA_ELEMENT_BreakBefore:
- case XFA_ELEMENT_Overflow:
- bNeedFindContainer = TRUE;
- break;
- case XFA_ELEMENT_Area:
- case XFA_ELEMENT_Draw:
- case XFA_ELEMENT_ExclGroup:
- case XFA_ELEMENT_Field:
- case XFA_ELEMENT_Subform:
- case XFA_ELEMENT_SubformSet:
- pLayoutPro->AddChangedContainer(this);
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, this, this);
- break;
- case XFA_ELEMENT_Sharptext:
- case XFA_ELEMENT_Sharpxml:
- case XFA_ELEMENT_SharpxHTML: {
- CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
- if (!pTextNode) {
- return;
+ pNotify->OnValueChanged(this, eAttribute, pUINode,
+ pUINode->GetNodeItem(XFA_NODEITEM_Parent));
}
- CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (!pValueNode) {
- return;
+ }
+ } break;
+ case XFA_ELEMENT_Button:
+ case XFA_ELEMENT_Barcode:
+ case XFA_ELEMENT_ChoiceList:
+ case XFA_ELEMENT_DateTimeEdit:
+ case XFA_ELEMENT_NumericEdit:
+ case XFA_ELEMENT_PasswordEdit:
+ case XFA_ELEMENT_TextEdit: {
+ CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
+ if (pUINode) {
+ pNotify->OnValueChanged(this, eAttribute, pUINode,
+ pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ }
+ } break;
+ case XFA_ELEMENT_CheckButton: {
+ bNeedFindContainer = true;
+ CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
+ if (pUINode) {
+ pNotify->OnValueChanged(this, eAttribute, pUINode,
+ pUINode->GetNodeItem(XFA_NODEITEM_Parent));
+ }
+ } break;
+ case XFA_ELEMENT_Keep:
+ case XFA_ELEMENT_Bookend:
+ case XFA_ELEMENT_Break:
+ case XFA_ELEMENT_BreakAfter:
+ case XFA_ELEMENT_BreakBefore:
+ case XFA_ELEMENT_Overflow:
+ bNeedFindContainer = true;
+ break;
+ case XFA_ELEMENT_Area:
+ case XFA_ELEMENT_Draw:
+ case XFA_ELEMENT_ExclGroup:
+ case XFA_ELEMENT_Field:
+ case XFA_ELEMENT_Subform:
+ case XFA_ELEMENT_SubformSet:
+ pLayoutPro->AddChangedContainer(this);
+ pNotify->OnValueChanged(this, eAttribute, this, this);
+ break;
+ case XFA_ELEMENT_Sharptext:
+ case XFA_ELEMENT_Sharpxml:
+ case XFA_ELEMENT_SharpxHTML: {
+ CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
+ if (!pTextNode) {
+ return;
+ }
+ CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
+ if (!pValueNode) {
+ return;
+ }
+ XFA_ELEMENT eType = pValueNode->GetClassID();
+ if (eType == XFA_ELEMENT_Value) {
+ bNeedFindContainer = true;
+ CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
+ if (pNode && pNode->IsContainerNode()) {
+ if (bScriptModify) {
+ pValueNode = pNode;
+ }
+ pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
+ } else {
+ pNotify->OnValueChanged(this, eAttribute, pNode,
+ pNode->GetNodeItem(XFA_NODEITEM_Parent));
}
- XFA_ELEMENT eType = pValueNode->GetClassID();
- if (eType == XFA_ELEMENT_Value) {
- bNeedFindContainer = TRUE;
+ } else {
+ if (eType == XFA_ELEMENT_Items) {
CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
if (pNode && pNode->IsContainerNode()) {
- if (bScriptModify) {
- pValueNode = pNode;
- }
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pValueNode, pNode);
- } else {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pNode,
- pNode->GetNodeItem(XFA_NODEITEM_Parent));
- }
- } else {
- if (eType == XFA_ELEMENT_Items) {
- CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
- if (pNode && pNode->IsContainerNode()) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
- eValue, pValueNode, pNode);
- }
+ pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
}
}
- } break;
- default:
+ }
+ } break;
+ default:
+ break;
+ }
+ if (bNeedFindContainer) {
+ CXFA_Node* pParent = this;
+ while (pParent) {
+ if (pParent->IsContainerNode())
break;
+
+ pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
}
- if (bNeedFindContainer) {
- CXFA_Node* pParent = this;
- while (pParent) {
- if (pParent->IsContainerNode()) {
- break;
- }
- pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
- }
- if (pParent) {
- pLayoutPro->AddChangedContainer(pParent);
- }
+ if (pParent) {
+ pLayoutPro->AddChangedContainer(pParent);
}
- } else {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue,
- this, this);
}
}
+
void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
XFA_ATTRIBUTE eAttribute) {
@@ -1471,7 +1460,7 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
CFX_ByteString szValue;
FXJSE_Value_ToUTF8String(hValue, szValue);
CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC());
- SetAttribute(eAttribute, wsValue.AsStringC(), TRUE);
+ SetAttribute(eAttribute, wsValue.AsStringC(), true);
if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
CXFA_Node* pTemplateNode =
@@ -1690,7 +1679,7 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue,
if (pContainerWidgetData) {
pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
}
- SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
+ SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
} else {
CFX_WideString content = GetScriptContent(TRUE);
if (content.IsEmpty() && classID != XFA_ELEMENT_Text &&
@@ -1739,7 +1728,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
if (pContainerWidgetData) {
pContainerWidgetData->GetFormatDataValue(wsNewValue, wsFormatValue);
}
- SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
+ SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
} else {
CFX_WideString wsValue = GetScriptContent(TRUE);
FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1"));
@@ -1950,7 +1939,7 @@ void CXFA_Node::Script_Draw_DefaultValue(FXJSE_HVALUE hValue,
CFX_WideString wsNewValue =
CFX_WideString::FromUTF8(newValue.AsStringC());
CFX_WideString wsFormatValue(wsNewValue);
- SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE);
+ SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
} else if (uiType != XFA_ELEMENT_Image) {
}
}
@@ -1999,7 +1988,7 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
if (pContainerWidgetData) {
pContainerWidgetData->GetFormatDataValue(wsNewText, wsFormatText);
}
- SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE);
+ SetScriptContent(wsNewText, wsFormatText, true, TRUE);
} else {
CFX_WideString content = GetScriptContent(TRUE);
if (content.IsEmpty()) {
@@ -2595,7 +2584,7 @@ void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue,
CFX_ByteString bsLocaleName;
FXJSE_Value_ToUTF8String(hValue, bsLocaleName);
SetCData(XFA_ATTRIBUTE_Locale,
- CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), TRUE, TRUE);
+ CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), true, TRUE);
} else {
CFX_WideString wsLocaleName;
GetLocaleName(wsLocaleName);
@@ -2733,7 +2722,7 @@ void CXFA_Node::Script_Template_CreateNode(CFXJSE_Arguments* pArguments) {
if (!strName.IsEmpty()) {
if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
XFA_XDPPACKET_UNKNOWN)) {
- pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), TRUE);
+ pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true);
if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
pNewNode->CreateXMLMappingNode();
}
@@ -3751,7 +3740,7 @@ FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) {
}
FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
const CFX_WideStringC& wsValue,
- FX_BOOL bNotify) {
+ bool bNotify) {
const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr);
if (pAttr == NULL) {
return FALSE;
@@ -3847,7 +3836,7 @@ FX_BOOL CXFA_Node::GetAttribute(XFA_ATTRIBUTE eAttr,
}
FX_BOOL CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr,
const CFX_WideStringC& wsValue,
- FX_BOOL bNotify) {
+ bool bNotify) {
const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue);
if (pAttributeInfo) {
return SetAttribute(pAttributeInfo->eName, wsValue, bNotify);
@@ -3905,15 +3894,17 @@ FX_BOOL CXFA_Node::TryEnum(XFA_ATTRIBUTE eAttr,
eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue;
return TRUE;
}
+
FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement mValue,
- FX_BOOL bNotify) {
+ bool bNotify) {
void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
- OnChanging(eAttr, &mValue, bNotify);
+ OnChanging(eAttr, bNotify);
SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement));
- OnChanged(eAttr, &mValue, bNotify);
+ OnChanged(eAttr, bNotify, FALSE);
return TRUE;
}
+
FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement& mValue,
FX_BOOL bUseDefault) const {
@@ -3940,10 +3931,10 @@ CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const {
FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
const CFX_WideString& wsValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify) {
void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
- OnChanging(eAttr, (void*)wsValue.c_str(), bNotify);
+ OnChanging(eAttr, bNotify);
if (eAttr == XFA_ATTRIBUTE_Value) {
CFX_WideString* pClone = new CFX_WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
@@ -3952,71 +3943,75 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
if (eAttr == XFA_ATTRIBUTE_Name)
UpdateNameHash();
}
- OnChanged(eAttr, (void*)wsValue.c_str(), bNotify, bScriptModify);
- if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName &&
- eAttr != XFA_ATTRIBUTE_BindingNode) {
- if (eAttr == XFA_ATTRIBUTE_Name &&
- (m_eNodeClass == XFA_ELEMENT_DataValue ||
- m_eNodeClass == XFA_ELEMENT_DataGroup)) {
- return TRUE;
- }
- if (eAttr == XFA_ATTRIBUTE_Value) {
- FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
- switch (eXMLType) {
- case FDE_XMLNODE_Element:
- if (IsAttributeInXML()) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)
- ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue);
- } else {
- FX_BOOL bDeleteChildren = TRUE;
- if (GetPacketID() == XFA_XDPPACKET_Datasets) {
- for (CXFA_Node* pChildDataNode =
- GetNodeItem(XFA_NODEITEM_FirstChild);
- pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
- XFA_NODEITEM_NextSibling)) {
- CXFA_NodeArray formNodes;
- if (pChildDataNode->GetBindItems(formNodes) > 0) {
- bDeleteChildren = FALSE;
- break;
- }
+ OnChanged(eAttr, bNotify, bScriptModify);
+
+ if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName ||
+ eAttr == XFA_ATTRIBUTE_BindingNode) {
+ return TRUE;
+ }
+
+ if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_ELEMENT_DataValue ||
+ m_eNodeClass == XFA_ELEMENT_DataGroup)) {
+ return TRUE;
+ }
+
+ if (eAttr == XFA_ATTRIBUTE_Value) {
+ FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
+ switch (eXMLType) {
+ case FDE_XMLNODE_Element:
+ if (IsAttributeInXML()) {
+ static_cast<CFDE_XMLElement*>(m_pXMLNode)
+ ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue);
+ } else {
+ FX_BOOL bDeleteChildren = TRUE;
+ if (GetPacketID() == XFA_XDPPACKET_Datasets) {
+ for (CXFA_Node* pChildDataNode =
+ GetNodeItem(XFA_NODEITEM_FirstChild);
+ pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
+ XFA_NODEITEM_NextSibling)) {
+ CXFA_NodeArray formNodes;
+ if (pChildDataNode->GetBindItems(formNodes) > 0) {
+ bDeleteChildren = FALSE;
+ break;
}
}
- if (bDeleteChildren) {
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
- }
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
}
- break;
- case FDE_XMLNODE_Text:
- static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue);
- break;
- default:
- FXSYS_assert(0);
- }
- return TRUE;
+ if (bDeleteChildren) {
+ static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
+ }
+ static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
+ }
+ break;
+ case FDE_XMLNODE_Text:
+ static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue);
+ break;
+ default:
+ FXSYS_assert(0);
}
- const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
- if (pInfo) {
- FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
- CFX_WideString wsAttrName = pInfo->pName;
- if (pInfo->eName == XFA_ATTRIBUTE_ContentType) {
- wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName;
- }
- static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue);
+ return TRUE;
+ }
+
+ const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
+ if (pInfo) {
+ FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
+ CFX_WideString wsAttrName = pInfo->pName;
+ if (pInfo->eName == XFA_ATTRIBUTE_ContentType) {
+ wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName;
}
+ static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue);
}
return TRUE;
}
+
FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify) {
void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value);
- OnChanging(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify);
+ OnChanging(XFA_ATTRIBUTE_Value, bNotify);
CFX_WideString* pClone = new CFX_WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
- OnChanged(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify,
- bScriptModify);
+ OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
if (IsNeedSavingXMLNode()) {
FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
switch (eXMLType) {
@@ -4123,11 +4118,11 @@ FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) {
FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr,
XFA_ATTRIBUTETYPE eType,
void* pValue,
- FX_BOOL bNotify) {
+ bool bNotify) {
void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
- OnChanging(eAttr, pValue, bNotify);
+ OnChanging(eAttr, bNotify);
SetMapModuleValue(pKey, pValue);
- OnChanged(eAttr, pValue, bNotify);
+ OnChanged(eAttr, bNotify, FALSE);
if (IsNeedSavingXMLNode()) {
FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
@@ -4189,7 +4184,7 @@ FX_BOOL CXFA_Node::TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso) {
}
FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
CXFA_Node* pNode = NULL;
@@ -4293,7 +4288,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
if (pNode == this) {
continue;
}
- pNode->SetScriptContent(wsContent, wsContent, bNotify, TRUE, FALSE);
+ pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE);
}
}
pBindNode = NULL;
@@ -4365,7 +4360,7 @@ FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
}
FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent,
const CFX_WideString& wsXMLValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify,
FX_BOOL bSyncData) {
return SetScriptContent(wsContent, wsXMLValue, bNotify, bScriptModify,
@@ -4537,7 +4532,7 @@ CXFA_Node* CXFA_Node::GetProperty(int32_t index,
return NULL;
}
InsertChild(pNewNode, nullptr);
- pNewNode->SetFlag(XFA_NODEFLAG_Initialized);
+ pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true);
}
return pNewNode;
}
@@ -4615,15 +4610,15 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) {
}
ASSERT(m_pLastChild);
ASSERT(m_pLastChild->m_pNext == NULL);
- pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE);
+ pNode->ClearFlag(XFA_NODEFLAG_HasRemoved);
CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
- if (pNotify) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode);
- }
+ if (pNotify)
+ pNotify->OnChildAdded(this);
+
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL);
m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index);
- pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE);
+ pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode);
}
return index;
}
@@ -4661,15 +4656,15 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
}
ASSERT(m_pLastChild);
ASSERT(m_pLastChild->m_pNext == NULL);
- pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE);
+ pNode->ClearFlag(XFA_NODEFLAG_HasRemoved);
CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
- if (pNotify) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode);
- }
+ if (pNotify)
+ pNotify->OnChildAdded(this);
+
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL);
m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex);
- pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE);
+ pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode);
}
return TRUE;
}
@@ -4685,7 +4680,7 @@ CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() {
}
return NULL;
}
-FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) {
+FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
if (pNode == NULL || pNode->m_pParent != this) {
FXSYS_assert(FALSE);
return FALSE;
@@ -4707,8 +4702,8 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) {
pNode->m_pParent = NULL;
}
ASSERT(m_pLastChild == NULL || m_pLastChild->m_pNext == NULL);
- OnRemoved(this, pNode, bNotify);
- pNode->SetFlag(XFA_NODEFLAG_HasRemoved);
+ OnRemoved(bNotify);
+ pNode->SetFlag(XFA_NODEFLAG_HasRemoved, true);
m_pDocument->AddPurgeNode(pNode);
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
if (pNode->IsAttributeInXML()) {
@@ -4733,7 +4728,7 @@ FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) {
} else {
m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
}
- pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
}
return TRUE;
}
@@ -4848,58 +4843,52 @@ FX_BOOL CXFA_Node::HasFlag(uint32_t dwFlag) const {
}
return FALSE;
}
-void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) {
- if (bOn) {
- switch (dwFlag) {
- case XFA_NODEFLAG_Initialized:
- if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) {
- CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
- if (pNotify) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready);
- }
- }
- break;
- default:
- break;
+
+void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
+ if (dwFlag == XFA_NODEFLAG_Initialized && bNotify &&
+ !HasFlag(XFA_NODEFLAG_Initialized)) {
+ CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+ if (pNotify) {
+ pNotify->OnNodeReady(this);
}
- m_uFlags |= dwFlag;
- } else {
- m_uFlags &= ~dwFlag;
}
+ m_uFlags |= dwFlag;
}
+
+void CXFA_Node::ClearFlag(uint32_t dwFlag) {
+ m_uFlags &= ~dwFlag;
+}
+
FX_BOOL CXFA_Node::IsAttributeInXML() {
return GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData;
}
-void CXFA_Node::OnRemoved(CXFA_Node* pParent,
- CXFA_Node* pRemoved,
- FX_BOOL bNotify) {
- if (bNotify && pParent) {
- CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
- if (pNotify) {
- pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved);
- }
- }
+
+void CXFA_Node::OnRemoved(bool bNotify) {
+ if (!bNotify)
+ return;
+
+ CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
+ if (pNotify)
+ pNotify->OnChildRemoved();
}
-void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr,
- void* pNewValue,
- FX_BOOL bNotify) {
+
+void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) {
CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
if (pNotify) {
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanging,
- (void*)(uintptr_t)eAttr, pNewValue);
+ pNotify->OnValueChanging(this, eAttr);
}
}
}
+
void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr,
- void* pNewValue,
- FX_BOOL bNotify,
+ bool bNotify,
FX_BOOL bScriptModify) {
if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) {
- Script_Attribute_SendAttributeChangeMessage((void*)(uintptr_t)eAttr,
- pNewValue, bScriptModify);
+ Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify);
}
}
+
int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName,
XFA_ELEMENT eElementType) {
int32_t iRet = XFA_EVENTERROR_NotExist;
@@ -4980,7 +4969,7 @@ CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
if (!m_pXMLNode) {
CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name);
m_pXMLNode = new CFDE_XMLElement(wsTag);
- SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
}
return m_pXMLNode;
}
@@ -5219,7 +5208,7 @@ void CXFA_Node::MoveBufferMapData(CXFA_Node* pDstModule, void* pKey) {
if (pWidgetData) {
pWidgetData->GetFormatDataValue(wsValue, wsFormatValue);
}
- pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE);
+ pDstModule->SetScriptContent(wsValue, wsFormatValue, true, TRUE);
}
}
void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
diff --git a/xfa/fxfa/parser/xfa_parser_imp.cpp b/xfa/fxfa/parser/xfa_parser_imp.cpp
index 75ccb1122a..5dd6be50ce 100644
--- a/xfa/fxfa/parser/xfa_parser_imp.cpp
+++ b/xfa/fxfa/parser/xfa_parser_imp.cpp
@@ -175,7 +175,7 @@ void CXFA_SimpleParser::ConstructXFANode(CXFA_Node* pXFANode,
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLChild);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
break;
}
}
@@ -694,7 +694,7 @@ CXFA_Node* CXFA_SimpleParser::ParseAsXDPPacket_Data(
}
pNode->SetXMLMappingNode(pDataXMLNode);
if (pDataXMLNode != pXMLDocumentNode) {
- pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE);
+ pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
}
return pNode;
}
@@ -1145,7 +1145,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
XFA_ATTRIBUTEENUM_MetaData);
pXFAChild->InsertChild(pXFAMetaData);
pXFAMetaData->SetXMLMappingNode(pXMLElement);
- pXFAMetaData->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAMetaData->SetFlag(XFA_NODEFLAG_Initialized, false);
}
if (!bNeedValue) {
CFX_WideString wsNilName = FX_WSTRC(L"xsi:nil");
@@ -1161,7 +1161,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
}
}
pXFAChild->SetXMLMappingNode(pXMLElement);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
}
continue;
case FDE_XMLNODE_CharData: {
@@ -1180,7 +1180,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCharData);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLCharData);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
}
continue;
case FDE_XMLNODE_Text: {
@@ -1198,7 +1198,7 @@ void CXFA_SimpleParser::ParseDataGroup(CXFA_Node* pXFANode,
pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsText);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLText);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
}
continue;
case FDE_XMLNODE_Instruction:
@@ -1259,7 +1259,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
wsValueTextBuf << wsCurValue;
wsCurValueTextBuf.Clear();
}
@@ -1276,7 +1276,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
ParseDataValue(pXFAChild, pXMLChild, ePacketID);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLChild);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
CFX_WideStringC wsCurValue = pXFAChild->GetCData(XFA_ATTRIBUTE_Value);
wsValueTextBuf << wsCurValue;
}
@@ -1294,7 +1294,7 @@ void CXFA_SimpleParser::ParseDataValue(CXFA_Node* pXFANode,
pXFAChild->SetCData(XFA_ATTRIBUTE_Value, wsCurValue);
pXFANode->InsertChild(pXFAChild);
pXFAChild->SetXMLMappingNode(pXMLCurValueNode);
- pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, TRUE, FALSE);
+ pXFAChild->SetFlag(XFA_NODEFLAG_Initialized, false);
}
wsValueTextBuf << wsCurValue;
wsCurValueTextBuf.Clear();