OLD | NEW |
| (Empty) |
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 // #include "../../include/formfiller/FormFiller.h" | |
8 #include "../../include/formfiller/FFL_FormFiller.h" | |
9 #include "../../include/formfiller/FFL_Notify.h" | |
10 // #include "../../include/formfiller/FFL_ComboBox.h" | |
11 // #include "../../include/formfiller/FFL_Module.h" | |
12 | |
13 /* -------------------------------- CFFL_Notify ------------------------------ | |
14 */ | |
15 | |
16 //#pragma warning(disable: 4800) | |
17 | |
18 CFFL_Notify::CFFL_Notify(CFFL_FormFiller* pFormFiller) | |
19 : m_bDoActioning(FALSE), m_nNotifyFlag(0) { | |
20 ASSERT(pFormFiller != NULL); | |
21 } | |
22 | |
23 CFFL_Notify::~CFFL_Notify() {} | |
24 | |
25 void CFFL_Notify::BeforeNotify() { | |
26 m_nNotifyFlag++; | |
27 } | |
28 | |
29 void CFFL_Notify::AfterNotify() { | |
30 m_nNotifyFlag--; | |
31 } | |
32 | |
33 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL& bExit) { | |
34 BeforeNotify(); | |
35 FX_BOOL bRet = | |
36 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit); | |
37 AfterNotify(); | |
38 return bRet; | |
39 } | |
40 | |
41 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL& bExit) { | |
42 BeforeNotify(); | |
43 FX_BOOL bRet = | |
44 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit); | |
45 AfterNotify(); | |
46 return bRet; | |
47 } | |
48 | |
49 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL& bExit) { | |
50 BeforeNotify(); | |
51 FX_BOOL bRet = | |
52 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit); | |
53 AfterNotify(); | |
54 return bRet; | |
55 } | |
56 | |
57 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL& bExit) { | |
58 BeforeNotify(); | |
59 FX_BOOL bRet = | |
60 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorExit, bExit); | |
61 AfterNotify(); | |
62 return bRet; | |
63 } | |
64 | |
65 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL& bExit) { | |
66 BeforeNotify(); | |
67 FX_BOOL bRet = | |
68 FALSE; // DoAAction(CPDF_AAction::AActionType::GetFocus, bExit); | |
69 AfterNotify(); | |
70 return bRet; | |
71 } | |
72 | |
73 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL& bExit) { | |
74 BeforeNotify(); | |
75 FX_BOOL bRet = | |
76 FALSE; // DoAAction(CPDF_AAction::AActionType::LoseFocus, bExit); | |
77 AfterNotify(); | |
78 return bRet; | |
79 } | |
80 | |
81 FX_BOOL CFFL_Notify::OnCalculate() { | |
82 return TRUE; | |
83 } | |
84 | |
85 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) { | |
86 return TRUE; | |
87 } | |
88 | |
89 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, | |
90 int nCommitKey, | |
91 CFX_WideString& strValue, | |
92 CFX_WideString& strChange, | |
93 const CFX_WideString& strChangeEx, | |
94 FX_BOOL bKeyDown, | |
95 FX_BOOL bModifier, | |
96 FX_BOOL bShift, | |
97 FX_BOOL bWillCommit, | |
98 FX_BOOL bFieldFull, | |
99 int& nSelStart, | |
100 int& nSelEnd, | |
101 FX_BOOL& bRC) { | |
102 return TRUE; | |
103 } | |
104 | |
105 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, | |
106 CFX_WideString& strValue, | |
107 CFX_WideString& strChange, | |
108 const CFX_WideString& strChangeEx, | |
109 FX_BOOL bKeyDown, | |
110 FX_BOOL bModifier, | |
111 FX_BOOL bShift, | |
112 FX_BOOL& bRC) { | |
113 return TRUE; | |
114 } | |
115 | |
116 FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit) { | |
117 if (m_bDoActioning) | |
118 return FALSE; | |
119 | |
120 CPDF_Action action; | |
121 if (!FindAAction(eAAT, action)) | |
122 return FALSE; | |
123 | |
124 m_bDoActioning = TRUE; | |
125 ExecuteActionTree(eAAT, action, bExit); | |
126 m_bDoActioning = FALSE; | |
127 return TRUE; | |
128 } | |
129 | |
130 FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT, | |
131 CPDF_Action& action, | |
132 FX_BOOL& bExit) { | |
133 if (!ExecuteAction(eAAT, action, bExit)) | |
134 return FALSE; | |
135 if (bExit) | |
136 return TRUE; | |
137 | |
138 for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) { | |
139 CPDF_Action subaction = action.GetSubAction(i); | |
140 if (!ExecuteActionTree(eAAT, subaction, bExit)) | |
141 return FALSE; | |
142 if (bExit) | |
143 break; | |
144 } | |
145 | |
146 return TRUE; | |
147 } | |
148 | |
149 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT, | |
150 CPDF_Action& action) { | |
151 return FALSE; | |
152 } | |
153 | |
154 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction, | |
155 CPDF_AAction::AActionType eAAT, | |
156 CPDF_Action& action) { | |
157 CPDF_Action MyAction; | |
158 | |
159 if (aaction.ActionExist(eAAT)) { | |
160 MyAction = aaction.GetAction(eAAT); | |
161 } else | |
162 return FALSE; | |
163 | |
164 if (MyAction.GetType() == CPDF_Action::Unknown) | |
165 return FALSE; | |
166 | |
167 action = MyAction; | |
168 | |
169 return TRUE; | |
170 } | |
171 | |
172 FX_BOOL CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT, | |
173 CPDF_Action& action, | |
174 FX_BOOL& bExit) { | |
175 return FALSE; | |
176 } | |
177 //#pragma warning(default: 4800) | |
OLD | NEW |