Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Side by Side Diff: fpdfsdk/src/formfiller/FFL_Notify.cpp

Issue 1265503005: clang-format all pdfium code. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: sigh Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
15 //#pragma warning(disable: 4800) 16 //#pragma warning(disable: 4800)
16 17
17 CFFL_Notify::CFFL_Notify(CFFL_FormFiller * pFormFiller) : 18 CFFL_Notify::CFFL_Notify(CFFL_FormFiller* pFormFiller)
18 » m_bDoActioning(FALSE), 19 : m_bDoActioning(FALSE), m_nNotifyFlag(0) {
19 » m_nNotifyFlag(0) 20 ASSERT(pFormFiller != NULL);
20 {
21 » ASSERT(pFormFiller != NULL);
22 } 21 }
23 22
24 CFFL_Notify::~CFFL_Notify() 23 CFFL_Notify::~CFFL_Notify() {}
25 { 24
25 void CFFL_Notify::BeforeNotify() {
26 m_nNotifyFlag++;
26 } 27 }
27 28
28 void CFFL_Notify::BeforeNotify() 29 void CFFL_Notify::AfterNotify() {
29 { 30 m_nNotifyFlag--;
30 » m_nNotifyFlag ++;
31 } 31 }
32 32
33 33 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL& bExit) {
34 void CFFL_Notify::AfterNotify() 34 BeforeNotify();
35 { 35 FX_BOOL bRet =
36 » m_nNotifyFlag --; 36 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonUp, bExit);
37 AfterNotify();
38 return bRet;
37 } 39 }
38 40
39 FX_BOOL CFFL_Notify::OnMouseUp(FX_BOOL & bExit) 41 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL& bExit) {
40 { 42 BeforeNotify();
41 » BeforeNotify(); 43 FX_BOOL bRet =
42 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonUp, bE xit); 44 FALSE; // DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit);
43 » AfterNotify(); 45 AfterNotify();
44 » return bRet; 46 return bRet;
45 } 47 }
46 48
47 FX_BOOL CFFL_Notify::OnMouseDown(FX_BOOL & bExit) 49 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL& bExit) {
48 { 50 BeforeNotify();
49 » BeforeNotify(); 51 FX_BOOL bRet =
50 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::ButtonDown, bExit); 52 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit);
51 » AfterNotify(); 53 AfterNotify();
52 » return bRet; 54 return bRet;
53 } 55 }
54 56
55 FX_BOOL CFFL_Notify::OnMouseEnter(FX_BOOL & bExit) 57 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL& bExit) {
56 { 58 BeforeNotify();
57 » BeforeNotify(); 59 FX_BOOL bRet =
58 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorEnter, bExit); 60 FALSE; // DoAAction(CPDF_AAction::AActionType::CursorExit, bExit);
59 » AfterNotify(); 61 AfterNotify();
60 » return bRet; 62 return bRet;
61 } 63 }
62 64
63 FX_BOOL CFFL_Notify::OnMouseExit(FX_BOOL & bExit) 65 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL& bExit) {
64 { 66 BeforeNotify();
65 » BeforeNotify(); 67 FX_BOOL bRet =
66 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::CursorExit, bExit); 68 FALSE; // DoAAction(CPDF_AAction::AActionType::GetFocus, bExit);
67 » AfterNotify(); 69 AfterNotify();
68 » return bRet; 70 return bRet;
69 } 71 }
70 72
71 FX_BOOL CFFL_Notify::OnSetFocus(FX_BOOL & bExit) 73 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL& bExit) {
72 { 74 BeforeNotify();
73 » BeforeNotify(); 75 FX_BOOL bRet =
74 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::GetFocus, bE xit); 76 FALSE; // DoAAction(CPDF_AAction::AActionType::LoseFocus, bExit);
75 » AfterNotify(); 77 AfterNotify();
76 » return bRet; 78 return bRet;
77 } 79 }
78 80
79 FX_BOOL CFFL_Notify::OnKillFocus(FX_BOOL & bExit) 81 FX_BOOL CFFL_Notify::OnCalculate() {
80 { 82 return TRUE;
81 » BeforeNotify();
82 » FX_BOOL bRet = FALSE;//DoAAction(CPDF_AAction::AActionType::LoseFocus, b Exit);
83 » AfterNotify();
84 » return bRet;
85 } 83 }
86 84
87 FX_BOOL CFFL_Notify::OnCalculate() 85 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) {
88 { 86 return TRUE;
89 » return TRUE;
90 } 87 }
91 88
92 FX_BOOL CFFL_Notify::OnFormat(int iCommitKey) 89 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField,
93 { 90 int nCommitKey,
94 » return TRUE; 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;
95 } 103 }
96 104
97 FX_BOOL CFFL_Notify::OnKeyStroke(CPDF_FormField* pFormField, int nCommitKey, CFX _WideString& strValue, CFX_WideString& strChange, 105 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField,
98 » » » » » » » const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, 106 CFX_WideString& strValue,
99 » » » » » » » FX_BOOL bShift, FX_BO OL bWillCommit, FX_BOOL bFieldFull, 107 CFX_WideString& strChange,
100 » » » » » » » int& nSelStart, int& nSelEnd, FX_BOOL& bRC) 108 const CFX_WideString& strChangeEx,
101 { 109 FX_BOOL bKeyDown,
102 » return TRUE; 110 FX_BOOL bModifier,
111 FX_BOOL bShift,
112 FX_BOOL& bRC) {
113 return TRUE;
103 } 114 }
104 115
105 FX_BOOL CFFL_Notify::OnValidate(CPDF_FormField* pFormField, CFX_WideString& strV alue, CFX_WideString & strChange, 116 FX_BOOL CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL& bExit) {
106 » » » » » » » » » const CFX_WideString& strChangeEx, FX_BOOL bKeyDown, FX_BOOL bModifier, 117 if (m_bDoActioning)
107 » » » » » » » » » FX_BO OL bShift, FX_BOOL & bRC) 118 return FALSE;
108 { 119
109 » return TRUE; 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;
110 } 128 }
111 129
112 FX_BOOL»CFFL_Notify::DoAAction(CPDF_AAction::AActionType eAAT, FX_BOOL & bExit) 130 FX_BOOL CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,
113 { 131 CPDF_Action& action,
114 if (m_bDoActioning) 132 FX_BOOL& bExit) {
115 return FALSE; 133 if (!ExecuteAction(eAAT, action, bExit))
134 return FALSE;
135 if (bExit)
136 return TRUE;
116 137
117 CPDF_Action action; 138 for (int32_t i = 0, sz = action.GetSubActionsCount(); i < sz; i++) {
118 if (!FindAAction(eAAT, action)) 139 CPDF_Action subaction = action.GetSubAction(i);
119 return FALSE; 140 if (!ExecuteActionTree(eAAT, subaction, bExit))
141 return FALSE;
142 if (bExit)
143 break;
144 }
120 145
121 m_bDoActioning = TRUE; 146 return TRUE;
122 ExecuteActionTree(eAAT,action,bExit);
123 m_bDoActioning = FALSE;
124 return TRUE;
125 } 147 }
126 148
127 FX_BOOL»CFFL_Notify::ExecuteActionTree(CPDF_AAction::AActionType eAAT,CPDF_Actio n & action, FX_BOOL& bExit) 149 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,
128 { 150 CPDF_Action& action) {
129 » if (!ExecuteAction(eAAT,action,bExit)) return FALSE; 151 return FALSE;
130 » if (bExit) return TRUE;
131
132 » for (int32_t i=0,sz=action.GetSubActionsCount(); i<sz; i++)
133 » {
134 » » CPDF_Action subaction = action.GetSubAction(i);
135 » » if (!ExecuteActionTree(eAAT,subaction,bExit)) return FALSE;
136 » » if (bExit) break;
137 » }
138
139 » return TRUE;
140 } 152 }
141 153
154 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,
155 CPDF_AAction::AActionType eAAT,
156 CPDF_Action& action) {
157 CPDF_Action MyAction;
142 158
143 FX_BOOL»CFFL_Notify::FindAAction(CPDF_AAction::AActionType eAAT,CPDF_Action & ac tion) 159 if (aaction.ActionExist(eAAT)) {
144 { 160 MyAction = aaction.GetAction(eAAT);
145 » return FALSE; 161 } else
162 return FALSE;
163
164 if (MyAction.GetType() == CPDF_Action::Unknown)
165 return FALSE;
166
167 action = MyAction;
168
169 return TRUE;
146 } 170 }
147 171
148 FX_BOOL CFFL_Notify::FindAAction(CPDF_AAction aaction,CPDF_AAction::AActionType eAAT,CPDF_Action & action) 172 FX_BOOL CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,
149 { 173 CPDF_Action& action,
150 » CPDF_Action MyAction; 174 FX_BOOL& bExit) {
151 175 return FALSE;
152 » if (aaction.ActionExist(eAAT))
153 » {
154 » » MyAction = aaction.GetAction(eAAT);
155 » }
156 » else
157 » » return FALSE;
158
159
160 » if (MyAction.GetType() == CPDF_Action::Unknown)
161 » » return FALSE;
162
163 » action = MyAction;
164
165 » return TRUE;
166 }
167
168 FX_BOOL»CFFL_Notify::ExecuteAction(CPDF_AAction::AActionType eAAT,CPDF_Action & action,FX_BOOL& bExit)
169 {
170 » return FALSE;
171 } 176 }
172 //#pragma warning(default: 4800) 177 //#pragma warning(default: 4800)
173
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698