blob: 01409f340386297d9ef0dddf043a5e5fff05f4eb [file] [log] [blame]
tsepeza0b2d232017-01-23 11:32:36 -08001// Copyrig 2014 PDFium Authors. All rights reserved.
Dan Sinclair1770c022016-03-14 14:14:16 -04002// 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 Sinclair80c48782017-03-23 12:11:20 -04007#ifndef XFA_FXFA_CXFA_FFPAGEVIEW_H_
8#define XFA_FXFA_CXFA_FFPAGEVIEW_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
Tom Sepez40badde2017-05-01 13:21:39 -070010#include <memory>
tsepeza0b2d232017-01-23 11:32:36 -080011#include <vector>
12
dsinclair0b851ff2016-07-21 12:03:01 -070013#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 Sinclairefcae5d2017-03-29 14:47:46 -040016#include "xfa/fxfa/parser/xfa_utils.h"
Dan Sinclair1770c022016-03-14 14:14:16 -040017
18class CXFA_FFWidget;
19class CXFA_FFDocView;
thestig9f3dbbc2016-04-13 13:18:21 -070020
dsinclairdf4bc592016-03-31 20:34:43 -070021class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
Dan Sinclair1770c022016-03-14 14:14:16 -040022 public:
23 CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
24 ~CXFA_FFPageView() override;
25
thestig9f3dbbc2016-04-13 13:18:21 -070026 CXFA_FFDocView* GetDocView() const;
Dan Sinclair1b08df12017-02-09 09:17:20 -050027 CFX_RectF GetPageViewRect() const;
28 CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const;
Tom Sepez40badde2017-05-01 13:21:39 -070029 std::unique_ptr<IXFA_WidgetIterator> CreateWidgetIterator(
30 uint32_t dwTraverseWay,
31 uint32_t dwWidgetFilter);
Dan Sinclair1770c022016-03-14 14:14:16 -040032
Dan Sinclair1770c022016-03-14 14:14:16 -040033 protected:
thestig9f3dbbc2016-04-13 13:18:21 -070034 CXFA_FFDocView* const m_pDocView;
Dan Sinclair1770c022016-03-14 14:14:16 -040035};
thestig9f3dbbc2016-04-13 13:18:21 -070036
Tom Sepez40badde2017-05-01 13:21:39 -070037using CXFA_LayoutItemIterator =
38 CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
39 CXFA_TraverseStrategy_LayoutItem>;
tsepezcc4d6d82016-05-16 13:21:03 -070040
Dan Sinclair1770c022016-03-14 14:14:16 -040041class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
42 public:
tsepezdeee3d22016-03-25 14:38:58 -070043 CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
tsepezcc4d6d82016-05-16 13:21:03 -070044 ~CXFA_FFPageWidgetIterator() override;
dsinclairdf4bc592016-03-31 20:34:43 -070045
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;
tsepezd19e9122016-11-02 15:43:18 -070052 bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
Dan Sinclair1770c022016-03-14 14:14:16 -040053
54 protected:
dsinclairdf4bc592016-03-31 20:34:43 -070055 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
56
Dan Sinclair1770c022016-03-14 14:14:16 -040057 CXFA_FFPageView* m_pPageView;
dsinclairdf4bc592016-03-31 20:34:43 -070058 CXFA_FFWidget* m_hCurWidget;
tsepezdeee3d22016-03-25 14:38:58 -070059 uint32_t m_dwFilter;
tsepezd19e9122016-11-02 15:43:18 -070060 bool m_bIgnorerelevant;
Dan Sinclair1770c022016-03-14 14:14:16 -040061 CXFA_LayoutItemIterator m_sIterator;
62};
weili47bcd4c2016-06-16 08:00:06 -070063
Dan Sinclair1770c022016-03-14 14:14:16 -040064class CXFA_TabParam {
65 public:
Tom Sepezb8227822017-03-24 13:10:14 -070066 explicit CXFA_TabParam(CXFA_FFWidget* pWidget);
weili47bcd4c2016-06-16 08:00:06 -070067 ~CXFA_TabParam();
Dan Sinclair1770c022016-03-14 14:14:16 -040068
Lei Zhangafc8eb32017-03-28 14:32:13 -070069 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;
tsepeza0b2d232017-01-23 11:32:36 -080076 std::vector<CXFA_FFWidget*> m_Children;
Dan Sinclair1770c022016-03-14 14:14:16 -040077};
weili47bcd4c2016-06-16 08:00:06 -070078
Dan Sinclair1770c022016-03-14 14:14:16 -040079class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
80 public:
81 CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
tsepezdeee3d22016-03-25 14:38:58 -070082 uint32_t dwFilter);
tsepezcc4d6d82016-05-16 13:21:03 -070083 ~CXFA_FFTabOrderPageWidgetIterator() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040084
dsinclairdf4bc592016-03-31 20:34:43 -070085 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;
tsepezd19e9122016-11-02 15:43:18 -070091 bool SetCurrentWidget(CXFA_FFWidget* hWidget) override;
Dan Sinclair1770c022016-03-14 14:14:16 -040092
93 protected:
Dan Sinclair1770c022016-03-14 14:14:16 -040094 CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
tsepez70c55202016-04-14 15:32:35 -070095 CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
Dan Sinclair1770c022016-03-14 14:14:16 -040096 CXFA_FFWidget* pRefWidget);
97 void CreateTabOrderWidgetArray();
tsepeza0b2d232017-01-23 11:32:36 -080098 void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray);
Dan Sinclair1770c022016-03-14 14:14:16 -040099 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
100 void OrderContainer(CXFA_LayoutItemIterator* sIterator,
101 CXFA_LayoutItem* pContainerItem,
102 CXFA_TabParam* pContainer,
tsepezd19e9122016-11-02 15:43:18 -0700103 bool& bCurrentItem,
104 bool& bContentArea,
105 bool bMarsterPage = false);
dsinclairdf4bc592016-03-31 20:34:43 -0700106
tsepeza0b2d232017-01-23 11:32:36 -0800107 std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray;
dsinclairdf4bc592016-03-31 20:34:43 -0700108 CXFA_FFPageView* m_pPageView;
109 uint32_t m_dwFilter;
110 int32_t m_iCurWidget;
tsepezd19e9122016-11-02 15:43:18 -0700111 bool m_bIgnorerelevant;
Dan Sinclair1770c022016-03-14 14:14:16 -0400112};
113
Dan Sinclair80c48782017-03-23 12:11:20 -0400114#endif // XFA_FXFA_CXFA_FFPAGEVIEW_H_