OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/cpdfsdk_xfawidgethandler.h" | 7 #include "fpdfsdk/cpdfsdk_xfawidgethandler.h" |
8 | 8 |
9 #include "core/fpdfdoc/cpdf_interform.h" | 9 #include "core/fpdfdoc/cpdf_interform.h" |
10 #include "fpdfsdk/cpdfsdk_annot.h" | 10 #include "fpdfsdk/cpdfsdk_annot.h" |
11 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 11 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
12 #include "fpdfsdk/cpdfsdk_interform.h" | 12 #include "fpdfsdk/cpdfsdk_interform.h" |
13 #include "fpdfsdk/cpdfsdk_pageview.h" | 13 #include "fpdfsdk/cpdfsdk_pageview.h" |
14 #include "fpdfsdk/cpdfsdk_xfawidget.h" | 14 #include "fpdfsdk/cpdfsdk_xfawidget.h" |
15 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" | 15 #include "fpdfsdk/fpdfxfa/cpdfxfa_context.h" |
16 #include "xfa/fwl/core/fwl_widgethit.h" | 16 #include "xfa/fwl/core/fwl_widgethit.h" |
17 #include "xfa/fwl/core/ifwl_app.h" | 17 #include "xfa/fwl/core/ifwl_app.h" |
18 #include "xfa/fxfa/fxfa_basic.h" | 18 #include "xfa/fxfa/fxfa_basic.h" |
19 #include "xfa/fxfa/xfa_ffdocview.h" | 19 #include "xfa/fxfa/xfa_ffdocview.h" |
20 #include "xfa/fxfa/xfa_ffpageview.h" | 20 #include "xfa/fxfa/xfa_ffpageview.h" |
21 #include "xfa/fxfa/xfa_ffwidget.h" | 21 #include "xfa/fxfa/xfa_ffwidget.h" |
22 #include "xfa/fxfa/xfa_ffwidgethandler.h" | 22 #include "xfa/fxfa/xfa_ffwidgethandler.h" |
23 #include "xfa/fxgraphics/cfx_graphics.h" | 23 #include "xfa/fxgraphics/cfx_graphics.h" |
24 | 24 |
25 CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler( | 25 CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 103 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
104 CPDFSDK_Annot* pAnnot, | 104 CPDFSDK_Annot* pAnnot, |
105 const CFX_FloatPoint& point) { | 105 const CFX_FloatPoint& point) { |
106 if (!pPageView || !pAnnot) | 106 if (!pPageView || !pAnnot) |
107 return FALSE; | 107 return FALSE; |
108 | 108 |
109 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); | 109 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); |
110 if (!pFormFillEnv) | 110 if (!pFormFillEnv) |
111 return FALSE; | 111 return FALSE; |
112 | 112 |
113 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument(); | 113 CPDFXFA_Context* pContext = pFormFillEnv->GetXFAContext(); |
114 if (!pDoc) | 114 if (!pContext) |
115 return FALSE; | 115 return FALSE; |
116 | 116 |
117 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); | 117 CXFA_FFDocView* pDocView = pContext->GetXFADocView(); |
118 if (!pDocView) | 118 if (!pDocView) |
119 return FALSE; | 119 return FALSE; |
120 | 120 |
121 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); | 121 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
122 if (!pWidgetHandler) | 122 if (!pWidgetHandler) |
123 return FALSE; | 123 return FALSE; |
124 | 124 |
125 FWL_WidgetHit dwHitTest = | 125 FWL_WidgetHit dwHitTest = |
126 pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); | 126 pWidgetHandler->OnHitTest(pAnnot->GetXFAWidget(), point.x, point.y); |
127 return dwHitTest != FWL_WidgetHit::Unknown; | 127 return dwHitTest != FWL_WidgetHit::Unknown; |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 return nullptr; | 328 return nullptr; |
329 | 329 |
330 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 330 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
331 if (!pPageView) | 331 if (!pPageView) |
332 return nullptr; | 332 return nullptr; |
333 | 333 |
334 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); | 334 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); |
335 if (!pFormFillEnv) | 335 if (!pFormFillEnv) |
336 return nullptr; | 336 return nullptr; |
337 | 337 |
338 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument(); | 338 CPDFXFA_Context* pDoc = pFormFillEnv->GetXFAContext(); |
339 if (!pDoc) | 339 if (!pDoc) |
340 return nullptr; | 340 return nullptr; |
341 | 341 |
342 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); | 342 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); |
343 if (!pDocView) | 343 if (!pDocView) |
344 return nullptr; | 344 return nullptr; |
345 | 345 |
346 return pDocView->GetWidgetHandler(); | 346 return pDocView->GetWidgetHandler(); |
347 } | 347 } |
348 | 348 |
349 uint32_t CPDFSDK_XFAWidgetHandler::GetFWLFlags(uint32_t dwFlag) { | 349 uint32_t CPDFSDK_XFAWidgetHandler::GetFWLFlags(uint32_t dwFlag) { |
350 uint32_t dwFWLFlag = 0; | 350 uint32_t dwFWLFlag = 0; |
351 | 351 |
352 if (dwFlag & FWL_EVENTFLAG_ControlKey) | 352 if (dwFlag & FWL_EVENTFLAG_ControlKey) |
353 dwFWLFlag |= FWL_KEYFLAG_Ctrl; | 353 dwFWLFlag |= FWL_KEYFLAG_Ctrl; |
354 if (dwFlag & FWL_EVENTFLAG_LeftButtonDown) | 354 if (dwFlag & FWL_EVENTFLAG_LeftButtonDown) |
355 dwFWLFlag |= FWL_KEYFLAG_LButton; | 355 dwFWLFlag |= FWL_KEYFLAG_LButton; |
356 if (dwFlag & FWL_EVENTFLAG_MiddleButtonDown) | 356 if (dwFlag & FWL_EVENTFLAG_MiddleButtonDown) |
357 dwFWLFlag |= FWL_KEYFLAG_MButton; | 357 dwFWLFlag |= FWL_KEYFLAG_MButton; |
358 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) | 358 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) |
359 dwFWLFlag |= FWL_KEYFLAG_RButton; | 359 dwFWLFlag |= FWL_KEYFLAG_RButton; |
360 if (dwFlag & FWL_EVENTFLAG_ShiftKey) | 360 if (dwFlag & FWL_EVENTFLAG_ShiftKey) |
361 dwFWLFlag |= FWL_KEYFLAG_Shift; | 361 dwFWLFlag |= FWL_KEYFLAG_Shift; |
362 if (dwFlag & FWL_EVENTFLAG_AltKey) | 362 if (dwFlag & FWL_EVENTFLAG_AltKey) |
363 dwFWLFlag |= FWL_KEYFLAG_Alt; | 363 dwFWLFlag |= FWL_KEYFLAG_Alt; |
364 | 364 |
365 return dwFWLFlag; | 365 return dwFWLFlag; |
366 } | 366 } |
OLD | NEW |