Fix a leak with g_DefaultGlobalObjectTemplate.
[pdfium.git] / fpdfsdk / include / formfiller / FFL_Notify.h
1 // Copyright 2014 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_INCLUDE_FORMFILLER_FFL_NOTIFY_H_
8 #define FPDFSDK_INCLUDE_FORMFILLER_FFL_NOTIFY_H_
9
10 #include "../../../core/include/fpdfdoc/fpdf_doc.h"
11 #include "../../../core/include/fxcrt/fx_string.h"
12
13 class CFFL_FormFiller;
14 class CPDF_FormField;
15
16 class CFFL_Notify {
17  public:
18   CFFL_Notify(CFFL_FormFiller* pFormFiller);
19   virtual ~CFFL_Notify();
20
21  public:
22   FX_BOOL OnSetFocus(FX_BOOL& bExit);
23   FX_BOOL OnMouseEnter(FX_BOOL& bExit);
24   FX_BOOL OnMouseDown(FX_BOOL& bExit);
25   FX_BOOL OnMouseUp(FX_BOOL& bExit);
26   FX_BOOL OnMouseExit(FX_BOOL& bExit);
27   FX_BOOL OnKillFocus(FX_BOOL& bExit);
28
29   FX_BOOL OnCalculate();
30   FX_BOOL OnFormat(int iCommitKey);
31   FX_BOOL OnValidate(CPDF_FormField* pFormField,
32                      CFX_WideString& strValue,
33                      CFX_WideString& strChange,
34                      const CFX_WideString& strChangeEx,
35                      FX_BOOL bKeyDown,
36                      FX_BOOL bModifier,
37                      FX_BOOL bShift,
38                      FX_BOOL& bRC);
39   FX_BOOL OnKeyStroke(CPDF_FormField* pFormField,
40                       int nCommitKey,
41                       CFX_WideString& strValue,
42                       CFX_WideString& strChange,
43                       const CFX_WideString& strChangeEx,
44                       FX_BOOL bKeyDown,
45                       FX_BOOL bModifier,
46                       FX_BOOL bShift,
47                       FX_BOOL bWillCommit,
48                       FX_BOOL bFieldFull,
49                       int& nSelStart,
50                       int& nSelEnd,
51                       FX_BOOL& bRC);
52
53   void BeforeNotify();
54   void AfterNotify();
55   FX_BOOL IsNotifying() const { return m_nNotifyFlag > 0; }
56
57  private:
58   FX_BOOL DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit);
59   FX_BOOL FindAAction(CPDF_AAction::AActionType eAAT, CPDF_Action& action);
60   FX_BOOL FindAAction(CPDF_AAction aaction,
61                       CPDF_AAction::AActionType eAAT,
62                       CPDF_Action& action);
63   FX_BOOL ExecuteActionTree(CPDF_AAction::AActionType eAAT,
64                             CPDF_Action& action,
65                             FX_BOOL& bExit);
66   FX_BOOL ExecuteAction(CPDF_AAction::AActionType eAAT,
67                         CPDF_Action& action,
68                         FX_BOOL& bExit);
69
70   FX_BOOL m_bDoActioning;
71   int32_t m_nNotifyFlag;
72 };
73
74 #endif  // FPDFSDK_INCLUDE_FORMFILLER_FFL_NOTIFY_H_