1 // 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 7 #ifndef _FXFA_FORMFILLER_PAGEVIEW_IMP_H 8 #define _FXFA_FORMFILLER_PAGEVIEW_IMP_H 9 class CXFA_FFWidget; 10 class CXFA_FFDocView; 11 class CXFA_FFPageView : public CXFA_ContainerLayoutItem, public IXFA_PageView { 12 public: 13 CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea); 14 ~CXFA_FFPageView() override; 15 16 // IFXA_PageView: 17 IXFA_DocView* GetDocView() override; 18 int32_t GetPageViewIndex() override; 19 void GetPageViewRect(CFX_RectF& rtPage) override; 20 void GetDisplayMatrix(CFX_Matrix& mt, 21 const CFX_Rect& rtDisp, 22 int32_t iRotate) override; 23 int32_t LoadPageView(IFX_Pause* pPause = NULL) override; 24 void UnloadPageView() override; 25 IXFA_Widget* GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) override; 26 IXFA_WidgetIterator* CreateWidgetIterator( 27 FX_DWORD dwTraverseWay = XFA_TRAVERSEWAY_Form, 28 FX_DWORD dwWidgetFilter = XFA_WIDGETFILTER_Visible | 29 XFA_WIDGETFILTER_Viewable | 30 XFA_WIDGETFILTER_AllType) override; 31 32 FX_BOOL IsPageViewLoaded(); 33 34 protected: 35 CXFA_FFDocView* m_pDocView; 36 FX_BOOL m_bLoaded; 37 }; 38 typedef CXFA_NodeIteratorTemplate<CXFA_LayoutItem, 39 CXFA_TraverseStrategy_LayoutItem> 40 CXFA_LayoutItemIterator; 41 class CXFA_FFPageWidgetIterator : public IXFA_WidgetIterator { 42 public: 43 CXFA_FFPageWidgetIterator(CXFA_FFPageView* pPageView, FX_DWORD dwFilter); 44 virtual ~CXFA_FFPageWidgetIterator(); Release()45 virtual void Release() { delete this; } 46 47 virtual void Reset(); 48 virtual IXFA_Widget* MoveToFirst(); 49 virtual IXFA_Widget* MoveToLast(); 50 virtual IXFA_Widget* MoveToNext(); 51 virtual IXFA_Widget* MoveToPrevious(); 52 virtual IXFA_Widget* GetCurrentWidget(); 53 virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); 54 55 protected: 56 IXFA_Widget* GetWidget(CXFA_LayoutItem* pLayoutItem); 57 CXFA_FFPageView* m_pPageView; 58 IXFA_Widget* m_hCurWidget; 59 FX_DWORD m_dwFilter; 60 FX_BOOL m_bIgnorerelevant; 61 CXFA_LayoutItemIterator m_sIterator; 62 }; 63 typedef CFX_ArrayTemplate<CXFA_FFWidget*> CXFA_WidgetArray; 64 class CXFA_TabParam { 65 public: CXFA_TabParam()66 CXFA_TabParam() : m_pWidget(NULL) {} ~CXFA_TabParam()67 ~CXFA_TabParam() {} 68 69 CXFA_FFWidget* m_pWidget; 70 CXFA_WidgetArray m_Children; 71 }; 72 class CXFA_FFTabOrderPageWidgetIterator : public IXFA_WidgetIterator { 73 public: 74 CXFA_FFTabOrderPageWidgetIterator(CXFA_FFPageView* pPageView, 75 FX_DWORD dwFilter); 76 virtual ~CXFA_FFTabOrderPageWidgetIterator(); 77 78 virtual void Release(); 79 80 virtual void Reset(); 81 virtual IXFA_Widget* MoveToFirst(); 82 virtual IXFA_Widget* MoveToLast(); 83 virtual IXFA_Widget* MoveToNext(); 84 virtual IXFA_Widget* MoveToPrevious(); 85 virtual IXFA_Widget* GetCurrentWidget(); 86 virtual FX_BOOL SetCurrentWidget(IXFA_Widget* hWidget); 87 88 protected: 89 CXFA_WidgetArray m_TabOrderWidgetArray; 90 CXFA_FFPageView* m_pPageView; 91 FX_DWORD m_dwFilter; 92 int32_t m_iCurWidget; 93 FX_BOOL m_bIgnorerelevant; 94 CXFA_FFWidget* GetTraverseWidget(CXFA_FFWidget* pWidget); 95 CXFA_FFWidget* FindWidgetByName(const CFX_WideStringC& wsWidgetName, 96 CXFA_FFWidget* pRefWidget); 97 void CreateTabOrderWidgetArray(); 98 void CreateSpaceOrderWidgetArray(CXFA_WidgetArray& WidgetArray); 99 CXFA_FFWidget* GetWidget(CXFA_LayoutItem* pLayoutItem); 100 void OrderContainer(CXFA_LayoutItemIterator* sIterator, 101 CXFA_LayoutItem* pContainerItem, 102 CXFA_TabParam* pContainer, 103 FX_BOOL& bCurrentItem, 104 FX_BOOL& bContentArea, 105 FX_BOOL bMarsterPage = FALSE); 106 }; 107 #endif 108