Home | History | Annotate | Download | only in parser
      1 // Copyright 2014 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_LAYOUT_APPADAPTER_H_
      8 #define _XFA_LAYOUT_APPADAPTER_H_
      9 class CXFA_TraverseStrategy_PageAreaContainerLayoutItem {
     10  public:
     11   static inline CXFA_ContainerLayoutItem* GetFirstChild(
     12       CXFA_ContainerLayoutItem* pLayoutItem) {
     13     if (pLayoutItem->m_pFormNode->GetClassID() == XFA_ELEMENT_PageSet) {
     14       return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pFirstChild;
     15     }
     16     return NULL;
     17   }
     18   static inline CXFA_ContainerLayoutItem* GetNextSibling(
     19       CXFA_ContainerLayoutItem* pLayoutItem) {
     20     return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pNextSibling;
     21   }
     22   static inline CXFA_ContainerLayoutItem* GetParent(
     23       CXFA_ContainerLayoutItem* pLayoutItem) {
     24     return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent;
     25   }
     26 };
     27 class CXFA_TraverseStrategy_ContentAreaContainerLayoutItem {
     28  public:
     29   static inline CXFA_ContainerLayoutItem* GetFirstChild(
     30       CXFA_ContainerLayoutItem* pLayoutItem) {
     31     for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pFirstChild; pChildItem;
     32          pChildItem = pChildItem->m_pNextSibling) {
     33       if (CXFA_ContainerLayoutItem* pContainer =
     34               pChildItem->AsContainerLayoutItem()) {
     35         return pContainer;
     36       }
     37     }
     38     return nullptr;
     39   }
     40   static inline CXFA_ContainerLayoutItem* GetNextSibling(
     41       CXFA_ContainerLayoutItem* pLayoutItem) {
     42     for (CXFA_LayoutItem* pChildItem = pLayoutItem->m_pNextSibling; pChildItem;
     43          pChildItem = pChildItem->m_pNextSibling) {
     44       if (CXFA_ContainerLayoutItem* pContainer =
     45               pChildItem->AsContainerLayoutItem()) {
     46         return pContainer;
     47       }
     48     }
     49     return nullptr;
     50   }
     51   static inline CXFA_ContainerLayoutItem* GetParent(
     52       CXFA_ContainerLayoutItem* pLayoutItem) {
     53     return (CXFA_ContainerLayoutItem*)pLayoutItem->m_pParent;
     54   }
     55 };
     56 class CXFA_TraverseStrategy_ContentLayoutItem {
     57  public:
     58   static inline CXFA_ContentLayoutItem* GetFirstChild(
     59       CXFA_ContentLayoutItem* pLayoutItem) {
     60     return (CXFA_ContentLayoutItem*)pLayoutItem->m_pFirstChild;
     61   }
     62   static inline CXFA_ContentLayoutItem* GetNextSibling(
     63       CXFA_ContentLayoutItem* pLayoutItem) {
     64     return (CXFA_ContentLayoutItem*)pLayoutItem->m_pNextSibling;
     65   }
     66   static inline CXFA_ContentLayoutItem* GetParent(
     67       CXFA_ContentLayoutItem* pLayoutItem) {
     68     return (CXFA_ContentLayoutItem*)pLayoutItem->m_pParent;
     69   }
     70 };
     71 FX_DWORD XFA_GetRelevant(CXFA_Node* pFormItem, FX_DWORD dwParentRelvant);
     72 void XFA_ReleaseLayoutItem(CXFA_LayoutItem* pLayoutItem);
     73 #endif
     74