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

Side by Side Diff: fpdfsdk/src/javascript/JS_EventHandler.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « fpdfsdk/src/javascript/Field.cpp ('k') | fpdfsdk/src/javascript/JS_GlobalData.cpp » ('j') | 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 "../../include/javascript/JavaScript.h" 7 #include "../../include/javascript/JavaScript.h"
8 #include "../../include/javascript/IJavaScript.h" 8 #include "../../include/javascript/IJavaScript.h"
9 #include "../../include/javascript/JS_EventHandler.h" 9 #include "../../include/javascript/JS_EventHandler.h"
10 //#include "../../include/javascript/JS_ResMgr.h"
11 #include "../../include/javascript/JS_Context.h" 10 #include "../../include/javascript/JS_Context.h"
12 #include "../../include/javascript/JS_Runtime.h" 11 #include "../../include/javascript/JS_Runtime.h"
13 #include "../../include/javascript/JS_Define.h" 12 #include "../../include/javascript/JS_Define.h"
14 #include "../../include/javascript/JS_Object.h" 13 #include "../../include/javascript/JS_Object.h"
15 #include "../../include/javascript/JS_Value.h" 14 #include "../../include/javascript/JS_Value.h"
16 #include "../../include/javascript/Document.h" 15 #include "../../include/javascript/Document.h"
17 #include "../../include/javascript/Field.h" 16 #include "../../include/javascript/Field.h"
18 17
19 /* ---------------------------- CJS_EventHandler ---------------------------- */ 18 /* ---------------------------- CJS_EventHandler ---------------------------- */
20 19
21 CJS_EventHandler::CJS_EventHandler(CJS_Context * pContext)» : 20 CJS_EventHandler::CJS_EventHandler(CJS_Context * pContext) :
22 » m_pJSContext(pContext), 21 m_pJSContext(pContext),
23 » m_eEventType(JET_UNKNOWN), 22 m_eEventType(JET_UNKNOWN),
24 » m_bValid(FALSE), 23 m_bValid(FALSE),
25 » m_pWideStrChange(NULL), 24 m_pWideStrChange(NULL),
26 » m_nCommitKey(-1), 25 m_nCommitKey(-1),
27 » m_bKeyDown(FALSE), 26 m_bKeyDown(FALSE),
28 » m_bModifier(FALSE), 27 m_bModifier(FALSE),
29 » m_bShift(FALSE), 28 m_bShift(FALSE),
30 » m_pISelEnd(NULL), 29 m_pISelEnd(NULL),
31 » m_nSelEndDu(0), 30 m_nSelEndDu(0),
32 » m_pISelStart(NULL), 31 m_pISelStart(NULL),
33 » m_nSelStartDu(0), 32 m_nSelStartDu(0),
34 » m_bWillCommit(FALSE), 33 m_bWillCommit(FALSE),
35 » m_pValue(NULL), 34 m_pValue(NULL),
36 » m_bFieldFull(FALSE), 35 m_bFieldFull(FALSE),
37 » m_pbRc(NULL), 36 m_pbRc(NULL),
38 » m_bRcDu(FALSE), 37 m_bRcDu(FALSE),
39 » m_pSourceDoc(NULL), 38 m_pSourceDoc(NULL),
40 » m_pTargetBookMark(NULL), 39 m_pTargetBookMark(NULL),
41 » m_pTargetDoc(NULL), 40 m_pTargetDoc(NULL),
42 » m_pTargetAnnot(NULL) 41 m_pTargetAnnot(NULL)
43 { 42 {
44 } 43 }
45 44
46 CJS_EventHandler::~CJS_EventHandler() 45 CJS_EventHandler::~CJS_EventHandler()
47 { 46 {
48 } 47 }
49 48
50 void CJS_EventHandler::OnApp_Init() 49 void CJS_EventHandler::OnApp_Init()
51 { 50 {
52 » Initial(JET_APP_INIT); 51 Initial(JET_APP_INIT);
53 } 52 }
54 53
55 void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName) 54 void CJS_EventHandler::OnDoc_Open(CPDFSDK_Document* pDoc, const CFX_WideString& strTargetName)
56 { 55 {
57 » Initial(JET_DOC_OPEN); 56 Initial(JET_DOC_OPEN);
58 57
59 » m_pTargetDoc = pDoc; 58 m_pTargetDoc = pDoc;
60 » m_strTargetName = strTargetName; 59 m_strTargetName = strTargetName;
61 } 60 }
62 61
63 void CJS_EventHandler::OnDoc_WillPrint(CPDFSDK_Document* pDoc) 62 void CJS_EventHandler::OnDoc_WillPrint(CPDFSDK_Document* pDoc)
64 { 63 {
65 » Initial(JET_DOC_WILLPRINT); 64 Initial(JET_DOC_WILLPRINT);
66 65
67 » m_pTargetDoc = pDoc; 66 m_pTargetDoc = pDoc;
68 } 67 }
69 68
70 void CJS_EventHandler::OnDoc_DidPrint(CPDFSDK_Document* pDoc) 69 void CJS_EventHandler::OnDoc_DidPrint(CPDFSDK_Document* pDoc)
71 { 70 {
72 » Initial(JET_DOC_DIDPRINT); 71 Initial(JET_DOC_DIDPRINT);
73 72
74 » m_pTargetDoc = pDoc; 73 m_pTargetDoc = pDoc;
75 } 74 }
76 75
77 void CJS_EventHandler::OnDoc_WillSave(CPDFSDK_Document* pDoc) 76 void CJS_EventHandler::OnDoc_WillSave(CPDFSDK_Document* pDoc)
78 { 77 {
79 » Initial(JET_DOC_WILLSAVE); 78 Initial(JET_DOC_WILLSAVE);
80 » m_pTargetDoc = pDoc; 79 m_pTargetDoc = pDoc;
81 } 80 }
82 81
83 void CJS_EventHandler::OnDoc_DidSave(CPDFSDK_Document* pDoc) 82 void CJS_EventHandler::OnDoc_DidSave(CPDFSDK_Document* pDoc)
84 { 83 {
85 » Initial(JET_DOC_DIDSAVE); 84 Initial(JET_DOC_DIDSAVE);
86 85
87 » m_pTargetDoc = pDoc; 86 m_pTargetDoc = pDoc;
88 } 87 }
89 88
90 void CJS_EventHandler::OnDoc_WillClose(CPDFSDK_Document* pDoc) 89 void CJS_EventHandler::OnDoc_WillClose(CPDFSDK_Document* pDoc)
91 { 90 {
92 » Initial(JET_DOC_WILLCLOSE); 91 Initial(JET_DOC_WILLCLOSE);
93 92
94 » m_pTargetDoc = pDoc; 93 m_pTargetDoc = pDoc;
95 } 94 }
96 95
97 void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc) 96 void CJS_EventHandler::OnPage_Open(CPDFSDK_Document* pDoc)
98 { 97 {
99 » Initial(JET_PAGE_OPEN); 98 Initial(JET_PAGE_OPEN);
100 99
101 » m_pTargetDoc = pDoc; 100 m_pTargetDoc = pDoc;
102 } 101 }
103 102
104 void CJS_EventHandler::OnPage_Close(CPDFSDK_Document* pDoc) 103 void CJS_EventHandler::OnPage_Close(CPDFSDK_Document* pDoc)
105 { 104 {
106 » Initial(JET_PAGE_CLOSE); 105 Initial(JET_PAGE_CLOSE);
107 106
108 » m_pTargetDoc = pDoc; 107 m_pTargetDoc = pDoc;
109 } 108 }
110 109
111 void CJS_EventHandler::OnPage_InView(CPDFSDK_Document* pDoc) 110 void CJS_EventHandler::OnPage_InView(CPDFSDK_Document* pDoc)
112 { 111 {
113 » Initial(JET_PAGE_INVIEW); 112 Initial(JET_PAGE_INVIEW);
114 113
115 » m_pTargetDoc = pDoc; 114 m_pTargetDoc = pDoc;
116 } 115 }
117 116
118 void CJS_EventHandler::OnPage_OutView(CPDFSDK_Document* pDoc) 117 void CJS_EventHandler::OnPage_OutView(CPDFSDK_Document* pDoc)
119 { 118 {
120 » Initial(JET_PAGE_OUTVIEW); 119 Initial(JET_PAGE_OUTVIEW);
121 120
122 » m_pTargetDoc = pDoc; 121 m_pTargetDoc = pDoc;
123 } 122 }
124 123
125 void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPD F_FormField* pTarget) 124 void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CPD F_FormField* pTarget)
126 { 125 {
127 » Initial(JET_FIELD_MOUSEENTER); 126 Initial(JET_FIELD_MOUSEENTER);
128 127
129 » m_bModifier = bModifier; 128 m_bModifier = bModifier;
130 » m_bShift = bShift; 129 m_bShift = bShift;
131 130
132 » ASSERT(pTarget != NULL); 131 ASSERT(pTarget != NULL);
133 » m_strTargetName = pTarget->GetFullName(); 132 m_strTargetName = pTarget->GetFullName();
134 } 133 }
135 134
136 void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF _FormField* pTarget) 135 void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPDF _FormField* pTarget)
137 { 136 {
138 » Initial(JET_FIELD_MOUSEEXIT); 137 Initial(JET_FIELD_MOUSEEXIT);
139 138
140 » m_bModifier = bModifier; 139 m_bModifier = bModifier;
141 » m_bShift = bShift; 140 m_bShift = bShift;
142 » ASSERT(pTarget != NULL); 141 ASSERT(pTarget != NULL);
143 » m_strTargetName = pTarget->GetFullName(); 142 m_strTargetName = pTarget->GetFullName();
144 } 143 }
145 144
146 void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF _FormField* pTarget) 145 void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPDF _FormField* pTarget)
147 { 146 {
148 » Initial(JET_FIELD_MOUSEDOWN); 147 Initial(JET_FIELD_MOUSEDOWN);
149 » m_eEventType = JET_FIELD_MOUSEDOWN; 148 m_eEventType = JET_FIELD_MOUSEDOWN;
150 149
151 » m_bModifier = bModifier; 150 m_bModifier = bModifier;
152 » m_bShift = bShift; 151 m_bShift = bShift;
153 » ASSERT(pTarget != NULL); 152 ASSERT(pTarget != NULL);
154 » m_strTargetName = pTarget->GetFullName(); 153 m_strTargetName = pTarget->GetFullName();
155 } 154 }
156 155
157 void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_F ormField* pTarget) 156 void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDF_F ormField* pTarget)
158 { 157 {
159 » Initial(JET_FIELD_MOUSEUP); 158 Initial(JET_FIELD_MOUSEUP);
160 159
161 » m_bModifier = bModifier; 160 m_bModifier = bModifier;
162 » m_bShift = bShift; 161 m_bShift = bShift;
163 » ASSERT(pTarget != NULL); 162 ASSERT(pTarget != NULL);
164 » m_strTargetName = pTarget->GetFullName(); 163 m_strTargetName = pTarget->GetFullName();
165 } 164 }
166 165
167 void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_For mField* pTarget, 166 void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDF_For mField* pTarget,
168 » » » » » » » » » const C FX_WideString& Value) 167 const CFX_WideString& Value)
169 { 168 {
170 » Initial(JET_FIELD_FOCUS); 169 Initial(JET_FIELD_FOCUS);
171 170
172 » m_bModifier = bModifier; 171 m_bModifier = bModifier;
173 » m_bShift = bShift; 172 m_bShift = bShift;
174 » ASSERT(pTarget != NULL); 173 ASSERT(pTarget != NULL);
175 » m_strTargetName = pTarget->GetFullName(); 174 m_strTargetName = pTarget->GetFullName();
176 » m_pValue = (CFX_WideString*)&Value; 175 m_pValue = (CFX_WideString*)&Value;
177 } 176 }
178 177
179 void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_Form Field* pTarget, 178 void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDF_Form Field* pTarget,
180 » » » » » » » » » const CF X_WideString& Value) 179 const CFX_WideString& Value)
181 { 180 {
182 » Initial(JET_FIELD_BLUR); 181 Initial(JET_FIELD_BLUR);
183 182
184 » m_bModifier = bModifier; 183 m_bModifier = bModifier;
185 » m_bShift = bShift; 184 m_bShift = bShift;
186 » ASSERT(pTarget != NULL); 185 ASSERT(pTarget != NULL);
187 » m_strTargetName = pTarget->GetFullName(); 186 m_strTargetName = pTarget->GetFullName();
188 » m_pValue = (CFX_WideString*)&Value; 187 m_pValue = (CFX_WideString*)&Value;
189 } 188 }
190 189
191 void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange, 190 void CJS_EventHandler::OnField_Keystroke(CFX_WideString &strChange,
192 » » » » » » » » » » const CFX_WideString& strChangeEx, FX_BOOL KeyDown, 191 const CFX_WideString& strChangeEx, FX_B OOL KeyDown,
193 » » » » » » » » » » FX_BOOL bModifier, int& nSelEnd, int& nSelStart, 192 FX_BOOL bModifier, int& nSelEnd, int& n SelStart,
194 » » » » » » » » » » FX_BOOL bShift, CPDF_FormField* pTarget, 193 FX_BOOL bShift, CPDF_FormField* pTarget ,
195 » » » » » » » » » » CFX_WideString& Value, FX_BOOL bWillCommit, 194 CFX_WideString& Value, FX_BOOL bWillCom mit,
196 » » » » » » » » » » FX_BOOL bFieldFull, FX_BOOL& bRc) 195 FX_BOOL bFieldFull, FX_BOOL& bRc)
197 { 196 {
198 » Initial(JET_FIELD_KEYSTROKE); 197 Initial(JET_FIELD_KEYSTROKE);
199 198
200 » m_nCommitKey = 0; 199 m_nCommitKey = 0;
201 » m_pWideStrChange = &strChange; 200 m_pWideStrChange = &strChange;
202 » m_WideStrChangeEx = strChangeEx; 201 m_WideStrChangeEx = strChangeEx;
203 » m_bKeyDown = KeyDown; 202 m_bKeyDown = KeyDown;
204 » m_bModifier = bModifier; 203 m_bModifier = bModifier;
205 » m_pISelEnd = &nSelEnd; 204 m_pISelEnd = &nSelEnd;
206 » m_pISelStart = &nSelStart; 205 m_pISelStart = &nSelStart;
207 » m_bShift = bShift; 206 m_bShift = bShift;
208 » ASSERT(pTarget != NULL); 207 ASSERT(pTarget != NULL);
209 » m_strTargetName = pTarget->GetFullName(); 208 m_strTargetName = pTarget->GetFullName();
210 » m_pValue = &Value; 209 m_pValue = &Value;
211 » m_bWillCommit = bWillCommit; 210 m_bWillCommit = bWillCommit;
212 » m_pbRc = &bRc; 211 m_pbRc = &bRc;
213 » m_bFieldFull = bFieldFull; 212 m_bFieldFull = bFieldFull;
214 } 213 }
215 214
216 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, const CFX_Wid eString& strChangeEx, 215 void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange, const CFX_Wid eString& strChangeEx,
217 » » » » » » » » » » FX_BOOL bKeyDown, FX_BOOL bModifier, FX_BOOL bShift, 216 FX_BOOL bKeyDown, FX_BOOL bModifier, FX_ BOOL bShift,
218 » » » » » » » » » » CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc) 217 CPDF_FormField* pTarget, CFX_WideString& Value, FX_BOOL& bRc)
219 { 218 {
220 » Initial(JET_FIELD_VALIDATE); 219 Initial(JET_FIELD_VALIDATE);
221 220
222 » m_pWideStrChange = &strChange; 221 m_pWideStrChange = &strChange;
223 » m_WideStrChangeEx = strChangeEx; 222 m_WideStrChangeEx = strChangeEx;
224 » m_bKeyDown = bKeyDown; 223 m_bKeyDown = bKeyDown;
225 » m_bModifier = bModifier; 224 m_bModifier = bModifier;
226 » m_bShift = bShift; 225 m_bShift = bShift;
227 » ASSERT(pTarget != NULL); 226 ASSERT(pTarget != NULL);
228 » m_strTargetName = pTarget->GetFullName(); 227 m_strTargetName = pTarget->GetFullName();
229 » m_pValue = &Value; 228 m_pValue = &Value;
230 » m_pbRc = &bRc; 229 m_pbRc = &bRc;
231 } 230 }
232 231
233 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField * pTarget, 232 void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource, CPDF_FormField * pTarget,
234 » » » » » » » » » » CFX_WideString& Value, FX_BOOL& bRc) 233 CFX_WideString& Value, FX_BOOL& bRc)
235 { 234 {
236 » Initial(JET_FIELD_CALCULATE); 235 Initial(JET_FIELD_CALCULATE);
237 236
238 » if (pSource) 237 if (pSource)
239 » » m_strSourceName = pSource->GetFullName(); 238 m_strSourceName = pSource->GetFullName();
240 » ASSERT(pTarget != NULL); 239 ASSERT(pTarget != NULL);
241 » m_strTargetName = pTarget->GetFullName(); 240 m_strTargetName = pTarget->GetFullName();
242 m_pValue = &Value; 241 m_pValue = &Value;
243 » m_pbRc = &bRc; 242 m_pbRc = &bRc;
244 } 243 }
245 244
246 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget, 245 void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
247 CFX_WideString& Value, 246 CFX_WideString& Value,
248 FX_BOOL bWillCommit) 247 FX_BOOL bWillCommit)
249 { 248 {
250 » Initial(JET_FIELD_FORMAT); 249 Initial(JET_FIELD_FORMAT);
251 250
252 » m_nCommitKey = 0; 251 m_nCommitKey = 0;
253 » ASSERT(pTarget != NULL); 252 ASSERT(pTarget != NULL);
254 » m_strTargetName = pTarget->GetFullName(); 253 m_strTargetName = pTarget->GetFullName();
255 » m_pValue = &Value; 254 m_pValue = &Value;
256 » m_bWillCommit = bWillCommit; 255 m_bWillCommit = bWillCommit;
257 } 256 }
258 257
259 void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK _Annot* pScreen) 258 void CJS_EventHandler::OnScreen_Focus(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK _Annot* pScreen)
260 { 259 {
261 » Initial(JET_SCREEN_FOCUS); 260 Initial(JET_SCREEN_FOCUS);
262 261
263 » m_bModifier = bModifier; 262 m_bModifier = bModifier;
264 » m_bShift = bShift; 263 m_bShift = bShift;
265 » m_pTargetAnnot = pScreen; 264 m_pTargetAnnot = pScreen;
266 } 265 }
267 266
268 void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_ Annot* pScreen) 267 void CJS_EventHandler::OnScreen_Blur(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_ Annot* pScreen)
269 { 268 {
270 » Initial(JET_SCREEN_BLUR); 269 Initial(JET_SCREEN_BLUR);
271 270
272 » m_bModifier = bModifier; 271 m_bModifier = bModifier;
273 » m_bShift = bShift; 272 m_bShift = bShift;
274 » m_pTargetAnnot = pScreen; 273 m_pTargetAnnot = pScreen;
275 } 274 }
276 275
277 void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_ Annot* pScreen) 276 void CJS_EventHandler::OnScreen_Open(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK_ Annot* pScreen)
278 { 277 {
279 » Initial(JET_SCREEN_OPEN); 278 Initial(JET_SCREEN_OPEN);
280 279
281 » m_bModifier = bModifier; 280 m_bModifier = bModifier;
282 » m_bShift = bShift; 281 m_bShift = bShift;
283 » m_pTargetAnnot = pScreen; 282 m_pTargetAnnot = pScreen;
284 } 283 }
285 284
286 void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK _Annot* pScreen) 285 void CJS_EventHandler::OnScreen_Close(FX_BOOL bModifier, FX_BOOL bShift, CPDFSDK _Annot* pScreen)
287 { 286 {
288 » Initial(JET_SCREEN_CLOSE); 287 Initial(JET_SCREEN_CLOSE);
289 288
290 » m_bModifier = bModifier; 289 m_bModifier = bModifier;
291 » m_bShift = bShift; 290 m_bShift = bShift;
292 » m_pTargetAnnot = pScreen; 291 m_pTargetAnnot = pScreen;
293 } 292 }
294 293
295 void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPD FSDK_Annot* pScreen) 294 void CJS_EventHandler::OnScreen_MouseDown(FX_BOOL bModifier, FX_BOOL bShift, CPD FSDK_Annot* pScreen)
296 { 295 {
297 » Initial(JET_SCREEN_MOUSEDOWN); 296 Initial(JET_SCREEN_MOUSEDOWN);
298 297
299 » m_bModifier = bModifier; 298 m_bModifier = bModifier;
300 » m_bShift = bShift; 299 m_bShift = bShift;
301 » m_pTargetAnnot = pScreen; 300 m_pTargetAnnot = pScreen;
302 } 301 }
303 302
304 void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFS DK_Annot* pScreen) 303 void CJS_EventHandler::OnScreen_MouseUp(FX_BOOL bModifier, FX_BOOL bShift, CPDFS DK_Annot* pScreen)
305 { 304 {
306 » Initial(JET_SCREEN_MOUSEUP); 305 Initial(JET_SCREEN_MOUSEUP);
307 306
308 » m_bModifier = bModifier; 307 m_bModifier = bModifier;
309 » m_bShift = bShift; 308 m_bShift = bShift;
310 » m_pTargetAnnot = pScreen; 309 m_pTargetAnnot = pScreen;
311 } 310 }
312 311
313 void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CP DFSDK_Annot* pScreen) 312 void CJS_EventHandler::OnScreen_MouseEnter(FX_BOOL bModifier, FX_BOOL bShift, CP DFSDK_Annot* pScreen)
314 { 313 {
315 » Initial(JET_SCREEN_MOUSEENTER); 314 Initial(JET_SCREEN_MOUSEENTER);
316 315
317 » m_bModifier = bModifier; 316 m_bModifier = bModifier;
318 » m_bShift = bShift; 317 m_bShift = bShift;
319 » m_pTargetAnnot = pScreen; 318 m_pTargetAnnot = pScreen;
320 } 319 }
321 320
322 void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPD FSDK_Annot* pScreen) 321 void CJS_EventHandler::OnScreen_MouseExit(FX_BOOL bModifier, FX_BOOL bShift, CPD FSDK_Annot* pScreen)
323 { 322 {
324 » Initial(JET_SCREEN_MOUSEEXIT); 323 Initial(JET_SCREEN_MOUSEEXIT);
325 324
326 » m_bModifier = bModifier; 325 m_bModifier = bModifier;
327 » m_bShift = bShift; 326 m_bShift = bShift;
328 » m_pTargetAnnot = pScreen; 327 m_pTargetAnnot = pScreen;
329 } 328 }
330 329
331 void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSD K_Annot* pScreen) 330 void CJS_EventHandler::OnScreen_InView(FX_BOOL bModifier, FX_BOOL bShift, CPDFSD K_Annot* pScreen)
332 { 331 {
333 » Initial(JET_SCREEN_INVIEW); 332 Initial(JET_SCREEN_INVIEW);
334 333
335 » m_bModifier = bModifier; 334 m_bModifier = bModifier;
336 » m_bShift = bShift; 335 m_bShift = bShift;
337 » m_pTargetAnnot = pScreen; 336 m_pTargetAnnot = pScreen;
338 } 337 }
339 338
340 void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFS DK_Annot* pScreen) 339 void CJS_EventHandler::OnScreen_OutView(FX_BOOL bModifier, FX_BOOL bShift, CPDFS DK_Annot* pScreen)
341 { 340 {
342 » Initial(JET_SCREEN_OUTVIEW); 341 Initial(JET_SCREEN_OUTVIEW);
343 342
344 » m_bModifier = bModifier; 343 m_bModifier = bModifier;
345 » m_bShift = bShift; 344 m_bShift = bShift;
346 » m_pTargetAnnot = pScreen; 345 m_pTargetAnnot = pScreen;
347 } 346 }
348 347
349 void CJS_EventHandler::OnLink_MouseUp(CPDFSDK_Document* pTarget) 348 void CJS_EventHandler::OnLink_MouseUp(CPDFSDK_Document* pTarget)
350 { 349 {
351 » Initial(JET_LINK_MOUSEUP); 350 Initial(JET_LINK_MOUSEUP);
352 351
353 » m_pTargetDoc = pTarget; 352 m_pTargetDoc = pTarget;
354 } 353 }
355 354
356 void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) 355 void CJS_EventHandler::OnBookmark_MouseUp(CPDF_Bookmark* pBookMark)
357 { 356 {
358 » Initial(JET_BOOKMARK_MOUSEUP); 357 Initial(JET_BOOKMARK_MOUSEUP);
359 358
360 » m_pTargetBookMark = pBookMark; 359 m_pTargetBookMark = pBookMark;
361 } 360 }
362 361
363 void CJS_EventHandler::OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideStri ng& strTargetName) 362 void CJS_EventHandler::OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideStri ng& strTargetName)
364 { 363 {
365 » Initial(JET_MENU_EXEC); 364 Initial(JET_MENU_EXEC);
366 365
367 » m_pTargetDoc = pTarget; 366 m_pTargetDoc = pTarget;
368 » m_strTargetName = strTargetName; 367 m_strTargetName = strTargetName;
369 } 368 }
370 369
371 void CJS_EventHandler::OnExternal_Exec() 370 void CJS_EventHandler::OnExternal_Exec()
372 { 371 {
373 » Initial(JET_EXTERNAL_EXEC); 372 Initial(JET_EXTERNAL_EXEC);
374 } 373 }
375 374
376 void CJS_EventHandler::OnBatchExec(CPDFSDK_Document* pTarget) 375 void CJS_EventHandler::OnBatchExec(CPDFSDK_Document* pTarget)
377 { 376 {
378 » Initial(JET_BATCH_EXEC); 377 Initial(JET_BATCH_EXEC);
379 378
380 » m_pTargetDoc = pTarget; 379 m_pTargetDoc = pTarget;
381 } 380 }
382 381
383 void CJS_EventHandler::OnConsole_Exec() 382 void CJS_EventHandler::OnConsole_Exec()
384 { 383 {
385 » Initial(JET_CONSOLE_EXEC); 384 Initial(JET_CONSOLE_EXEC);
386 } 385 }
387 386
388 387
389 void CJS_EventHandler::Initial(JS_EVENT_T type) 388 void CJS_EventHandler::Initial(JS_EVENT_T type)
390 { 389 {
391 » m_eEventType = type; 390 m_eEventType = type;
392 391
393 » m_strTargetName = L""; 392 m_strTargetName = L"";
394 » m_strSourceName = L""; 393 m_strSourceName = L"";
395 » m_pWideStrChange = NULL; 394 m_pWideStrChange = NULL;
396 » m_WideStrChangeDu = L""; 395 m_WideStrChangeDu = L"";
397 » m_WideStrChangeEx = L""; 396 m_WideStrChangeEx = L"";
398 » m_nCommitKey = -1; 397 m_nCommitKey = -1;
399 » m_bKeyDown = FALSE; 398 m_bKeyDown = FALSE;
400 » m_bModifier = FALSE; 399 m_bModifier = FALSE;
401 » m_bShift = FALSE; 400 m_bShift = FALSE;
402 » m_pISelEnd = NULL; 401 m_pISelEnd = NULL;
403 » m_nSelEndDu = 0; 402 m_nSelEndDu = 0;
404 » m_pISelStart = NULL; 403 m_pISelStart = NULL;
405 » m_nSelStartDu = 0; 404 m_nSelStartDu = 0;
406 » m_bWillCommit = FALSE; 405 m_bWillCommit = FALSE;
407 » m_pValue = NULL; 406 m_pValue = NULL;
408 » m_bFieldFull = FALSE; 407 m_bFieldFull = FALSE;
409 » m_pbRc = NULL; 408 m_pbRc = NULL;
410 » m_bRcDu = FALSE; 409 m_bRcDu = FALSE;
411 410
412 » m_pSourceDoc = NULL; 411 m_pSourceDoc = NULL;
413 » m_pTargetBookMark = NULL; 412 m_pTargetBookMark = NULL;
414 » m_pTargetDoc = NULL; 413 m_pTargetDoc = NULL;
415 » m_pTargetAnnot = NULL; 414 m_pTargetAnnot = NULL;
416 415
417 » m_bValid = TRUE; 416 m_bValid = TRUE;
418 } 417 }
419 418
420 void CJS_EventHandler::Destroy() 419 void CJS_EventHandler::Destroy()
421 { 420 {
422 » m_bValid = FALSE; 421 m_bValid = FALSE;
423 } 422 }
424 423
425 FX_BOOL CJS_EventHandler::IsValid() 424 FX_BOOL CJS_EventHandler::IsValid()
426 { 425 {
427 » return m_bValid; 426 return m_bValid;
428 } 427 }
429 428
430 CFX_WideString & CJS_EventHandler::Change() 429 CFX_WideString & CJS_EventHandler::Change()
431 { 430 {
432 » if (m_pWideStrChange != NULL) 431 if (m_pWideStrChange) {
433 » » return *m_pWideStrChange; 432 return *m_pWideStrChange;
434 » else 433 }
435 » { 434 return m_WideStrChangeDu;
436 » » return m_WideStrChangeDu;
437 » }
438 } 435 }
439 436
440 CFX_WideString CJS_EventHandler::ChangeEx() 437 CFX_WideString CJS_EventHandler::ChangeEx()
441 { 438 {
442 » return m_WideStrChangeEx; 439 return m_WideStrChangeEx;
443 } 440 }
444 441
445 int CJS_EventHandler::CommitKey() 442 int CJS_EventHandler::CommitKey()
446 { 443 {
447 » return m_nCommitKey; 444 return m_nCommitKey;
448 } 445 }
449 446
450 FX_BOOL CJS_EventHandler::FieldFull() 447 FX_BOOL CJS_EventHandler::FieldFull()
451 { 448 {
452 » return m_bFieldFull; 449 return m_bFieldFull;
453 } 450 }
454 451
455 FX_BOOL CJS_EventHandler::KeyDown() 452 FX_BOOL CJS_EventHandler::KeyDown()
456 { 453 {
457 » return m_bKeyDown; 454 return m_bKeyDown;
458 } 455 }
459 456
460 FX_BOOL CJS_EventHandler::Modifier() 457 FX_BOOL CJS_EventHandler::Modifier()
461 { 458 {
462 » return m_bModifier; 459 return m_bModifier;
463 } 460 }
464 461
465 const FX_WCHAR* CJS_EventHandler::Name() 462 const FX_WCHAR* CJS_EventHandler::Name()
466 { 463 {
467 » switch (m_eEventType) 464 switch (m_eEventType)
468 » { 465 {
469 » case JET_APP_INIT:» » » return L"Init"; 466 case JET_APP_INIT: return L"Init";
470 » case JET_BATCH_EXEC:» » return L"Exec"; 467 case JET_BATCH_EXEC: return L"Exec";
471 » case JET_BOOKMARK_MOUSEUP:» return L"Mouse Up"; 468 case JET_BOOKMARK_MOUSEUP: return L"Mouse Up";
472 » case JET_CONSOLE_EXEC:» » return L"Exec"; 469 case JET_CONSOLE_EXEC: return L"Exec";
473 » case JET_DOC_DIDPRINT:» » return L"DidPrint"; 470 case JET_DOC_DIDPRINT: return L"DidPrint";
474 » case JET_DOC_DIDSAVE:» » return L"DidSave"; 471 case JET_DOC_DIDSAVE: return L"DidSave";
475 » case JET_DOC_OPEN:» » » return L"Open"; 472 case JET_DOC_OPEN: return L"Open";
476 » case JET_DOC_WILLCLOSE:»» return L"WillClose"; 473 case JET_DOC_WILLCLOSE: return L"WillClose";
477 » case JET_DOC_WILLPRINT:»» return L"WillPrint"; 474 case JET_DOC_WILLPRINT: return L"WillPrint";
478 » case JET_DOC_WILLSAVE:» » return L"WillSave"; 475 case JET_DOC_WILLSAVE: return L"WillSave";
479 » case JET_EXTERNAL_EXEC:»» return L"Exec"; 476 case JET_EXTERNAL_EXEC: return L"Exec";
480 » case JET_FIELD_FOCUS: 477 case JET_FIELD_FOCUS:
481 » case JET_SCREEN_FOCUS:» » return L"Focus"; 478 case JET_SCREEN_FOCUS: return L"Focus";
482 » case JET_FIELD_BLUR: 479 case JET_FIELD_BLUR:
483 » case JET_SCREEN_BLUR:» » return L"Blur"; 480 case JET_SCREEN_BLUR: return L"Blur";
484 » case JET_FIELD_MOUSEDOWN: 481 case JET_FIELD_MOUSEDOWN:
485 » case JET_SCREEN_MOUSEDOWN:» return L"Mouse Down"; 482 case JET_SCREEN_MOUSEDOWN: return L"Mouse Down";
486 » case JET_FIELD_MOUSEUP: 483 case JET_FIELD_MOUSEUP:
487 » case JET_SCREEN_MOUSEUP:» return L"Mouse Up"; 484 case JET_SCREEN_MOUSEUP: return L"Mouse Up";
488 » case JET_FIELD_MOUSEENTER: 485 case JET_FIELD_MOUSEENTER:
489 » case JET_SCREEN_MOUSEENTER:» return L"Mouse Enter"; 486 case JET_SCREEN_MOUSEENTER: return L"Mouse Enter";
490 » case JET_FIELD_MOUSEEXIT: 487 case JET_FIELD_MOUSEEXIT:
491 » case JET_SCREEN_MOUSEEXIT:» return L"Mouse Exit"; 488 case JET_SCREEN_MOUSEEXIT: return L"Mouse Exit";
492 » case JET_FIELD_CALCULATE:» return L"Calculate"; 489 case JET_FIELD_CALCULATE: return L"Calculate";
493 » case JET_FIELD_FORMAT:» » return L"Format"; 490 case JET_FIELD_FORMAT: return L"Format";
494 » case JET_FIELD_KEYSTROKE:» return L"Keystroke"; 491 case JET_FIELD_KEYSTROKE: return L"Keystroke";
495 » case JET_FIELD_VALIDATE:» return L"Validate"; 492 case JET_FIELD_VALIDATE: return L"Validate";
496 » case JET_LINK_MOUSEUP:» » return L"Mouse Up"; 493 case JET_LINK_MOUSEUP: return L"Mouse Up";
497 » case JET_MENU_EXEC:» » » return L"Exec"; 494 case JET_MENU_EXEC: return L"Exec";
498 » case JET_PAGE_OPEN: 495 case JET_PAGE_OPEN:
499 » case JET_SCREEN_OPEN:» » return L"Open"; 496 case JET_SCREEN_OPEN: return L"Open";
500 » case JET_PAGE_CLOSE: 497 case JET_PAGE_CLOSE:
501 » case JET_SCREEN_CLOSE:» » return L"Close"; 498 case JET_SCREEN_CLOSE: return L"Close";
502 » case JET_SCREEN_INVIEW: 499 case JET_SCREEN_INVIEW:
503 » case JET_PAGE_INVIEW:» » return L"InView"; 500 case JET_PAGE_INVIEW: return L"InView";
504 » case JET_PAGE_OUTVIEW: 501 case JET_PAGE_OUTVIEW:
505 » case JET_SCREEN_OUTVIEW:» return L"OutView"; 502 case JET_SCREEN_OUTVIEW: return L"OutView";
506 » default: 503 default:
507 » » return L""; 504 return L"";
508 » } 505 }
509 506
510 » return L""; 507 return L"";
511 } 508 }
512 509
513 const FX_WCHAR* CJS_EventHandler::Type() 510 const FX_WCHAR* CJS_EventHandler::Type()
514 { 511 {
515 » switch (m_eEventType) 512 switch (m_eEventType)
516 » { 513 {
517 » case JET_APP_INIT:» » » return L"App"; 514 case JET_APP_INIT: return L"App";
518 » case JET_BATCH_EXEC:» » return L"Batch"; 515 case JET_BATCH_EXEC: return L"Batch";
519 » case JET_BOOKMARK_MOUSEUP:» return L"BookMark"; 516 case JET_BOOKMARK_MOUSEUP: return L"BookMark";
520 » case JET_CONSOLE_EXEC:» » return L"Console"; 517 case JET_CONSOLE_EXEC: return L"Console";
521 » case JET_DOC_DIDPRINT: 518 case JET_DOC_DIDPRINT:
522 » case JET_DOC_DIDSAVE: 519 case JET_DOC_DIDSAVE:
523 » case JET_DOC_OPEN: 520 case JET_DOC_OPEN:
524 » case JET_DOC_WILLCLOSE: 521 case JET_DOC_WILLCLOSE:
525 » case JET_DOC_WILLPRINT: 522 case JET_DOC_WILLPRINT:
526 » case JET_DOC_WILLSAVE:» » return L"Doc"; 523 case JET_DOC_WILLSAVE: return L"Doc";
527 » case JET_EXTERNAL_EXEC:»» return L"External"; 524 case JET_EXTERNAL_EXEC: return L"External";
528 » case JET_FIELD_BLUR: 525 case JET_FIELD_BLUR:
529 » case JET_FIELD_FOCUS: 526 case JET_FIELD_FOCUS:
530 » case JET_FIELD_MOUSEDOWN: 527 case JET_FIELD_MOUSEDOWN:
531 » case JET_FIELD_MOUSEENTER: 528 case JET_FIELD_MOUSEENTER:
532 » case JET_FIELD_MOUSEEXIT: 529 case JET_FIELD_MOUSEEXIT:
533 » case JET_FIELD_MOUSEUP: 530 case JET_FIELD_MOUSEUP:
534 » case JET_FIELD_CALCULATE: 531 case JET_FIELD_CALCULATE:
535 » case JET_FIELD_FORMAT: 532 case JET_FIELD_FORMAT:
536 » case JET_FIELD_KEYSTROKE: 533 case JET_FIELD_KEYSTROKE:
537 » case JET_FIELD_VALIDATE:» return L"Field"; 534 case JET_FIELD_VALIDATE: return L"Field";
538 » case JET_SCREEN_FOCUS: 535 case JET_SCREEN_FOCUS:
539 » case JET_SCREEN_BLUR: 536 case JET_SCREEN_BLUR:
540 » case JET_SCREEN_OPEN: 537 case JET_SCREEN_OPEN:
541 » case JET_SCREEN_CLOSE: 538 case JET_SCREEN_CLOSE:
542 » case JET_SCREEN_MOUSEDOWN: 539 case JET_SCREEN_MOUSEDOWN:
543 » case JET_SCREEN_MOUSEUP: 540 case JET_SCREEN_MOUSEUP:
544 » case JET_SCREEN_MOUSEENTER: 541 case JET_SCREEN_MOUSEENTER:
545 » case JET_SCREEN_MOUSEEXIT: 542 case JET_SCREEN_MOUSEEXIT:
546 » case JET_SCREEN_INVIEW: 543 case JET_SCREEN_INVIEW:
547 » case JET_SCREEN_OUTVIEW:» return L"Screen"; 544 case JET_SCREEN_OUTVIEW: return L"Screen";
548 » case JET_LINK_MOUSEUP:» » return L"Link"; 545 case JET_LINK_MOUSEUP: return L"Link";
549 » case JET_MENU_EXEC:» » » return L"Menu"; 546 case JET_MENU_EXEC: return L"Menu";
550 » case JET_PAGE_OPEN: 547 case JET_PAGE_OPEN:
551 » case JET_PAGE_CLOSE: 548 case JET_PAGE_CLOSE:
552 » case JET_PAGE_INVIEW: 549 case JET_PAGE_INVIEW:
553 » case JET_PAGE_OUTVIEW:return L"Page"; 550 case JET_PAGE_OUTVIEW:return L"Page";
554 » default: 551 default:
555 » » return L""; 552 return L"";
556 » } 553 }
557 554
558 » return L""; 555 return L"";
559 } 556 }
560 557
561 FX_BOOL& CJS_EventHandler::Rc() 558 FX_BOOL& CJS_EventHandler::Rc()
562 { 559 {
563 » if (m_pbRc != NULL) 560 if (m_pbRc) {
564 » » return *m_pbRc; 561 return *m_pbRc;
565 » else 562 }
566 » { 563 return m_bRcDu;
567 » » return m_bRcDu;
568 » }
569 } 564 }
570 565
571 int & CJS_EventHandler::SelEnd() 566 int & CJS_EventHandler::SelEnd()
572 { 567 {
573 » if (m_pISelEnd != NULL) 568 if (m_pISelEnd) {
574 » { 569 return *m_pISelEnd;
575 » » return *m_pISelEnd; 570 }
576 » } 571 return m_nSelEndDu;
577 » else
578 » {
579 » » return m_nSelEndDu;
580 » }
581 } 572 }
582 573
583 int & CJS_EventHandler::SelStart() 574 int & CJS_EventHandler::SelStart()
584 { 575 {
585 » if (m_pISelStart != NULL) 576 if (m_pISelStart) {
586 » » return * m_pISelStart; 577 return *m_pISelStart;
587 » else 578 }
588 » { 579 return m_nSelStartDu;
589 » » return m_nSelStartDu;
590 » }
591 } 580 }
592 581
593 FX_BOOL CJS_EventHandler::Shift() 582 FX_BOOL CJS_EventHandler::Shift()
594 { 583 {
595 » return m_bShift; 584 return m_bShift;
596 } 585 }
597 586
598 Field* CJS_EventHandler::Source() 587 Field* CJS_EventHandler::Source()
599 { 588 {
600 » ASSERT(m_pJSContext != NULL); 589 ASSERT(m_pJSContext != NULL);
601 590
602 » CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); 591 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
603 592
604 » JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_Get ObjDefnID(*pRuntime, L"Document")); 593 JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjD efnID(*pRuntime, L"Document"));
605 » ASSERT(pDocObj.IsEmpty() == FALSE); 594 ASSERT(pDocObj.IsEmpty() == FALSE);
606 » JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_G etObjDefnID(*pRuntime, L"Field")); 595 JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetOb jDefnID(*pRuntime, L"Field"));
607 » ASSERT(pFieldObj.IsEmpty() == FALSE); 596 ASSERT(pFieldObj.IsEmpty() == FALSE);
608 597
609 » CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); 598 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj);
610 » ASSERT(pJSDocument != NULL); 599 ASSERT(pJSDocument != NULL);
611 » Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 600 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
612 » ASSERT(pDocument != NULL); 601 ASSERT(pDocument != NULL);
613 » if (m_pTargetDoc != NULL) 602 if (m_pTargetDoc != NULL)
614 » » pDocument->AttachDoc(m_pTargetDoc); 603 pDocument->AttachDoc(m_pTargetDoc);
615 » else 604 else
616 » » pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); 605 pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
617 606
618 » //if (m_pSourceField == NULL) 607 //if (m_pSourceField == NULL)
619 » //» return NULL; 608 // return NULL;
620 » //CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField); 609 //CRAO_Widget *pWidget = IBCL_Widget::GetWidget(m_pSourceField);
621 » //CPDF_FormField* pFormField = pWidget->GetFormField(); 610 //CPDF_FormField* pFormField = pWidget->GetFormField();
622 » //ASSERT(pFormField); 611 //ASSERT(pFormField);
623 » //CFX_WideString csFieldName = pFormField->GetFullName(); 612 //CFX_WideString csFieldName = pFormField->GetFullName();
624 » CJS_Field * pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); 613 CJS_Field * pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj);
625 » ASSERT(pJSField != NULL); 614 ASSERT(pJSField != NULL);
626 » Field * pField = (Field *)pJSField->GetEmbedObject(); 615 Field * pField = (Field *)pJSField->GetEmbedObject();
627 » ASSERT(pField != NULL); 616 ASSERT(pField != NULL);
628 » pField->AttachField(pDocument, m_strSourceName); 617 pField->AttachField(pDocument, m_strSourceName);
629 » return pField; 618 return pField;
630 } 619 }
631 620
632 Field* CJS_EventHandler::Target_Field() 621 Field* CJS_EventHandler::Target_Field()
633 { 622 {
634 » ASSERT(m_pJSContext != NULL); 623 ASSERT(m_pJSContext != NULL);
635 624
636 » CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime(); 625 CJS_Runtime* pRuntime = m_pJSContext->GetJSRuntime();
637 626
638 » JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetO bjDefnID(*pRuntime, L"Document")); 627 JSFXObject pDocObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObjDe fnID(*pRuntime, L"Document"));
639 » ASSERT(pDocObj.IsEmpty() == FALSE); 628 ASSERT(pDocObj.IsEmpty() == FALSE);
640 » JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_Ge tObjDefnID(*pRuntime, L"Field")); 629 JSFXObject pFieldObj = JS_NewFxDynamicObj(*pRuntime, m_pJSContext, JS_GetObj DefnID(*pRuntime, L"Field"));
641 » ASSERT(pFieldObj.IsEmpty() == FALSE); 630 ASSERT(pFieldObj.IsEmpty() == FALSE);
642 631
643 » CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj); 632 CJS_Document* pJSDocument = (CJS_Document*)JS_GetPrivate(pDocObj);
644 » ASSERT(pJSDocument != NULL); 633 ASSERT(pJSDocument != NULL);
645 » Document* pDocument = (Document*)pJSDocument->GetEmbedObject(); 634 Document* pDocument = (Document*)pJSDocument->GetEmbedObject();
646 » ASSERT(pDocument != NULL); 635 ASSERT(pDocument != NULL);
647 » if (m_pTargetDoc != NULL) 636 if (m_pTargetDoc != NULL)
648 » » pDocument->AttachDoc(m_pTargetDoc); 637 pDocument->AttachDoc(m_pTargetDoc);
649 » else 638 else
650 » » pDocument->AttachDoc(m_pJSContext->GetReaderDocument()); 639 pDocument->AttachDoc(m_pJSContext->GetReaderDocument());
651 640
652 » CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj); 641 CJS_Field* pJSField = (CJS_Field*)JS_GetPrivate(pFieldObj);
653 » ASSERT(pJSField != NULL); 642 ASSERT(pJSField != NULL);
654 643
655 » Field* pField = (Field *)pJSField->GetEmbedObject(); 644 Field* pField = (Field *)pJSField->GetEmbedObject();
656 » ASSERT(pField != NULL); 645 ASSERT(pField != NULL);
657 646
658 » pField->AttachField(pDocument, m_strTargetName); 647 pField->AttachField(pDocument, m_strTargetName);
659 » return pField; 648 return pField;
660 } 649 }
661 650
662 CFX_WideString& CJS_EventHandler::Value() 651 CFX_WideString& CJS_EventHandler::Value()
663 { 652 {
664 » return *m_pValue; 653 return *m_pValue;
665 } 654 }
666 655
667 FX_BOOL CJS_EventHandler::WillCommit() 656 FX_BOOL CJS_EventHandler::WillCommit()
668 { 657 {
669 » return m_bWillCommit; 658 return m_bWillCommit;
670 } 659 }
671 660
672 CFX_WideString CJS_EventHandler::TargetName() 661 CFX_WideString CJS_EventHandler::TargetName()
673 { 662 {
674 » return m_strTargetName; 663 return m_strTargetName;
675 } 664 }
676
677
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/Field.cpp ('k') | fpdfsdk/src/javascript/JS_GlobalData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698