1 // Copyrig 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 7 #ifndef XFA_FXFA_XFA_FFPAGEVIEW_H_ 8 #define XFA_FXFA_XFA_FFPAGEVIEW_H_ 9 10 #include <vector> 11 12 #include "xfa/fxfa/parser/cxfa_containerlayoutitem.h" 13 #include "xfa/fxfa/parser/cxfa_contentlayoutitem.h" 14 #include "xfa/fxfa/parser/cxfa_traversestrategy_layoutitem.h" 15 16 class CXFA_FFWidget; 17 class CXFA_FFDocView; 18 19 class CXFA_FFPageView : public CXFA_ContainerLayoutItem { 20 public: 21 CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); 22 ~CXFA_FFPageView() override; 23 24 CXFA_FFDocView* GetDocView() const; 25 CFX_RectF GetPageViewRect() const; 26 CFX_Matrix GetDisplayMatrix(const CFX_Rect& rtDisp, int32_t iRotate) const; 27 IXFA_WidgetIterator* CreateWidgetIterator( 28 uint32_t dwTraverseWay = XFA_TRAVERSEWAY_Form, 29 uint32_t dwWidgetFilter = XFA_WidgetStatus_Visible | 30 XFA_WidgetStatus_Viewable); 31 32 protected: 33 CXFA_FFDocView* const m_pDocView; 34 }; 35 36 typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem, 37 CXFA_TraverseStrategy_LayoutItem> 38 CXFA_LayoutItemIterator; 39 40 class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { 41 public: 42 CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, uint32_t dwFilter); 43 ~CXFA_FFPageWidgetIterator() override; 44 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 bool SetCurrentWidget(CXFA_FFWidget* hWidget) override; 52 53 protected: 54 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); 55 56 CXFA_FFPageView* m_pPageView; 57 CXFA_FFWidget* m_hCurWidget; 58 uint32_t m_dwFilter; 59 bool m_bIgnorerelevant; 60 CXFA_LayoutItemIterator m_sIterator; 61 }; 62 63 class CXFA_TabParam { 64 public: 65 CXFA_TabParam(); 66 ~CXFA_TabParam(); 67 68 CXFA_FFWidget* m_pWidget; 69 std::vector<CXFA_FFWidget*> m_Children; 70 }; 71 72 class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { 73 public: 74 CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, 75 uint32_t dwFilter); 76 ~CXFA_FFTabOrderPageWidgetIterator() override; 77 78 void Reset() override; 79 CXFA_FFWidget* MoveToFirst() override; 80 CXFA_FFWidget* MoveToLast() override; 81 CXFA_FFWidget* MoveToNext() override; 82 CXFA_FFWidget* MoveToPrevious() override; 83 CXFA_FFWidget* GetCurrentWidget() override; 84 bool SetCurrentWidget(CXFA_FFWidget* hWidget) override; 85 86 protected: 87 CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); 88 CXFA_FFWidget* FindWidgetByName(const CFX_WideString& wsWidgetName, 89 CXFA_FFWidget* pRefWidget); 90 void CreateTabOrderWidgetArray(); 91 void CreateSpaceOrderWidgetArray(std::vector<CXFA_FFWidget*>* WidgetArray); 92 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); 93 void OrderContainer(CXFA_LayoutItemIterator* sIterator, 94 CXFA_LayoutItem* pContainerItem, 95 CXFA_TabParam* pContainer, 96 bool& bCurrentItem, 97 bool& bContentArea, 98 bool bMarsterPage = false); 99 100 std::vector<CXFA_FFWidget*> m_TabOrderWidgetArray; 101 CXFA_FFPageView* m_pPageView; 102 uint32_t m_dwFilter; 103 int32_t m_iCurWidget; 104 bool m_bIgnorerelevant; 105 }; 106 107 #endif // XFA_FXFA_XFA_FFPAGEVIEW_H_ 108