Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(652)

Side by Side Diff: xfa/fxfa/parser/xfa_object_imp.cpp

Issue 1890563003: Simplify XFA event handling. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « xfa/fxfa/parser/xfa_object.h ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fxfa/parser/xfa_object.h" 7 #include "xfa/fxfa/parser/xfa_object.h"
8 8
9 #include "core/fxcrt/include/fx_ext.h" 9 #include "core/fxcrt/include/fx_ext.h"
10 #include "xfa/fde/xml/fde_xml_imp.h" 10 #include "xfa/fde/xml/fde_xml_imp.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 if (!wsValue.IsEmpty()) { 140 if (!wsValue.IsEmpty()) {
141 pCloneXMLElement->SetTextData(wsValue); 141 pCloneXMLElement->SetTextData(wsValue);
142 } 142 }
143 pCloneXML = pCloneXMLElement; 143 pCloneXML = pCloneXMLElement;
144 pCloneXMLElement = NULL; 144 pCloneXMLElement = NULL;
145 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 145 pClone->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
146 } else { 146 } else {
147 pCloneXML = m_pXMLNode->Clone(FALSE); 147 pCloneXML = m_pXMLNode->Clone(FALSE);
148 } 148 }
149 pClone->SetXMLMappingNode(pCloneXML); 149 pClone->SetXMLMappingNode(pCloneXML);
150 pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 150 pClone->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
151 } 151 }
152 if (bRecursive) { 152 if (bRecursive) {
153 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; 153 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
154 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 154 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
155 pClone->InsertChild(pChild->Clone(bRecursive)); 155 pClone->InsertChild(pChild->Clone(bRecursive));
156 } 156 }
157 } 157 }
158 pClone->SetFlag(XFA_NODEFLAG_Initialized); 158 pClone->SetFlag(XFA_NODEFLAG_Initialized, true);
159 pClone->SetObject(XFA_ATTRIBUTE_BindingNode, NULL); 159 pClone->SetObject(XFA_ATTRIBUTE_BindingNode, NULL);
160 return pClone; 160 return pClone;
161 } 161 }
162 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem) const { 162 CXFA_Node* CXFA_Node::GetNodeItem(XFA_NODEITEM eItem) const {
163 switch (eItem) { 163 switch (eItem) {
164 case XFA_NODEITEM_NextSibling: 164 case XFA_NODEITEM_NextSibling:
165 return m_pNext; 165 return m_pNext;
166 case XFA_NODEITEM_FirstChild: 166 case XFA_NODEITEM_FirstChild:
167 return m_pChild; 167 return m_pChild;
168 case XFA_NODEITEM_Parent: 168 case XFA_NODEITEM_Parent:
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 for (int32_t i = 0; i < iProperties; i++) { 293 for (int32_t i = 0; i < iProperties; i++) {
294 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) { 294 if (pProperty[i].uFlags & XFA_PROPERTYFLAG_DefaultOneOf) {
295 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 295 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
296 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID()); 296 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(GetPacketID());
297 CXFA_Node* pNewNode = 297 CXFA_Node* pNewNode =
298 pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName); 298 pFactory->CreateNode(pPacket, (XFA_ELEMENT)pProperty[i].eName);
299 if (!pNewNode) { 299 if (!pNewNode) {
300 break; 300 break;
301 } 301 }
302 InsertChild(pNewNode, NULL); 302 InsertChild(pNewNode, NULL);
303 pNewNode->SetFlag(XFA_NODEFLAG_Initialized); 303 pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true);
304 nodes.Add(pNewNode); 304 nodes.Add(pNewNode);
305 break; 305 break;
306 } 306 }
307 } 307 }
308 } 308 }
309 } 309 }
310 return nodes.GetSize(); 310 return nodes.GetSize();
311 } 311 }
312 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement, 312 CXFA_Node* CXFA_Node::CreateSamePacketNode(XFA_ELEMENT eElement,
313 uint32_t dwFlags) { 313 uint32_t dwFlags) {
314 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 314 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
315 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement); 315 CXFA_Node* pNode = pFactory->CreateNode(m_ePacket, eElement);
316 pNode->SetFlag(dwFlags); 316 pNode->SetFlag(dwFlags, true);
317 return pNode; 317 return pNode;
318 } 318 }
319 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) { 319 CXFA_Node* CXFA_Node::CloneTemplateToForm(FX_BOOL bRecursive) {
320 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template); 320 FXSYS_assert(m_ePacket == XFA_XDPPACKET_Template);
321 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 321 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
322 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass); 322 CXFA_Node* pClone = pFactory->CreateNode(XFA_XDPPACKET_Form, m_eNodeClass);
323 if (!pClone) { 323 if (!pClone) {
324 return NULL; 324 return NULL;
325 } 325 }
326 pClone->SetTemplateNode(this); 326 pClone->SetTemplateNode(this);
327 pClone->UpdateNameHash(); 327 pClone->UpdateNameHash();
328 pClone->SetXMLMappingNode(GetXMLMappingNode()); 328 pClone->SetXMLMappingNode(GetXMLMappingNode());
329 if (bRecursive) { 329 if (bRecursive) {
330 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild; 330 for (CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); pChild;
331 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) { 331 pChild = pChild->GetNodeItem(XFA_NODEITEM_NextSibling)) {
332 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive)); 332 pClone->InsertChild(pChild->CloneTemplateToForm(bRecursive));
333 } 333 }
334 } 334 }
335 pClone->SetFlag(XFA_NODEFLAG_Initialized); 335 pClone->SetFlag(XFA_NODEFLAG_Initialized, true);
336 return pClone; 336 return pClone;
337 } 337 }
338 338
339 CXFA_Node* CXFA_Node::GetTemplateNode() const { 339 CXFA_Node* CXFA_Node::GetTemplateNode() const {
340 return m_pAuxNode; 340 return m_pAuxNode;
341 } 341 }
342 342
343 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) { 343 void CXFA_Node::SetTemplateNode(CXFA_Node* pTemplateNode) {
344 m_pAuxNode = pTemplateNode; 344 m_pAuxNode = pTemplateNode;
345 } 345 }
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 pFakeRoot = pParser->GetRootNode(); 1011 pFakeRoot = pParser->GetRootNode();
1012 if (pFakeRoot) { 1012 if (pFakeRoot) {
1013 if (bOverwrite) { 1013 if (bOverwrite) {
1014 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild); 1014 CXFA_Node* pChild = GetNodeItem(XFA_NODEITEM_FirstChild);
1015 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1015 CXFA_Node* pNewChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1016 int32_t index = 0; 1016 int32_t index = 0;
1017 while (pNewChild) { 1017 while (pNewChild) {
1018 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1018 CXFA_Node* pItem = pNewChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1019 pFakeRoot->RemoveChild(pNewChild); 1019 pFakeRoot->RemoveChild(pNewChild);
1020 InsertChild(index++, pNewChild); 1020 InsertChild(index++, pNewChild);
1021 pNewChild->SetFlag(XFA_NODEFLAG_Initialized); 1021 pNewChild->SetFlag(XFA_NODEFLAG_Initialized, true);
1022 pNewChild = pItem; 1022 pNewChild = pItem;
1023 } 1023 }
1024 while (pChild) { 1024 while (pChild) {
1025 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1025 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1026 RemoveChild(pChild); 1026 RemoveChild(pChild);
1027 pFakeRoot->InsertChild(pChild); 1027 pFakeRoot->InsertChild(pChild);
1028 pChild = pItem; 1028 pChild = pItem;
1029 } 1029 }
1030 if (GetPacketID() == XFA_XDPPACKET_Form && 1030 if (GetPacketID() == XFA_XDPPACKET_Form &&
1031 GetClassID() == XFA_ELEMENT_ExData) { 1031 GetClassID() == XFA_ELEMENT_ExData) {
1032 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode(); 1032 CFDE_XMLNode* pTempXMLNode = GetXMLMappingNode();
1033 SetXMLMappingNode(pFakeXMLRoot); 1033 SetXMLMappingNode(pFakeXMLRoot);
1034 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 1034 SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
1035 if (pTempXMLNode && 1035 if (pTempXMLNode &&
1036 pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL) { 1036 pTempXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL) {
1037 pFakeXMLRoot = pTempXMLNode; 1037 pFakeXMLRoot = pTempXMLNode;
1038 } else { 1038 } else {
1039 pFakeXMLRoot = NULL; 1039 pFakeXMLRoot = NULL;
1040 } 1040 }
1041 } 1041 }
1042 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE); 1042 MoveBufferMapData(pFakeRoot, this, XFA_CalcData, TRUE);
1043 } else { 1043 } else {
1044 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild); 1044 CXFA_Node* pChild = pFakeRoot->GetNodeItem(XFA_NODEITEM_FirstChild);
1045 while (pChild) { 1045 while (pChild) {
1046 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling); 1046 CXFA_Node* pItem = pChild->GetNodeItem(XFA_NODEITEM_NextSibling);
1047 pFakeRoot->RemoveChild(pChild); 1047 pFakeRoot->RemoveChild(pChild);
1048 InsertChild(pChild); 1048 InsertChild(pChild);
1049 pChild->SetFlag(XFA_NODEFLAG_Initialized); 1049 pChild->SetFlag(XFA_NODEFLAG_Initialized, true);
1050 pChild = pItem; 1050 pChild = pItem;
1051 } 1051 }
1052 } 1052 }
1053 if (pFakeXMLRoot) { 1053 if (pFakeXMLRoot) {
1054 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot); 1054 pFakeRoot->SetXMLMappingNode(pFakeXMLRoot);
1055 pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 1055 pFakeRoot->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
1056 } 1056 }
1057 pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, TRUE, FALSE); 1057 pFakeRoot->SetFlag(XFA_NODEFLAG_HasRemoved, false);
1058 } else { 1058 } else {
1059 if (pFakeXMLRoot) { 1059 if (pFakeXMLRoot) {
1060 pFakeXMLRoot->Release(); 1060 pFakeXMLRoot->Release();
1061 pFakeXMLRoot = NULL; 1061 pFakeXMLRoot = NULL;
1062 } 1062 }
1063 } 1063 }
1064 pParser->Release(); 1064 pParser->Release();
1065 pParser = NULL; 1065 pParser = NULL;
1066 } 1066 }
1067 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) { 1067 void CXFA_Node::Script_NodeClass_SaveFilteredXML(CFXJSE_Arguments* pArguments) {
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue, 1259 void CXFA_Node::Script_ModelClass_Context(FXJSE_HVALUE hValue,
1260 FX_BOOL bSetting, 1260 FX_BOOL bSetting,
1261 XFA_ATTRIBUTE eAttribute) {} 1261 XFA_ATTRIBUTE eAttribute) {}
1262 void CXFA_Node::Script_ModelClass_AliasNode(FXJSE_HVALUE hValue, 1262 void CXFA_Node::Script_ModelClass_AliasNode(FXJSE_HVALUE hValue,
1263 FX_BOOL bSetting, 1263 FX_BOOL bSetting,
1264 XFA_ATTRIBUTE eAttribute) {} 1264 XFA_ATTRIBUTE eAttribute) {}
1265 void CXFA_Node::Script_Attribute_Integer(FXJSE_HVALUE hValue, 1265 void CXFA_Node::Script_Attribute_Integer(FXJSE_HVALUE hValue,
1266 FX_BOOL bSetting, 1266 FX_BOOL bSetting,
1267 XFA_ATTRIBUTE eAttribute) { 1267 XFA_ATTRIBUTE eAttribute) {
1268 if (bSetting) { 1268 if (bSetting) {
1269 SetInteger(eAttribute, FXJSE_Value_ToInteger(hValue), TRUE); 1269 SetInteger(eAttribute, FXJSE_Value_ToInteger(hValue), true);
1270 } else { 1270 } else {
1271 FXJSE_Value_SetInteger(hValue, GetInteger(eAttribute)); 1271 FXJSE_Value_SetInteger(hValue, GetInteger(eAttribute));
1272 } 1272 }
1273 } 1273 }
1274 void CXFA_Node::Script_Attribute_IntegerRead(FXJSE_HVALUE hValue, 1274 void CXFA_Node::Script_Attribute_IntegerRead(FXJSE_HVALUE hValue,
1275 FX_BOOL bSetting, 1275 FX_BOOL bSetting,
1276 XFA_ATTRIBUTE eAttribute) { 1276 XFA_ATTRIBUTE eAttribute) {
1277 if (!bSetting) { 1277 if (!bSetting) {
1278 FXJSE_Value_SetInteger(hValue, GetInteger(eAttribute)); 1278 FXJSE_Value_SetInteger(hValue, GetInteger(eAttribute));
1279 } else { 1279 } else {
1280 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1280 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1281 } 1281 }
1282 } 1282 }
1283 void CXFA_Node::Script_Attribute_BOOL(FXJSE_HVALUE hValue, 1283 void CXFA_Node::Script_Attribute_BOOL(FXJSE_HVALUE hValue,
1284 FX_BOOL bSetting, 1284 FX_BOOL bSetting,
1285 XFA_ATTRIBUTE eAttribute) { 1285 XFA_ATTRIBUTE eAttribute) {
1286 if (bSetting) { 1286 if (bSetting) {
1287 SetBoolean(eAttribute, FXJSE_Value_ToBoolean(hValue), TRUE); 1287 SetBoolean(eAttribute, FXJSE_Value_ToBoolean(hValue), true);
1288 } else { 1288 } else {
1289 FXJSE_Value_SetUTF8String(hValue, GetBoolean(eAttribute) ? "1" : "0"); 1289 FXJSE_Value_SetUTF8String(hValue, GetBoolean(eAttribute) ? "1" : "0");
1290 } 1290 }
1291 } 1291 }
1292 void CXFA_Node::Script_Attribute_BOOLRead(FXJSE_HVALUE hValue, 1292 void CXFA_Node::Script_Attribute_BOOLRead(FXJSE_HVALUE hValue,
1293 FX_BOOL bSetting, 1293 FX_BOOL bSetting,
1294 XFA_ATTRIBUTE eAttribute) { 1294 XFA_ATTRIBUTE eAttribute) {
1295 if (!bSetting) { 1295 if (!bSetting) {
1296 FXJSE_Value_SetUTF8String(hValue, GetBoolean(eAttribute) ? "1" : "0"); 1296 FXJSE_Value_SetUTF8String(hValue, GetBoolean(eAttribute) ? "1" : "0");
1297 } else { 1297 } else {
1298 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 1298 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
1299 } 1299 }
1300 } 1300 }
1301
1301 void CXFA_Node::Script_Attribute_SendAttributeChangeMessage( 1302 void CXFA_Node::Script_Attribute_SendAttributeChangeMessage(
1302 void* eAttribute, 1303 XFA_ATTRIBUTE eAttribute,
1303 void* eValue,
1304 FX_BOOL bScriptModify) { 1304 FX_BOOL bScriptModify) {
1305 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor(); 1305 CXFA_LayoutProcessor* pLayoutPro = m_pDocument->GetLayoutProcessor();
1306 if (!pLayoutPro) { 1306 if (!pLayoutPro)
1307 return;
1308
1309 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
1310 if (!pNotify)
1311 return;
1312
1313 uint32_t dwPacket = GetPacketID();
1314 if (!(dwPacket & XFA_XDPPACKET_Form)) {
1315 pNotify->OnValueChanged(this, eAttribute, this, this);
1307 return; 1316 return;
1308 } 1317 }
1309 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 1318
1310 if (!pNotify) { 1319 bool bNeedFindContainer = false;
1311 return; 1320 XFA_ELEMENT eType = GetClassID();
1312 } 1321 switch (eType) {
1313 uint32_t dwPacket = GetPacketID(); 1322 case XFA_ELEMENT_Caption:
1314 if (dwPacket & XFA_XDPPACKET_Form) { 1323 bNeedFindContainer = true;
1315 FX_BOOL bNeedFindContainer = FALSE; 1324 pNotify->OnValueChanged(this, eAttribute, this,
1316 XFA_ELEMENT eType = GetClassID(); 1325 GetNodeItem(XFA_NODEITEM_Parent));
1317 switch (eType) { 1326 break;
1318 case XFA_ELEMENT_Caption: 1327 case XFA_ELEMENT_Font:
1319 bNeedFindContainer = TRUE; 1328 case XFA_ELEMENT_Para: {
1320 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1329 bNeedFindContainer = true;
1321 eValue, this, GetNodeItem(XFA_NODEITEM_Parent)); 1330 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1322 break; 1331 if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) {
1323 case XFA_ELEMENT_Font: 1332 pNotify->OnValueChanged(this, eAttribute, pParentNode,
1324 case XFA_ELEMENT_Para: { 1333 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1325 bNeedFindContainer = TRUE; 1334 } else {
1326 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 1335 pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
1327 if (pParentNode->GetClassID() == XFA_ELEMENT_Caption) { 1336 }
1328 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1337 } break;
1329 eValue, pParentNode, 1338 case XFA_ELEMENT_Margin: {
1330 pParentNode->GetNodeItem(XFA_NODEITEM_Parent)); 1339 bNeedFindContainer = true;
1340 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent);
1341 XFA_ELEMENT eParentType = pParentNode->GetClassID();
1342 if (pParentNode->IsContainerNode()) {
1343 pNotify->OnValueChanged(this, eAttribute, this, pParentNode);
1344 } else if (eParentType == XFA_ELEMENT_Caption) {
1345 pNotify->OnValueChanged(this, eAttribute, pParentNode,
1346 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1347 } else {
1348 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
1349 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) {
1350 pNotify->OnValueChanged(this, eAttribute, pNode,
1351 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1352 }
1353 }
1354 } break;
1355 case XFA_ELEMENT_Comb: {
1356 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent);
1357 XFA_ELEMENT eUIType = pEditNode->GetClassID();
1358 if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit ||
1359 eUIType == XFA_ELEMENT_NumericEdit ||
1360 eUIType == XFA_ELEMENT_TextEdit)) {
1361 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent);
1362 if (pUINode) {
1363 pNotify->OnValueChanged(this, eAttribute, pUINode,
1364 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1365 }
1366 }
1367 } break;
1368 case XFA_ELEMENT_Button:
1369 case XFA_ELEMENT_Barcode:
1370 case XFA_ELEMENT_ChoiceList:
1371 case XFA_ELEMENT_DateTimeEdit:
1372 case XFA_ELEMENT_NumericEdit:
1373 case XFA_ELEMENT_PasswordEdit:
1374 case XFA_ELEMENT_TextEdit: {
1375 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1376 if (pUINode) {
1377 pNotify->OnValueChanged(this, eAttribute, pUINode,
1378 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1379 }
1380 } break;
1381 case XFA_ELEMENT_CheckButton: {
1382 bNeedFindContainer = true;
1383 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1384 if (pUINode) {
1385 pNotify->OnValueChanged(this, eAttribute, pUINode,
1386 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1387 }
1388 } break;
1389 case XFA_ELEMENT_Keep:
1390 case XFA_ELEMENT_Bookend:
1391 case XFA_ELEMENT_Break:
1392 case XFA_ELEMENT_BreakAfter:
1393 case XFA_ELEMENT_BreakBefore:
1394 case XFA_ELEMENT_Overflow:
1395 bNeedFindContainer = true;
1396 break;
1397 case XFA_ELEMENT_Area:
1398 case XFA_ELEMENT_Draw:
1399 case XFA_ELEMENT_ExclGroup:
1400 case XFA_ELEMENT_Field:
1401 case XFA_ELEMENT_Subform:
1402 case XFA_ELEMENT_SubformSet:
1403 pLayoutPro->AddChangedContainer(this);
1404 pNotify->OnValueChanged(this, eAttribute, this, this);
1405 break;
1406 case XFA_ELEMENT_Sharptext:
1407 case XFA_ELEMENT_Sharpxml:
1408 case XFA_ELEMENT_SharpxHTML: {
1409 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
1410 if (!pTextNode) {
1411 return;
1412 }
1413 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
1414 if (!pValueNode) {
1415 return;
1416 }
1417 XFA_ELEMENT eType = pValueNode->GetClassID();
1418 if (eType == XFA_ELEMENT_Value) {
1419 bNeedFindContainer = true;
1420 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1421 if (pNode && pNode->IsContainerNode()) {
1422 if (bScriptModify) {
1423 pValueNode = pNode;
1424 }
1425 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
1331 } else { 1426 } else {
1332 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, 1427 pNotify->OnValueChanged(this, eAttribute, pNode,
1333 eValue, this, pParentNode); 1428 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1334 } 1429 }
1335 } break; 1430 } else {
1336 case XFA_ELEMENT_Margin: { 1431 if (eType == XFA_ELEMENT_Items) {
1337 bNeedFindContainer = TRUE; 1432 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1338 CXFA_Node* pParentNode = GetNodeItem(XFA_NODEITEM_Parent); 1433 if (pNode && pNode->IsContainerNode()) {
1339 XFA_ELEMENT eParentType = pParentNode->GetClassID(); 1434 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode);
1340 if (pParentNode->IsContainerNode()) {
1341 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1342 eValue, this, pParentNode);
1343 } else if (eParentType == XFA_ELEMENT_Caption) {
1344 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1345 eValue, pParentNode,
1346 pParentNode->GetNodeItem(XFA_NODEITEM_Parent));
1347 } else {
1348 CXFA_Node* pNode = pParentNode->GetNodeItem(XFA_NODEITEM_Parent);
1349 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Ui) {
1350 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1351 eValue, pNode,
1352 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1353 } 1435 }
1354 } 1436 }
1355 } break; 1437 }
1356 case XFA_ELEMENT_Comb: { 1438 } break;
1357 CXFA_Node* pEditNode = GetNodeItem(XFA_NODEITEM_Parent); 1439 default:
1358 XFA_ELEMENT eUIType = pEditNode->GetClassID(); 1440 break;
1359 if (pEditNode && (eUIType == XFA_ELEMENT_DateTimeEdit || 1441 }
1360 eUIType == XFA_ELEMENT_NumericEdit || 1442 if (bNeedFindContainer) {
1361 eUIType == XFA_ELEMENT_TextEdit)) { 1443 CXFA_Node* pParent = this;
1362 CXFA_Node* pUINode = pEditNode->GetNodeItem(XFA_NODEITEM_Parent); 1444 while (pParent) {
1363 if (pUINode) { 1445 if (pParent->IsContainerNode())
1364 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1365 eValue, pUINode,
1366 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1367 }
1368 }
1369 } break;
1370 case XFA_ELEMENT_Button:
1371 case XFA_ELEMENT_Barcode:
1372 case XFA_ELEMENT_ChoiceList:
1373 case XFA_ELEMENT_DateTimeEdit:
1374 case XFA_ELEMENT_NumericEdit:
1375 case XFA_ELEMENT_PasswordEdit:
1376 case XFA_ELEMENT_TextEdit: {
1377 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1378 if (pUINode) {
1379 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1380 eValue, pUINode,
1381 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1382 }
1383 } break;
1384 case XFA_ELEMENT_CheckButton: {
1385 bNeedFindContainer = TRUE;
1386 CXFA_Node* pUINode = GetNodeItem(XFA_NODEITEM_Parent);
1387 if (pUINode) {
1388 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1389 eValue, pUINode,
1390 pUINode->GetNodeItem(XFA_NODEITEM_Parent));
1391 }
1392 } break;
1393 case XFA_ELEMENT_Keep:
1394 case XFA_ELEMENT_Bookend:
1395 case XFA_ELEMENT_Break:
1396 case XFA_ELEMENT_BreakAfter:
1397 case XFA_ELEMENT_BreakBefore:
1398 case XFA_ELEMENT_Overflow:
1399 bNeedFindContainer = TRUE;
1400 break; 1446 break;
1401 case XFA_ELEMENT_Area: 1447
1402 case XFA_ELEMENT_Draw: 1448 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
1403 case XFA_ELEMENT_ExclGroup:
1404 case XFA_ELEMENT_Field:
1405 case XFA_ELEMENT_Subform:
1406 case XFA_ELEMENT_SubformSet:
1407 pLayoutPro->AddChangedContainer(this);
1408 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1409 eValue, this, this);
1410 break;
1411 case XFA_ELEMENT_Sharptext:
1412 case XFA_ELEMENT_Sharpxml:
1413 case XFA_ELEMENT_SharpxHTML: {
1414 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent);
1415 if (!pTextNode) {
1416 return;
1417 }
1418 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent);
1419 if (!pValueNode) {
1420 return;
1421 }
1422 XFA_ELEMENT eType = pValueNode->GetClassID();
1423 if (eType == XFA_ELEMENT_Value) {
1424 bNeedFindContainer = TRUE;
1425 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1426 if (pNode && pNode->IsContainerNode()) {
1427 if (bScriptModify) {
1428 pValueNode = pNode;
1429 }
1430 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1431 eValue, pValueNode, pNode);
1432 } else {
1433 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1434 eValue, pNode,
1435 pNode->GetNodeItem(XFA_NODEITEM_Parent));
1436 }
1437 } else {
1438 if (eType == XFA_ELEMENT_Items) {
1439 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent);
1440 if (pNode && pNode->IsContainerNode()) {
1441 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute,
1442 eValue, pValueNode, pNode);
1443 }
1444 }
1445 }
1446 } break;
1447 default:
1448 break;
1449 } 1449 }
1450 if (bNeedFindContainer) { 1450 if (pParent) {
1451 CXFA_Node* pParent = this; 1451 pLayoutPro->AddChangedContainer(pParent);
1452 while (pParent) {
1453 if (pParent->IsContainerNode()) {
1454 break;
1455 }
1456 pParent = pParent->GetNodeItem(XFA_NODEITEM_Parent);
1457 }
1458 if (pParent) {
1459 pLayoutPro->AddChangedContainer(pParent);
1460 }
1461 } 1452 }
1462 } else {
1463 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanged, eAttribute, eValue,
1464 this, this);
1465 } 1453 }
1466 } 1454 }
1455
1467 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue, 1456 void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
1468 FX_BOOL bSetting, 1457 FX_BOOL bSetting,
1469 XFA_ATTRIBUTE eAttribute) { 1458 XFA_ATTRIBUTE eAttribute) {
1470 if (bSetting) { 1459 if (bSetting) {
1471 CFX_ByteString szValue; 1460 CFX_ByteString szValue;
1472 FXJSE_Value_ToUTF8String(hValue, szValue); 1461 FXJSE_Value_ToUTF8String(hValue, szValue);
1473 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC()); 1462 CFX_WideString wsValue = CFX_WideString::FromUTF8(szValue.AsStringC());
1474 SetAttribute(eAttribute, wsValue.AsStringC(), TRUE); 1463 SetAttribute(eAttribute, wsValue.AsStringC(), true);
1475 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) { 1464 if (eAttribute == XFA_ATTRIBUTE_Use && GetClassID() == XFA_ELEMENT_Desc) {
1476 CFX_WideString wsUseVal = wsValue, wsID, wsSOM; 1465 CFX_WideString wsUseVal = wsValue, wsID, wsSOM;
1477 CXFA_Node* pTemplateNode = 1466 CXFA_Node* pTemplateNode =
1478 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template)); 1467 ToNode(m_pDocument->GetXFAObject(XFA_HASHCODE_Template));
1479 CXFA_Node* pProtoRoot = 1468 CXFA_Node* pProtoRoot =
1480 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform) 1469 pTemplateNode->GetFirstChildByClass(XFA_ELEMENT_Subform)
1481 ->GetFirstChildByClass(XFA_ELEMENT_Proto); 1470 ->GetFirstChildByClass(XFA_ELEMENT_Proto);
1482 if (!wsUseVal.IsEmpty()) { 1471 if (!wsUseVal.IsEmpty()) {
1483 if (wsUseVal[0] == '#') { 1472 if (wsUseVal[0] == '#') {
1484 wsID = CFX_WideString(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1); 1473 wsID = CFX_WideString(wsUseVal.c_str() + 1, wsUseVal.GetLength() - 1);
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
1684 } 1673 }
1685 pContainerWidgetData = NULL; 1674 pContainerWidgetData = NULL;
1686 } 1675 }
1687 } else if (GetPacketID() == XFA_XDPPACKET_Form) { 1676 } else if (GetPacketID() == XFA_XDPPACKET_Form) {
1688 pContainerWidgetData = GetContainerWidgetData(); 1677 pContainerWidgetData = GetContainerWidgetData();
1689 } 1678 }
1690 if (pContainerWidgetData) { 1679 if (pContainerWidgetData) {
1691 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), 1680 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
1692 wsFormatValue); 1681 wsFormatValue);
1693 } 1682 }
1694 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1683 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1695 } else { 1684 } else {
1696 CFX_WideString content = GetScriptContent(TRUE); 1685 CFX_WideString content = GetScriptContent(TRUE);
1697 if (content.IsEmpty() && classID != XFA_ELEMENT_Text && 1686 if (content.IsEmpty() && classID != XFA_ELEMENT_Text &&
1698 classID != XFA_ELEMENT_SubmitUrl) { 1687 classID != XFA_ELEMENT_SubmitUrl) {
1699 FXJSE_Value_SetNull(hValue); 1688 FXJSE_Value_SetNull(hValue);
1700 } else if (classID == XFA_ELEMENT_Integer) { 1689 } else if (classID == XFA_ELEMENT_Integer) {
1701 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str())); 1690 FXJSE_Value_SetInteger(hValue, FXSYS_wtoi(content.c_str()));
1702 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) { 1691 } else if (classID == XFA_ELEMENT_Float || classID == XFA_ELEMENT_Decimal) {
1703 CFX_Decimal decimal(content.AsStringC()); 1692 CFX_Decimal decimal(content.AsStringC());
1704 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal); 1693 FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
(...skipping 29 matching lines...) Expand all
1734 FXJSE_Value_ToUTF8String(hValue, newValue); 1723 FXJSE_Value_ToUTF8String(hValue, newValue);
1735 } 1724 }
1736 int32_t iValue = FXSYS_atoi(newValue.c_str()); 1725 int32_t iValue = FXSYS_atoi(newValue.c_str());
1737 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); 1726 CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1");
1738 CFX_WideString wsFormatValue(wsNewValue); 1727 CFX_WideString wsFormatValue(wsNewValue);
1739 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1728 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
1740 if (pContainerWidgetData) { 1729 if (pContainerWidgetData) {
1741 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(), 1730 pContainerWidgetData->GetFormatDataValue(wsNewValue.AsStringC(),
1742 wsFormatValue); 1731 wsFormatValue);
1743 } 1732 }
1744 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1733 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1745 } else { 1734 } else {
1746 CFX_WideString wsValue = GetScriptContent(TRUE); 1735 CFX_WideString wsValue = GetScriptContent(TRUE);
1747 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1")); 1736 FXJSE_Value_SetBoolean(hValue, wsValue == FX_WSTRC(L"1"));
1748 } 1737 }
1749 } 1738 }
1750 struct XFA_ExecEventParaInfo { 1739 struct XFA_ExecEventParaInfo {
1751 public: 1740 public:
1752 uint32_t m_uHash; 1741 uint32_t m_uHash;
1753 const FX_WCHAR* m_lpcEventName; 1742 const FX_WCHAR* m_lpcEventName;
1754 XFA_EVENTTYPE m_eventType; 1743 XFA_EVENTTYPE m_eventType;
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1945 if (FXJSE_Value_IsUTF8String(hValue)) { 1934 if (FXJSE_Value_IsUTF8String(hValue)) {
1946 CXFA_WidgetData* pWidgetData = GetWidgetData(); 1935 CXFA_WidgetData* pWidgetData = GetWidgetData();
1947 FXSYS_assert(pWidgetData); 1936 FXSYS_assert(pWidgetData);
1948 XFA_ELEMENT uiType = pWidgetData->GetUIType(); 1937 XFA_ELEMENT uiType = pWidgetData->GetUIType();
1949 if (uiType == XFA_ELEMENT_Text) { 1938 if (uiType == XFA_ELEMENT_Text) {
1950 CFX_ByteString newValue; 1939 CFX_ByteString newValue;
1951 FXJSE_Value_ToUTF8String(hValue, newValue); 1940 FXJSE_Value_ToUTF8String(hValue, newValue);
1952 CFX_WideString wsNewValue = 1941 CFX_WideString wsNewValue =
1953 CFX_WideString::FromUTF8(newValue.AsStringC()); 1942 CFX_WideString::FromUTF8(newValue.AsStringC());
1954 CFX_WideString wsFormatValue(wsNewValue); 1943 CFX_WideString wsFormatValue(wsNewValue);
1955 SetScriptContent(wsNewValue, wsFormatValue, TRUE, TRUE); 1944 SetScriptContent(wsNewValue, wsFormatValue, true, TRUE);
1956 } else if (uiType != XFA_ELEMENT_Image) { 1945 } else if (uiType != XFA_ELEMENT_Image) {
1957 } 1946 }
1958 } 1947 }
1959 } else { 1948 } else {
1960 CFX_WideString content = GetScriptContent(TRUE); 1949 CFX_WideString content = GetScriptContent(TRUE);
1961 if (content.IsEmpty()) { 1950 if (content.IsEmpty()) {
1962 FXJSE_Value_SetNull(hValue); 1951 FXJSE_Value_SetNull(hValue);
1963 } else { 1952 } else {
1964 FXJSE_Value_SetUTF8String( 1953 FXJSE_Value_SetUTF8String(
1965 hValue, 1954 hValue,
(...skipping 29 matching lines...) Expand all
1995 pWidgetData->GetFracDigits(iFracDigits); 1984 pWidgetData->GetFracDigits(iFracDigits);
1996 wsNewText = 1985 wsNewText =
1997 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits); 1986 pWidgetData->NumericLimit(wsNewText, iLeadDigits, iFracDigits);
1998 } 1987 }
1999 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); 1988 CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData();
2000 CFX_WideString wsFormatText(wsNewText); 1989 CFX_WideString wsFormatText(wsNewText);
2001 if (pContainerWidgetData) { 1990 if (pContainerWidgetData) {
2002 pContainerWidgetData->GetFormatDataValue(wsNewText.AsStringC(), 1991 pContainerWidgetData->GetFormatDataValue(wsNewText.AsStringC(),
2003 wsFormatText); 1992 wsFormatText);
2004 } 1993 }
2005 SetScriptContent(wsNewText, wsFormatText, TRUE, TRUE); 1994 SetScriptContent(wsNewText, wsFormatText, true, TRUE);
2006 } else { 1995 } else {
2007 CFX_WideString content = GetScriptContent(TRUE); 1996 CFX_WideString content = GetScriptContent(TRUE);
2008 if (content.IsEmpty()) { 1997 if (content.IsEmpty()) {
2009 FXJSE_Value_SetNull(hValue); 1998 FXJSE_Value_SetNull(hValue);
2010 } else { 1999 } else {
2011 CXFA_Node* pUIChild = pWidgetData->GetUIChild(); 2000 CXFA_Node* pUIChild = pWidgetData->GetUIChild();
2012 XFA_ELEMENT eUI = pUIChild->GetClassID(); 2001 XFA_ELEMENT eUI = pUIChild->GetClassID();
2013 CXFA_Value defVal = pWidgetData->GetFormValue(); 2002 CXFA_Value defVal = pWidgetData->GetFormValue();
2014 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild); 2003 CXFA_Node* pNode = defVal.GetNode()->GetNodeItem(XFA_NODEITEM_FirstChild);
2015 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) { 2004 if (pNode && pNode->GetClassID() == XFA_ELEMENT_Decimal) {
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
2591 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET); 2580 ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
2592 } 2581 }
2593 } 2582 }
2594 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue, 2583 void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue,
2595 FX_BOOL bSetting, 2584 FX_BOOL bSetting,
2596 XFA_ATTRIBUTE eAttribute) { 2585 XFA_ATTRIBUTE eAttribute) {
2597 if (bSetting) { 2586 if (bSetting) {
2598 CFX_ByteString bsLocaleName; 2587 CFX_ByteString bsLocaleName;
2599 FXJSE_Value_ToUTF8String(hValue, bsLocaleName); 2588 FXJSE_Value_ToUTF8String(hValue, bsLocaleName);
2600 SetCData(XFA_ATTRIBUTE_Locale, 2589 SetCData(XFA_ATTRIBUTE_Locale,
2601 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), TRUE, TRUE); 2590 CFX_WideString::FromUTF8(bsLocaleName.AsStringC()), true, TRUE);
2602 } else { 2591 } else {
2603 CFX_WideString wsLocaleName; 2592 CFX_WideString wsLocaleName;
2604 GetLocaleName(wsLocaleName); 2593 GetLocaleName(wsLocaleName);
2605 FXJSE_Value_SetUTF8String( 2594 FXJSE_Value_SetUTF8String(
2606 hValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength()) 2595 hValue, FX_UTF8Encode(wsLocaleName.c_str(), wsLocaleName.GetLength())
2607 .AsStringC()); 2596 .AsStringC());
2608 } 2597 }
2609 } 2598 }
2610 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) { 2599 void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
2611 int32_t argc = pArguments->GetLength(); 2600 int32_t argc = pArguments->GetLength();
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2729 } 2718 }
2730 const XFA_ELEMENTINFO* pElement = 2719 const XFA_ELEMENTINFO* pElement =
2731 XFA_GetElementByName(strTagName.AsStringC()); 2720 XFA_GetElementByName(strTagName.AsStringC());
2732 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName); 2721 CXFA_Node* pNewNode = CreateSamePacketNode(pElement->eName);
2733 if (!pNewNode) { 2722 if (!pNewNode) {
2734 FXJSE_Value_SetNull(pArguments->GetReturnValue()); 2723 FXJSE_Value_SetNull(pArguments->GetReturnValue());
2735 } else { 2724 } else {
2736 if (!strName.IsEmpty()) { 2725 if (!strName.IsEmpty()) {
2737 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name, 2726 if (XFA_GetAttributeOfElement(pElement->eName, XFA_ATTRIBUTE_Name,
2738 XFA_XDPPACKET_UNKNOWN)) { 2727 XFA_XDPPACKET_UNKNOWN)) {
2739 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), TRUE); 2728 pNewNode->SetAttribute(XFA_ATTRIBUTE_Name, strName.AsStringC(), true);
2740 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) { 2729 if (pNewNode->GetPacketID() == XFA_XDPPACKET_Datasets) {
2741 pNewNode->CreateXMLMappingNode(); 2730 pNewNode->CreateXMLMappingNode();
2742 } 2731 }
2743 FXJSE_Value_Set( 2732 FXJSE_Value_Set(
2744 pArguments->GetReturnValue(), 2733 pArguments->GetReturnValue(),
2745 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode)); 2734 m_pDocument->GetScriptContext()->GetJSValueFromMap(pNewNode));
2746 } else { 2735 } else {
2747 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(), 2736 ThrowScriptErrorMessage(XFA_IDS_NOT_HAVE_PROPERTY, strTagName.c_str(),
2748 L"name"); 2737 L"name");
2749 } 2738 }
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
3747 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) { 3736 void* XFA_GetMapKey_Element(XFA_ELEMENT eElement, XFA_ATTRIBUTE eAttribute) {
3748 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) | 3737 return (void*)(uintptr_t)((eElement << 16) | (eAttribute << 8) |
3749 XFA_KEYTYPE_Element); 3738 XFA_KEYTYPE_Element);
3750 } 3739 }
3751 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) { 3740 FX_BOOL CXFA_Node::HasAttribute(XFA_ATTRIBUTE eAttr, FX_BOOL bCanInherit) {
3752 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3741 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3753 return HasMapModuleKey(pKey, bCanInherit); 3742 return HasMapModuleKey(pKey, bCanInherit);
3754 } 3743 }
3755 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr, 3744 FX_BOOL CXFA_Node::SetAttribute(XFA_ATTRIBUTE eAttr,
3756 const CFX_WideStringC& wsValue, 3745 const CFX_WideStringC& wsValue,
3757 FX_BOOL bNotify) { 3746 bool bNotify) {
3758 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr); 3747 const XFA_ATTRIBUTEINFO* pAttr = XFA_GetAttributeByID(eAttr);
3759 if (pAttr == NULL) { 3748 if (pAttr == NULL) {
3760 return FALSE; 3749 return FALSE;
3761 } 3750 }
3762 XFA_ATTRIBUTETYPE eType = pAttr->eType; 3751 XFA_ATTRIBUTETYPE eType = pAttr->eType;
3763 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) { 3752 if (eType == XFA_ATTRIBUTETYPE_NOTSURE) {
3764 const XFA_NOTSUREATTRIBUTE* pNotsure = 3753 const XFA_NOTSUREATTRIBUTE* pNotsure =
3765 XFA_GetNotsureAttribute(GetClassID(), pAttr->eName); 3754 XFA_GetNotsureAttribute(GetClassID(), pAttr->eName);
3766 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata; 3755 eType = pNotsure ? pNotsure->eType : XFA_ATTRIBUTETYPE_Cdata;
3767 } 3756 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3843 mValue.ToString(wsValue); 3832 mValue.ToString(wsValue);
3844 return TRUE; 3833 return TRUE;
3845 } break; 3834 } break;
3846 default: 3835 default:
3847 break; 3836 break;
3848 } 3837 }
3849 return FALSE; 3838 return FALSE;
3850 } 3839 }
3851 FX_BOOL CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr, 3840 FX_BOOL CXFA_Node::SetAttribute(const CFX_WideStringC& wsAttr,
3852 const CFX_WideStringC& wsValue, 3841 const CFX_WideStringC& wsValue,
3853 FX_BOOL bNotify) { 3842 bool bNotify) {
3854 const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue); 3843 const XFA_ATTRIBUTEINFO* pAttributeInfo = XFA_GetAttributeByName(wsValue);
3855 if (pAttributeInfo) { 3844 if (pAttributeInfo) {
3856 return SetAttribute(pAttributeInfo->eName, wsValue, bNotify); 3845 return SetAttribute(pAttributeInfo->eName, wsValue, bNotify);
3857 } 3846 }
3858 void* pKey = XFA_GetMapKey_Custom(wsAttr); 3847 void* pKey = XFA_GetMapKey_Custom(wsAttr);
3859 SetMapModuleString(pKey, wsValue); 3848 SetMapModuleString(pKey, wsValue);
3860 return TRUE; 3849 return TRUE;
3861 } 3850 }
3862 FX_BOOL CXFA_Node::GetAttribute(const CFX_WideStringC& wsAttr, 3851 FX_BOOL CXFA_Node::GetAttribute(const CFX_WideStringC& wsAttr,
3863 CFX_WideString& wsValue, 3852 CFX_WideString& wsValue,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3901 FX_BOOL CXFA_Node::TryEnum(XFA_ATTRIBUTE eAttr, 3890 FX_BOOL CXFA_Node::TryEnum(XFA_ATTRIBUTE eAttr,
3902 XFA_ATTRIBUTEENUM& eValue, 3891 XFA_ATTRIBUTEENUM& eValue,
3903 FX_BOOL bUseDefault) { 3892 FX_BOOL bUseDefault) {
3904 void* pValue = NULL; 3893 void* pValue = NULL;
3905 if (!GetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, bUseDefault, pValue)) { 3894 if (!GetValue(eAttr, XFA_ATTRIBUTETYPE_Enum, bUseDefault, pValue)) {
3906 return FALSE; 3895 return FALSE;
3907 } 3896 }
3908 eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue; 3897 eValue = (XFA_ATTRIBUTEENUM)(uintptr_t)pValue;
3909 return TRUE; 3898 return TRUE;
3910 } 3899 }
3900
3911 FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr, 3901 FX_BOOL CXFA_Node::SetMeasure(XFA_ATTRIBUTE eAttr,
3912 CXFA_Measurement mValue, 3902 CXFA_Measurement mValue,
3913 FX_BOOL bNotify) { 3903 bool bNotify) {
3914 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3904 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3915 OnChanging(eAttr, &mValue, bNotify); 3905 OnChanging(eAttr, bNotify);
3916 SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement)); 3906 SetMapModuleBuffer(pKey, &mValue, sizeof(CXFA_Measurement));
3917 OnChanged(eAttr, &mValue, bNotify); 3907 OnChanged(eAttr, bNotify, FALSE);
3918 return TRUE; 3908 return TRUE;
3919 } 3909 }
3910
3920 FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr, 3911 FX_BOOL CXFA_Node::TryMeasure(XFA_ATTRIBUTE eAttr,
3921 CXFA_Measurement& mValue, 3912 CXFA_Measurement& mValue,
3922 FX_BOOL bUseDefault) const { 3913 FX_BOOL bUseDefault) const {
3923 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3914 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3924 void* pValue; 3915 void* pValue;
3925 int32_t iBytes; 3916 int32_t iBytes;
3926 if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) { 3917 if (GetMapModuleBuffer(pKey, pValue, iBytes) && iBytes == sizeof(mValue)) {
3927 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); 3918 FXSYS_memcpy(&mValue, pValue, sizeof(mValue));
3928 return TRUE; 3919 return TRUE;
3929 } 3920 }
3930 if (bUseDefault && 3921 if (bUseDefault &&
3931 XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr, 3922 XFA_GetAttributeDefaultValue(pValue, GetClassID(), eAttr,
3932 XFA_ATTRIBUTETYPE_Measure, m_ePacket)) { 3923 XFA_ATTRIBUTETYPE_Measure, m_ePacket)) {
3933 FXSYS_memcpy(&mValue, pValue, sizeof(mValue)); 3924 FXSYS_memcpy(&mValue, pValue, sizeof(mValue));
3934 return TRUE; 3925 return TRUE;
3935 } 3926 }
3936 return FALSE; 3927 return FALSE;
3937 } 3928 }
3938 3929
3939 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const { 3930 CXFA_Measurement CXFA_Node::GetMeasure(XFA_ATTRIBUTE eAttr) const {
3940 CXFA_Measurement mValue; 3931 CXFA_Measurement mValue;
3941 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement(); 3932 return TryMeasure(eAttr, mValue, TRUE) ? mValue : CXFA_Measurement();
3942 } 3933 }
3943 3934
3944 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr, 3935 FX_BOOL CXFA_Node::SetCData(XFA_ATTRIBUTE eAttr,
3945 const CFX_WideString& wsValue, 3936 const CFX_WideString& wsValue,
3946 FX_BOOL bNotify, 3937 bool bNotify,
3947 FX_BOOL bScriptModify) { 3938 FX_BOOL bScriptModify) {
3948 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 3939 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
3949 OnChanging(eAttr, (void*)wsValue.c_str(), bNotify); 3940 OnChanging(eAttr, bNotify);
3950 if (eAttr == XFA_ATTRIBUTE_Value) { 3941 if (eAttr == XFA_ATTRIBUTE_Value) {
3951 CFX_WideString* pClone = new CFX_WideString(wsValue); 3942 CFX_WideString* pClone = new CFX_WideString(wsValue);
3952 SetUserData(pKey, pClone, &deleteWideStringCallBack); 3943 SetUserData(pKey, pClone, &deleteWideStringCallBack);
3953 } else { 3944 } else {
3954 SetMapModuleString(pKey, wsValue.AsStringC()); 3945 SetMapModuleString(pKey, wsValue.AsStringC());
3955 if (eAttr == XFA_ATTRIBUTE_Name) 3946 if (eAttr == XFA_ATTRIBUTE_Name)
3956 UpdateNameHash(); 3947 UpdateNameHash();
3957 } 3948 }
3958 OnChanged(eAttr, (void*)wsValue.c_str(), bNotify, bScriptModify); 3949 OnChanged(eAttr, bNotify, bScriptModify);
3959 if (IsNeedSavingXMLNode() && eAttr != XFA_ATTRIBUTE_QualifiedName && 3950
3960 eAttr != XFA_ATTRIBUTE_BindingNode) { 3951 if (!IsNeedSavingXMLNode() || eAttr == XFA_ATTRIBUTE_QualifiedName ||
3961 if (eAttr == XFA_ATTRIBUTE_Name && 3952 eAttr == XFA_ATTRIBUTE_BindingNode) {
3962 (m_eNodeClass == XFA_ELEMENT_DataValue || 3953 return TRUE;
3963 m_eNodeClass == XFA_ELEMENT_DataGroup)) { 3954 }
3964 return TRUE; 3955
3965 } 3956 if (eAttr == XFA_ATTRIBUTE_Name && (m_eNodeClass == XFA_ELEMENT_DataValue ||
3966 if (eAttr == XFA_ATTRIBUTE_Value) { 3957 m_eNodeClass == XFA_ELEMENT_DataGroup)) {
3967 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 3958 return TRUE;
3968 switch (eXMLType) { 3959 }
3969 case FDE_XMLNODE_Element: 3960
3970 if (IsAttributeInXML()) { 3961 if (eAttr == XFA_ATTRIBUTE_Value) {
3971 static_cast<CFDE_XMLElement*>(m_pXMLNode) 3962 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
3972 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue); 3963 switch (eXMLType) {
3973 } else { 3964 case FDE_XMLNODE_Element:
3974 FX_BOOL bDeleteChildren = TRUE; 3965 if (IsAttributeInXML()) {
3975 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 3966 static_cast<CFDE_XMLElement*>(m_pXMLNode)
3976 for (CXFA_Node* pChildDataNode = 3967 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsValue);
3977 GetNodeItem(XFA_NODEITEM_FirstChild); 3968 } else {
3978 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem( 3969 FX_BOOL bDeleteChildren = TRUE;
3979 XFA_NODEITEM_NextSibling)) { 3970 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
3980 CXFA_NodeArray formNodes; 3971 for (CXFA_Node* pChildDataNode =
3981 if (pChildDataNode->GetBindItems(formNodes) > 0) { 3972 GetNodeItem(XFA_NODEITEM_FirstChild);
3982 bDeleteChildren = FALSE; 3973 pChildDataNode; pChildDataNode = pChildDataNode->GetNodeItem(
3983 break; 3974 XFA_NODEITEM_NextSibling)) {
3984 } 3975 CXFA_NodeArray formNodes;
3976 if (pChildDataNode->GetBindItems(formNodes) > 0) {
3977 bDeleteChildren = FALSE;
3978 break;
3985 } 3979 }
3986 } 3980 }
3987 if (bDeleteChildren) {
3988 static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
3989 }
3990 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
3991 } 3981 }
3992 break; 3982 if (bDeleteChildren) {
3993 case FDE_XMLNODE_Text: 3983 static_cast<CFDE_XMLElement*>(m_pXMLNode)->DeleteChildren();
3994 static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue); 3984 }
3995 break; 3985 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetTextData(wsValue);
3996 default: 3986 }
3997 FXSYS_assert(0); 3987 break;
3998 } 3988 case FDE_XMLNODE_Text:
3999 return TRUE; 3989 static_cast<CFDE_XMLText*>(m_pXMLNode)->SetText(wsValue);
3990 break;
3991 default:
3992 FXSYS_assert(0);
4000 } 3993 }
4001 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); 3994 return TRUE;
4002 if (pInfo) { 3995 }
4003 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); 3996
4004 CFX_WideString wsAttrName = pInfo->pName; 3997 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
4005 if (pInfo->eName == XFA_ATTRIBUTE_ContentType) { 3998 if (pInfo) {
4006 wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName; 3999 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4007 } 4000 CFX_WideString wsAttrName = pInfo->pName;
4008 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue); 4001 if (pInfo->eName == XFA_ATTRIBUTE_ContentType) {
4002 wsAttrName = FX_WSTRC(L"xfa:") + wsAttrName;
4009 } 4003 }
4004 static_cast<CFDE_XMLElement*>(m_pXMLNode)->SetString(wsAttrName, wsValue);
4010 } 4005 }
4011 return TRUE; 4006 return TRUE;
4012 } 4007 }
4008
4013 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue, 4009 FX_BOOL CXFA_Node::SetAttributeValue(const CFX_WideString& wsValue,
4014 const CFX_WideString& wsXMLValue, 4010 const CFX_WideString& wsXMLValue,
4015 FX_BOOL bNotify, 4011 bool bNotify,
4016 FX_BOOL bScriptModify) { 4012 FX_BOOL bScriptModify) {
4017 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value); 4013 void* pKey = XFA_GetMapKey_Element(GetClassID(), XFA_ATTRIBUTE_Value);
4018 OnChanging(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify); 4014 OnChanging(XFA_ATTRIBUTE_Value, bNotify);
4019 CFX_WideString* pClone = new CFX_WideString(wsValue); 4015 CFX_WideString* pClone = new CFX_WideString(wsValue);
4020 SetUserData(pKey, pClone, &deleteWideStringCallBack); 4016 SetUserData(pKey, pClone, &deleteWideStringCallBack);
4021 OnChanged(XFA_ATTRIBUTE_Value, (void*)wsValue.c_str(), bNotify, 4017 OnChanged(XFA_ATTRIBUTE_Value, bNotify, bScriptModify);
4022 bScriptModify);
4023 if (IsNeedSavingXMLNode()) { 4018 if (IsNeedSavingXMLNode()) {
4024 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType(); 4019 FDE_XMLNODETYPE eXMLType = m_pXMLNode->GetType();
4025 switch (eXMLType) { 4020 switch (eXMLType) {
4026 case FDE_XMLNODE_Element: 4021 case FDE_XMLNODE_Element:
4027 if (IsAttributeInXML()) { 4022 if (IsAttributeInXML()) {
4028 static_cast<CFDE_XMLElement*>(m_pXMLNode) 4023 static_cast<CFDE_XMLElement*>(m_pXMLNode)
4029 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue); 4024 ->SetString(GetCData(XFA_ATTRIBUTE_QualifiedName), wsXMLValue);
4030 } else { 4025 } else {
4031 FX_BOOL bDeleteChildren = TRUE; 4026 FX_BOOL bDeleteChildren = TRUE;
4032 if (GetPacketID() == XFA_XDPPACKET_Datasets) { 4027 if (GetPacketID() == XFA_XDPPACKET_Datasets) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
4119 return SetUserData(pKey, pData, pCallbackInfo); 4114 return SetUserData(pKey, pData, pCallbackInfo);
4120 } 4115 }
4121 FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) { 4116 FX_BOOL CXFA_Node::TryObject(XFA_ATTRIBUTE eAttr, void*& pData) {
4122 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 4117 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
4123 pData = GetUserData(pKey); 4118 pData = GetUserData(pKey);
4124 return pData != NULL; 4119 return pData != NULL;
4125 } 4120 }
4126 FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr, 4121 FX_BOOL CXFA_Node::SetValue(XFA_ATTRIBUTE eAttr,
4127 XFA_ATTRIBUTETYPE eType, 4122 XFA_ATTRIBUTETYPE eType,
4128 void* pValue, 4123 void* pValue,
4129 FX_BOOL bNotify) { 4124 bool bNotify) {
4130 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr); 4125 void* pKey = XFA_GetMapKey_Element(GetClassID(), eAttr);
4131 OnChanging(eAttr, pValue, bNotify); 4126 OnChanging(eAttr, bNotify);
4132 SetMapModuleValue(pKey, pValue); 4127 SetMapModuleValue(pKey, pValue);
4133 OnChanged(eAttr, pValue, bNotify); 4128 OnChanged(eAttr, bNotify, FALSE);
4134 if (IsNeedSavingXMLNode()) { 4129 if (IsNeedSavingXMLNode()) {
4135 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element); 4130 FXSYS_assert(m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4136 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr); 4131 const XFA_ATTRIBUTEINFO* pInfo = XFA_GetAttributeByID(eAttr);
4137 if (pInfo) { 4132 if (pInfo) {
4138 switch (eType) { 4133 switch (eType) {
4139 case XFA_ATTRIBUTETYPE_Enum: 4134 case XFA_ATTRIBUTETYPE_Enum:
4140 static_cast<CFDE_XMLElement*>(m_pXMLNode) 4135 static_cast<CFDE_XMLElement*>(m_pXMLNode)
4141 ->SetString( 4136 ->SetString(
4142 pInfo->pName, 4137 pInfo->pName,
4143 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue) 4138 XFA_GetAttributeEnumByID((XFA_ATTRIBUTEENUM)(uintptr_t)pValue)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
4185 } 4180 }
4186 FX_BOOL CXFA_Node::TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso) { 4181 FX_BOOL CXFA_Node::TryUserData(void* pKey, void*& pData, FX_BOOL bProtoAlso) {
4187 int32_t iBytes = 0; 4182 int32_t iBytes = 0;
4188 if (!GetMapModuleBuffer(pKey, pData, iBytes, bProtoAlso)) { 4183 if (!GetMapModuleBuffer(pKey, pData, iBytes, bProtoAlso)) {
4189 return FALSE; 4184 return FALSE;
4190 } 4185 }
4191 return iBytes == sizeof(void*) && FXSYS_memcpy(&pData, pData, iBytes); 4186 return iBytes == sizeof(void*) && FXSYS_memcpy(&pData, pData, iBytes);
4192 } 4187 }
4193 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent, 4188 FX_BOOL CXFA_Node::SetScriptContent(const CFX_WideString& wsContent,
4194 const CFX_WideString& wsXMLValue, 4189 const CFX_WideString& wsXMLValue,
4195 FX_BOOL bNotify, 4190 bool bNotify,
4196 FX_BOOL bScriptModify, 4191 FX_BOOL bScriptModify,
4197 FX_BOOL bSyncData) { 4192 FX_BOOL bSyncData) {
4198 CXFA_Node* pNode = NULL; 4193 CXFA_Node* pNode = NULL;
4199 CXFA_Node* pBindNode = NULL; 4194 CXFA_Node* pBindNode = NULL;
4200 switch (GetObjectType()) { 4195 switch (GetObjectType()) {
4201 case XFA_OBJECTTYPE_ContainerNode: { 4196 case XFA_OBJECTTYPE_ContainerNode: {
4202 if (XFA_FieldIsMultiListBox(this)) { 4197 if (XFA_FieldIsMultiListBox(this)) {
4203 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); 4198 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value);
4204 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); 4199 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild);
4205 FXSYS_assert(pChildValue); 4200 FXSYS_assert(pChildValue);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
4289 if (pBindNode && bSyncData) { 4284 if (pBindNode && bSyncData) {
4290 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, 4285 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify,
4291 bScriptModify, FALSE); 4286 bScriptModify, FALSE);
4292 CXFA_NodeArray nodeArray; 4287 CXFA_NodeArray nodeArray;
4293 pBindNode->GetBindItems(nodeArray); 4288 pBindNode->GetBindItems(nodeArray);
4294 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { 4289 for (int32_t i = 0; i < nodeArray.GetSize(); i++) {
4295 CXFA_Node* pNode = nodeArray[i]; 4290 CXFA_Node* pNode = nodeArray[i];
4296 if (pNode == this) { 4291 if (pNode == this) {
4297 continue; 4292 continue;
4298 } 4293 }
4299 pNode->SetScriptContent(wsContent, wsContent, bNotify, TRUE, FALSE); 4294 pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE);
4300 } 4295 }
4301 } 4296 }
4302 pBindNode = NULL; 4297 pBindNode = NULL;
4303 break; 4298 break;
4304 } 4299 }
4305 case XFA_OBJECTTYPE_ContentNode: { 4300 case XFA_OBJECTTYPE_ContentNode: {
4306 CFX_WideString wsContentType; 4301 CFX_WideString wsContentType;
4307 if (GetClassID() == XFA_ELEMENT_ExData) { 4302 if (GetClassID() == XFA_ELEMENT_ExData) {
4308 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); 4303 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE);
4309 if (wsContentType == FX_WSTRC(L"text/html")) { 4304 if (wsContentType == FX_WSTRC(L"text/html")) {
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
4361 pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, 4356 pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify,
4362 FALSE); 4357 FALSE);
4363 } 4358 }
4364 } 4359 }
4365 return TRUE; 4360 return TRUE;
4366 } 4361 }
4367 return FALSE; 4362 return FALSE;
4368 } 4363 }
4369 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent, 4364 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent,
4370 const CFX_WideString& wsXMLValue, 4365 const CFX_WideString& wsXMLValue,
4371 FX_BOOL bNotify, 4366 bool bNotify,
4372 FX_BOOL bScriptModify, 4367 FX_BOOL bScriptModify,
4373 FX_BOOL bSyncData) { 4368 FX_BOOL bSyncData) {
4374 return SetScriptContent(wsContent, wsXMLValue, bNotify, bScriptModify, 4369 return SetScriptContent(wsContent, wsXMLValue, bNotify, bScriptModify,
4375 bSyncData); 4370 bSyncData);
4376 } 4371 }
4377 CFX_WideString CXFA_Node::GetScriptContent(FX_BOOL bScriptModify) { 4372 CFX_WideString CXFA_Node::GetScriptContent(FX_BOOL bScriptModify) {
4378 CFX_WideString wsContent; 4373 CFX_WideString wsContent;
4379 return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString(); 4374 return TryContent(wsContent, bScriptModify) ? wsContent : CFX_WideString();
4380 } 4375 }
4381 CFX_WideString CXFA_Node::GetContent() { 4376 CFX_WideString CXFA_Node::GetContent() {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4533 } 4528 }
4534 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory(); 4529 CXFA_Document* pFactory = m_pDocument->GetParser()->GetFactory();
4535 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket); 4530 const XFA_PACKETINFO* pPacket = XFA_GetPacketByID(dwPacket);
4536 CXFA_Node* pNewNode; 4531 CXFA_Node* pNewNode;
4537 for (; iCount <= index; iCount++) { 4532 for (; iCount <= index; iCount++) {
4538 pNewNode = pFactory->CreateNode(pPacket, eProperty); 4533 pNewNode = pFactory->CreateNode(pPacket, eProperty);
4539 if (!pNewNode) { 4534 if (!pNewNode) {
4540 return NULL; 4535 return NULL;
4541 } 4536 }
4542 InsertChild(pNewNode, nullptr); 4537 InsertChild(pNewNode, nullptr);
4543 pNewNode->SetFlag(XFA_NODEFLAG_Initialized); 4538 pNewNode->SetFlag(XFA_NODEFLAG_Initialized, true);
4544 } 4539 }
4545 return pNewNode; 4540 return pNewNode;
4546 } 4541 }
4547 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) { 4542 int32_t CXFA_Node::CountChildren(XFA_ELEMENT eElement, FX_BOOL bOnlyChild) {
4548 CXFA_Node* pNode = m_pChild; 4543 CXFA_Node* pNode = m_pChild;
4549 int32_t iCount = 0; 4544 int32_t iCount = 0;
4550 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) { 4545 for (; pNode; pNode = pNode->GetNodeItem(XFA_NODEITEM_NextSibling)) {
4551 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) { 4546 if (pNode->GetClassID() == eElement || eElement == XFA_ELEMENT_UNKNOWN) {
4552 if (bOnlyChild) { 4547 if (bOnlyChild) {
4553 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement( 4548 const XFA_PROPERTY* pProperty = XFA_GetPropertyOfElement(
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4611 } 4606 }
4612 pNode->m_pNext = pPrev->m_pNext; 4607 pNode->m_pNext = pPrev->m_pNext;
4613 pPrev->m_pNext = pNode; 4608 pPrev->m_pNext = pNode;
4614 index = iCount; 4609 index = iCount;
4615 } 4610 }
4616 if (pNode->m_pNext == NULL) { 4611 if (pNode->m_pNext == NULL) {
4617 m_pLastChild = pNode; 4612 m_pLastChild = pNode;
4618 } 4613 }
4619 ASSERT(m_pLastChild); 4614 ASSERT(m_pLastChild);
4620 ASSERT(m_pLastChild->m_pNext == NULL); 4615 ASSERT(m_pLastChild->m_pNext == NULL);
4621 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); 4616 pNode->ClearFlag(XFA_NODEFLAG_HasRemoved);
4622 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4617 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4623 if (pNotify) { 4618 if (pNotify)
4624 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); 4619 pNotify->OnChildAdded(this);
4625 } 4620
4626 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4621 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4627 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); 4622 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL);
4628 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index); 4623 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, index);
4629 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); 4624 pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode);
4630 } 4625 }
4631 return index; 4626 return index;
4632 } 4627 }
4633 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) { 4628 FX_BOOL CXFA_Node::InsertChild(CXFA_Node* pNode, CXFA_Node* pBeforeNode) {
4634 if (!pNode || pNode->m_pParent || 4629 if (!pNode || pNode->m_pParent ||
4635 (pBeforeNode && pBeforeNode->m_pParent != this)) { 4630 (pBeforeNode && pBeforeNode->m_pParent != this)) {
4636 FXSYS_assert(false); 4631 FXSYS_assert(false);
4637 return FALSE; 4632 return FALSE;
4638 } 4633 }
4639 FX_BOOL bWasPurgeNode = m_pDocument->RemovePurgeNode(pNode); 4634 FX_BOOL bWasPurgeNode = m_pDocument->RemovePurgeNode(pNode);
(...skipping 17 matching lines...) Expand all
4657 nIndex++; 4652 nIndex++;
4658 } 4653 }
4659 pNode->m_pNext = pPrev->m_pNext; 4654 pNode->m_pNext = pPrev->m_pNext;
4660 pPrev->m_pNext = pNode; 4655 pPrev->m_pNext = pNode;
4661 } 4656 }
4662 if (pNode->m_pNext == NULL) { 4657 if (pNode->m_pNext == NULL) {
4663 m_pLastChild = pNode; 4658 m_pLastChild = pNode;
4664 } 4659 }
4665 ASSERT(m_pLastChild); 4660 ASSERT(m_pLastChild);
4666 ASSERT(m_pLastChild->m_pNext == NULL); 4661 ASSERT(m_pLastChild->m_pNext == NULL);
4667 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, FALSE); 4662 pNode->ClearFlag(XFA_NODEFLAG_HasRemoved);
4668 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4663 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4669 if (pNotify) { 4664 if (pNotify)
4670 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ChildAdded, pNode); 4665 pNotify->OnChildAdded(this);
4671 } 4666
4672 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4667 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4673 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL); 4668 FXSYS_assert(pNode->m_pXMLNode->GetNodeItem(CFDE_XMLNode::Parent) == NULL);
4674 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex); 4669 m_pXMLNode->InsertChildNode(pNode->m_pXMLNode, nIndex);
4675 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, FALSE, FALSE); 4670 pNode->ClearFlag(XFA_NODEFLAG_OwnXMLNode);
4676 } 4671 }
4677 return TRUE; 4672 return TRUE;
4678 } 4673 }
4679 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() { 4674 CXFA_Node* CXFA_Node::Deprecated_GetPrevSibling() {
4680 if (!m_pParent) { 4675 if (!m_pParent) {
4681 return NULL; 4676 return NULL;
4682 } 4677 }
4683 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling; 4678 for (CXFA_Node* pSibling = m_pParent->m_pChild; pSibling;
4684 pSibling = pSibling->m_pNext) { 4679 pSibling = pSibling->m_pNext) {
4685 if (pSibling->m_pNext == this) { 4680 if (pSibling->m_pNext == this) {
4686 return pSibling; 4681 return pSibling;
4687 } 4682 }
4688 } 4683 }
4689 return NULL; 4684 return NULL;
4690 } 4685 }
4691 FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, FX_BOOL bNotify) { 4686 FX_BOOL CXFA_Node::RemoveChild(CXFA_Node* pNode, bool bNotify) {
4692 if (pNode == NULL || pNode->m_pParent != this) { 4687 if (pNode == NULL || pNode->m_pParent != this) {
4693 FXSYS_assert(FALSE); 4688 FXSYS_assert(FALSE);
4694 return FALSE; 4689 return FALSE;
4695 } 4690 }
4696 if (m_pChild == pNode) { 4691 if (m_pChild == pNode) {
4697 m_pChild = pNode->m_pNext; 4692 m_pChild = pNode->m_pNext;
4698 if (m_pLastChild == pNode) { 4693 if (m_pLastChild == pNode) {
4699 m_pLastChild = pNode->m_pNext; 4694 m_pLastChild = pNode->m_pNext;
4700 } 4695 }
4701 pNode->m_pNext = NULL; 4696 pNode->m_pNext = NULL;
4702 pNode->m_pParent = NULL; 4697 pNode->m_pParent = NULL;
4703 } else { 4698 } else {
4704 CXFA_Node* pPrev = pNode->Deprecated_GetPrevSibling(); 4699 CXFA_Node* pPrev = pNode->Deprecated_GetPrevSibling();
4705 pPrev->m_pNext = pNode->m_pNext; 4700 pPrev->m_pNext = pNode->m_pNext;
4706 if (m_pLastChild == pNode) { 4701 if (m_pLastChild == pNode) {
4707 m_pLastChild = pNode->m_pNext ? pNode->m_pNext : pPrev; 4702 m_pLastChild = pNode->m_pNext ? pNode->m_pNext : pPrev;
4708 } 4703 }
4709 pNode->m_pNext = NULL; 4704 pNode->m_pNext = NULL;
4710 pNode->m_pParent = NULL; 4705 pNode->m_pParent = NULL;
4711 } 4706 }
4712 ASSERT(m_pLastChild == NULL || m_pLastChild->m_pNext == NULL); 4707 ASSERT(m_pLastChild == NULL || m_pLastChild->m_pNext == NULL);
4713 OnRemoved(this, pNode, bNotify); 4708 OnRemoved(bNotify);
4714 pNode->SetFlag(XFA_NODEFLAG_HasRemoved); 4709 pNode->SetFlag(XFA_NODEFLAG_HasRemoved, true);
4715 m_pDocument->AddPurgeNode(pNode); 4710 m_pDocument->AddPurgeNode(pNode);
4716 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) { 4711 if (IsNeedSavingXMLNode() && pNode->m_pXMLNode) {
4717 if (pNode->IsAttributeInXML()) { 4712 if (pNode->IsAttributeInXML()) {
4718 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode && 4713 FXSYS_assert(pNode->m_pXMLNode == m_pXMLNode &&
4719 m_pXMLNode->GetType() == FDE_XMLNODE_Element); 4714 m_pXMLNode->GetType() == FDE_XMLNODE_Element);
4720 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) { 4715 if (pNode->m_pXMLNode->GetType() == FDE_XMLNODE_Element) {
4721 CFDE_XMLElement* pXMLElement = 4716 CFDE_XMLElement* pXMLElement =
4722 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode); 4717 static_cast<CFDE_XMLElement*>(pNode->m_pXMLNode);
4723 CFX_WideStringC wsAttributeName = 4718 CFX_WideStringC wsAttributeName =
4724 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName); 4719 pNode->GetCData(XFA_ATTRIBUTE_QualifiedName);
4725 pXMLElement->RemoveAttribute(wsAttributeName.c_str()); 4720 pXMLElement->RemoveAttribute(wsAttributeName.c_str());
4726 } 4721 }
4727 CFX_WideString wsName; 4722 CFX_WideString wsName;
4728 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE); 4723 pNode->GetAttribute(XFA_ATTRIBUTE_Name, wsName, FALSE);
4729 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName); 4724 CFDE_XMLElement* pNewXMLElement = new CFDE_XMLElement(wsName);
4730 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value); 4725 CFX_WideStringC wsValue = GetCData(XFA_ATTRIBUTE_Value);
4731 if (!wsValue.IsEmpty()) { 4726 if (!wsValue.IsEmpty()) {
4732 pNewXMLElement->SetTextData(wsValue); 4727 pNewXMLElement->SetTextData(wsValue);
4733 } 4728 }
4734 pNode->m_pXMLNode = pNewXMLElement; 4729 pNode->m_pXMLNode = pNewXMLElement;
4735 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown); 4730 pNode->SetEnum(XFA_ATTRIBUTE_Contains, XFA_ATTRIBUTEENUM_Unknown);
4736 } else { 4731 } else {
4737 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode); 4732 m_pXMLNode->RemoveChildNode(pNode->m_pXMLNode);
4738 } 4733 }
4739 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 4734 pNode->SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
4740 } 4735 }
4741 return TRUE; 4736 return TRUE;
4742 } 4737 }
4743 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const { 4738 CXFA_Node* CXFA_Node::GetFirstChildByName(const CFX_WideStringC& wsName) const {
4744 return GetFirstChildByName( 4739 return GetFirstChildByName(
4745 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), 4740 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(),
4746 wsName.GetLength())); 4741 wsName.GetLength()));
4747 } 4742 }
4748 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const { 4743 CXFA_Node* CXFA_Node::GetFirstChildByName(uint32_t dwNameHash) const {
4749 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode; 4744 for (CXFA_Node* pNode = GetNodeItem(XFA_NODEITEM_FirstChild); pNode;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
4844 return TRUE; 4839 return TRUE;
4845 } 4840 }
4846 switch (dwFlag) { 4841 switch (dwFlag) {
4847 case XFA_NODEFLAG_HasRemoved: 4842 case XFA_NODEFLAG_HasRemoved:
4848 return m_pParent && m_pParent->HasFlag(dwFlag); 4843 return m_pParent && m_pParent->HasFlag(dwFlag);
4849 default: 4844 default:
4850 break; 4845 break;
4851 } 4846 }
4852 return FALSE; 4847 return FALSE;
4853 } 4848 }
4854 void CXFA_Node::SetFlag(uint32_t dwFlag, FX_BOOL bOn, FX_BOOL bNotify) { 4849
4855 if (bOn) { 4850 void CXFA_Node::SetFlag(uint32_t dwFlag, bool bNotify) {
4856 switch (dwFlag) { 4851 if (dwFlag == XFA_NODEFLAG_Initialized && bNotify &&
4857 case XFA_NODEFLAG_Initialized: 4852 !HasFlag(XFA_NODEFLAG_Initialized)) {
4858 if (bNotify && !HasFlag(XFA_NODEFLAG_Initialized)) { 4853 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4859 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4854 if (pNotify) {
4860 if (pNotify) { 4855 pNotify->OnNodeReady(this);
4861 pNotify->OnNodeEvent(this, XFA_NODEEVENT_Ready);
4862 }
4863 }
4864 break;
4865 default:
4866 break;
4867 } 4856 }
4868 m_uFlags |= dwFlag;
4869 } else {
4870 m_uFlags &= ~dwFlag;
4871 } 4857 }
4858 m_uFlags |= dwFlag;
4872 } 4859 }
4860
4861 void CXFA_Node::ClearFlag(uint32_t dwFlag) {
4862 m_uFlags &= ~dwFlag;
4863 }
4864
4873 FX_BOOL CXFA_Node::IsAttributeInXML() { 4865 FX_BOOL CXFA_Node::IsAttributeInXML() {
4874 return GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData; 4866 return GetEnum(XFA_ATTRIBUTE_Contains) == XFA_ATTRIBUTEENUM_MetaData;
4875 } 4867 }
4876 void CXFA_Node::OnRemoved(CXFA_Node* pParent, 4868
4877 CXFA_Node* pRemoved, 4869 void CXFA_Node::OnRemoved(bool bNotify) {
4878 FX_BOOL bNotify) { 4870 if (!bNotify)
4879 if (bNotify && pParent) { 4871 return;
4872
4873 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4874 if (pNotify)
4875 pNotify->OnChildRemoved();
4876 }
4877
4878 void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, bool bNotify) {
4879 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) {
4880 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4880 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4881 if (pNotify) { 4881 if (pNotify) {
4882 pNotify->OnNodeEvent(pParent, XFA_NODEEVENT_ChildRemoved, pRemoved); 4882 pNotify->OnValueChanging(this, eAttr);
4883 } 4883 }
4884 } 4884 }
4885 } 4885 }
4886 void CXFA_Node::OnChanging(XFA_ATTRIBUTE eAttr, 4886
4887 void* pNewValue, 4887 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr,
4888 FX_BOOL bNotify) { 4888 bool bNotify,
4889 FX_BOOL bScriptModify) {
4889 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) { 4890 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) {
4890 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4891 Script_Attribute_SendAttributeChangeMessage(eAttr, bScriptModify);
4891 if (pNotify) {
4892 pNotify->OnNodeEvent(this, XFA_NODEEVENT_ValueChanging,
4893 (void*)(uintptr_t)eAttr, pNewValue);
4894 }
4895 } 4892 }
4896 } 4893 }
4897 void CXFA_Node::OnChanged(XFA_ATTRIBUTE eAttr, 4894
4898 void* pNewValue,
4899 FX_BOOL bNotify,
4900 FX_BOOL bScriptModify) {
4901 if (bNotify && HasFlag(XFA_NODEFLAG_Initialized)) {
4902 Script_Attribute_SendAttributeChangeMessage((void*)(uintptr_t)eAttr,
4903 pNewValue, bScriptModify);
4904 }
4905 }
4906 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName, 4895 int32_t CXFA_Node::execSingleEventByName(const CFX_WideStringC& wsEventName,
4907 XFA_ELEMENT eElementType) { 4896 XFA_ELEMENT eElementType) {
4908 int32_t iRet = XFA_EVENTERROR_NotExist; 4897 int32_t iRet = XFA_EVENTERROR_NotExist;
4909 const XFA_ExecEventParaInfo* eventParaInfo = 4898 const XFA_ExecEventParaInfo* eventParaInfo =
4910 GetEventParaInfoByName(wsEventName); 4899 GetEventParaInfoByName(wsEventName);
4911 if (eventParaInfo) { 4900 if (eventParaInfo) {
4912 uint32_t validFlags = eventParaInfo->m_validFlags; 4901 uint32_t validFlags = eventParaInfo->m_validFlags;
4913 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify(); 4902 CXFA_FFNotify* pNotify = m_pDocument->GetParser()->GetNotify();
4914 if (!pNotify) { 4903 if (!pNotify) {
4915 return iRet; 4904 return iRet;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
4976 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName; 4965 XFA_GetAttributeEnumByID(GetEnum(XFA_ATTRIBUTE_Name))->pName;
4977 m_dwNameHash = 4966 m_dwNameHash =
4978 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(), 4967 wsName.IsEmpty() ? 0 : FX_HashCode_String_GetW(wsName.c_str(),
4979 wsName.GetLength()); 4968 wsName.GetLength());
4980 } 4969 }
4981 } 4970 }
4982 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() { 4971 CFDE_XMLNode* CXFA_Node::CreateXMLMappingNode() {
4983 if (!m_pXMLNode) { 4972 if (!m_pXMLNode) {
4984 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name); 4973 CFX_WideStringC wsTag = GetCData(XFA_ATTRIBUTE_Name);
4985 m_pXMLNode = new CFDE_XMLElement(wsTag); 4974 m_pXMLNode = new CFDE_XMLElement(wsTag);
4986 SetFlag(XFA_NODEFLAG_OwnXMLNode, TRUE, FALSE); 4975 SetFlag(XFA_NODEFLAG_OwnXMLNode, false);
4987 } 4976 }
4988 return m_pXMLNode; 4977 return m_pXMLNode;
4989 } 4978 }
4990 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() { 4979 FX_BOOL CXFA_Node::IsNeedSavingXMLNode() {
4991 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets || 4980 return m_pXMLNode && (GetPacketID() == XFA_XDPPACKET_Datasets ||
4992 GetClassID() == XFA_ELEMENT_Xfa); 4981 GetClassID() == XFA_ELEMENT_Xfa);
4993 } 4982 }
4994 4983
4995 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() { 4984 XFA_MAPMODULEDATA* CXFA_Node::CreateMapModuleData() {
4996 if (!m_pMapModuleData) 4985 if (!m_pMapModuleData)
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5215 (XFA_MAPDATABLOCK*)pBufferBlockData); 5204 (XFA_MAPDATABLOCK*)pBufferBlockData);
5216 } 5205 }
5217 } 5206 }
5218 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) { 5207 if (pDstModule->GetObjectType() == XFA_OBJECTTYPE_NodeV) {
5219 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE); 5208 CFX_WideString wsValue = pDstModule->GetScriptContent(FALSE);
5220 CFX_WideString wsFormatValue(wsValue); 5209 CFX_WideString wsFormatValue(wsValue);
5221 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData(); 5210 CXFA_WidgetData* pWidgetData = pDstModule->GetContainerWidgetData();
5222 if (pWidgetData) { 5211 if (pWidgetData) {
5223 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatValue); 5212 pWidgetData->GetFormatDataValue(wsValue.AsStringC(), wsFormatValue);
5224 } 5213 }
5225 pDstModule->SetScriptContent(wsValue, wsFormatValue, TRUE, TRUE); 5214 pDstModule->SetScriptContent(wsValue, wsFormatValue, true, TRUE);
5226 } 5215 }
5227 } 5216 }
5228 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule, 5217 void CXFA_Node::MoveBufferMapData(CXFA_Node* pSrcModule,
5229 CXFA_Node* pDstModule, 5218 CXFA_Node* pDstModule,
5230 void* pKey, 5219 void* pKey,
5231 FX_BOOL bRecursive) { 5220 FX_BOOL bRecursive) {
5232 if (!pSrcModule || !pDstModule || !pKey) { 5221 if (!pSrcModule || !pDstModule || !pKey) {
5233 return; 5222 return;
5234 } 5223 }
5235 if (bRecursive) { 5224 if (bRecursive) {
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
5410 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); 5399 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode);
5411 } 5400 }
5412 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { 5401 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) {
5413 return m_pAttachNode->RemoveChild(pNode); 5402 return m_pAttachNode->RemoveChild(pNode);
5414 } 5403 }
5415 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { 5404 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) {
5416 return m_pAttachNode->GetChild( 5405 return m_pAttachNode->GetChild(
5417 iIndex, XFA_ELEMENT_UNKNOWN, 5406 iIndex, XFA_ELEMENT_UNKNOWN,
5418 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); 5407 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform);
5419 } 5408 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_object.h ('k') | xfa/fxfa/parser/xfa_parser_imp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698