Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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 | |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 7 | #ifndef FXJS_CFXJSE_RESOLVEPROCESSOR_H_ |
| 8 | #define FXJS_CFXJSE_RESOLVEPROCESSOR_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
weili | b4d1b57 | 2016-08-10 14:50:48 -0700 | [diff] [blame] | 10 | #include <memory> |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 11 | #include <vector> |
weili | b4d1b57 | 2016-08-10 14:50:48 -0700 | [diff] [blame] | 12 | |
dsinclair | 31f8740 | 2016-07-20 06:34:45 -0700 | [diff] [blame] | 13 | #include "xfa/fxfa/parser/xfa_resolvenode_rs.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 14 | |
| 15 | class CXFA_NodeHelper; |
Dan Sinclair | 3fff90a | 2017-11-01 13:12:39 +0000 | [diff] [blame] | 16 | class CFXJSE_Engine; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 17 | |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 18 | class CFXJSE_ResolveNodeData { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 19 | public: |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 20 | explicit CFXJSE_ResolveNodeData(CFXJSE_Engine* pSC); |
| 21 | ~CFXJSE_ResolveNodeData(); |
weili | 47bcd4c | 2016-06-16 08:00:06 -0700 | [diff] [blame] | 22 | |
Dan Sinclair | 3fff90a | 2017-11-01 13:12:39 +0000 | [diff] [blame] | 23 | CFXJSE_Engine* m_pSC; |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 24 | CXFA_Object* m_CurObject; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 25 | WideString m_wsName; |
dsinclair | cbfef57 | 2016-05-18 13:16:12 -0700 | [diff] [blame] | 26 | XFA_HashCode m_uHashName; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 27 | WideString m_wsCondition; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 28 | int32_t m_nLevel; |
Tom Sepez | f8a9439 | 2017-03-14 12:13:22 -0700 | [diff] [blame] | 29 | std::vector<CXFA_Object*> m_Objects; // Not owned. |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 30 | uint32_t m_dwStyles; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 31 | const XFA_SCRIPTATTRIBUTEINFO* m_pScriptAttribute; |
Dan Sinclair | 33beb4e | 2017-12-04 19:12:16 +0000 | [diff] [blame] | 32 | XFA_ResolveNode_RSType m_dwFlag; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 33 | }; |
weili | bff506d | 2016-06-20 11:37:05 -0700 | [diff] [blame] | 34 | |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 35 | class CFXJSE_ResolveProcessor { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 36 | public: |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 37 | CFXJSE_ResolveProcessor(); |
| 38 | ~CFXJSE_ResolveProcessor(); |
weili | bff506d | 2016-06-20 11:37:05 -0700 | [diff] [blame] | 39 | |
Dan Sinclair | 76e336d | 2017-12-04 18:08:58 +0000 | [diff] [blame] | 40 | bool Resolve(CFXJSE_ResolveNodeData& rnd); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 41 | int32_t GetFilter(const WideStringView& wsExpression, |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 42 | int32_t nStart, |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 43 | CFXJSE_ResolveNodeData& rnd); |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 44 | void SetIndexDataBind(WideString& wsNextCondition, |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 45 | int32_t& iIndex, |
| 46 | int32_t iCount); |
| 47 | void SetCurStart(int32_t start) { m_iCurStart = start; } |
| 48 | |
weili | b4d1b57 | 2016-08-10 14:50:48 -0700 | [diff] [blame] | 49 | CXFA_NodeHelper* GetNodeHelper() const { return m_pNodeHelper.get(); } |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 50 | |
| 51 | private: |
Dan Sinclair | 76e336d | 2017-12-04 18:08:58 +0000 | [diff] [blame] | 52 | bool ResolveForAttributeRs(CXFA_Object* curNode, |
| 53 | CFXJSE_ResolveNodeData& rnd, |
| 54 | const WideStringView& strAttr); |
| 55 | bool ResolveAnyChild(CFXJSE_ResolveNodeData& rnd); |
| 56 | bool ResolveDollar(CFXJSE_ResolveNodeData& rnd); |
| 57 | bool ResolveExcalmatory(CFXJSE_ResolveNodeData& rnd); |
| 58 | bool ResolveNumberSign(CFXJSE_ResolveNodeData& rnd); |
| 59 | bool ResolveAsterisk(CFXJSE_ResolveNodeData& rnd); |
| 60 | bool ResolveNormal(CFXJSE_ResolveNodeData& rnd); |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 61 | void SetStylesForChild(uint32_t dwParentStyles, CFXJSE_ResolveNodeData& rnd); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 62 | |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 63 | void ConditionArray(int32_t iCurIndex, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 64 | WideString wsCondition, |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 65 | int32_t iFoundCount, |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 66 | CFXJSE_ResolveNodeData& rnd); |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 67 | void DoPredicateFilter(int32_t iCurIndex, |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 68 | WideString wsCondition, |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 69 | int32_t iFoundCount, |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 70 | CFXJSE_ResolveNodeData& rnd); |
| 71 | void FilterCondition(CFXJSE_ResolveNodeData& rnd, WideString wsCondition); |
dsinclair | d1cf239 | 2016-07-11 06:46:59 -0700 | [diff] [blame] | 72 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 73 | int32_t m_iCurStart; |
weili | b4d1b57 | 2016-08-10 14:50:48 -0700 | [diff] [blame] | 74 | std::unique_ptr<CXFA_NodeHelper> m_pNodeHelper; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 75 | }; |
| 76 | |
Dan Sinclair | d19aa7c | 2017-11-06 17:10:21 +0000 | [diff] [blame] | 77 | #endif // FXJS_CFXJSE_RESOLVEPROCESSOR_H_ |