Home | History | Annotate | Download | only in fpdfsdk
      1 // Copyright 2016 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 FPDFSDK_CPDFSDK_BAANNOTHANDLER_H_
      8 #define FPDFSDK_CPDFSDK_BAANNOTHANDLER_H_
      9 
     10 #include "core/fxcrt/fx_coordinates.h"
     11 #include "fpdfsdk/ipdfsdk_annothandler.h"
     12 
     13 class CFFL_InteractiveFormFiller;
     14 class CFX_Matrix;
     15 class CFX_RenderDevice;
     16 class CPDF_Annot;
     17 class CPDFSDK_FormFillEnvironment;
     18 class CPDFSDK_Annot;
     19 class CPDFSDK_PageView;
     20 
     21 #ifdef PDF_ENABLE_XFA
     22 class CXFA_FFWidget;
     23 #endif  // PDF_ENABLE_XFA
     24 
     25 class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
     26  public:
     27   CPDFSDK_BAAnnotHandler();
     28   ~CPDFSDK_BAAnnotHandler() override;
     29 
     30   bool CanAnswer(CPDFSDK_Annot* pAnnot) override;
     31   CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
     32 #ifdef PDF_ENABLE_XFA
     33   CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* hWidget,
     34                           CPDFSDK_PageView* pPage) override;
     35 #endif  // PDF_ENABLE_XFA
     36   void ReleaseAnnot(CPDFSDK_Annot* pAnnot) override;
     37   CFX_FloatRect GetViewBBox(CPDFSDK_PageView* pPageView,
     38                             CPDFSDK_Annot* pAnnot) override;
     39   WideString GetSelectedText(CPDFSDK_Annot* pAnnot) override;
     40   void ReplaceSelection(CPDFSDK_Annot* pAnnot, const WideString& text) override;
     41   bool HitTest(CPDFSDK_PageView* pPageView,
     42                CPDFSDK_Annot* pAnnot,
     43                const CFX_PointF& point) override;
     44   void OnDraw(CPDFSDK_PageView* pPageView,
     45               CPDFSDK_Annot* pAnnot,
     46               CFX_RenderDevice* pDevice,
     47               CFX_Matrix* pUser2Device,
     48               bool bDrawAnnots) override;
     49   void OnLoad(CPDFSDK_Annot* pAnnot) override;
     50 
     51   void OnMouseEnter(CPDFSDK_PageView* pPageView,
     52                     CPDFSDK_Annot::ObservedPtr* pAnnot,
     53                     uint32_t nFlag) override;
     54   void OnMouseExit(CPDFSDK_PageView* pPageView,
     55                    CPDFSDK_Annot::ObservedPtr* pAnnot,
     56                    uint32_t nFlag) override;
     57   bool OnLButtonDown(CPDFSDK_PageView* pPageView,
     58                      CPDFSDK_Annot::ObservedPtr* pAnnot,
     59                      uint32_t nFlags,
     60                      const CFX_PointF& point) override;
     61   bool OnLButtonUp(CPDFSDK_PageView* pPageView,
     62                    CPDFSDK_Annot::ObservedPtr* pAnnot,
     63                    uint32_t nFlags,
     64                    const CFX_PointF& point) override;
     65   bool OnLButtonDblClk(CPDFSDK_PageView* pPageView,
     66                        CPDFSDK_Annot::ObservedPtr* pAnnot,
     67                        uint32_t nFlags,
     68                        const CFX_PointF& point) override;
     69   bool OnMouseMove(CPDFSDK_PageView* pPageView,
     70                    CPDFSDK_Annot::ObservedPtr* pAnnot,
     71                    uint32_t nFlags,
     72                    const CFX_PointF& point) override;
     73   bool OnMouseWheel(CPDFSDK_PageView* pPageView,
     74                     CPDFSDK_Annot::ObservedPtr* pAnnot,
     75                     uint32_t nFlags,
     76                     short zDelta,
     77                     const CFX_PointF& point) override;
     78   bool OnRButtonDown(CPDFSDK_PageView* pPageView,
     79                      CPDFSDK_Annot::ObservedPtr* pAnnot,
     80                      uint32_t nFlags,
     81                      const CFX_PointF& point) override;
     82   bool OnRButtonUp(CPDFSDK_PageView* pPageView,
     83                    CPDFSDK_Annot::ObservedPtr* pAnnot,
     84                    uint32_t nFlags,
     85                    const CFX_PointF& point) override;
     86   bool OnRButtonDblClk(CPDFSDK_PageView* pPageView,
     87                        CPDFSDK_Annot::ObservedPtr* pAnnot,
     88                        uint32_t nFlags,
     89                        const CFX_PointF& point) override;
     90   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
     91   bool OnKeyDown(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
     92   bool OnKeyUp(CPDFSDK_Annot* pAnnot, int nKeyCode, int nFlag) override;
     93   bool OnSetFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
     94   bool OnKillFocus(CPDFSDK_Annot::ObservedPtr* pAnnot, uint32_t nFlag) override;
     95 #ifdef PDF_ENABLE_XFA
     96   bool OnXFAChangedFocus(CPDFSDK_Annot::ObservedPtr* pOldAnnot,
     97                          CPDFSDK_Annot::ObservedPtr* pNewAnnot) override;
     98 #endif  // PDF_ENABLE_XFA
     99 };
    100 
    101 #endif  // FPDFSDK_CPDFSDK_BAANNOTHANDLER_H_
    102