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_RESOLVEPROCESSOR_H_
8 #define _XFA_RESOLVEPROCESSOR_H_
9 class CXFA_NodeHelper;
10 class CXFA_ScriptContext;
11 class CXFA_ResolveNodesData {
12  public:
13   CXFA_ResolveNodesData(CXFA_ScriptContext* pSC = NULL)
m_pSC(pSC)14       : m_pSC(pSC),
15         m_CurNode(NULL),
16         m_wsName(),
17         m_uHashName(0),
18         m_wsCondition(),
19         m_nLevel(0),
20         m_Nodes(),
21         m_dwStyles(XFA_RESOLVENODE_Children),
22         m_pScriptAttribute(NULL),
23         m_dwFlag(XFA_RESOVENODE_RSTYPE_Nodes) {}
~CXFA_ResolveNodesData()24   ~CXFA_ResolveNodesData() { m_Nodes.RemoveAll(); }
25   CXFA_ScriptContext* m_pSC;
26   CXFA_Object* m_CurNode;
27   CFX_WideString m_wsName;
28   uint32_t m_uHashName;
29   CFX_WideString m_wsCondition;
30   int32_t m_nLevel;
31   CXFA_ObjArray m_Nodes;
32   FX_DWORD m_dwStyles;
33   XFA_LPCSCRIPTATTRIBUTEINFO m_pScriptAttribute;
34   XFA_RESOVENODE_RSTYPE m_dwFlag;
35 };
36 class CXFA_ResolveProcessor {
37  public:
38   CXFA_ResolveProcessor(void);
39   ~CXFA_ResolveProcessor(void);
40   int32_t XFA_ResolveNodes(CXFA_ResolveNodesData& rnd);
41   int32_t XFA_ResolveNodes_AnyChild(CXFA_ResolveNodesData& rnd);
42   int32_t XFA_ResolveNodes_Dollar(CXFA_ResolveNodesData& rnd);
43   int32_t XFA_ResolveNodes_Excalmatory(CXFA_ResolveNodesData& rnd);
44   int32_t XFA_ResolveNodes_NumberSign(CXFA_ResolveNodesData& rnd);
45   int32_t XFA_ResolveNodes_Asterisk(CXFA_ResolveNodesData& rnd);
46   int32_t XFA_ResolveNodes_Normal(CXFA_ResolveNodesData& rnd);
47   int32_t XFA_ResolveNodes_ForAttributeRs(CXFA_Object* curNode,
48                                           CXFA_ResolveNodesData& rnd,
49                                           const CFX_WideStringC& strAttr);
50   void XFA_ResolveNode_ConditionArray(int32_t iCurIndex,
51                                       CFX_WideString wsCondition,
52                                       int32_t iFoundCount,
53                                       CXFA_ResolveNodesData& rnd);
54   void XFA_ResolveNode_DoPredicateFilter(int32_t iCurIndex,
55                                          CFX_WideString wsCondition,
56                                          int32_t iFoundCount,
57                                          CXFA_ResolveNodesData& rnd);
58   int32_t XFA_ResolveNodes_GetFilter(const CFX_WideStringC& wsExpression,
59                                      int32_t nStart,
60                                      CXFA_ResolveNodesData& rnd);
61   void XFA_ResolveNode_FilterCondition(CXFA_ResolveNodesData& rnd,
62                                        CFX_WideString wsCondition);
63   int32_t XFA_ResolveNodes_PopStack(CFX_Int32Array& stack);
64   void XFA_ResolveNodes_SetStylesForChild(FX_DWORD dwParentStyles,
65                                           CXFA_ResolveNodesData& rnd);
66   int32_t XFA_ResolveNode_SetResultCreateNode(XFA_RESOLVENODE_RS& resolveNodeRS,
67                                               CFX_WideString& wsLastCondition);
68   void XFA_ResolveNode_SetIndexDataBind(CFX_WideString& wsNextCondition,
69                                         int32_t& iIndex,
70                                         int32_t iCount);
GetNodeHelper()71   CXFA_NodeHelper* GetNodeHelper() { return m_pNodeHelper; }
72 
73  private:
74   CXFA_NodeHelper* m_pNodeHelper;
75 
76  public:
77   int32_t m_iCurStart;
78 };
79 #endif
80