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 #ifndef XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_CONTENTAREACONTAINERLAYOUTITEM_H_ 8 #define XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_CONTENTAREACONTAINERLAYOUTITEM_H_ 9 10 #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" 11 12 class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem { 13 public: GetFirstChild(CXFA_ContainerLayoutItem * pLayoutItem)14 static CXFA_ContainerLayoutItem* GetFirstChild( 15 CXFA_ContainerLayoutItem* pLayoutItem) { 16 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pFirstChild; pChildItem; 17 pChildItem = pChildItem->m_pNextSibling) { 18 if (CXFA_ContainerLayoutItem* pContainer = 19 pChildItem->AsContainerLayoutItem()) { 20 return pContainer; 21 } 22 } 23 return nullptr; 24 } 25 GetNextSibling(CXFA_ContainerLayoutItem * pLayoutItem)26 static CXFA_ContainerLayoutItem* GetNextSibling( 27 CXFA_ContainerLayoutItem* pLayoutItem) { 28 for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pNextSibling; pChildItem; 29 pChildItem = pChildItem->m_pNextSibling) { 30 if (CXFA_ContainerLayoutItem* pContainer = 31 pChildItem->AsContainerLayoutItem()) { 32 return pContainer; 33 } 34 } 35 return nullptr; 36 } 37 GetParent(CXFA_ContainerLayoutItem * pLayoutItem)38 static CXFA_ContainerLayoutItem* GetParent( 39 CXFA_ContainerLayoutItem* pLayoutItem) { 40 return static_cast<CXFA_ContainerLayoutItem*>(pLayoutItem->m_pParent); 41 } 42 }; 43 44 #endif // XFA_FXFA_PARSER_CXFA_TRAVERSESTRATEGY_CONTENTAREACONTAINERLAYOUTITEM_H_ 45