tsepez | a0b2d23 | 2017-01-23 11:32:36 -0800 | [diff] [blame] | 1 | // Copyrig 2014 PDFium Authors. All rights reserved. |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 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 | 80c4878 | 2017-03-23 12:11:20 -0400 | [diff] [blame] | 7 | #ifndef XFA_FXFA_CXFA_FFPAGEVIEW_H_ |
| 8 | #define XFA_FXFA_CXFA_FFPAGEVIEW_H_ |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 9 | |
Tom Sepez | 40badde | 2017-05-01 13:21:39 -0700 | [diff] [blame^] | 10 | #include <memory> |
tsepez | a0b2d23 | 2017-01-23 11:32:36 -0800 | [diff] [blame] | 11 | #include <vector> |
| 12 | |
dsinclair | 0b851ff | 2016-07-21 12:03:01 -0700 | [diff] [blame] | 13 | #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" |
| 14 | #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" |
| 15 | #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" |
Dan Sinclair | efcae5d | 2017-03-29 14:47:46 -0400 | [diff] [blame] | 16 | #include "xfa/fxfa/parser/xfa_utils.h" |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 17 | |
| 18 | class CXFA_FFWidget; |
| 19 | class CXFA_FFDocView; |
thestig | 9f3dbbc | 2016-04-13 13:18:21 -0700 | [diff] [blame] | 20 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 21 | class CXFA_FFPageView : public CXFA_ContainerLayoutItem { |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 22 | public: |
| 23 | CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); |
| 24 | ~CXFA_FFPageView() override; |
| 25 | |
thestig | 9f3dbbc | 2016-04-13 13:18:21 -0700 | [diff] [blame] | 26 | CXFA_FFDocView* GetDocView() const; |
Dan Sinclair | 1b08df1 | 2017-02-09 09:17:20 -0500 | [diff] [blame] | 27 | CFX_RectF GetPageViewRect() const; |
| 28 | CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const; |
Tom Sepez | 40badde | 2017-05-01 13:21:39 -0700 | [diff] [blame^] | 29 | std::unique_ptr<IXFA_WidgetIterator> CreateWidgetIterator( |
| 30 | uint32_t dwTraverseWay, |
| 31 | uint32_t dwWidgetFilter); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 32 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 33 | protected: |
thestig | 9f3dbbc | 2016-04-13 13:18:21 -0700 | [diff] [blame] | 34 | CXFA_FFDocView* const m_pDocView; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 35 | }; |
thestig | 9f3dbbc | 2016-04-13 13:18:21 -0700 | [diff] [blame] | 36 | |
Tom Sepez | 40badde | 2017-05-01 13:21:39 -0700 | [diff] [blame^] | 37 | using CXFA_LayoutItemIterator = |
| 38 | CXFA_NodeIteratorTemplate<CXFA_LayoutItem, |
| 39 | CXFA_TraverseStrategy_LayoutItem>; |
tsepez | cc4d6d8 | 2016-05-16 13:21:03 -0700 | [diff] [blame] | 40 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 41 | class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { |
| 42 | public: |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 43 | CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter); |
tsepez | cc4d6d8 | 2016-05-16 13:21:03 -0700 | [diff] [blame] | 44 | ~CXFA_FFPageWidgetIterator() override; |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 45 | |
| 46 | void Reset() override; |
| 47 | CXFA_FFWidget* MoveToFirst() override; |
| 48 | CXFA_FFWidget* MoveToLast() override; |
| 49 | CXFA_FFWidget* MoveToNext() override; |
| 50 | CXFA_FFWidget* MoveToPrevious() override; |
| 51 | CXFA_FFWidget* GetCurrentWidget() override; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 52 | bool SetCurrentWidget(CXFA_FFWidget* hWidget) override; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 53 | |
| 54 | protected: |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 55 | CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); |
| 56 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 57 | CXFA_FFPageView* m_pPageView; |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 58 | CXFA_FFWidget* m_hCurWidget; |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 59 | uint32_t m_dwFilter; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 60 | bool m_bIgnorerelevant; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 61 | CXFA_LayoutItemIterator m_sIterator; |
| 62 | }; |
weili | 47bcd4c | 2016-06-16 08:00:06 -0700 | [diff] [blame] | 63 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 64 | class CXFA_TabParam { |
| 65 | public: |
Tom Sepez | b822782 | 2017-03-24 13:10:14 -0700 | [diff] [blame] | 66 | explicit CXFA_TabParam(CXFA_FFWidget* pWidget); |
weili | 47bcd4c | 2016-06-16 08:00:06 -0700 | [diff] [blame] | 67 | ~CXFA_TabParam(); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 68 | |
Lei Zhang | afc8eb3 | 2017-03-28 14:32:13 -0700 | [diff] [blame] | 69 | void AppendTabParam(CXFA_TabParam* pParam); |
| 70 | void ClearChildren(); |
| 71 | CXFA_FFWidget* GetWidget() { return m_pWidget; } |
| 72 | const std::vector<CXFA_FFWidget*>& GetChildren() const { return m_Children; } |
| 73 | |
| 74 | private: |
| 75 | CXFA_FFWidget* const m_pWidget; |
tsepez | a0b2d23 | 2017-01-23 11:32:36 -0800 | [diff] [blame] | 76 | std::vector<CXFA_FFWidget*> m_Children; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 77 | }; |
weili | 47bcd4c | 2016-06-16 08:00:06 -0700 | [diff] [blame] | 78 | |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 79 | class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { |
| 80 | public: |
| 81 | CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, |
tsepez | deee3d2 | 2016-03-25 14:38:58 -0700 | [diff] [blame] | 82 | uint32_t dwFilter); |
tsepez | cc4d6d8 | 2016-05-16 13:21:03 -0700 | [diff] [blame] | 83 | ~CXFA_FFTabOrderPageWidgetIterator() override; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 84 | |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 85 | void Reset() override; |
| 86 | CXFA_FFWidget* MoveToFirst() override; |
| 87 | CXFA_FFWidget* MoveToLast() override; |
| 88 | CXFA_FFWidget* MoveToNext() override; |
| 89 | CXFA_FFWidget* MoveToPrevious() override; |
| 90 | CXFA_FFWidget* GetCurrentWidget() override; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 91 | bool SetCurrentWidget(CXFA_FFWidget* hWidget) override; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 92 | |
| 93 | protected: |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 94 | CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); |
tsepez | 70c5520 | 2016-04-14 15:32:35 -0700 | [diff] [blame] | 95 | CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName, |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 96 | CXFA_FFWidget* pRefWidget); |
| 97 | void CreateTabOrderWidgetArray(); |
tsepez | a0b2d23 | 2017-01-23 11:32:36 -0800 | [diff] [blame] | 98 | void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray); |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 99 | CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); |
| 100 | void OrderContainer(CXFA_LayoutItemIterator* sIterator, |
| 101 | CXFA_LayoutItem* pContainerItem, |
| 102 | CXFA_TabParam* pContainer, |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 103 | bool& bCurrentItem, |
| 104 | bool& bContentArea, |
| 105 | bool bMarsterPage = false); |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 106 | |
tsepez | a0b2d23 | 2017-01-23 11:32:36 -0800 | [diff] [blame] | 107 | std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray; |
dsinclair | df4bc59 | 2016-03-31 20:34:43 -0700 | [diff] [blame] | 108 | CXFA_FFPageView* m_pPageView; |
| 109 | uint32_t m_dwFilter; |
| 110 | int32_t m_iCurWidget; |
tsepez | d19e912 | 2016-11-02 15:43:18 -0700 | [diff] [blame] | 111 | bool m_bIgnorerelevant; |
Dan Sinclair | 1770c02 | 2016-03-14 14:14:16 -0400 | [diff] [blame] | 112 | }; |
| 113 | |
Dan Sinclair | 80c4878 | 2017-03-23 12:11:20 -0400 | [diff] [blame] | 114 | #endif // XFA_FXFA_CXFA_FFPAGEVIEW_H_ |