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 "fpdfsdk/formfiller/cffl_interactiveformfiller.h" | 7 #include "fpdfsdk/formfiller/cffl_interactiveformfiller.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 } | 115 } |
116 | 116 |
117 void CFFL_InteractiveFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { | 117 void CFFL_InteractiveFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) { |
118 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 118 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
119 pFormFiller->OnDelete(pAnnot); | 119 pFormFiller->OnDelete(pAnnot); |
120 } | 120 } |
121 | 121 |
122 UnRegisterFormFiller(pAnnot); | 122 UnRegisterFormFiller(pAnnot); |
123 } | 123 } |
124 | 124 |
125 void CFFL_InteractiveFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView, | 125 void CFFL_InteractiveFormFiller::OnMouseEnter( |
126 CPDFSDK_Annot* pAnnot, | 126 CPDFSDK_PageView* pPageView, |
127 uint32_t nFlag) { | 127 CPDFSDK_Annot::ObservedPtr* pAnnot, |
128 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 128 uint32_t nFlag) { |
129 | 129 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
130 if (!m_bNotifying) { | 130 if (!m_bNotifying) { |
131 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 131 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
132 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { | 132 if (pWidget->GetAAction(CPDF_AAction::CursorEnter).GetDict()) { |
133 m_bNotifying = TRUE; | 133 m_bNotifying = TRUE; |
134 | 134 |
135 int nValueAge = pWidget->GetValueAge(); | 135 int nValueAge = pWidget->GetValueAge(); |
136 | |
137 pWidget->ClearAppModified(); | 136 pWidget->ClearAppModified(); |
138 | |
139 ASSERT(pPageView); | 137 ASSERT(pPageView); |
140 | 138 |
141 PDFSDK_FieldAction fa; | 139 PDFSDK_FieldAction fa; |
142 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 140 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
143 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 141 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
144 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); | 142 pWidget->OnAAction(CPDF_AAction::CursorEnter, fa, pPageView); |
145 m_bNotifying = FALSE; | 143 m_bNotifying = FALSE; |
| 144 if (!(*pAnnot)) |
| 145 return; |
146 | 146 |
147 if (pWidget->IsAppModified()) { | 147 if (pWidget->IsAppModified()) { |
148 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 148 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
149 pFormFiller->ResetPDFWindow(pPageView, | 149 pFormFiller->ResetPDFWindow(pPageView, |
150 pWidget->GetValueAge() == nValueAge); | 150 pWidget->GetValueAge() == nValueAge); |
151 } | 151 } |
152 } | 152 } |
153 } | 153 } |
154 } | 154 } |
155 | 155 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE)) |
156 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 156 pFormFiller->OnMouseEnter(pPageView, pAnnot->Get()); |
157 pFormFiller->OnMouseEnter(pPageView, pAnnot); | |
158 } | |
159 } | 157 } |
160 | 158 |
161 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, | 159 void CFFL_InteractiveFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView, |
162 CPDFSDK_Annot* pAnnot, | 160 CPDFSDK_Annot::ObservedPtr* pAnnot, |
163 uint32_t nFlag) { | 161 uint32_t nFlag) { |
164 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 162 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
165 | |
166 if (!m_bNotifying) { | 163 if (!m_bNotifying) { |
167 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 164 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
168 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { | 165 if (pWidget->GetAAction(CPDF_AAction::CursorExit).GetDict()) { |
169 m_bNotifying = TRUE; | 166 m_bNotifying = TRUE; |
170 pWidget->GetAppearanceAge(); | 167 pWidget->GetAppearanceAge(); |
| 168 |
171 int nValueAge = pWidget->GetValueAge(); | 169 int nValueAge = pWidget->GetValueAge(); |
172 pWidget->ClearAppModified(); | 170 pWidget->ClearAppModified(); |
173 | |
174 ASSERT(pPageView); | 171 ASSERT(pPageView); |
175 | 172 |
176 PDFSDK_FieldAction fa; | 173 PDFSDK_FieldAction fa; |
177 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 174 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
178 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 175 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
179 | |
180 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); | 176 pWidget->OnAAction(CPDF_AAction::CursorExit, fa, pPageView); |
181 m_bNotifying = FALSE; | 177 m_bNotifying = FALSE; |
| 178 if (!(*pAnnot)) |
| 179 return; |
182 | 180 |
183 if (pWidget->IsAppModified()) { | 181 if (pWidget->IsAppModified()) { |
184 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 182 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
185 pFormFiller->ResetPDFWindow(pPageView, | 183 pFormFiller->ResetPDFWindow(pPageView, |
186 nValueAge == pWidget->GetValueAge()); | 184 nValueAge == pWidget->GetValueAge()); |
187 } | 185 } |
188 } | 186 } |
189 } | 187 } |
190 } | 188 } |
191 | 189 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) |
192 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 190 pFormFiller->OnMouseExit(pPageView, pAnnot->Get()); |
193 pFormFiller->OnMouseExit(pPageView, pAnnot); | |
194 } | |
195 } | 191 } |
196 | 192 |
197 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView, | 193 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDown( |
198 CPDFSDK_Annot* pAnnot, | 194 CPDFSDK_PageView* pPageView, |
199 uint32_t nFlags, | 195 CPDFSDK_Annot::ObservedPtr* pAnnot, |
200 const CFX_FloatPoint& point) { | 196 uint32_t nFlags, |
201 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 197 const CFX_FloatPoint& point) { |
202 | 198 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
203 if (!m_bNotifying) { | 199 if (!m_bNotifying) { |
204 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 200 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
205 if (Annot_HitTest(pPageView, pAnnot, point) && | 201 if (Annot_HitTest(pPageView, pAnnot->Get(), point) && |
206 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { | 202 pWidget->GetAAction(CPDF_AAction::ButtonDown).GetDict()) { |
207 m_bNotifying = TRUE; | 203 m_bNotifying = TRUE; |
208 pWidget->GetAppearanceAge(); | 204 pWidget->GetAppearanceAge(); |
| 205 |
209 int nValueAge = pWidget->GetValueAge(); | 206 int nValueAge = pWidget->GetValueAge(); |
210 pWidget->ClearAppModified(); | 207 pWidget->ClearAppModified(); |
211 | |
212 ASSERT(pPageView); | 208 ASSERT(pPageView); |
213 | 209 |
214 PDFSDK_FieldAction fa; | 210 PDFSDK_FieldAction fa; |
215 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlags); | 211 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlags); |
216 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlags); | 212 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlags); |
217 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); | 213 pWidget->OnAAction(CPDF_AAction::ButtonDown, fa, pPageView); |
218 m_bNotifying = FALSE; | 214 m_bNotifying = FALSE; |
| 215 if (!(*pAnnot)) |
| 216 return TRUE; |
219 | 217 |
220 if (!IsValidAnnot(pPageView, pAnnot)) | 218 if (!IsValidAnnot(pPageView, pAnnot->Get())) |
221 return TRUE; | 219 return TRUE; |
222 | 220 |
223 if (pWidget->IsAppModified()) { | 221 if (pWidget->IsAppModified()) { |
224 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 222 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
225 pFormFiller->ResetPDFWindow(pPageView, | 223 pFormFiller->ResetPDFWindow(pPageView, |
226 nValueAge == pWidget->GetValueAge()); | 224 nValueAge == pWidget->GetValueAge()); |
227 } | 225 } |
228 } | 226 } |
229 } | 227 } |
230 } | 228 } |
231 | 229 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) |
232 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 230 return pFormFiller->OnLButtonDown(pPageView, pAnnot->Get(), nFlags, point); |
233 return pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point); | |
234 } | |
235 | 231 |
236 return FALSE; | 232 return FALSE; |
237 } | 233 } |
238 | 234 |
239 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView, | 235 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonUp( |
240 CPDFSDK_Annot* pAnnot, | 236 CPDFSDK_PageView* pPageView, |
241 uint32_t nFlags, | 237 CPDFSDK_Annot::ObservedPtr* pAnnot, |
242 const CFX_FloatPoint& point) { | 238 uint32_t nFlags, |
243 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 239 const CFX_FloatPoint& point) { |
244 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 240 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
| 241 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
245 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); | 242 CPDFSDK_Document* pDocument = m_pEnv->GetSDKDocument(); |
246 | 243 |
247 switch (pWidget->GetFieldType()) { | 244 switch (pWidget->GetFieldType()) { |
248 case FIELDTYPE_PUSHBUTTON: | 245 case FIELDTYPE_PUSHBUTTON: |
249 case FIELDTYPE_CHECKBOX: | 246 case FIELDTYPE_CHECKBOX: |
250 case FIELDTYPE_RADIOBUTTON: | 247 case FIELDTYPE_RADIOBUTTON: |
251 if (GetViewBBox(pPageView, pAnnot).Contains((int)point.x, (int)point.y)) | 248 if (GetViewBBox(pPageView, pAnnot->Get()) |
| 249 .Contains((int)point.x, (int)point.y)) |
252 pDocument->SetFocusAnnot(pAnnot); | 250 pDocument->SetFocusAnnot(pAnnot); |
253 break; | 251 break; |
254 default: | 252 default: |
255 pDocument->SetFocusAnnot(pAnnot); | 253 pDocument->SetFocusAnnot(pAnnot); |
256 break; | 254 break; |
257 } | 255 } |
258 | 256 |
259 FX_BOOL bRet = FALSE; | 257 FX_BOOL bRet = FALSE; |
| 258 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) |
| 259 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot->Get(), nFlags, point); |
260 | 260 |
261 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 261 if (pDocument->GetFocusAnnot() == pAnnot->Get()) { |
262 bRet = pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point); | |
263 } | |
264 | |
265 if (pDocument->GetFocusAnnot() == pAnnot) { | |
266 FX_BOOL bExit = FALSE; | 262 FX_BOOL bExit = FALSE; |
267 FX_BOOL bReset = FALSE; | 263 FX_BOOL bReset = FALSE; |
268 OnButtonUp(pWidget, pPageView, bReset, bExit, nFlags); | 264 OnButtonUp(pAnnot, pPageView, bReset, bExit, nFlags); |
269 if (bExit) | 265 if (!pAnnot || bExit) |
270 return TRUE; | 266 return TRUE; |
271 #ifdef PDF_ENABLE_XFA | 267 #ifdef PDF_ENABLE_XFA |
272 OnClick(pWidget, pPageView, bReset, bExit, nFlags); | 268 OnClick(pWidget, pPageView, bReset, bExit, nFlags); |
273 if (bExit) | 269 if (!pAnnot || bExit) |
274 return TRUE; | 270 return TRUE; |
275 #endif // PDF_ENABLE_XFA | 271 #endif // PDF_ENABLE_XFA |
276 } | 272 } |
277 return bRet; | 273 return bRet; |
278 } | 274 } |
279 | 275 |
280 void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Widget* pWidget, | 276 void CFFL_InteractiveFormFiller::OnButtonUp(CPDFSDK_Annot::ObservedPtr* pAnnot, |
281 CPDFSDK_PageView* pPageView, | 277 CPDFSDK_PageView* pPageView, |
282 FX_BOOL& bReset, | 278 FX_BOOL& bReset, |
283 FX_BOOL& bExit, | 279 FX_BOOL& bExit, |
284 uint32_t nFlag) { | 280 uint32_t nFlag) { |
285 ASSERT(pWidget); | |
286 | |
287 if (!m_bNotifying) { | 281 if (!m_bNotifying) { |
| 282 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
288 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { | 283 if (pWidget->GetAAction(CPDF_AAction::ButtonUp).GetDict()) { |
289 m_bNotifying = TRUE; | 284 m_bNotifying = TRUE; |
| 285 |
290 int nAge = pWidget->GetAppearanceAge(); | 286 int nAge = pWidget->GetAppearanceAge(); |
291 int nValueAge = pWidget->GetValueAge(); | 287 int nValueAge = pWidget->GetValueAge(); |
292 | |
293 ASSERT(pPageView); | 288 ASSERT(pPageView); |
294 | 289 |
295 PDFSDK_FieldAction fa; | 290 PDFSDK_FieldAction fa; |
296 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 291 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
297 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 292 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
298 | |
299 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); | 293 pWidget->OnAAction(CPDF_AAction::ButtonUp, fa, pPageView); |
300 m_bNotifying = FALSE; | 294 m_bNotifying = FALSE; |
301 | 295 if (!(*pAnnot) || !IsValidAnnot(pPageView, pWidget)) { |
302 if (!IsValidAnnot(pPageView, pWidget)) { | |
303 bExit = TRUE; | 296 bExit = TRUE; |
304 return; | 297 return; |
305 } | 298 } |
306 | |
307 if (nAge != pWidget->GetAppearanceAge()) { | 299 if (nAge != pWidget->GetAppearanceAge()) { |
308 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { | 300 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE)) { |
309 pFormFiller->ResetPDFWindow(pPageView, | 301 pFormFiller->ResetPDFWindow(pPageView, |
310 nValueAge == pWidget->GetValueAge()); | 302 nValueAge == pWidget->GetValueAge()); |
311 } | 303 } |
312 | |
313 bReset = TRUE; | 304 bReset = TRUE; |
314 } | 305 } |
315 } | 306 } |
316 } | 307 } |
317 } | 308 } |
318 | 309 |
319 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDblClk( | 310 FX_BOOL CFFL_InteractiveFormFiller::OnLButtonDblClk( |
320 CPDFSDK_PageView* pPageView, | 311 CPDFSDK_PageView* pPageView, |
321 CPDFSDK_Annot* pAnnot, | 312 CPDFSDK_Annot::ObservedPtr* pAnnot, |
322 uint32_t nFlags, | 313 uint32_t nFlags, |
323 const CFX_FloatPoint& point) { | 314 const CFX_FloatPoint& point) { |
324 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 315 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
325 | 316 CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); |
326 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 317 return pFormFiller && |
327 return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point); | 318 pFormFiller->OnLButtonDblClk(pPageView, pAnnot->Get(), nFlags, point); |
328 } | |
329 | |
330 return FALSE; | |
331 } | 319 } |
332 | 320 |
333 FX_BOOL CFFL_InteractiveFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView, | 321 FX_BOOL CFFL_InteractiveFormFiller::OnMouseMove( |
334 CPDFSDK_Annot* pAnnot, | 322 CPDFSDK_PageView* pPageView, |
335 uint32_t nFlags, | 323 CPDFSDK_Annot::ObservedPtr* pAnnot, |
336 const CFX_FloatPoint& point) { | 324 uint32_t nFlags, |
337 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 325 const CFX_FloatPoint& point) { |
338 | 326 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
339 // change cursor | 327 CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE); |
340 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) { | 328 return pFormFiller && |
341 return pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point); | 329 pFormFiller->OnMouseMove(pPageView, pAnnot->Get(), nFlags, point); |
342 } | |
343 | |
344 return FALSE; | |
345 } | 330 } |
346 | 331 |
347 FX_BOOL CFFL_InteractiveFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView, | 332 FX_BOOL CFFL_InteractiveFormFiller::OnMouseWheel( |
348 CPDFSDK_Annot* pAnnot, | 333 CPDFSDK_PageView* pPageView, |
349 uint32_t nFlags, | 334 CPDFSDK_Annot::ObservedPtr* pAnnot, |
350 short zDelta, | 335 uint32_t nFlags, |
351 const CFX_FloatPoint& point) { | 336 short zDelta, |
352 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 337 const CFX_FloatPoint& point) { |
353 | 338 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
354 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 339 CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); |
355 return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point); | 340 return pFormFiller && |
356 } | 341 pFormFiller->OnMouseWheel(pPageView, pAnnot->Get(), nFlags, zDelta, |
357 | 342 point); |
358 return FALSE; | |
359 } | 343 } |
360 | 344 |
361 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView, | 345 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonDown( |
362 CPDFSDK_Annot* pAnnot, | 346 CPDFSDK_PageView* pPageView, |
363 uint32_t nFlags, | 347 CPDFSDK_Annot::ObservedPtr* pAnnot, |
364 const CFX_FloatPoint& point) { | 348 uint32_t nFlags, |
365 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 349 const CFX_FloatPoint& point) { |
366 | 350 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
367 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 351 CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); |
368 return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point); | 352 return pFormFiller && |
369 } | 353 pFormFiller->OnRButtonDown(pPageView, pAnnot->Get(), nFlags, point); |
370 | |
371 return FALSE; | |
372 } | 354 } |
373 | 355 |
374 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView, | 356 FX_BOOL CFFL_InteractiveFormFiller::OnRButtonUp( |
375 CPDFSDK_Annot* pAnnot, | 357 CPDFSDK_PageView* pPageView, |
376 uint32_t nFlags, | 358 CPDFSDK_Annot::ObservedPtr* pAnnot, |
377 const CFX_FloatPoint& point) { | 359 uint32_t nFlags, |
378 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 360 const CFX_FloatPoint& point) { |
379 | 361 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
380 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 362 CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE); |
381 return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point); | 363 return pFormFiller && |
382 } | 364 pFormFiller->OnRButtonUp(pPageView, pAnnot->Get(), nFlags, point); |
383 | |
384 return FALSE; | |
385 } | 365 } |
386 | 366 |
387 FX_BOOL CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, | 367 FX_BOOL CFFL_InteractiveFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot, |
388 uint32_t nKeyCode, | 368 uint32_t nKeyCode, |
389 uint32_t nFlags) { | 369 uint32_t nFlags) { |
390 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 370 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
391 | 371 |
392 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 372 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { |
393 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); | 373 return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags); |
394 } | 374 } |
395 | 375 |
396 return FALSE; | 376 return FALSE; |
397 } | 377 } |
398 | 378 |
399 FX_BOOL CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot, | 379 FX_BOOL CFFL_InteractiveFormFiller::OnChar(CPDFSDK_Annot* pAnnot, |
400 uint32_t nChar, | 380 uint32_t nChar, |
401 uint32_t nFlags) { | 381 uint32_t nFlags) { |
402 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 382 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
403 if (nChar == FWL_VKEY_Tab) | 383 if (nChar == FWL_VKEY_Tab) |
404 return TRUE; | 384 return TRUE; |
405 | 385 |
406 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) | 386 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) |
407 return pFormFiller->OnChar(pAnnot, nChar, nFlags); | 387 return pFormFiller->OnChar(pAnnot, nChar, nFlags); |
408 | 388 |
409 return FALSE; | 389 return FALSE; |
410 } | 390 } |
411 | 391 |
412 FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, | 392 FX_BOOL CFFL_InteractiveFormFiller::OnSetFocus( |
413 uint32_t nFlag) { | 393 CPDFSDK_Annot::ObservedPtr* pAnnot, |
414 if (!pAnnot) | 394 uint32_t nFlag) { |
| 395 if (!(*pAnnot)) |
415 return FALSE; | 396 return FALSE; |
416 | 397 |
417 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | 398 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
418 | |
419 if (!m_bNotifying) { | 399 if (!m_bNotifying) { |
420 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 400 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
421 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { | 401 if (pWidget->GetAAction(CPDF_AAction::GetFocus).GetDict()) { |
422 m_bNotifying = TRUE; | 402 m_bNotifying = TRUE; |
423 pWidget->GetAppearanceAge(); | 403 pWidget->GetAppearanceAge(); |
424 | 404 |
425 int nValueAge = pWidget->GetValueAge(); | 405 int nValueAge = pWidget->GetValueAge(); |
426 pWidget->ClearAppModified(); | 406 pWidget->ClearAppModified(); |
427 | 407 |
428 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 408 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); |
| 409 if (!pFormFiller) |
| 410 return FALSE; |
| 411 |
| 412 CPDFSDK_PageView* pPageView = (*pAnnot)->GetPageView(); |
429 ASSERT(pPageView); | 413 ASSERT(pPageView); |
430 | 414 |
431 PDFSDK_FieldAction fa; | 415 PDFSDK_FieldAction fa; |
432 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 416 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
433 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 417 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
434 | |
435 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, TRUE); | |
436 if (!pFormFiller) | |
437 return FALSE; | |
438 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); | 418 pFormFiller->GetActionData(pPageView, CPDF_AAction::GetFocus, fa); |
439 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); | 419 pWidget->OnAAction(CPDF_AAction::GetFocus, fa, pPageView); |
440 m_bNotifying = FALSE; | 420 m_bNotifying = FALSE; |
| 421 if (!(*pAnnot)) |
| 422 return FALSE; |
441 | 423 |
442 if (pWidget->IsAppModified()) { | 424 if (pWidget->IsAppModified()) { |
443 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { | 425 if (CFFL_FormFiller* pFiller = GetFormFiller(pWidget, FALSE)) { |
444 pFiller->ResetPDFWindow(pPageView, | 426 pFiller->ResetPDFWindow(pPageView, |
445 nValueAge == pWidget->GetValueAge()); | 427 nValueAge == pWidget->GetValueAge()); |
446 } | 428 } |
447 } | 429 } |
448 } | 430 } |
449 } | 431 } |
450 | 432 |
451 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) | 433 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), TRUE)) |
452 pFormFiller->SetFocusForAnnot(pAnnot, nFlag); | 434 pFormFiller->SetFocusForAnnot(pAnnot->Get(), nFlag); |
453 | 435 |
454 return TRUE; | 436 return TRUE; |
455 } | 437 } |
456 | 438 |
457 FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, | 439 FX_BOOL CFFL_InteractiveFormFiller::OnKillFocus( |
458 uint32_t nFlag) { | 440 CPDFSDK_Annot::ObservedPtr* pAnnot, |
459 if (!pAnnot) | 441 uint32_t nFlag) { |
| 442 if (!(*pAnnot)) |
460 return FALSE; | 443 return FALSE; |
461 ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); | |
462 | 444 |
463 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { | 445 ASSERT((*pAnnot)->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET); |
464 pFormFiller->KillFocusForAnnot(pAnnot, nFlag); | 446 if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot->Get(), FALSE)) { |
465 | 447 pFormFiller->KillFocusForAnnot(pAnnot->Get(), nFlag); |
466 if (!m_bNotifying) { | 448 if (!m_bNotifying) { |
467 CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; | 449 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
468 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { | 450 if (pWidget->GetAAction(CPDF_AAction::LoseFocus).GetDict()) { |
469 m_bNotifying = TRUE; | 451 m_bNotifying = TRUE; |
470 pWidget->ClearAppModified(); | 452 pWidget->ClearAppModified(); |
471 | 453 |
472 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); | 454 CPDFSDK_PageView* pPageView = pWidget->GetPageView(); |
473 ASSERT(pPageView); | 455 ASSERT(pPageView); |
474 | 456 |
475 PDFSDK_FieldAction fa; | 457 PDFSDK_FieldAction fa; |
476 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 458 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
477 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 459 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
478 | |
479 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); | 460 pFormFiller->GetActionData(pPageView, CPDF_AAction::LoseFocus, fa); |
480 | |
481 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); | 461 pWidget->OnAAction(CPDF_AAction::LoseFocus, fa, pPageView); |
482 m_bNotifying = FALSE; | 462 m_bNotifying = FALSE; |
| 463 if (!(*pAnnot)) |
| 464 return FALSE; |
483 } | 465 } |
484 } | 466 } |
485 } | 467 } |
486 | |
487 return TRUE; | 468 return TRUE; |
488 } | 469 } |
489 | 470 |
490 FX_BOOL CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { | 471 FX_BOOL CFFL_InteractiveFormFiller::IsVisible(CPDFSDK_Widget* pWidget) { |
491 return pWidget->IsVisible(); | 472 return pWidget->IsVisible(); |
492 } | 473 } |
493 | 474 |
494 FX_BOOL CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { | 475 FX_BOOL CFFL_InteractiveFormFiller::IsReadOnly(CPDFSDK_Widget* pWidget) { |
495 int nFieldFlags = pWidget->GetFieldFlags(); | 476 int nFieldFlags = pWidget->GetFieldFlags(); |
496 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; | 477 return (nFieldFlags & FIELDFLAG_READONLY) == FIELDFLAG_READONLY; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 fFactHeight = fBottom; | 614 fFactHeight = fBottom; |
634 bBottom = TRUE; | 615 bBottom = TRUE; |
635 } | 616 } |
636 } | 617 } |
637 } | 618 } |
638 | 619 |
639 nRet = bBottom ? 0 : 1; | 620 nRet = bBottom ? 0 : 1; |
640 fPopupRet = fFactHeight; | 621 fPopupRet = fFactHeight; |
641 } | 622 } |
642 | 623 |
643 void CFFL_InteractiveFormFiller::OnKeyStrokeCommit(CPDFSDK_Widget* pWidget, | 624 void CFFL_InteractiveFormFiller::OnKeyStrokeCommit( |
644 CPDFSDK_PageView* pPageView, | 625 CPDFSDK_Annot::ObservedPtr* pAnnot, |
645 FX_BOOL& bRC, | 626 CPDFSDK_PageView* pPageView, |
646 FX_BOOL& bExit, | 627 FX_BOOL& bRC, |
647 uint32_t nFlag) { | 628 FX_BOOL& bExit, |
| 629 uint32_t nFlag) { |
648 if (!m_bNotifying) { | 630 if (!m_bNotifying) { |
| 631 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
649 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { | 632 if (pWidget->GetAAction(CPDF_AAction::KeyStroke).GetDict()) { |
| 633 ASSERT(pPageView); |
650 m_bNotifying = TRUE; | 634 m_bNotifying = TRUE; |
651 pWidget->ClearAppModified(); | 635 pWidget->ClearAppModified(); |
652 | 636 |
653 ASSERT(pPageView); | |
654 | |
655 PDFSDK_FieldAction fa; | 637 PDFSDK_FieldAction fa; |
656 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 638 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
657 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 639 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
658 fa.bWillCommit = TRUE; | 640 fa.bWillCommit = TRUE; |
659 fa.bKeyDown = TRUE; | 641 fa.bKeyDown = TRUE; |
660 fa.bRC = TRUE; | 642 fa.bRC = TRUE; |
661 | 643 |
662 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 644 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
663 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); | 645 pFormFiller->GetActionData(pPageView, CPDF_AAction::KeyStroke, fa); |
664 pFormFiller->SaveState(pPageView); | 646 pFormFiller->SaveState(pPageView); |
665 | |
666 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); | 647 pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, pPageView); |
| 648 if (!(*pAnnot)) |
| 649 return; |
667 | 650 |
668 bRC = fa.bRC; | 651 bRC = fa.bRC; |
669 m_bNotifying = FALSE; | 652 m_bNotifying = FALSE; |
670 } | 653 } |
671 } | 654 } |
672 } | 655 } |
673 | 656 |
674 void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Widget* pWidget, | 657 void CFFL_InteractiveFormFiller::OnValidate(CPDFSDK_Annot::ObservedPtr* pAnnot, |
675 CPDFSDK_PageView* pPageView, | 658 CPDFSDK_PageView* pPageView, |
676 FX_BOOL& bRC, | 659 FX_BOOL& bRC, |
677 FX_BOOL& bExit, | 660 FX_BOOL& bExit, |
678 uint32_t nFlag) { | 661 uint32_t nFlag) { |
679 if (!m_bNotifying) { | 662 if (!m_bNotifying) { |
| 663 CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot->Get()); |
680 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { | 664 if (pWidget->GetAAction(CPDF_AAction::Validate).GetDict()) { |
| 665 ASSERT(pPageView); |
681 m_bNotifying = TRUE; | 666 m_bNotifying = TRUE; |
682 pWidget->ClearAppModified(); | 667 pWidget->ClearAppModified(); |
683 | 668 |
684 ASSERT(pPageView); | |
685 | |
686 PDFSDK_FieldAction fa; | 669 PDFSDK_FieldAction fa; |
687 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); | 670 fa.bModifier = m_pEnv->IsCTRLKeyDown(nFlag); |
688 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); | 671 fa.bShift = m_pEnv->IsSHIFTKeyDown(nFlag); |
689 fa.bKeyDown = TRUE; | 672 fa.bKeyDown = TRUE; |
690 fa.bRC = TRUE; | 673 fa.bRC = TRUE; |
691 | 674 |
692 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); | 675 CFFL_FormFiller* pFormFiller = GetFormFiller(pWidget, FALSE); |
693 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); | 676 pFormFiller->GetActionData(pPageView, CPDF_AAction::Validate, fa); |
694 pFormFiller->SaveState(pPageView); | 677 pFormFiller->SaveState(pPageView); |
695 | |
696 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); | 678 pWidget->OnAAction(CPDF_AAction::Validate, fa, pPageView); |
| 679 if (!(*pAnnot)) |
| 680 return; |
697 | 681 |
698 bRC = fa.bRC; | 682 bRC = fa.bRC; |
699 m_bNotifying = FALSE; | 683 m_bNotifying = FALSE; |
700 } | 684 } |
701 } | 685 } |
702 } | 686 } |
703 | 687 |
704 void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, | 688 void CFFL_InteractiveFormFiller::OnCalculate(CPDFSDK_Widget* pWidget, |
705 CPDFSDK_PageView* pPageView, | 689 CPDFSDK_PageView* pPageView, |
706 FX_BOOL& bExit, | 690 FX_BOOL& bExit, |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, | 797 void CFFL_InteractiveFormFiller::OnPopupPreOpen(void* pPrivateData, |
814 FX_BOOL& bExit, | 798 FX_BOOL& bExit, |
815 uint32_t nFlag) { | 799 uint32_t nFlag) { |
816 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 800 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
817 ASSERT(pData); | 801 ASSERT(pData); |
818 ASSERT(pData->pWidget); | 802 ASSERT(pData->pWidget); |
819 | 803 |
820 FX_BOOL bTempReset = FALSE; | 804 FX_BOOL bTempReset = FALSE; |
821 FX_BOOL bTempExit = FALSE; | 805 FX_BOOL bTempExit = FALSE; |
822 OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); | 806 OnPreOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); |
823 | 807 if (bTempReset || bTempExit) |
824 if (bTempReset || bTempExit) { | |
825 bExit = TRUE; | 808 bExit = TRUE; |
826 } | |
827 } | 809 } |
828 | 810 |
829 void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, | 811 void CFFL_InteractiveFormFiller::OnPopupPostOpen(void* pPrivateData, |
830 FX_BOOL& bExit, | 812 FX_BOOL& bExit, |
831 uint32_t nFlag) { | 813 uint32_t nFlag) { |
832 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; | 814 CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; |
833 ASSERT(pData); | 815 ASSERT(pData); |
834 ASSERT(pData->pWidget); | 816 ASSERT(pData->pWidget); |
835 | 817 |
836 FX_BOOL bTempReset = FALSE; | 818 FX_BOOL bTempReset = FALSE; |
837 FX_BOOL bTempExit = FALSE; | 819 FX_BOOL bTempExit = FALSE; |
838 OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); | 820 OnPostOpen(pData->pWidget, pData->pPageView, bTempReset, bTempExit, nFlag); |
839 | 821 if (bTempReset || bTempExit) |
840 if (bTempReset || bTempExit) { | |
841 bExit = TRUE; | 822 bExit = TRUE; |
842 } | |
843 } | 823 } |
844 | 824 |
845 void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, | 825 void CFFL_InteractiveFormFiller::OnPreOpen(CPDFSDK_Widget* pWidget, |
846 CPDFSDK_PageView* pPageView, | 826 CPDFSDK_PageView* pPageView, |
847 FX_BOOL& bReset, | 827 FX_BOOL& bReset, |
848 FX_BOOL& bExit, | 828 FX_BOOL& bExit, |
849 uint32_t nFlag) { | 829 uint32_t nFlag) { |
850 if (!m_bNotifying) { | 830 if (!m_bNotifying) { |
851 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { | 831 if (pWidget->HasXFAAAction(PDFSDK_XFA_PreOpen)) { |
852 m_bNotifying = TRUE; | 832 m_bNotifying = TRUE; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 | 888 |
909 bReset = TRUE; | 889 bReset = TRUE; |
910 } | 890 } |
911 } | 891 } |
912 } | 892 } |
913 } | 893 } |
914 #endif // PDF_ENABLE_XFA | 894 #endif // PDF_ENABLE_XFA |
915 | 895 |
916 FX_BOOL CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, | 896 FX_BOOL CFFL_InteractiveFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, |
917 CPDFSDK_Annot* pAnnot) { | 897 CPDFSDK_Annot* pAnnot) { |
918 if (pPageView) | 898 return pPageView && pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); |
919 return pPageView->IsValidAnnot(pAnnot->GetPDFAnnot()); | |
920 | |
921 return FALSE; | |
922 } | 899 } |
923 | 900 |
924 void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( | 901 void CFFL_InteractiveFormFiller::OnBeforeKeyStroke( |
925 void* pPrivateData, | 902 void* pPrivateData, |
926 CFX_WideString& strChange, | 903 CFX_WideString& strChange, |
927 const CFX_WideString& strChangeEx, | 904 const CFX_WideString& strChangeEx, |
928 int nSelStart, | 905 int nSelStart, |
929 int nSelEnd, | 906 int nSelEnd, |
930 FX_BOOL bKeyDown, | 907 FX_BOOL bKeyDown, |
931 FX_BOOL& bRC, | 908 FX_BOOL& bRC, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 fa.sChangeEx = strChangeEx; | 941 fa.sChangeEx = strChangeEx; |
965 fa.bKeyDown = bKeyDown; | 942 fa.bKeyDown = bKeyDown; |
966 fa.bWillCommit = FALSE; | 943 fa.bWillCommit = FALSE; |
967 fa.bRC = TRUE; | 944 fa.bRC = TRUE; |
968 fa.nSelStart = nSelStart; | 945 fa.nSelStart = nSelStart; |
969 fa.nSelEnd = nSelEnd; | 946 fa.nSelEnd = nSelEnd; |
970 | 947 |
971 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); | 948 pFormFiller->GetActionData(pData->pPageView, CPDF_AAction::KeyStroke, fa); |
972 pFormFiller->SaveState(pData->pPageView); | 949 pFormFiller->SaveState(pData->pPageView); |
973 | 950 |
| 951 CPDFSDK_Annot::ObservedPtr pObserved(pData->pWidget); |
974 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, | 952 if (pData->pWidget->OnAAction(CPDF_AAction::KeyStroke, fa, |
975 pData->pPageView)) { | 953 pData->pPageView)) { |
976 if (!IsValidAnnot(pData->pPageView, pData->pWidget)) { | 954 if (!pObserved || !IsValidAnnot(pData->pPageView, pData->pWidget)) { |
977 bExit = TRUE; | 955 bExit = TRUE; |
978 m_bNotifying = FALSE; | 956 m_bNotifying = FALSE; |
979 return; | 957 return; |
980 } | 958 } |
981 | 959 |
982 if (nAge != pData->pWidget->GetAppearanceAge()) { | 960 if (nAge != pData->pWidget->GetAppearanceAge()) { |
983 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow( | 961 CPWL_Wnd* pWnd = pFormFiller->ResetPDFWindow( |
984 pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); | 962 pData->pPageView, nValueAge == pData->pWidget->GetValueAge()); |
985 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); | 963 pData = (CFFL_PrivateData*)pWnd->GetAttachedData(); |
986 bExit = TRUE; | 964 bExit = TRUE; |
(...skipping 17 matching lines...) Expand all Loading... |
1004 bExit = TRUE; | 982 bExit = TRUE; |
1005 m_bNotifying = FALSE; | 983 m_bNotifying = FALSE; |
1006 return; | 984 return; |
1007 } | 985 } |
1008 } | 986 } |
1009 | 987 |
1010 m_bNotifying = FALSE; | 988 m_bNotifying = FALSE; |
1011 } | 989 } |
1012 } | 990 } |
1013 } | 991 } |
OLD | NEW |