blob: 75e418b25b04e3f356a93790fbb0505df886ba8d [file] [log] [blame]
Dan Sinclair1770c022016-03-14 14:14:16 -04001// 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
dsinclair7222ea62016-04-06 14:33:07 -07007#ifndef XFA_FXFA_INCLUDE_XFA_FFPAGEVIEW_H_
8#define XFA_FXFA_INCLUDE_XFA_FFPAGEVIEW_H_
Dan Sinclair1770c022016-03-14 14:14:16 -04009
10#include "xfa/fxfa/parser/xfa_doclayout.h"
11
12class CXFA_FFWidget;
13class CXFA_FFDocView;
thestig9f3dbbc2016-04-13 13:18:21 -070014
dsinclairdf4bc592016-03-31 20:34:43 -070015class CXFA_FFPageView : public CXFA_ContainerLayoutItem {
Dan Sinclair1770c022016-03-14 14:14:16 -040016 public:
17 CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea);
18 ~CXFA_FFPageView() override;
19
thestig9f3dbbc2016-04-13 13:18:21 -070020 CXFA_FFDocView* GetDocView() const;
21 int32_t GetPageViewIndex() const;
22 void GetPageViewRect(CFX_RectF& rtPage) const;
Dan Sinclair1770c022016-03-14 14:14:16 -040023 void GetDisplayMatrix(CFX_Matrix& mt,
24 const CFX_Rect& rtDisp,
thestig9f3dbbc2016-04-13 13:18:21 -070025 int32_t iRotate) const;
Dan Sinclair1770c022016-03-14 14:14:16 -040026 IXFA_WidgetIterator* CreateWidgetIterator(
tsepezdeee3d22016-03-25 14:38:58 -070027 uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form,
28 uint32_t dwWidgetFilter = XFA_WIDGETFILTER_Visible |
Dan Sinclair1770c022016-03-14 14:14:16 -040029 XFA_WIDGETFILTER_Viewable |
dsinclairdf4bc592016-03-31 20:34:43 -070030 XFA_WIDGETFILTER_AllType);
Dan Sinclair1770c022016-03-14 14:14:16 -040031
Dan Sinclair1770c022016-03-14 14:14:16 -040032 protected:
thestig9f3dbbc2016-04-13 13:18:21 -070033 CXFA_FFDocView* const m_pDocView;
Dan Sinclair1770c022016-03-14 14:14:16 -040034};
thestig9f3dbbc2016-04-13 13:18:21 -070035
Dan Sinclair1770c022016-03-14 14:14:16 -040036typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem,
37 CXFA_TraverseStrategy_LayoutItem>
38 CXFA_LayoutItemIterator;
39class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
40 public:
tsepezdeee3d22016-03-25 14:38:58 -070041 CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
Dan Sinclair1770c022016-03-14 14:14:16 -040042 virtual ~CXFA_FFPageWidgetIterator();
Dan Sinclair1770c022016-03-14 14:14:16 -040043
dsinclairdf4bc592016-03-31 20:34:43 -070044 void Release() override { delete this; }
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;
52 FX_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;
Dan Sinclair1770c022016-03-14 14:14:16 -040060 FX_BOOL m_bIgnorerelevant;
61 CXFA_LayoutItemIterator m_sIterator;
62};
63typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray;
64class CXFA_TabParam {
65 public:
66 CXFA_TabParam() : m_pWidget(NULL) {}
67 ~CXFA_TabParam() {}
68
69 CXFA_FFWidget* m_pWidget;
70 CXFA_WidgetArray m_Children;
71};
72class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
73 public:
74 CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
tsepezdeee3d22016-03-25 14:38:58 -070075 uint32_t dwFilter);
Dan Sinclair1770c022016-03-14 14:14:16 -040076 virtual ~CXFA_FFTabOrderPageWidgetIterator();
77
dsinclairdf4bc592016-03-31 20:34:43 -070078 void Release() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040079
dsinclairdf4bc592016-03-31 20:34:43 -070080 void Reset() override;
81 CXFA_FFWidget* MoveToFirst() override;
82 CXFA_FFWidget* MoveToLast() override;
83 CXFA_FFWidget* MoveToNext() override;
84 CXFA_FFWidget* MoveToPrevious() override;
85 CXFA_FFWidget* GetCurrentWidget() override;
86 FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override;
Dan Sinclair1770c022016-03-14 14:14:16 -040087
88 protected:
Dan Sinclair1770c022016-03-14 14:14:16 -040089 CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
tsepez70c55202016-04-14 15:32:35 -070090 CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
Dan Sinclair1770c022016-03-14 14:14:16 -040091 CXFA_FFWidget* pRefWidget);
92 void CreateTabOrderWidgetArray();
93 void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray);
94 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
95 void OrderContainer(CXFA_LayoutItemIterator* sIterator,
96 CXFA_LayoutItem* pContainerItem,
97 CXFA_TabParam* pContainer,
98 FX_BOOL& bCurrentItem,
99 FX_BOOL& bContentArea,
100 FX_BOOL bMarsterPage = FALSE);
dsinclairdf4bc592016-03-31 20:34:43 -0700101
102 CXFA_WidgetArray m_TabOrderWidgetArray;
103 CXFA_FFPageView* m_pPageView;
104 uint32_t m_dwFilter;
105 int32_t m_iCurWidget;
106 FX_BOOL m_bIgnorerelevant;
Dan Sinclair1770c022016-03-14 14:14:16 -0400107};
108
dsinclair7222ea62016-04-06 14:33:07 -0700109#endif // XFA_FXFA_INCLUDE_XFA_FFPAGEVIEW_H_