• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
8 #define XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
9 
10 #include "core/fxcrt/fx_coordinates.h"
11 #include "core/fxcrt/mask.h"
12 #include "fxjs/gc/heap.h"
13 #include "v8/include/cppgc/garbage-collected.h"
14 #include "v8/include/cppgc/member.h"
15 #include "v8/include/cppgc/visitor.h"
16 #include "xfa/fwl/cfwl_message.h"
17 #include "xfa/fwl/fwl_widgetdef.h"
18 #include "xfa/fxfa/cxfa_eventparam.h"
19 #include "xfa/fxfa/parser/cxfa_document.h"
20 
21 class CFGAS_GEGraphics;
22 class CXFA_FFDocView;
23 class CXFA_FFWidget;
24 enum class FWL_WidgetHit;
25 
26 class CXFA_FFWidgetHandler final
27     : public cppgc::GarbageCollected<CXFA_FFWidgetHandler> {
28  public:
29   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
30   ~CXFA_FFWidgetHandler();
31 
32   void Trace(cppgc::Visitor* visitor) const;
33 
34   bool OnMouseEnter(CXFA_FFWidget* hWidget);
35   bool OnMouseExit(CXFA_FFWidget* hWidget);
36   bool OnLButtonDown(CXFA_FFWidget* hWidget,
37                      Mask<XFA_FWL_KeyFlag> dwFlags,
38                      const CFX_PointF& point);
39   bool OnLButtonUp(CXFA_FFWidget* hWidget,
40                    Mask<XFA_FWL_KeyFlag> dwFlags,
41                    const CFX_PointF& point);
42   bool OnLButtonDblClk(CXFA_FFWidget* hWidget,
43                        Mask<XFA_FWL_KeyFlag> dwFlags,
44                        const CFX_PointF& point);
45   bool OnMouseMove(CXFA_FFWidget* hWidget,
46                    Mask<XFA_FWL_KeyFlag> dwFlags,
47                    const CFX_PointF& point);
48   bool OnMouseWheel(CXFA_FFWidget* hWidget,
49                     Mask<XFA_FWL_KeyFlag> dwFlags,
50                     const CFX_PointF& point,
51                     const CFX_Vector& delta);
52   bool OnRButtonDown(CXFA_FFWidget* hWidget,
53                      Mask<XFA_FWL_KeyFlag> dwFlags,
54                      const CFX_PointF& point);
55   bool OnRButtonUp(CXFA_FFWidget* hWidget,
56                    Mask<XFA_FWL_KeyFlag> dwFlags,
57                    const CFX_PointF& point);
58   bool OnRButtonDblClk(CXFA_FFWidget* hWidget,
59                        Mask<XFA_FWL_KeyFlag> dwFlags,
60                        const CFX_PointF& point);
61 
62   WideString GetText(CXFA_FFWidget* widget);
63   WideString GetSelectedText(CXFA_FFWidget* widget);
64   void PasteText(CXFA_FFWidget* widget, const WideString& text);
65   bool SelectAllText(CXFA_FFWidget* widget);
66 
67   bool CanUndo(CXFA_FFWidget* widget);
68   bool CanRedo(CXFA_FFWidget* widget);
69   bool Undo(CXFA_FFWidget* widget);
70   bool Redo(CXFA_FFWidget* widget);
71 
72   bool OnKeyDown(CXFA_FFWidget* hWidget,
73                  XFA_FWL_VKEYCODE dwKeyCode,
74                  Mask<XFA_FWL_KeyFlag> dwFlags);
75   bool OnChar(CXFA_FFWidget* hWidget,
76               uint32_t dwChar,
77               Mask<XFA_FWL_KeyFlag> dwFlags);
78   FWL_WidgetHit HitTest(CXFA_FFWidget* pWidget, const CFX_PointF& point);
79   void RenderWidget(CXFA_FFWidget* hWidget,
80                     CFGAS_GEGraphics* pGS,
81                     const CFX_Matrix& matrix,
82                     bool bHighlight);
83   bool HasEvent(CXFA_Node* pNode, XFA_EVENTTYPE eEventType);
84   XFA_EventError ProcessEvent(CXFA_Node* pNode, CXFA_EventParam* pParam);
85 
86  private:
87   explicit CXFA_FFWidgetHandler(CXFA_FFDocView* pDocView);
88 
89   cppgc::Member<CXFA_FFDocView> m_pDocView;
90 };
91 
92 #endif  //  XFA_FXFA_CXFA_FFWIDGETHANDLER_H_
93