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 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 case XFA_ELEMENT_Sharpxml: | 1391 case XFA_ELEMENT_Sharpxml: |
1392 case XFA_ELEMENT_SharpxHTML: { | 1392 case XFA_ELEMENT_SharpxHTML: { |
1393 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); | 1393 CXFA_Node* pTextNode = GetNodeItem(XFA_NODEITEM_Parent); |
1394 if (!pTextNode) { | 1394 if (!pTextNode) { |
1395 return; | 1395 return; |
1396 } | 1396 } |
1397 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); | 1397 CXFA_Node* pValueNode = pTextNode->GetNodeItem(XFA_NODEITEM_Parent); |
1398 if (!pValueNode) { | 1398 if (!pValueNode) { |
1399 return; | 1399 return; |
1400 } | 1400 } |
1401 XFA_ELEMENT eType = pValueNode->GetClassID(); | 1401 XFA_ELEMENT eNodeType = pValueNode->GetClassID(); |
1402 if (eType == XFA_ELEMENT_Value) { | 1402 if (eNodeType == XFA_ELEMENT_Value) { |
1403 bNeedFindContainer = true; | 1403 bNeedFindContainer = true; |
1404 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1404 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
1405 if (pNode && pNode->IsContainerNode()) { | 1405 if (pNode && pNode->IsContainerNode()) { |
1406 if (bScriptModify) { | 1406 if (bScriptModify) { |
1407 pValueNode = pNode; | 1407 pValueNode = pNode; |
1408 } | 1408 } |
1409 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1409 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
1410 } else { | 1410 } else { |
1411 pNotify->OnValueChanged(this, eAttribute, pNode, | 1411 pNotify->OnValueChanged(this, eAttribute, pNode, |
1412 pNode->GetNodeItem(XFA_NODEITEM_Parent)); | 1412 pNode->GetNodeItem(XFA_NODEITEM_Parent)); |
1413 } | 1413 } |
1414 } else { | 1414 } else { |
1415 if (eType == XFA_ELEMENT_Items) { | 1415 if (eNodeType == XFA_ELEMENT_Items) { |
1416 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); | 1416 CXFA_Node* pNode = pValueNode->GetNodeItem(XFA_NODEITEM_Parent); |
1417 if (pNode && pNode->IsContainerNode()) { | 1417 if (pNode && pNode->IsContainerNode()) { |
1418 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); | 1418 pNotify->OnValueChanged(this, eAttribute, pValueNode, pNode); |
1419 } | 1419 } |
1420 } | 1420 } |
1421 } | 1421 } |
1422 } break; | 1422 } break; |
1423 default: | 1423 default: |
1424 break; | 1424 break; |
1425 } | 1425 } |
(...skipping 2787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4213 pValueNode; pValueNode = pValueNode->GetNodeItem( | 4213 pValueNode; pValueNode = pValueNode->GetNodeItem( |
4214 XFA_NODEITEM_NextSibling)) { | 4214 XFA_NODEITEM_NextSibling)) { |
4215 pValueNode->SetAttributeValue(wsSaveTextArray[i], | 4215 pValueNode->SetAttributeValue(wsSaveTextArray[i], |
4216 wsSaveTextArray[i], FALSE); | 4216 wsSaveTextArray[i], FALSE); |
4217 i++; | 4217 i++; |
4218 } | 4218 } |
4219 } | 4219 } |
4220 CXFA_NodeArray nodeArray; | 4220 CXFA_NodeArray nodeArray; |
4221 pBind->GetBindItems(nodeArray); | 4221 pBind->GetBindItems(nodeArray); |
4222 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4222 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
4223 CXFA_Node* pNode = nodeArray[i]; | 4223 if (nodeArray[i] != this) { |
4224 if (pNode == this) { | 4224 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, |
4225 continue; | 4225 bScriptModify, FALSE); |
4226 } | 4226 } |
4227 pNode->SetScriptContent(wsContent, wsContent, bNotify, | |
4228 bScriptModify, FALSE); | |
4229 } | 4227 } |
4230 } | 4228 } |
4231 break; | 4229 break; |
4232 } else if (GetClassID() == XFA_ELEMENT_ExclGroup) { | 4230 } else if (GetClassID() == XFA_ELEMENT_ExclGroup) { |
4233 pNode = this; | 4231 pNode = this; |
4234 } else { | 4232 } else { |
4235 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); | 4233 CXFA_Node* pValue = GetProperty(0, XFA_ELEMENT_Value); |
4236 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); | 4234 CXFA_Node* pChildValue = pValue->GetNodeItem(XFA_NODEITEM_FirstChild); |
4237 ASSERT(pChildValue); | 4235 ASSERT(pChildValue); |
4238 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, | 4236 pChildValue->SetScriptContent(wsContent, wsContent, bNotify, |
4239 bScriptModify, FALSE); | 4237 bScriptModify, FALSE); |
4240 } | 4238 } |
4241 pBindNode = GetBindData(); | 4239 pBindNode = GetBindData(); |
4242 if (pBindNode && bSyncData) { | 4240 if (pBindNode && bSyncData) { |
4243 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, | 4241 pBindNode->SetScriptContent(wsContent, wsXMLValue, bNotify, |
4244 bScriptModify, FALSE); | 4242 bScriptModify, FALSE); |
4245 CXFA_NodeArray nodeArray; | 4243 CXFA_NodeArray nodeArray; |
4246 pBindNode->GetBindItems(nodeArray); | 4244 pBindNode->GetBindItems(nodeArray); |
4247 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4245 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
4248 CXFA_Node* pNode = nodeArray[i]; | 4246 if (nodeArray[i] != this) { |
4249 if (pNode == this) { | 4247 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, true, |
4250 continue; | 4248 FALSE); |
4251 } | 4249 } |
4252 pNode->SetScriptContent(wsContent, wsContent, bNotify, true, FALSE); | |
4253 } | 4250 } |
4254 } | 4251 } |
4255 pBindNode = nullptr; | 4252 pBindNode = nullptr; |
4256 break; | 4253 break; |
4257 } | 4254 } |
4258 case XFA_OBJECTTYPE_ContentNode: { | 4255 case XFA_OBJECTTYPE_ContentNode: { |
4259 CFX_WideString wsContentType; | 4256 CFX_WideString wsContentType; |
4260 if (GetClassID() == XFA_ELEMENT_ExData) { | 4257 if (GetClassID() == XFA_ELEMENT_ExData) { |
4261 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); | 4258 GetAttribute(XFA_ATTRIBUTE_ContentType, wsContentType, FALSE); |
4262 if (wsContentType == FX_WSTRC(L"text/html")) { | 4259 if (wsContentType == FX_WSTRC(L"text/html")) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4303 pBindNode = this; | 4300 pBindNode = this; |
4304 } | 4301 } |
4305 break; | 4302 break; |
4306 } | 4303 } |
4307 if (pNode) { | 4304 if (pNode) { |
4308 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); | 4305 SetAttributeValue(wsContent, wsXMLValue, bNotify, bScriptModify); |
4309 if (pBindNode && bSyncData) { | 4306 if (pBindNode && bSyncData) { |
4310 CXFA_NodeArray nodeArray; | 4307 CXFA_NodeArray nodeArray; |
4311 pBindNode->GetBindItems(nodeArray); | 4308 pBindNode->GetBindItems(nodeArray); |
4312 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { | 4309 for (int32_t i = 0; i < nodeArray.GetSize(); i++) { |
4313 CXFA_Node* pNode = nodeArray[i]; | 4310 nodeArray[i]->SetScriptContent(wsContent, wsContent, bNotify, |
4314 pNode->SetScriptContent(wsContent, wsContent, bNotify, bScriptModify, | 4311 bScriptModify, FALSE); |
4315 FALSE); | |
4316 } | 4312 } |
4317 } | 4313 } |
4318 return TRUE; | 4314 return TRUE; |
4319 } | 4315 } |
4320 return FALSE; | 4316 return FALSE; |
4321 } | 4317 } |
4322 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent, | 4318 FX_BOOL CXFA_Node::SetContent(const CFX_WideString& wsContent, |
4323 const CFX_WideString& wsXMLValue, | 4319 const CFX_WideString& wsXMLValue, |
4324 bool bNotify, | 4320 bool bNotify, |
4325 FX_BOOL bScriptModify, | 4321 FX_BOOL bScriptModify, |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5345 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); | 5341 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
5346 } | 5342 } |
5347 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { | 5343 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
5348 return m_pAttachNode->RemoveChild(pNode); | 5344 return m_pAttachNode->RemoveChild(pNode); |
5349 } | 5345 } |
5350 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { | 5346 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
5351 return m_pAttachNode->GetChild( | 5347 return m_pAttachNode->GetChild( |
5352 iIndex, XFA_ELEMENT_UNKNOWN, | 5348 iIndex, XFA_ELEMENT_UNKNOWN, |
5353 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); | 5349 m_pAttachNode->GetClassID() == XFA_ELEMENT_Subform); |
5354 } | 5350 } |
OLD | NEW |