blob: 79b0afb602df8b78375cae030e1b0ade265fb6ac [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;
tsepezcc4d6d82016-05-16 13:21:03 -070039
Dan Sinclair1770c022016-03-14 14:14:16 -040040class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator {
41 public:
tsepezdeee3d22016-03-25 14:38:58 -070042 CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter);
tsepezcc4d6d82016-05-16 13:21:03 -070043 ~CXFA_FFPageWidgetIterator() override;
dsinclairdf4bc592016-03-31 20:34:43 -070044
45 void Reset() override;
46 CXFA_FFWidget* MoveToFirst() override;
47 CXFA_FFWidget* MoveToLast() override;
48 CXFA_FFWidget* MoveToNext() override;
49 CXFA_FFWidget* MoveToPrevious() override;
50 CXFA_FFWidget* GetCurrentWidget() override;
51 FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override;
Dan Sinclair1770c022016-03-14 14:14:16 -040052
53 protected:
dsinclairdf4bc592016-03-31 20:34:43 -070054 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
55
Dan Sinclair1770c022016-03-14 14:14:16 -040056 CXFA_FFPageView* m_pPageView;
dsinclairdf4bc592016-03-31 20:34:43 -070057 CXFA_FFWidget* m_hCurWidget;
tsepezdeee3d22016-03-25 14:38:58 -070058 uint32_t m_dwFilter;
Dan Sinclair1770c022016-03-14 14:14:16 -040059 FX_BOOL m_bIgnorerelevant;
60 CXFA_LayoutItemIterator m_sIterator;
61};
62typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray;
63class CXFA_TabParam {
64 public:
65 CXFA_TabParam() : m_pWidget(NULL) {}
66 ~CXFA_TabParam() {}
67
68 CXFA_FFWidget* m_pWidget;
69 CXFA_WidgetArray m_Children;
70};
71class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator {
72 public:
73 CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView,
tsepezdeee3d22016-03-25 14:38:58 -070074 uint32_t dwFilter);
tsepezcc4d6d82016-05-16 13:21:03 -070075 ~CXFA_FFTabOrderPageWidgetIterator() override;
Dan Sinclair1770c022016-03-14 14:14:16 -040076
dsinclairdf4bc592016-03-31 20:34:43 -070077 void Reset() override;
78 CXFA_FFWidget* MoveToFirst() override;
79 CXFA_FFWidget* MoveToLast() override;
80 CXFA_FFWidget* MoveToNext() override;
81 CXFA_FFWidget* MoveToPrevious() override;
82 CXFA_FFWidget* GetCurrentWidget() override;
83 FX_BOOL SetCurrentWidget(CXFA_FFWidget* hWidget) override;
Dan Sinclair1770c022016-03-14 14:14:16 -040084
85 protected:
Dan Sinclair1770c022016-03-14 14:14:16 -040086 CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget);
tsepez70c55202016-04-14 15:32:35 -070087 CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName,
Dan Sinclair1770c022016-03-14 14:14:16 -040088 CXFA_FFWidget* pRefWidget);
89 void CreateTabOrderWidgetArray();
90 void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray);
91 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem);
92 void OrderContainer(CXFA_LayoutItemIterator* sIterator,
93 CXFA_LayoutItem* pContainerItem,
94 CXFA_TabParam* pContainer,
95 FX_BOOL& bCurrentItem,
96 FX_BOOL& bContentArea,
97 FX_BOOL bMarsterPage = FALSE);
dsinclairdf4bc592016-03-31 20:34:43 -070098
99 CXFA_WidgetArray m_TabOrderWidgetArray;
100 CXFA_FFPageView* m_pPageView;
101 uint32_t m_dwFilter;
102 int32_t m_iCurWidget;
103 FX_BOOL m_bIgnorerelevant;
Dan Sinclair1770c022016-03-14 14:14:16 -0400104};
105
dsinclair7222ea62016-04-06 14:33:07 -0700106#endif // XFA_FXFA_INCLUDE_XFA_FFPAGEVIEW_H_