| OLD | NEW |
| 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 <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1386 case XFA_ELEMENT_Sharpxml: | 1386 case XFA_ELEMENT_Sharpxml: |
| 1387 case XFA_ELEMENT_SharpxHTML: { | 1387 case XFA_ELEMENT_SharpxHTML: { |
| 1388 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); | 1388 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); |
| 1389 if (!pTextNode) { | 1389 if (!pTextNode) { |
| 1390 return; | 1390 return; |
| 1391 } | 1391 } |
| 1392 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); | 1392 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1393 if (!pValueNode) { | 1393 if (!pValueNode) { |
| 1394 return; | 1394 return; |
| 1395 } | 1395 } |
| 1396 XFA_ELEMENT eType = pValueNode->GetClassID(); | 1396 XFA_ELEMENT eNodeType = pValueNode->GetClassID(); |
| 1397 if (eType == XFA_ELEMENT_Value) { | 1397 if (eNodeType == XFA_ELEMENT_Value) { |
| 1398 bNeedFindContainer = true; | 1398 bNeedFindContainer = true; |
| 1399 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1399 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1400 if (pNode && pNode->IsContainerNode()) { | 1400 if (pNode && pNode->IsContainerNode()) { |
| 1401 if (bScriptModify) { | 1401 if (bScriptModify) { |
| 1402 pValueNode = pNode; | 1402 pValueNode = pNode; |
| 1403 } | 1403 } |
| 1404 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1404 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
| 1405 } else { | 1405 } else { |
| 1406 pNotify->OnValueChanged(this, eAttribute, pNode, | 1406 pNotify->OnValueChanged(this, eAttribute, pNode, |
| 1407 pNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1407 pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
| 1408 } | 1408 } |
| 1409 } else { | 1409 } else { |
| 1410 if (eType == XFA_ELEMENT_Items) { | 1410 if (eNodeType == XFA_ELEMENT_Items) { |
| 1411 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1411 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 1412 if (pNode && pNode->IsContainerNode()) { | 1412 if (pNode && pNode->IsContainerNode()) { |
| 1413 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1413 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
| 1414 } | 1414 } |
| 1415 } | 1415 } |
| 1416 } | 1416 } |
| 1417 } break; | 1417 } break; |
| 1418 default: | 1418 default: |
| 1419 break; | 1419 break; |
| 1420 } | 1420 } |
| (...skipping 2762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4183 pValueNode; pValueNode = pValueNode->GetNodeItem( | 4183 pValueNode; pValueNode = pValueNode->GetNodeItem( |
| 4184 XFA_NODEITEM_NextSibling)) { | 4184 XFA_NODEITEM_NextSibling)) { |
| 4185 pValueNode->SetAttributeValue(wsSaveTextArray[i], | 4185 pValueNode->SetAttributeValue(wsSaveTextArray[i], |
| 4186 wsSaveTextArray[i], FALSE); | 4186 wsSaveTextArray[i], FALSE); |
| 4187 i++; | 4187 i++; |
| 4188 } | 4188 } |
| 4189 } | 4189 } |
| 4190 CXFA_NodeArray nodeArray; | 4190 CXFA_NodeArray nodeArray; |
| 4191 pBind->GetBindItems(nodeArray); | 4191 pBind->GetBindItems(nodeArray); |
| 4192 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4192 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
| 4193 CXFA_Node* pNode = nodeArray[i]; | 4193 if (nodeArray[i] != this) { |
| 4194 if (pNode == this) { | 4194 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, |
| 4195 continue; | 4195 bScriptModify, FALSE); |
| 4196 } | 4196 } |
| 4197 pNode->SetScriptContent(wsContent, wsContent, bNotify, | |
| 4198 bScriptModify, FALSE); | |
| 4199 } | 4197 } |
| 4200 } | 4198 } |
| 4201 break; | 4199 break; |
| 4202 } else if (GetClassID() == XFA_ELEMENT_ExclGroup) { | 4200 } else if (GetClassID() == XFA_ELEMENT_ExclGroup) { |
| 4203 pNode = this; | 4201 pNode = this; |
| 4204 } else { | 4202 } else { |
| 4205 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); | 4203 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); |
| 4206 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 4204 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
| 4207 ASSERT(pChildValue); | 4205 ASSERT(pChildValue); |
| 4208 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, | 4206 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, |
| 4209 bScriptModify, FALSE); | 4207 bScriptModify, FALSE); |
| 4210 } | 4208 } |
| 4211 pBindNode = GetBindData(); | 4209 pBindNode = GetBindData(); |
| 4212 if (pBindNode && bSyncData) { | 4210 if (pBindNode && bSyncData) { |
| 4213 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, | 4211 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, |
| 4214 bScriptModify, FALSE); | 4212 bScriptModify, FALSE); |
| 4215 CXFA_NodeArray nodeArray; | 4213 CXFA_NodeArray nodeArray; |
| 4216 pBindNode->GetBindItems(nodeArray); | 4214 pBindNode->GetBindItems(nodeArray); |
| 4217 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4215 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
| 4218 CXFA_Node* pNode = nodeArray[i]; | 4216 if (nodeArray[i] != this) { |
| 4219 if (pNode == this) { | 4217 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, |
| 4220 continue; | 4218 FALSE); |
| 4221 } | 4219 } |
| 4222 pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE); | |
| 4223 } | 4220 } |
| 4224 } | 4221 } |
| 4225 pBindNode = nullptr; | 4222 pBindNode = nullptr; |
| 4226 break; | 4223 break; |
| 4227 } | 4224 } |
| 4228 case XFA_OBJECTTYPE_ContentNode: { | 4225 case XFA_OBJECTTYPE_ContentNode: { |
| 4229 CFX_WideString wsContentType; | 4226 CFX_WideString wsContentType; |
| 4230 if (GetClassID() == XFA_ELEMENT_ExData) { | 4227 if (GetClassID() == XFA_ELEMENT_ExData) { |
| 4231 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 4228 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); |
| 4232 if (wsContentType == FX_WSTRC(L"text/html")) { | 4229 if (wsContentType == FX_WSTRC(L"text/html")) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4273 pBindNode = this; | 4270 pBindNode = this; |
| 4274 } | 4271 } |
| 4275 break; | 4272 break; |
| 4276 } | 4273 } |
| 4277 if (pNode) { | 4274 if (pNode) { |
| 4278 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); | 4275 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); |
| 4279 if (pBindNode && bSyncData) { | 4276 if (pBindNode && bSyncData) { |
| 4280 CXFA_NodeArray nodeArray; | 4277 CXFA_NodeArray nodeArray; |
| 4281 pBindNode->GetBindItems(nodeArray); | 4278 pBindNode->GetBindItems(nodeArray); |
| 4282 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4279 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
| 4283 CXFA_Node* pNode = nodeArray[i]; | 4280 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, |
| 4284 pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, | 4281 bScriptModify, FALSE); |
| 4285 FALSE); | |
| 4286 } | 4282 } |
| 4287 } | 4283 } |
| 4288 return TRUE; | 4284 return TRUE; |
| 4289 } | 4285 } |
| 4290 return FALSE; | 4286 return FALSE; |
| 4291 } | 4287 } |
| 4292 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent, | 4288 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent, |
| 4293 const CFX_WideString& wsXMLValue, | 4289 const CFX_WideString& wsXMLValue, |
| 4294 bool bNotify, | 4290 bool bNotify, |
| 4295 FX_BOOL bScriptModify, | 4291 FX_BOOL bScriptModify, |
| (...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5315 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5311 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 5316 } | 5312 } |
| 5317 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5313 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 5318 return m_pAttachNode->RemoveChild(pNode); | 5314 return m_pAttachNode->RemoveChild(pNode); |
| 5319 } | 5315 } |
| 5320 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5316 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 5321 return m_pAttachNode->GetChild( | 5317 return m_pAttachNode->GetChild( |
| 5322 iIndex, XFA_ELEMENT_UNKNOWN, | 5318 iIndex, XFA_ELEMENT_UNKNOWN, |
| 5323 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5319 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
| 5324 } | 5320 } |
| OLD | NEW |