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" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, | 49 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, |
50 CPDFSDK_Annot* pAnnot, | 50 CPDFSDK_Annot* pAnnot, |
51 CFX_RenderDevice* pDevice, | 51 CFX_RenderDevice* pDevice, |
52 CFX_Matrix* pUser2Device, | 52 CFX_Matrix* pUser2Device, |
53 bool bDrawAnnots) { | 53 bool bDrawAnnots) { |
54 ASSERT(pPageView); | 54 ASSERT(pPageView); |
55 ASSERT(pAnnot); | 55 ASSERT(pAnnot); |
56 | 56 |
57 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | |
58 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); | |
59 | |
60 CFX_Graphics gs; | 57 CFX_Graphics gs; |
61 gs.Create(pDevice); | 58 gs.Create(pDevice); |
62 | 59 |
63 CFX_Matrix mt; | 60 CFX_Matrix mt; |
64 mt = *pUser2Device; | 61 mt = *pUser2Device; |
65 | 62 |
66 FX_BOOL bIsHighlight = FALSE; | 63 FX_BOOL bIsHighlight = FALSE; |
67 if (pSDKDoc->GetFocusAnnot() != pAnnot) | 64 if (pPageView->GetFormFillEnv()->GetSDKDocument()->GetFocusAnnot() != pAnnot) |
68 bIsHighlight = TRUE; | 65 bIsHighlight = TRUE; |
69 | 66 |
70 pWidgetHandler->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, bIsHighlight); | 67 GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, |
| 68 bIsHighlight); |
71 | 69 |
72 // to do highlight and shadow | 70 // to do highlight and shadow |
73 } | 71 } |
74 | 72 |
75 void CPDFSDK_XFAWidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {} | 73 void CPDFSDK_XFAWidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {} |
76 | 74 |
77 void CPDFSDK_XFAWidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} | 75 void CPDFSDK_XFAWidgetHandler::OnLoad(CPDFSDK_Annot* pAnnot) {} |
78 | 76 |
79 void CPDFSDK_XFAWidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {} | 77 void CPDFSDK_XFAWidgetHandler::OnDelete(CPDFSDK_Annot* pAnnot) {} |
80 | 78 |
(...skipping 29 matching lines...) Expand all Loading... |
110 | 108 |
111 return rcWidget; | 109 return rcWidget; |
112 } | 110 } |
113 | 111 |
114 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, | 112 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, |
115 CPDFSDK_Annot* pAnnot, | 113 CPDFSDK_Annot* pAnnot, |
116 const CFX_FloatPoint& point) { | 114 const CFX_FloatPoint& point) { |
117 if (!pPageView || !pAnnot) | 115 if (!pPageView || !pAnnot) |
118 return FALSE; | 116 return FALSE; |
119 | 117 |
120 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 118 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); |
121 if (!pSDKDoc) | 119 if (!pFormFillEnv->GetSDKDocument()) |
122 return FALSE; | 120 return FALSE; |
123 | 121 |
124 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 122 CPDFXFA_Document* pDoc = pFormFillEnv->GetSDKDocument()->GetXFADocument(); |
125 if (!pDoc) | 123 if (!pDoc) |
126 return FALSE; | 124 return FALSE; |
127 | 125 |
128 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); | 126 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); |
129 if (!pDocView) | 127 if (!pDocView) |
130 return FALSE; | 128 return FALSE; |
131 | 129 |
132 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); | 130 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); |
133 if (!pWidgetHandler) | 131 if (!pWidgetHandler) |
134 return FALSE; | 132 return FALSE; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 | 337 |
340 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler( | 338 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler( |
341 CPDFSDK_Annot* pAnnot) { | 339 CPDFSDK_Annot* pAnnot) { |
342 if (!pAnnot) | 340 if (!pAnnot) |
343 return nullptr; | 341 return nullptr; |
344 | 342 |
345 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); | 343 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); |
346 if (!pPageView) | 344 if (!pPageView) |
347 return nullptr; | 345 return nullptr; |
348 | 346 |
349 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); | 347 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); |
350 if (!pSDKDoc) | 348 if (!pFormFillEnv->GetSDKDocument()) |
351 return nullptr; | 349 return nullptr; |
352 | 350 |
353 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); | 351 CPDFXFA_Document* pDoc = pFormFillEnv->GetSDKDocument()->GetXFADocument(); |
354 if (!pDoc) | 352 if (!pDoc) |
355 return nullptr; | 353 return nullptr; |
356 | 354 |
357 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); | 355 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); |
358 if (!pDocView) | 356 if (!pDocView) |
359 return nullptr; | 357 return nullptr; |
360 | 358 |
361 return pDocView->GetWidgetHandler(); | 359 return pDocView->GetWidgetHandler(); |
362 } | 360 } |
363 | 361 |
(...skipping 15 matching lines...) Expand all Loading... |
379 dwFWLFlag |= FWL_KEYFLAG_MButton; | 377 dwFWLFlag |= FWL_KEYFLAG_MButton; |
380 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) | 378 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) |
381 dwFWLFlag |= FWL_KEYFLAG_RButton; | 379 dwFWLFlag |= FWL_KEYFLAG_RButton; |
382 if (dwFlag & FWL_EVENTFLAG_ShiftKey) | 380 if (dwFlag & FWL_EVENTFLAG_ShiftKey) |
383 dwFWLFlag |= FWL_KEYFLAG_Shift; | 381 dwFWLFlag |= FWL_KEYFLAG_Shift; |
384 if (dwFlag & FWL_EVENTFLAG_AltKey) | 382 if (dwFlag & FWL_EVENTFLAG_AltKey) |
385 dwFWLFlag |= FWL_KEYFLAG_Alt; | 383 dwFWLFlag |= FWL_KEYFLAG_Alt; |
386 | 384 |
387 return dwFWLFlag; | 385 return dwFWLFlag; |
388 } | 386 } |
OLD | NEW |