Index: xfa/fxfa/parser/xfa_object_imp.cpp |
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp |
index 87941af070350665662581b4c64fd04738573720..4c35cb7afb9499323425142a290b7f62499b82d8 100644 |
--- a/xfa/fxfa/parser/xfa_object_imp.cpp |
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp |
@@ -1298,9 +1298,9 @@ 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) { |
@@ -1317,20 +1317,19 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
switch (eType) { |
case XFA_ELEMENT_Caption: |
bNeedFindContainer = TRUE; |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, this, GetNodeItem(XFA_NODEITEM_Parent)); |
+ 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->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pParentNode, |
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); |
+ pNotify->OnValueChanged( |
+ this, eAttribute, pParentNode, |
+ pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); |
} else { |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, this, pParentNode); |
+ pNotify->OnValueChanged(this, eAttribute, this, pParentNode); |
} |
} break; |
case XFA_ELEMENT_Margin: { |
@@ -1338,18 +1337,16 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
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); |
+ pNotify->OnValueChanged(this, eAttribute, this, pParentNode); |
} else if (eParentType == XFA_ELEMENT_Caption) { |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pParentNode, |
- pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); |
+ 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->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pNode, |
- pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
+ pNotify->OnValueChanged(this, eAttribute, pNode, |
+ pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
} |
} |
} break; |
@@ -1361,9 +1358,8 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
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)); |
+ pNotify->OnValueChanged(this, eAttribute, pUINode, |
+ pUINode->GetNodeItem(XFA_NODEITEM_Parent)); |
} |
} |
} break; |
@@ -1376,18 +1372,16 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
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)); |
+ 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->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pUINode, |
- pUINode->GetNodeItem(XFA_NODEITEM_Parent)); |
+ pNotify->OnValueChanged(this, eAttribute, pUINode, |
+ pUINode->GetNodeItem(XFA_NODEITEM_Parent)); |
} |
} break; |
case XFA_ELEMENT_Keep: |
@@ -1405,8 +1399,7 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
case XFA_ELEMENT_Subform: |
case XFA_ELEMENT_SubformSet: |
pLayoutPro->AddChangedContainer(this); |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, this, this); |
+ pNotify->OnValueChanged(this, eAttribute, this, this); |
break; |
case XFA_ELEMENT_Sharptext: |
case XFA_ELEMENT_Sharpxml: |
@@ -1427,19 +1420,16 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
if (bScriptModify) { |
pValueNode = pNode; |
} |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pValueNode, pNode); |
+ pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
} else { |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, |
- eValue, pNode, |
- pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
+ pNotify->OnValueChanged(this, eAttribute, 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); |
} |
} |
} |
@@ -1460,10 +1450,10 @@ void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( |
} |
} |
} else { |
- pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue, |
- this, this); |
+ pNotify->OnValueChanged(this, eAttribute, this, this); |
} |
} |
+ |
void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, |
FX_BOOL bSetting, |
XFA_ATTRIBUTE eAttribute) { |
@@ -3754,7 +3744,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; |
@@ -3850,7 +3840,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); |
@@ -3908,15 +3898,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); |
Tom Sepez
2016/04/14 22:45:44
nit: false vs. FALSE ?
Lei Zhang
2016/04/15 01:16:40
I didn't change the last parameter to a bool yet.
|
return TRUE; |
} |
+ |
FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, |
CXFA_Measurement& mValue, |
FX_BOOL bUseDefault) const { |
@@ -3943,10 +3935,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); |
@@ -3955,7 +3947,7 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, |
if (eAttr == XFA_ATTRIBUTE_Name) |
UpdateNameHash(); |
} |
- OnChanged(eAttr, (void*)wsValue.c_str(), bNotify, bScriptModify); |
+ OnChanged(eAttr, bNotify, bScriptModify); |
if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && |
eAttr != XFA_ATTRIBUTE_BindingNode) { |
if (eAttr == XFA_ATTRIBUTE_Name && |
@@ -4012,14 +4004,13 @@ FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, |
} |
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) { |
@@ -4126,11 +4117,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); |
Tom Sepez
2016/04/14 22:45:44
ditto
Lei Zhang
2016/04/15 01:16:40
same as above.
|
if (IsNeedSavingXMLNode()) { |
FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); |
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); |
@@ -4192,7 +4183,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; |
@@ -4368,7 +4359,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, |
@@ -4620,9 +4611,9 @@ int32_t CXFA_Node::InsertChild(int32_t index, CXFA_Node* pNode) { |
ASSERT(m_pLastChild->m_pNext == NULL); |
pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); |
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); |
@@ -4666,9 +4657,9 @@ FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { |
ASSERT(m_pLastChild->m_pNext == NULL); |
pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); |
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); |
@@ -4688,7 +4679,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; |
@@ -4710,7 +4701,7 @@ 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); |
+ OnRemoved(bNotify); |
pNode->SetFlag(XFA_NODEFLAG_HasRemoved); |
m_pDocument->AddPurgeNode(pNode); |
if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { |
@@ -4851,14 +4842,14 @@ FX_BOOL CXFA_Node::HasFlag(uint32_t dwFlag) const { |
} |
return FALSE; |
} |
-void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { |
+void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, 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); |
+ pNotify->OnNodeReady(this); |
} |
} |
break; |
@@ -4873,36 +4864,33 @@ void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { |
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) { |
+ |
+void CXFA_Node::OnRemoved(bool bNotify) { |
+ if (bNotify) { |
Tom Sepez
2016/04/14 22:45:44
nit: maybe early return?
Lei Zhang
2016/04/15 01:16:41
Done.
|
CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); |
if (pNotify) { |
- pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved); |
+ 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; |