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

Side by Side Diff: fpdfsdk/cpdfsdk_xfawidgethandler.cpp

Issue 2400673002: Convert CPDFSDK_PageView to have a CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Created 4 years, 2 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
OLDNEW
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
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 28 matching lines...) Expand all
109 rcWidget.top += 1.0f; 107 rcWidget.top += 1.0f;
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 if (!pPageView->GetFormFillEnv()->GetSDKDocument())
Tom Sepez 2016/10/06 18:46:28 really want local here.
dsinclair 2016/10/06 19:32:55 Added one for the FormFillEnv.
120 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
121 if (!pSDKDoc)
122 return FALSE; 118 return FALSE;
123 119
124 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 120 CPDFXFA_Document* pDoc =
121 pPageView->GetFormFillEnv()->GetSDKDocument()->GetXFADocument();
125 if (!pDoc) 122 if (!pDoc)
126 return FALSE; 123 return FALSE;
127 124
128 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 125 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
129 if (!pDocView) 126 if (!pDocView)
130 return FALSE; 127 return FALSE;
131 128
132 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); 129 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
133 if (!pWidgetHandler) 130 if (!pWidgetHandler)
134 return FALSE; 131 return FALSE;
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 335 }
339 336
340 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler( 337 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler(
341 CPDFSDK_Annot* pAnnot) { 338 CPDFSDK_Annot* pAnnot) {
342 if (!pAnnot) 339 if (!pAnnot)
343 return nullptr; 340 return nullptr;
344 341
345 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 342 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
346 if (!pPageView) 343 if (!pPageView)
347 return nullptr; 344 return nullptr;
348 345 if (!pPageView->GetFormFillEnv()->GetSDKDocument())
Tom Sepez 2016/10/06 18:46:28 ditto
dsinclair 2016/10/06 19:32:55 Done.
349 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
350 if (!pSDKDoc)
351 return nullptr; 346 return nullptr;
352 347
353 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 348 CPDFXFA_Document* pDoc =
349 pPageView->GetFormFillEnv()->GetSDKDocument()->GetXFADocument();
354 if (!pDoc) 350 if (!pDoc)
355 return nullptr; 351 return nullptr;
356 352
357 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 353 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
358 if (!pDocView) 354 if (!pDocView)
359 return nullptr; 355 return nullptr;
360 356
361 return pDocView->GetWidgetHandler(); 357 return pDocView->GetWidgetHandler();
362 } 358 }
363 359
(...skipping 15 matching lines...) Expand all
379 dwFWLFlag |= FWL_KEYFLAG_MButton; 375 dwFWLFlag |= FWL_KEYFLAG_MButton;
380 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) 376 if (dwFlag & FWL_EVENTFLAG_RightButtonDown)
381 dwFWLFlag |= FWL_KEYFLAG_RButton; 377 dwFWLFlag |= FWL_KEYFLAG_RButton;
382 if (dwFlag & FWL_EVENTFLAG_ShiftKey) 378 if (dwFlag & FWL_EVENTFLAG_ShiftKey)
383 dwFWLFlag |= FWL_KEYFLAG_Shift; 379 dwFWLFlag |= FWL_KEYFLAG_Shift;
384 if (dwFlag & FWL_EVENTFLAG_AltKey) 380 if (dwFlag & FWL_EVENTFLAG_AltKey)
385 dwFWLFlag |= FWL_KEYFLAG_Alt; 381 dwFWLFlag |= FWL_KEYFLAG_Alt;
386 382
387 return dwFWLFlag; 383 return dwFWLFlag;
388 } 384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698