• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 The PDFium Authors
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_PWL_IPWL_FILLERNOTIFY_H_
8 #define FPDFSDK_PWL_IPWL_FILLERNOTIFY_H_
9 
10 #include <memory>
11 #include <utility>
12 
13 #include "core/fxcrt/mask.h"
14 #include "core/fxcrt/widestring.h"
15 #include "public/fpdf_fwlevent.h"
16 
17 class CFX_FloatRect;
18 
19 class IPWL_FillerNotify {
20  public:
21   // These must match the values in public/fpdf_formfill.h
22   enum CursorStyle {
23     kArrow = 0,
24     kNESW = 1,
25     kNWSE = 2,
26     kVBeam = 3,
27     kHBeam = 4,
28     kHand = 5,
29   };
30 
31   class PerWindowData {
32    public:
33     virtual ~PerWindowData() = default;
34     virtual std::unique_ptr<PerWindowData> Clone() const = 0;
35   };
36 
37   virtual ~IPWL_FillerNotify() = default;
38 
39   virtual void InvalidateRect(PerWindowData* pWidgetData,
40                               const CFX_FloatRect& rect) = 0;
41   virtual void OutputSelectedRect(PerWindowData* pWidgetData,
42                                   const CFX_FloatRect& rect) = 0;
43   virtual bool IsSelectionImplemented() const = 0;
44   virtual void SetCursor(CursorStyle nCursorStyle) = 0;
45 
46   // Must write to |bBottom| and |fPopupRet|.
47   virtual void QueryWherePopup(const PerWindowData* pAttached,
48                                float fPopupMin,
49                                float fPopupMax,
50                                bool* bBottom,
51                                float* fPopupRet) = 0;
52 
53   virtual std::pair<bool, bool> OnBeforeKeyStroke(
54       const PerWindowData* pAttached,
55       WideString& strChange,
56       const WideString& strChangeEx,
57       int nSelStart,
58       int nSelEnd,
59       bool bKeyDown,
60       Mask<FWL_EVENTFLAG> nFlag) = 0;
61 
62   virtual bool OnPopupPreOpen(const PerWindowData* pAttached,
63                               Mask<FWL_EVENTFLAG> nFlag) = 0;
64 
65   virtual bool OnPopupPostOpen(const PerWindowData* pAttached,
66                                Mask<FWL_EVENTFLAG> nFlag) = 0;
67 };
68 
69 #endif  // FPDFSDK_PWL_IPWL_FILLERNOTIFY_H_
70