OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 // #include "../../include/formfiller/FormFiller.h" | 7 // #include "../../include/formfiller/FormFiller.h" |
8 #include "../../include/formfiller/FFL_FormFiller.h" | 8 #include "../../include/formfiller/FFL_FormFiller.h" |
9 #include "../../include/formfiller/FFL_Notify.h" | 9 #include "../../include/formfiller/FFL_Notify.h" |
10 // #include "../../include/formfiller/FFL_ComboBox.h" | 10 // #include "../../include/formfiller/FFL_ComboBox.h" |
11 // #include "../../include/formfiller/FFL_Module.h" | 11 // #include "../../include/formfiller/FFL_Module.h" |
12 | 12 |
13 /* -------------------------------- CFFL_Notify ------------------------------ *
/ | 13 /* -------------------------------- CFFL_Notify ------------------------------ *
/ |
14 | 14 |
15 //#pragma warning(disable: 4800) | 15 //#pragma warning(disable: 4800) |
16 | 16 |
17 CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : | 17 CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : |
18 » m_bDoActioning(FALSE), | 18 » m_bDoActioning(false), |
19 m_nNotifyFlag(0) | 19 m_nNotifyFlag(0) |
20 { | 20 { |
21 ASSERT(pFormFiller != NULL); | 21 ASSERT(pFormFiller != NULL); |
22 } | 22 } |
23 | 23 |
24 CFFL_Notify::~CFFL_Notify() | 24 CFFL_Notify::~CFFL_Notify() |
25 { | 25 { |
26 } | 26 } |
27 | 27 |
28 void CFFL_Notify::BeforeNotify() | 28 void CFFL_Notify::BeforeNotify() |
29 { | 29 { |
30 m_nNotifyFlag ++; | 30 m_nNotifyFlag ++; |
31 } | 31 } |
32 | 32 |
33 | 33 |
34 void CFFL_Notify::AfterNotify() | 34 void CFFL_Notify::AfterNotify() |
35 { | 35 { |
36 m_nNotifyFlag --; | 36 m_nNotifyFlag --; |
37 } | 37 } |
38 | 38 |
39 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL & bExit) | 39 bool CFFL_Notify::OnMouseUp(bool & bExit) |
40 { | 40 { |
41 BeforeNotify(); | 41 BeforeNotify(); |
42 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonUp, bE
xit); | 42 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit
); |
43 AfterNotify(); | 43 AfterNotify(); |
44 return bRet; | 44 return bRet; |
45 } | 45 } |
46 | 46 |
47 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL & bExit) | 47 bool CFFL_Notify::OnMouseDown(bool & bExit) |
48 { | 48 { |
49 BeforeNotify(); | 49 BeforeNotify(); |
50 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonDown,
bExit); | 50 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::ButtonDown, bEx
it); |
51 AfterNotify(); | 51 AfterNotify(); |
52 return bRet; | 52 return bRet; |
53 } | 53 } |
54 | 54 |
55 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL & bExit) | 55 bool CFFL_Notify::OnMouseEnter(bool & bExit) |
56 { | 56 { |
57 BeforeNotify(); | 57 BeforeNotify(); |
58 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorEnter,
bExit); | 58 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::CursorEnter, bE
xit); |
59 AfterNotify(); | 59 AfterNotify(); |
60 return bRet; | 60 return bRet; |
61 } | 61 } |
62 | 62 |
63 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL & bExit) | 63 bool CFFL_Notify::OnMouseExit(bool & bExit) |
64 { | 64 { |
65 BeforeNotify(); | 65 BeforeNotify(); |
66 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorExit,
bExit); | 66 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::CursorExit, bEx
it); |
67 AfterNotify(); | 67 AfterNotify(); |
68 return bRet; | 68 return bRet; |
69 } | 69 } |
70 | 70 |
71 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL & bExit) | 71 bool CFFL_Notify::OnSetFocus(bool & bExit) |
72 { | 72 { |
73 BeforeNotify(); | 73 BeforeNotify(); |
74 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::GetFocus, bE
xit); | 74 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::GetFocus, bExit
); |
75 AfterNotify(); | 75 AfterNotify(); |
76 return bRet; | 76 return bRet; |
77 } | 77 } |
78 | 78 |
79 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL & bExit) | 79 bool CFFL_Notify::OnKillFocus(bool & bExit) |
80 { | 80 { |
81 BeforeNotify(); | 81 BeforeNotify(); |
82 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::LoseFocus, b
Exit); | 82 » bool bRet = false;//DoAAction(CPDF_AAction::AActionType::LoseFocus, bExi
t); |
83 AfterNotify(); | 83 AfterNotify(); |
84 return bRet; | 84 return bRet; |
85 } | 85 } |
86 | 86 |
87 FX_BOOL CFFL_Notify::OnCalculate() | 87 bool CFFL_Notify::OnCalculate() |
88 { | 88 { |
89 » return TRUE; | 89 » return true; |
90 } | 90 } |
91 | 91 |
92 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) | 92 bool CFFL_Notify::OnFormat(int iCommitKey) |
93 { | 93 { |
94 » return TRUE; | 94 » return true; |
95 } | 95 } |
96 | 96 |
97 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX
_WideString& strValue, CFX_WideString& strChange, | 97 bool CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX_Wi
deString& strValue, CFX_WideString& strChange, |
98 » » » » » » » const CFX_WideString&
strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, | 98 » » » » » » » const CFX_WideString&
strChangeEx, bool bKeyDown, bool bModifier, |
99 » » » » » » » FX_BOOL bShift, FX_BO
OL bWillCommit, FX_BOOL bFieldFull, | 99 » » » » » » » bool bShift, bool bWi
llCommit, bool bFieldFull, |
100 » » » » » » » int& nSelStart, int&
nSelEnd, FX_BOOL& bRC) | 100 » » » » » » » int& nSelStart, int&
nSelEnd, bool& bRC) |
101 { | 101 { |
102 » return TRUE; | 102 » return true; |
103 } | 103 } |
104 | 104 |
105 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strV
alue, CFX_WideString & strChange, | 105 bool CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strValu
e, CFX_WideString & strChange, |
106 » » » » » » » » » const
CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, | 106 » » » » » » » » » const
CFX_WideString& strChangeEx, bool bKeyDown, bool bModifier, |
107 » » » » » » » » » FX_BO
OL bShift, FX_BOOL & bRC) | 107 » » » » » » » » » bool
bShift, bool & bRC) |
108 { | 108 { |
109 » return TRUE; | 109 » return true; |
110 } | 110 } |
111 | 111 |
112 FX_BOOL»CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit) | 112 bool» CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, bool & bExit) |
113 { | 113 { |
114 if (m_bDoActioning) | 114 if (m_bDoActioning) |
115 return FALSE; | 115 return false; |
116 | 116 |
117 CPDF_Action action; | 117 CPDF_Action action; |
118 if (!FindAAction(eAAT, action)) | 118 if (!FindAAction(eAAT, action)) |
119 return FALSE; | 119 return false; |
120 | 120 |
121 m_bDoActioning = TRUE; | 121 m_bDoActioning = true; |
122 ExecuteActionTree(eAAT,action,bExit); | 122 ExecuteActionTree(eAAT,action,bExit); |
123 m_bDoActioning = FALSE; | 123 m_bDoActioning = false; |
124 return TRUE; | 124 return true; |
125 } | 125 } |
126 | 126 |
127 FX_BOOL»CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Actio
n & action, FX_BOOL& bExit) | 127 bool» CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Actio
n & action, bool& bExit) |
128 { | 128 { |
129 » if (!ExecuteAction(eAAT,action,bExit)) return FALSE; | 129 » if (!ExecuteAction(eAAT,action,bExit)) return false; |
130 » if (bExit) return TRUE; | 130 » if (bExit) return true; |
131 | 131 |
132 for (int32_t i=0,sz=action.GetSubActionsCount(); i<sz; i++) | 132 for (int32_t i=0,sz=action.GetSubActionsCount(); i<sz; i++) |
133 { | 133 { |
134 CPDF_Action subaction = action.GetSubAction(i); | 134 CPDF_Action subaction = action.GetSubAction(i); |
135 » » if (!ExecuteActionTree(eAAT,subaction,bExit)) return FALSE; | 135 » » if (!ExecuteActionTree(eAAT,subaction,bExit)) return false; |
136 if (bExit) break; | 136 if (bExit) break; |
137 } | 137 } |
138 | 138 |
139 » return TRUE; | 139 » return true; |
140 } | 140 } |
141 | 141 |
142 | 142 |
143 FX_BOOL»CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & ac
tion) | 143 bool» CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & ac
tion) |
144 { | 144 { |
145 » return FALSE; | 145 » return false; |
146 } | 146 } |
147 | 147 |
148 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType
eAAT,CPDF_Action & action) | 148 bool CFFL_Notify::FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAA
T,CPDF_Action & action) |
149 { | 149 { |
150 CPDF_Action MyAction; | 150 CPDF_Action MyAction; |
151 | 151 |
152 if (aaction.ActionExist(eAAT)) | 152 if (aaction.ActionExist(eAAT)) |
153 { | 153 { |
154 MyAction = aaction.GetAction(eAAT); | 154 MyAction = aaction.GetAction(eAAT); |
155 } | 155 } |
156 else | 156 else |
157 » » return FALSE; | 157 » » return false; |
158 | 158 |
159 | 159 |
160 if (MyAction.GetType() == CPDF_Action::Unknown) | 160 if (MyAction.GetType() == CPDF_Action::Unknown) |
161 » » return FALSE; | 161 » » return false; |
162 | 162 |
163 action = MyAction; | 163 action = MyAction; |
164 | 164 |
165 » return TRUE; | 165 » return true; |
166 } | 166 } |
167 | 167 |
168 FX_BOOL»CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action &
action,FX_BOOL& bExit) | 168 bool» CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action &
action,bool& bExit) |
169 { | 169 { |
170 » return FALSE; | 170 » return false; |
171 } | 171 } |
172 //#pragma warning(default: 4800) | 172 //#pragma warning(default: 4800) |
173 | 173 |
OLD | NEW |