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

Side by Side Diff: xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp

Issue 1938163002: More define cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 7 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
« no previous file with comments | « xfa/fxfa/parser/xfa_script_eventpseudomodel.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "xfa/fxfa/parser/xfa_script_eventpseudomodel.h" 7 #include "xfa/fxfa/parser/xfa_script_eventpseudomodel.h"
8 8
9 #include "xfa/fxfa/app/xfa_ffnotify.h" 9 #include "xfa/fxfa/app/xfa_ffnotify.h"
10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h" 10 #include "xfa/fxfa/fm2js/xfa_fm2jsapi.h"
(...skipping 30 matching lines...) Expand all
41 FX_BOOL bSetting) { 41 FX_BOOL bSetting) {
42 if (bSetting) { 42 if (bSetting) {
43 iValue = FXJSE_Value_ToInteger(hValue); 43 iValue = FXJSE_Value_ToInteger(hValue);
44 } else { 44 } else {
45 FXJSE_Value_SetInteger(hValue, iValue); 45 FXJSE_Value_SetInteger(hValue, iValue);
46 } 46 }
47 } 47 }
48 void Script_EventPseudoModel_BooleanProperty(FXJSE_HVALUE hValue, 48 void Script_EventPseudoModel_BooleanProperty(FXJSE_HVALUE hValue,
49 FX_BOOL& bValue, 49 FX_BOOL& bValue,
50 FX_BOOL bSetting) { 50 FX_BOOL bSetting) {
51 if (bSetting) { 51 if (bSetting)
52 bValue = FXJSE_Value_ToBoolean(hValue); 52 bValue = FXJSE_Value_ToBoolean(hValue);
53 } else { 53 else
54 FXJSE_Value_SetBoolean(hValue, bValue); 54 FXJSE_Value_SetBoolean(hValue, bValue);
55 }
56 } 55 }
56
57 void CScript_EventPseudoModel::Script_EventPseudoModel_Property( 57 void CScript_EventPseudoModel::Script_EventPseudoModel_Property(
58 FXJSE_HVALUE hValue, 58 FXJSE_HVALUE hValue,
59 uint32_t dwFlag, 59 XFA_Event dwFlag,
60 FX_BOOL bSetting) { 60 FX_BOOL bSetting) {
61 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 61 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
62 if (!pScriptContext) { 62 if (!pScriptContext)
63 return; 63 return;
64 } 64
65 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); 65 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam();
66 if (!pEventParam) { 66 if (!pEventParam)
67 return; 67 return;
68 } 68
69 switch (dwFlag) { 69 switch (dwFlag) {
70 case XFA_EVENT_CANCELACTION: 70 case XFA_Event::CancelAction:
71 Script_EventPseudoModel_BooleanProperty( 71 Script_EventPseudoModel_BooleanProperty(
72 hValue, pEventParam->m_bCancelAction, bSetting); 72 hValue, pEventParam->m_bCancelAction, bSetting);
73 break; 73 break;
74 case XFA_EVENT_CHANGE: 74 case XFA_Event::Change:
75 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsChange, 75 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsChange,
76 bSetting); 76 bSetting);
77 break; 77 break;
78 case XFA_EVENT_COMMITKEY: 78 case XFA_Event::CommitKey:
79 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iCommitKey, 79 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iCommitKey,
80 bSetting); 80 bSetting);
81 break; 81 break;
82 case XFA_EVENT_FULLTEXT: 82 case XFA_Event::FullText:
83 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsFullText, 83 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsFullText,
84 bSetting); 84 bSetting);
85 break; 85 break;
86 case XFA_EVENT_KEYDOWN: 86 case XFA_Event::Keydown:
87 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bKeyDown, 87 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bKeyDown,
88 bSetting); 88 bSetting);
89 break; 89 break;
90 case XFA_EVENT_MODIFIER: 90 case XFA_Event::Modifier:
91 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bModifier, 91 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bModifier,
92 bSetting); 92 bSetting);
93 break; 93 break;
94 case XFA_EVENT_NEWCONTENTTYPE: 94 case XFA_Event::NewContentType:
95 Script_EventPseudoModel_StringProperty( 95 Script_EventPseudoModel_StringProperty(
96 hValue, pEventParam->m_wsNewContentType, bSetting); 96 hValue, pEventParam->m_wsNewContentType, bSetting);
97 break; 97 break;
98 case XFA_EVENT_NEWTEXT: 98 case XFA_Event::NewText:
99 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsNewText, 99 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsNewText,
100 bSetting); 100 bSetting);
101 break; 101 break;
102 case XFA_EVENT_PREVCONTENTTYPE: 102 case XFA_Event::PreviousContentType:
103 Script_EventPseudoModel_StringProperty( 103 Script_EventPseudoModel_StringProperty(
104 hValue, pEventParam->m_wsPrevContentType, bSetting); 104 hValue, pEventParam->m_wsPrevContentType, bSetting);
105 break; 105 break;
106 case XFA_EVENT_PREVTEXT: 106 case XFA_Event::PreviousText:
107 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsPrevText, 107 Script_EventPseudoModel_StringProperty(hValue, pEventParam->m_wsPrevText,
108 bSetting); 108 bSetting);
109 break; 109 break;
110 case XFA_EVENT_REENTER: 110 case XFA_Event::Reenter:
111 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bReenter, 111 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bReenter,
112 bSetting); 112 bSetting);
113 break; 113 break;
114 case XFA_EVENT_SELEND: 114 case XFA_Event::SelectionEnd:
115 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelEnd, 115 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelEnd,
116 bSetting); 116 bSetting);
117 break; 117 break;
118 case XFA_EVENT_SELSTART: 118 case XFA_Event::SelectionStart:
119 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelStart, 119 Script_EventPseudoModel_InterProperty(hValue, pEventParam->m_iSelStart,
120 bSetting); 120 bSetting);
121 break; 121 break;
122 case XFA_EVENT_SHIFT: 122 case XFA_Event::Shift:
123 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bShift, 123 Script_EventPseudoModel_BooleanProperty(hValue, pEventParam->m_bShift,
124 bSetting); 124 bSetting);
125 break; 125 break;
126 case XFA_EVENT_SOAPFAULTCODE: 126 case XFA_Event::SoapFaultCode:
127 Script_EventPseudoModel_StringProperty( 127 Script_EventPseudoModel_StringProperty(
128 hValue, pEventParam->m_wsSoapFaultCode, bSetting); 128 hValue, pEventParam->m_wsSoapFaultCode, bSetting);
129 break; 129 break;
130 case XFA_EVENT_SOAPFAULTSTRING: 130 case XFA_Event::SoapFaultString:
131 Script_EventPseudoModel_StringProperty( 131 Script_EventPseudoModel_StringProperty(
132 hValue, pEventParam->m_wsSoapFaultString, bSetting); 132 hValue, pEventParam->m_wsSoapFaultString, bSetting);
133 break; 133 break;
134 case XFA_EVENT_TARGET: 134 case XFA_Event::Target:
135 break; 135 break;
136 default: 136 default:
137 break; 137 break;
138 } 138 }
139 } 139 }
140 void CScript_EventPseudoModel::Script_EventPseudoModel_Change( 140 void CScript_EventPseudoModel::Script_EventPseudoModel_Change(
141 FXJSE_HVALUE hValue, 141 FXJSE_HVALUE hValue,
142 FX_BOOL bSetting, 142 FX_BOOL bSetting,
143 XFA_ATTRIBUTE eAttribute) { 143 XFA_ATTRIBUTE eAttribute) {
144 Script_EventPseudoModel_Property(hValue, XFA_EVENT_CHANGE, bSetting); 144 Script_EventPseudoModel_Property(hValue, XFA_Event::Change, bSetting);
145 } 145 }
146 void CScript_EventPseudoModel::Script_EventPseudoModel_CommitKey( 146 void CScript_EventPseudoModel::Script_EventPseudoModel_CommitKey(
147 FXJSE_HVALUE hValue, 147 FXJSE_HVALUE hValue,
148 FX_BOOL bSetting, 148 FX_BOOL bSetting,
149 XFA_ATTRIBUTE eAttribute) { 149 XFA_ATTRIBUTE eAttribute) {
150 Script_EventPseudoModel_Property(hValue, XFA_EVENT_COMMITKEY, bSetting); 150 Script_EventPseudoModel_Property(hValue, XFA_Event::CommitKey, bSetting);
151 } 151 }
152 void CScript_EventPseudoModel::Script_EventPseudoModel_FullText( 152 void CScript_EventPseudoModel::Script_EventPseudoModel_FullText(
153 FXJSE_HVALUE hValue, 153 FXJSE_HVALUE hValue,
154 FX_BOOL bSetting, 154 FX_BOOL bSetting,
155 XFA_ATTRIBUTE eAttribute) { 155 XFA_ATTRIBUTE eAttribute) {
156 Script_EventPseudoModel_Property(hValue, XFA_EVENT_FULLTEXT, bSetting); 156 Script_EventPseudoModel_Property(hValue, XFA_Event::FullText, bSetting);
157 } 157 }
158 void CScript_EventPseudoModel::Script_EventPseudoModel_KeyDown( 158 void CScript_EventPseudoModel::Script_EventPseudoModel_KeyDown(
159 FXJSE_HVALUE hValue, 159 FXJSE_HVALUE hValue,
160 FX_BOOL bSetting, 160 FX_BOOL bSetting,
161 XFA_ATTRIBUTE eAttribute) { 161 XFA_ATTRIBUTE eAttribute) {
162 Script_EventPseudoModel_Property(hValue, XFA_EVENT_KEYDOWN, bSetting); 162 Script_EventPseudoModel_Property(hValue, XFA_Event::Keydown, bSetting);
163 } 163 }
164 void CScript_EventPseudoModel::Script_EventPseudoModel_Modifier( 164 void CScript_EventPseudoModel::Script_EventPseudoModel_Modifier(
165 FXJSE_HVALUE hValue, 165 FXJSE_HVALUE hValue,
166 FX_BOOL bSetting, 166 FX_BOOL bSetting,
167 XFA_ATTRIBUTE eAttribute) { 167 XFA_ATTRIBUTE eAttribute) {
168 Script_EventPseudoModel_Property(hValue, XFA_EVENT_MODIFIER, bSetting); 168 Script_EventPseudoModel_Property(hValue, XFA_Event::Modifier, bSetting);
169 } 169 }
170 void CScript_EventPseudoModel::Script_EventPseudoModel_NewContentType( 170 void CScript_EventPseudoModel::Script_EventPseudoModel_NewContentType(
171 FXJSE_HVALUE hValue, 171 FXJSE_HVALUE hValue,
172 FX_BOOL bSetting, 172 FX_BOOL bSetting,
173 XFA_ATTRIBUTE eAttribute) { 173 XFA_ATTRIBUTE eAttribute) {
174 Script_EventPseudoModel_Property(hValue, XFA_EVENT_NEWCONTENTTYPE, bSetting); 174 Script_EventPseudoModel_Property(hValue, XFA_Event::NewContentType, bSetting);
175 } 175 }
176 void CScript_EventPseudoModel::Script_EventPseudoModel_NewText( 176 void CScript_EventPseudoModel::Script_EventPseudoModel_NewText(
177 FXJSE_HVALUE hValue, 177 FXJSE_HVALUE hValue,
178 FX_BOOL bSetting, 178 FX_BOOL bSetting,
179 XFA_ATTRIBUTE eAttribute) { 179 XFA_ATTRIBUTE eAttribute) {
180 Script_EventPseudoModel_Property(hValue, XFA_EVENT_NEWTEXT, bSetting); 180 Script_EventPseudoModel_Property(hValue, XFA_Event::NewText, bSetting);
181 } 181 }
182 void CScript_EventPseudoModel::Script_EventPseudoModel_PrevContentType( 182 void CScript_EventPseudoModel::Script_EventPseudoModel_PrevContentType(
183 FXJSE_HVALUE hValue, 183 FXJSE_HVALUE hValue,
184 FX_BOOL bSetting, 184 FX_BOOL bSetting,
185 XFA_ATTRIBUTE eAttribute) { 185 XFA_ATTRIBUTE eAttribute) {
186 Script_EventPseudoModel_Property(hValue, XFA_EVENT_PREVCONTENTTYPE, bSetting); 186 Script_EventPseudoModel_Property(hValue, XFA_Event::PreviousContentType,
187 bSetting);
187 } 188 }
188 void CScript_EventPseudoModel::Script_EventPseudoModel_PrevText( 189 void CScript_EventPseudoModel::Script_EventPseudoModel_PrevText(
189 FXJSE_HVALUE hValue, 190 FXJSE_HVALUE hValue,
190 FX_BOOL bSetting, 191 FX_BOOL bSetting,
191 XFA_ATTRIBUTE eAttribute) { 192 XFA_ATTRIBUTE eAttribute) {
192 Script_EventPseudoModel_Property(hValue, XFA_EVENT_PREVTEXT, bSetting); 193 Script_EventPseudoModel_Property(hValue, XFA_Event::PreviousText, bSetting);
193 } 194 }
194 void CScript_EventPseudoModel::Script_EventPseudoModel_Reenter( 195 void CScript_EventPseudoModel::Script_EventPseudoModel_Reenter(
195 FXJSE_HVALUE hValue, 196 FXJSE_HVALUE hValue,
196 FX_BOOL bSetting, 197 FX_BOOL bSetting,
197 XFA_ATTRIBUTE eAttribute) { 198 XFA_ATTRIBUTE eAttribute) {
198 Script_EventPseudoModel_Property(hValue, XFA_EVENT_REENTER, bSetting); 199 Script_EventPseudoModel_Property(hValue, XFA_Event::Reenter, bSetting);
199 } 200 }
200 void CScript_EventPseudoModel::Script_EventPseudoModel_SelEnd( 201 void CScript_EventPseudoModel::Script_EventPseudoModel_SelEnd(
201 FXJSE_HVALUE hValue, 202 FXJSE_HVALUE hValue,
202 FX_BOOL bSetting, 203 FX_BOOL bSetting,
203 XFA_ATTRIBUTE eAttribute) { 204 XFA_ATTRIBUTE eAttribute) {
204 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SELEND, bSetting); 205 Script_EventPseudoModel_Property(hValue, XFA_Event::SelectionEnd, bSetting);
205 } 206 }
206 void CScript_EventPseudoModel::Script_EventPseudoModel_SelStart( 207 void CScript_EventPseudoModel::Script_EventPseudoModel_SelStart(
207 FXJSE_HVALUE hValue, 208 FXJSE_HVALUE hValue,
208 FX_BOOL bSetting, 209 FX_BOOL bSetting,
209 XFA_ATTRIBUTE eAttribute) { 210 XFA_ATTRIBUTE eAttribute) {
210 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SELSTART, bSetting); 211 Script_EventPseudoModel_Property(hValue, XFA_Event::SelectionStart, bSetting);
211 } 212 }
212 void CScript_EventPseudoModel::Script_EventPseudoModel_Shift( 213 void CScript_EventPseudoModel::Script_EventPseudoModel_Shift(
213 FXJSE_HVALUE hValue, 214 FXJSE_HVALUE hValue,
214 FX_BOOL bSetting, 215 FX_BOOL bSetting,
215 XFA_ATTRIBUTE eAttribute) { 216 XFA_ATTRIBUTE eAttribute) {
216 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SHIFT, bSetting); 217 Script_EventPseudoModel_Property(hValue, XFA_Event::Shift, bSetting);
217 } 218 }
218 void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultCode( 219 void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultCode(
219 FXJSE_HVALUE hValue, 220 FXJSE_HVALUE hValue,
220 FX_BOOL bSetting, 221 FX_BOOL bSetting,
221 XFA_ATTRIBUTE eAttribute) { 222 XFA_ATTRIBUTE eAttribute) {
222 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTCODE, bSetting); 223 Script_EventPseudoModel_Property(hValue, XFA_Event::SoapFaultCode, bSetting);
223 } 224 }
224 void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultString( 225 void CScript_EventPseudoModel::Script_EventPseudoModel_SoapFaultString(
225 FXJSE_HVALUE hValue, 226 FXJSE_HVALUE hValue,
226 FX_BOOL bSetting, 227 FX_BOOL bSetting,
227 XFA_ATTRIBUTE eAttribute) { 228 XFA_ATTRIBUTE eAttribute) {
228 Script_EventPseudoModel_Property(hValue, XFA_EVENT_SOAPFAULTSTRING, bSetting); 229 Script_EventPseudoModel_Property(hValue, XFA_Event::SoapFaultString,
230 bSetting);
229 } 231 }
230 void CScript_EventPseudoModel::Script_EventPseudoModel_Target( 232 void CScript_EventPseudoModel::Script_EventPseudoModel_Target(
231 FXJSE_HVALUE hValue, 233 FXJSE_HVALUE hValue,
232 FX_BOOL bSetting, 234 FX_BOOL bSetting,
233 XFA_ATTRIBUTE eAttribute) { 235 XFA_ATTRIBUTE eAttribute) {
234 Script_EventPseudoModel_Property(hValue, XFA_EVENT_TARGET, bSetting); 236 Script_EventPseudoModel_Property(hValue, XFA_Event::Target, bSetting);
235 } 237 }
236 void CScript_EventPseudoModel::Script_EventPseudoModel_Emit( 238 void CScript_EventPseudoModel::Script_EventPseudoModel_Emit(
237 CFXJSE_Arguments* pArguments) { 239 CFXJSE_Arguments* pArguments) {
238 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 240 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
239 if (!pScriptContext) { 241 if (!pScriptContext) {
240 return; 242 return;
241 } 243 }
242 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); 244 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam();
243 if (!pEventParam) { 245 if (!pEventParam) {
244 return; 246 return;
(...skipping 13 matching lines...) Expand all
258 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext(); 260 CXFA_ScriptContext* pScriptContext = m_pDocument->GetScriptContext();
259 if (!pScriptContext) { 261 if (!pScriptContext) {
260 return; 262 return;
261 } 263 }
262 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam(); 264 CXFA_EventParam* pEventParam = pScriptContext->GetEventParam();
263 if (!pEventParam) { 265 if (!pEventParam) {
264 return; 266 return;
265 } 267 }
266 pEventParam->Reset(); 268 pEventParam->Reset();
267 } 269 }
OLDNEW
« no previous file with comments | « xfa/fxfa/parser/xfa_script_eventpseudomodel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698