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 struct BeforeKeystrokeResult { 38 bool rc; 39 bool exit; 40 }; 41 42 virtual ~IPWL_FillerNotify() = default; 43 44 virtual void InvalidateRect(PerWindowData* pWidgetData, 45 const CFX_FloatRect& rect) = 0; 46 virtual void OutputSelectedRect(PerWindowData* pWidgetData, 47 const CFX_FloatRect& rect) = 0; 48 virtual bool IsSelectionImplemented() const = 0; 49 virtual void SetCursor(CursorStyle nCursorStyle) = 0; 50 51 // Must write to |bBottom| and |fPopupRet|. 52 virtual void QueryWherePopup(const PerWindowData* pAttached, 53 float fPopupMin, 54 float fPopupMax, 55 bool* bBottom, 56 float* fPopupRet) = 0; 57 58 virtual BeforeKeystrokeResult OnBeforeKeyStroke( 59 const PerWindowData* pAttached, 60 WideString& strChange, 61 const WideString& strChangeEx, 62 int nSelStart, 63 int nSelEnd, 64 bool bKeyDown, 65 Mask<FWL_EVENTFLAG> nFlag) = 0; 66 67 virtual bool OnPopupPreOpen(const PerWindowData* pAttached, 68 Mask<FWL_EVENTFLAG> nFlag) = 0; 69 70 virtual bool OnPopupPostOpen(const PerWindowData* pAttached, 71 Mask<FWL_EVENTFLAG> nFlag) = 0; 72 }; 73 74 #endif // FPDFSDK_PWL_IPWL_FILLERNOTIFY_H_ 75