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