OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 |
| 7 #include "xfa/fxfa/parser/xfa_object.h" |
| 8 |
| 9 CXFA_AttachNodeList::CXFA_AttachNodeList(CXFA_Document* pDocument, |
| 10 CXFA_Node* pAttachNode) |
| 11 : CXFA_NodeList(pDocument) { |
| 12 m_pAttachNode = pAttachNode; |
| 13 } |
| 14 |
| 15 int32_t CXFA_AttachNodeList::GetLength() { |
| 16 return m_pAttachNode->CountChildren( |
| 17 XFA_Element::Unknown, |
| 18 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 19 } |
| 20 |
| 21 FX_BOOL CXFA_AttachNodeList::Append(CXFA_Node* pNode) { |
| 22 CXFA_Node* pParent = pNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 23 if (pParent) { |
| 24 pParent->RemoveChild(pNode); |
| 25 } |
| 26 return m_pAttachNode->InsertChild(pNode); |
| 27 } |
| 28 |
| 29 FX_BOOL CXFA_AttachNodeList::Insert(CXFA_Node* pNewNode, |
| 30 CXFA_Node* pBeforeNode) { |
| 31 CXFA_Node* pParent = pNewNode->GetNodeItem(XFA_NODEITEM_Parent); |
| 32 if (pParent) { |
| 33 pParent->RemoveChild(pNewNode); |
| 34 } |
| 35 return m_pAttachNode->InsertChild(pNewNode, pBeforeNode); |
| 36 } |
| 37 |
| 38 FX_BOOL CXFA_AttachNodeList::Remove(CXFA_Node* pNode) { |
| 39 return m_pAttachNode->RemoveChild(pNode); |
| 40 } |
| 41 |
| 42 CXFA_Node* CXFA_AttachNodeList::Item(int32_t iIndex) { |
| 43 return m_pAttachNode->GetChild( |
| 44 iIndex, XFA_Element::Unknown, |
| 45 m_pAttachNode->GetElementType() == XFA_Element::Subform); |
| 46 } |
OLD | NEW |