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