summaryrefslogtreecommitdiff
path: root/xfa/fxfa/parser
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/parser')
-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
11 files changed, 359 insertions, 401 deletions
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();