| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef FPDFSDK_CPDFSDK_PAGEVIEW_H_ | 7 #ifndef FPDFSDK_CPDFSDK_PAGEVIEW_H_ |
| 8 #define FPDFSDK_CPDFSDK_PAGEVIEW_H_ | 8 #define FPDFSDK_CPDFSDK_PAGEVIEW_H_ |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 void PageView_OnDraw(CFX_RenderDevice* pDevice, | 28 void PageView_OnDraw(CFX_RenderDevice* pDevice, |
| 29 CFX_Matrix* pUser2Device, | 29 CFX_Matrix* pUser2Device, |
| 30 CPDF_RenderOptions* pOptions, | 30 CPDF_RenderOptions* pOptions, |
| 31 const FX_RECT& pClip); | 31 const FX_RECT& pClip); |
| 32 #else // PDF_ENABLE_XFA | 32 #else // PDF_ENABLE_XFA |
| 33 void PageView_OnDraw(CFX_RenderDevice* pDevice, | 33 void PageView_OnDraw(CFX_RenderDevice* pDevice, |
| 34 CFX_Matrix* pUser2Device, | 34 CFX_Matrix* pUser2Device, |
| 35 CPDF_RenderOptions* pOptions); | 35 CPDF_RenderOptions* pOptions); |
| 36 #endif // PDF_ENABLE_XFA | 36 #endif // PDF_ENABLE_XFA |
| 37 | 37 |
| 38 const CPDF_Annot* GetPDFAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | |
| 39 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 38 CPDFSDK_Annot* GetFXAnnotAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
| 40 const CPDF_Annot* GetPDFWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | |
| 41 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); | 39 CPDFSDK_Annot* GetFXWidgetAtPoint(FX_FLOAT pageX, FX_FLOAT pageY); |
| 40 |
| 41 void LoadFXAnnots(); |
| 42 CPDFSDK_Annot* GetFocusAnnot(); | 42 CPDFSDK_Annot* GetFocusAnnot(); |
| 43 void SetFocusAnnot(CPDFSDK_Annot::ObservedPtr* pSDKAnnot, | 43 bool IsValidAnnot(const CPDF_Annot* p) const; |
| 44 uint32_t nFlag = 0) { | 44 bool IsValidSDKAnnot(const CPDFSDK_Annot* p) const; |
| 45 m_pSDKDoc->SetFocusAnnot(pSDKAnnot, nFlag); | 45 |
| 46 const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { |
| 47 return m_SDKAnnotArray; |
| 46 } | 48 } |
| 47 FX_BOOL KillFocusAnnot(uint32_t nFlag = 0) { | |
| 48 return m_pSDKDoc->KillFocusAnnot(nFlag); | |
| 49 } | |
| 50 void KillFocusAnnotIfNeeded(); | |
| 51 | |
| 52 CPDFSDK_Annot* AddAnnot(CPDF_Dictionary* pDict); | |
| 53 CPDFSDK_Annot* AddAnnot(const FX_CHAR* lpSubType, CPDF_Dictionary* pDict); | |
| 54 CPDFSDK_Annot* AddAnnot(CPDF_Annot* pPDFAnnot); | |
| 55 | |
| 56 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); | |
| 57 size_t CountAnnots() const; | |
| 58 CPDFSDK_Annot* GetAnnot(size_t nIndex); | |
| 59 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); | 49 CPDFSDK_Annot* GetAnnotByDict(CPDF_Dictionary* pDict); |
| 60 | 50 |
| 61 #ifdef PDF_ENABLE_XFA | 51 #ifdef PDF_ENABLE_XFA |
| 52 FX_BOOL DeleteAnnot(CPDFSDK_Annot* pAnnot); |
| 62 CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot); | 53 CPDFSDK_Annot* AddAnnot(CXFA_FFWidget* pPDFAnnot); |
| 63 CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget); | 54 CPDFSDK_Annot* GetAnnotByXFAWidget(CXFA_FFWidget* hWidget); |
| 55 |
| 64 CPDFXFA_Page* GetPDFXFAPage() { return m_page; } | 56 CPDFXFA_Page* GetPDFXFAPage() { return m_page; } |
| 65 #endif // PDF_ENABLE_XFA | 57 #endif // PDF_ENABLE_XFA |
| 66 | 58 |
| 67 CPDF_Page* GetPDFPage() const; | 59 CPDF_Page* GetPDFPage() const; |
| 68 CPDF_Document* GetPDFDocument(); | 60 CPDF_Document* GetPDFDocument(); |
| 69 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } | 61 CPDFSDK_Document* GetSDKDocument() { return m_pSDKDoc; } |
| 70 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); | 62 FX_BOOL OnLButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); |
| 71 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); | 63 FX_BOOL OnLButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); |
| 72 #ifdef PDF_ENABLE_XFA | 64 #ifdef PDF_ENABLE_XFA |
| 73 FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); | 65 FX_BOOL OnRButtonDown(const CFX_FloatPoint& point, uint32_t nFlag); |
| 74 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); | 66 FX_BOOL OnRButtonUp(const CFX_FloatPoint& point, uint32_t nFlag); |
| 75 #endif // PDF_ENABLE_XFA | 67 #endif // PDF_ENABLE_XFA |
| 76 FX_BOOL OnChar(int nChar, uint32_t nFlag); | 68 FX_BOOL OnChar(int nChar, uint32_t nFlag); |
| 77 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); | 69 FX_BOOL OnKeyDown(int nKeyCode, int nFlag); |
| 78 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); | 70 FX_BOOL OnKeyUp(int nKeyCode, int nFlag); |
| 79 | 71 |
| 80 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, int nFlag); | 72 FX_BOOL OnMouseMove(const CFX_FloatPoint& point, int nFlag); |
| 81 FX_BOOL OnMouseWheel(double deltaX, | 73 FX_BOOL OnMouseWheel(double deltaX, |
| 82 double deltaY, | 74 double deltaY, |
| 83 const CFX_FloatPoint& point, | 75 const CFX_FloatPoint& point, |
| 84 int nFlag); | 76 int nFlag); |
| 85 bool IsValidAnnot(const CPDF_Annot* p) const; | 77 |
| 86 void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } | 78 void GetCurrentMatrix(CFX_Matrix& matrix) { matrix = m_curMatrix; } |
| 87 void UpdateRects(const std::vector<CFX_FloatRect>& rects); | 79 void UpdateRects(const std::vector<CFX_FloatRect>& rects); |
| 88 void UpdateView(CPDFSDK_Annot* pAnnot); | 80 void UpdateView(CPDFSDK_Annot* pAnnot); |
| 89 const std::vector<CPDFSDK_Annot*>& GetAnnotList() const { | |
| 90 return m_fxAnnotArray; | |
| 91 } | |
| 92 | 81 |
| 93 int GetPageIndex() const; | 82 int GetPageIndex() const; |
| 94 void LoadFXAnnots(); | |
| 95 | 83 |
| 96 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } | 84 void SetValid(FX_BOOL bValid) { m_bValid = bValid; } |
| 97 FX_BOOL IsValid() { return m_bValid; } | 85 FX_BOOL IsValid() { return m_bValid; } |
| 98 | 86 |
| 99 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } | 87 void SetLock(FX_BOOL bLocked) { m_bLocked = bLocked; } |
| 100 FX_BOOL IsLocked() { return m_bLocked; } | 88 FX_BOOL IsLocked() { return m_bLocked; } |
| 101 | 89 |
| 102 void SetBeingDestroyed() { m_bBeingDestroyed = true; } | 90 void SetBeingDestroyed() { m_bBeingDestroyed = true; } |
| 103 bool IsBeingDestroyed() const { return m_bBeingDestroyed; } | 91 bool IsBeingDestroyed() const { return m_bBeingDestroyed; } |
| 104 | 92 |
| 105 #ifndef PDF_ENABLE_XFA | 93 #ifndef PDF_ENABLE_XFA |
| 106 bool OwnsPage() const { return m_bOwnsPage; } | 94 bool OwnsPage() const { return m_bOwnsPage; } |
| 107 void TakePageOwnership() { m_bOwnsPage = true; } | 95 void TakePageOwnership() { m_bOwnsPage = true; } |
| 108 #endif // PDF_ENABLE_XFA | 96 #endif // PDF_ENABLE_XFA |
| 109 | 97 |
| 110 private: | 98 private: |
| 111 int GetPageIndexForStaticPDF() const; | 99 int GetPageIndexForStaticPDF() const; |
| 112 | 100 |
| 113 CFX_Matrix m_curMatrix; | 101 CFX_Matrix m_curMatrix; |
| 114 UnderlyingPageType* const m_page; | 102 UnderlyingPageType* const m_page; |
| 115 std::unique_ptr<CPDF_AnnotList> m_pAnnotList; | 103 std::unique_ptr<CPDF_AnnotList> m_pAnnotList; |
| 116 std::vector<CPDFSDK_Annot*> m_fxAnnotArray; | 104 std::vector<CPDFSDK_Annot*> m_SDKAnnotArray; |
| 117 CPDFSDK_Document* const m_pSDKDoc; | 105 CPDFSDK_Document* const m_pSDKDoc; |
| 118 CPDFSDK_Annot::ObservedPtr m_pCaptureWidget; | 106 CPDFSDK_Annot::ObservedPtr m_pCaptureWidget; |
| 119 #ifndef PDF_ENABLE_XFA | 107 #ifndef PDF_ENABLE_XFA |
| 120 bool m_bOwnsPage; | 108 bool m_bOwnsPage; |
| 121 #endif // PDF_ENABLE_XFA | 109 #endif // PDF_ENABLE_XFA |
| 122 FX_BOOL m_bEnterWidget; | 110 FX_BOOL m_bEnterWidget; |
| 123 FX_BOOL m_bExitWidget; | 111 FX_BOOL m_bExitWidget; |
| 124 FX_BOOL m_bOnWidget; | 112 FX_BOOL m_bOnWidget; |
| 125 FX_BOOL m_bValid; | 113 FX_BOOL m_bValid; |
| 126 FX_BOOL m_bLocked; | 114 FX_BOOL m_bLocked; |
| 127 bool m_bBeingDestroyed; | 115 bool m_bBeingDestroyed; |
| 128 }; | 116 }; |
| 129 | 117 |
| 130 #endif // FPDFSDK_CPDFSDK_PAGEVIEW_H_ | 118 #endif // FPDFSDK_CPDFSDK_PAGEVIEW_H_ |
| OLD | NEW |