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_FXFA_PARSER_CXFA_NODEHELPER_H_
      8 #define XFA_FXFA_PARSER_CXFA_NODEHELPER_H_
      9 
     10 #include "xfa/fxfa/parser/xfa_object.h"
     11 #include "xfa/fxfa/parser/xfa_resolvenode_rs.h"
     12 
     13 class CXFA_ScriptContext;
     14 
     15 enum XFA_LOGIC_TYPE {
     16   XFA_LOGIC_NoTransparent,
     17   XFA_LOGIC_Transparent,
     18 };
     19 
     20 class CXFA_NodeHelper {
     21  public:
     22   CXFA_NodeHelper();
     23   ~CXFA_NodeHelper();
     24 
     25   CXFA_Node* ResolveNodes_GetOneChild(CXFA_Node* parent,
     26                                       const FX_WCHAR* pwsName,
     27                                       bool bIsClassName = false);
     28   CXFA_Node* ResolveNodes_GetParent(
     29       CXFA_Node* pNode,
     30       XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
     31 
     32   int32_t NodeAcc_TraverseSiblings(CXFA_Node* parent,
     33                                    uint32_t dNameHash,
     34                                    CXFA_NodeArray* pSiblings,
     35                                    XFA_LOGIC_TYPE eLogicType,
     36                                    bool bIsClassName = false,
     37                                    bool bIsFindProperty = true);
     38   int32_t NodeAcc_TraverseAnySiblings(CXFA_Node* parent,
     39                                       uint32_t dNameHash,
     40                                       CXFA_NodeArray* pSiblings,
     41                                       bool bIsClassName = false);
     42   int32_t CountSiblings(CXFA_Node* pNode,
     43                         XFA_LOGIC_TYPE eLogicType,
     44                         CXFA_NodeArray* pSiblings,
     45                         bool bIsClassName = false);
     46   int32_t GetIndex(CXFA_Node* pNode,
     47                    XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent,
     48                    bool bIsProperty = false,
     49                    bool bIsClassIndex = false);
     50   void GetNameExpression(CXFA_Node* refNode,
     51                          CFX_WideString& wsName,
     52                          bool bIsAllPath,
     53                          XFA_LOGIC_TYPE eLogicType = XFA_LOGIC_NoTransparent);
     54   bool NodeIsTransparent(CXFA_Node* refNode);
     55   bool ResolveNodes_CreateNode(CFX_WideString wsName,
     56                                CFX_WideString wsCondition,
     57                                bool bLastNode,
     58                                CXFA_ScriptContext* pScriptContext);
     59   bool CreateNode_ForCondition(CFX_WideString& wsCondition);
     60   void SetCreateNodeType(CXFA_Node* refNode);
     61   bool NodeIsProperty(CXFA_Node* refNode);
     62 
     63  public:
     64   XFA_Element m_eLastCreateType;
     65   CXFA_Node* m_pCreateParent;
     66   int32_t m_iCreateCount;
     67   XFA_RESOVENODE_RSTYPE m_iCreateFlag;
     68   int32_t m_iCurAllStart;
     69   CXFA_Node* m_pAllStartParent;
     70 };
     71 
     72 #endif  // XFA_FXFA_PARSER_CXFA_NODEHELPER_H_
     73