summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fxjs/cjx_node.cpp51
-rw-r--r--fxjs/cjx_node.h16
-rw-r--r--xfa/fxfa/parser/cxfa_node.cpp31
-rw-r--r--xfa/fxfa/parser/cxfa_node.h9
4 files changed, 43 insertions, 64 deletions
diff --git a/fxjs/cjx_node.cpp b/fxjs/cjx_node.cpp
index b4d99dd38e..131fe5567b 100644
--- a/fxjs/cjx_node.cpp
+++ b/fxjs/cjx_node.cpp
@@ -483,13 +483,13 @@ void CJX_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) {
CXFA_Node* refNode = GetXFANode();
if (refNode->GetElementType() == XFA_Element::Xfa)
refNode = ToNode(GetDocument()->GetScriptContext()->GetThisObject());
- Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode);
+ ResolveNodeList(pValue, wsExpression, dwFlag, refNode);
}
-void CJX_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- WideString wsExpression,
- uint32_t dwFlag,
- CXFA_Node* refNode) {
+void CJX_Node::ResolveNodeList(CFXJSE_Value* pValue,
+ WideString wsExpression,
+ uint32_t dwFlag,
+ CXFA_Node* refNode) {
CFXJSE_Engine* pScriptContext = GetDocument()->GetScriptContext();
if (!pScriptContext)
return;
@@ -528,7 +528,7 @@ void CJX_Node::Script_TreeClass_All(CFXJSE_Value* pValue,
WideString wsName;
GetAttribute(XFA_ATTRIBUTE_Name, wsName, true);
WideString wsExpression = wsName + L"[*]";
- Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
+ ResolveNodeList(pValue, wsExpression, dwFlag, nullptr);
}
void CJX_Node::Script_TreeClass_Nodes(CFXJSE_Value* pValue,
@@ -557,7 +557,7 @@ void CJX_Node::Script_TreeClass_ClassAll(CFXJSE_Value* pValue,
}
uint32_t dwFlag = XFA_RESOLVENODE_Siblings | XFA_RESOLVENODE_ALL;
WideString wsExpression = L"#" + GetXFANode()->GetClassName() + L"[*]";
- Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag);
+ ResolveNodeList(pValue, wsExpression, dwFlag, nullptr);
}
void CJX_Node::Script_TreeClass_Parent(CFXJSE_Value* pValue,
@@ -1056,9 +1056,24 @@ void CJX_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue,
pValue->SetString(GetBoolean(eAttribute) ? "1" : "0");
}
-void CJX_Node::Script_Attribute_SendAttributeChangeMessage(
- XFA_ATTRIBUTE eAttribute,
- bool bScriptModify) {
+void CJX_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
+ if (!bNotify || !GetXFANode()->IsInitialized())
+ return;
+
+ CXFA_FFNotify* pNotify = GetDocument()->GetNotify();
+ if (pNotify)
+ pNotify->OnValueChanging(GetXFANode(), eAttr);
+}
+
+void CJX_Node::OnChanged(XFA_ATTRIBUTE eAttr,
+ bool bNotify,
+ bool bScriptModify) {
+ if (bNotify && GetXFANode()->IsInitialized())
+ SendAttributeChangeMessage(eAttr, bScriptModify);
+}
+
+void CJX_Node::SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
+ bool bScriptModify) {
CXFA_LayoutProcessor* pLayoutPro = GetDocument()->GetLayoutProcessor();
if (!pLayoutPro)
return;
@@ -2998,9 +3013,9 @@ bool CJX_Node::SetMeasure(XFA_ATTRIBUTE eAttr,
CXFA_Measurement mValue,
bool bNotify) {
void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
- GetXFANode()->OnChanging(eAttr, bNotify);
+ OnChanging(eAttr, bNotify);
SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement));
- GetXFANode()->OnChanged(eAttr, bNotify, false);
+ OnChanged(eAttr, bNotify, false);
return true;
}
@@ -3039,7 +3054,7 @@ bool CJX_Node::SetCData(XFA_ATTRIBUTE eAttr,
bool bNotify,
bool bScriptModify) {
void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
- GetXFANode()->OnChanging(eAttr, bNotify);
+ OnChanging(eAttr, bNotify);
if (eAttr == XFA_ATTRIBUTE_Value) {
WideString* pClone = new WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
@@ -3048,7 +3063,7 @@ bool CJX_Node::SetCData(XFA_ATTRIBUTE eAttr,
if (eAttr == XFA_ATTRIBUTE_Name)
GetXFANode()->UpdateNameHash();
}
- GetXFANode()->OnChanged(eAttr, bNotify, bScriptModify);
+ OnChanged(eAttr, bNotify, bScriptModify);
if (!GetXFANode()->IsNeedSavingXMLNode() ||
eAttr == XFA_ATTRIBUTE_QualifiedName ||
@@ -3120,10 +3135,10 @@ bool CJX_Node::SetAttributeValue(const WideString& wsValue,
bool bScriptModify) {
void* pKey =
GetMapKey_Element(GetXFANode()->GetElementType(), XFA_ATTRIBUTE_Value);
- GetXFANode()->OnChanging(XFA_ATTRIBUTE_Value, bNotify);
+ OnChanging(XFA_ATTRIBUTE_Value, bNotify);
WideString* pClone = new WideString(wsValue);
SetUserData(pKey, pClone, &deleteWideStringCallBack);
- GetXFANode()->OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
+ OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
if (GetXFANode()->IsNeedSavingXMLNode()) {
FX_XMLNODETYPE eXMLType = GetXFANode()->GetXMLMappingNode()->GetType();
switch (eXMLType) {
@@ -3245,9 +3260,9 @@ bool CJX_Node::SetValue(XFA_ATTRIBUTE eAttr,
void* pValue,
bool bNotify) {
void* pKey = GetMapKey_Element(GetXFANode()->GetElementType(), eAttr);
- GetXFANode()->OnChanging(eAttr, bNotify);
+ OnChanging(eAttr, bNotify);
SetMapModuleValue(pKey, pValue);
- GetXFANode()->OnChanged(eAttr, bNotify, false);
+ OnChanged(eAttr, bNotify, false);
if (GetXFANode()->IsNeedSavingXMLNode()) {
ASSERT(GetXFANode()->GetXMLMappingNode()->GetType() == FX_XMLNODE_Element);
const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
diff --git a/fxjs/cjx_node.h b/fxjs/cjx_node.h
index 1434029def..c92744f7ad 100644
--- a/fxjs/cjx_node.h
+++ b/fxjs/cjx_node.h
@@ -135,10 +135,7 @@ class CJX_Node : public CJX_Object {
void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
- void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- WideString wsExpression,
- uint32_t dwFlag,
- CXFA_Node* refNode = nullptr);
+
void Script_TreeClass_All(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);
@@ -208,8 +205,6 @@ class CJX_Node : public CJX_Object {
void Script_Delta_Target(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
- bool bScriptModify);
void Script_Attribute_Integer(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);
@@ -413,6 +408,15 @@ class CJX_Node : public CJX_Object {
XFA_ATTRIBUTE eAttribute);
private:
+ void ResolveNodeList(CFXJSE_Value* pValue,
+ WideString wsExpression,
+ uint32_t dwFlag,
+ CXFA_Node* refNode);
+
+ void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify);
+ void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
+ void SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute, bool bScriptModify);
+
bool SetValue(XFA_ATTRIBUTE eAttr,
XFA_ATTRIBUTETYPE eType,
void* pValue,
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index b2677573f5..e4fae59a4b 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -645,13 +645,6 @@ void CXFA_Node::Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments) {
JSNode()->Script_TreeClass_ResolveNodes(pArguments);
}
-void CXFA_Node::Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- WideString wsExpression,
- uint32_t dwFlag,
- CXFA_Node* refNode) {
- JSNode()->Script_Som_ResolveNodeList(pValue, wsExpression, dwFlag, refNode);
-}
-
void CXFA_Node::Script_TreeClass_All(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
@@ -825,13 +818,6 @@ void CXFA_Node::Script_Attribute_BOOLRead(CFXJSE_Value* pValue,
JSNode()->Script_Attribute_BOOLRead(pValue, bSetting, eAttribute);
}
-void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
- XFA_ATTRIBUTE eAttribute,
- bool bScriptModify) {
- JSNode()->Script_Attribute_SendAttributeChangeMessage(eAttribute,
- bScriptModify);
-}
-
void CXFA_Node::Script_Attribute_String(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute) {
@@ -1738,23 +1724,6 @@ void CXFA_Node::OnRemoved(bool bNotify) {
pNotify->OnChildRemoved();
}
-void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
- if (bNotify && IsInitialized()) {
- CXFA_FFNotify* pNotify = m_pDocument->GetNotify();
- if (pNotify) {
- pNotify->OnValueChanging(this, eAttr);
- }
- }
-}
-
-void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr,
- bool bNotify,
- bool bScriptModify) {
- if (bNotify && IsInitialized()) {
- Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify);
- }
-}
-
void CXFA_Node::UpdateNameHash() {
const XFA_NOTSUREATTRIBUTE* pNotsure =
XFA_GetNotsureAttribute(GetElementType(), XFA_ATTRIBUTE_Name);
diff --git a/xfa/fxfa/parser/cxfa_node.h b/xfa/fxfa/parser/cxfa_node.h
index e7eafe3a29..01f9b3df15 100644
--- a/xfa/fxfa/parser/cxfa_node.h
+++ b/xfa/fxfa/parser/cxfa_node.h
@@ -140,15 +140,8 @@ class CXFA_Node : public CXFA_Object {
CXFA_Node* GetOccurNode();
- void OnChanged(XFA_ATTRIBUTE eAttr, bool bNotify, bool bScriptModify);
- void OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify);
-
void Script_TreeClass_ResolveNode(CFXJSE_Arguments* pArguments);
void Script_TreeClass_ResolveNodes(CFXJSE_Arguments* pArguments);
- void Script_Som_ResolveNodeList(CFXJSE_Value* pValue,
- WideString wsExpression,
- uint32_t dwFlag,
- CXFA_Node* refNode = nullptr);
void Script_TreeClass_All(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);
@@ -218,8 +211,6 @@ class CXFA_Node : public CXFA_Object {
void Script_Delta_Target(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);
- void Script_Attribute_SendAttributeChangeMessage(XFA_ATTRIBUTE eAttribute,
- bool bScriptModify);
void Script_Attribute_Integer(CFXJSE_Value* pValue,
bool bSetting,
XFA_ATTRIBUTE eAttribute);