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

Side by Side Diff: fpdfsdk/cpdfsdk_xfawidgethandler.cpp

Issue 2412523002: Cleanup env variable names (Closed)
Patch Set: Cleanup 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"
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_document.h"
16 #include "xfa/fwl/core/fwl_widgethit.h" 16 #include "xfa/fwl/core/fwl_widgethit.h"
17 #include "xfa/fxfa/fxfa_basic.h" 17 #include "xfa/fxfa/fxfa_basic.h"
18 #include "xfa/fxfa/xfa_ffdocview.h" 18 #include "xfa/fxfa/xfa_ffdocview.h"
19 #include "xfa/fxfa/xfa_ffpageview.h" 19 #include "xfa/fxfa/xfa_ffpageview.h"
20 #include "xfa/fxfa/xfa_ffwidget.h" 20 #include "xfa/fxfa/xfa_ffwidget.h"
21 #include "xfa/fxfa/xfa_ffwidgethandler.h" 21 #include "xfa/fxfa/xfa_ffwidgethandler.h"
22 #include "xfa/fxgraphics/cfx_graphics.h" 22 #include "xfa/fxgraphics/cfx_graphics.h"
23 23
24 CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler( 24 CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(
25 CPDFSDK_FormFillEnvironment* pEnv) 25 CPDFSDK_FormFillEnvironment* pFormFillEnv)
26 : m_pEnv(pEnv) {} 26 : m_pFormFillEnv(pFormFillEnv) {}
27 27
28 CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {} 28 CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {}
29 29
30 FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { 30 FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
31 return !!pAnnot->GetXFAWidget(); 31 return !!pAnnot->GetXFAWidget();
32 } 32 }
33 33
34 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CPDF_Annot* pAnnot, 34 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CPDF_Annot* pAnnot,
35 CPDFSDK_PageView* pPage) { 35 CPDFSDK_PageView* pPage) {
36 return nullptr; 36 return nullptr;
37 } 37 }
38 38
39 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot, 39 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot,
40 CPDFSDK_PageView* pPage) { 40 CPDFSDK_PageView* pPage) {
41 CPDFSDK_InterForm* pInterForm = m_pEnv->GetSDKDocument()->GetInterForm(); 41 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
42 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); 42 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm);
43 pInterForm->AddXFAMap(pAnnot, pWidget); 43 pInterForm->AddXFAMap(pAnnot, pWidget);
44 return pWidget; 44 return pWidget;
45 } 45 }
46 46
47 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, 47 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
48 CPDFSDK_Annot* pAnnot, 48 CPDFSDK_Annot* pAnnot,
49 CFX_RenderDevice* pDevice, 49 CFX_RenderDevice* pDevice,
50 CFX_Matrix* pUser2Device, 50 CFX_Matrix* pUser2Device,
51 bool bDrawAnnots) { 51 bool bDrawAnnots) {
52 ASSERT(pPageView); 52 ASSERT(pPageView);
53 ASSERT(pAnnot); 53 ASSERT(pAnnot);
54 54
55 CFX_Graphics gs; 55 CFX_Graphics gs;
56 gs.Create(pDevice); 56 gs.Create(pDevice);
57 57
58 CFX_Matrix mt; 58 CFX_Matrix mt;
59 mt = *pUser2Device; 59 mt = *pUser2Device;
60 60
61 FX_BOOL bIsHighlight = FALSE; 61 FX_BOOL bIsHighlight = FALSE;
62 if (pPageView->GetFormFillEnv()->GetSDKDocument()->GetFocusAnnot() != pAnnot) 62 if (pPageView->GetFormFillEnv()->GetFocusAnnot() != pAnnot)
63 bIsHighlight = TRUE; 63 bIsHighlight = TRUE;
64 64
65 GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt, 65 GetXFAWidgetHandler(pAnnot)->RenderWidget(pAnnot->GetXFAWidget(), &gs, &mt,
66 bIsHighlight); 66 bIsHighlight);
67 67
68 // to do highlight and shadow 68 // to do highlight and shadow
69 } 69 }
70 70
71 void CPDFSDK_XFAWidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {} 71 void CPDFSDK_XFAWidgetHandler::OnCreate(CPDFSDK_Annot* pAnnot) {}
72 72
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return rcWidget; 107 return rcWidget;
108 } 108 }
109 109
110 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, 110 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
111 CPDFSDK_Annot* pAnnot, 111 CPDFSDK_Annot* pAnnot,
112 const CFX_FloatPoint& point) { 112 const CFX_FloatPoint& point) {
113 if (!pPageView || !pAnnot) 113 if (!pPageView || !pAnnot)
114 return FALSE; 114 return FALSE;
115 115
116 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); 116 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
117 if (!pFormFillEnv->GetSDKDocument()) 117 if (!pFormFillEnv)
118 return FALSE; 118 return FALSE;
119 119
120 CPDFXFA_Document* pDoc = pFormFillEnv->GetSDKDocument()->GetXFADocument(); 120 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
121 if (!pDoc) 121 if (!pDoc)
122 return FALSE; 122 return FALSE;
123 123
124 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 124 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
125 if (!pDocView) 125 if (!pDocView)
126 return FALSE; 126 return FALSE;
127 127
128 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); 128 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
129 if (!pWidgetHandler) 129 if (!pWidgetHandler)
130 return FALSE; 130 return FALSE;
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler( 336 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler(
337 CPDFSDK_Annot* pAnnot) { 337 CPDFSDK_Annot* pAnnot) {
338 if (!pAnnot) 338 if (!pAnnot)
339 return nullptr; 339 return nullptr;
340 340
341 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 341 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
342 if (!pPageView) 342 if (!pPageView)
343 return nullptr; 343 return nullptr;
344 344
345 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv(); 345 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
346 if (!pFormFillEnv->GetSDKDocument()) 346 if (!pFormFillEnv)
347 return nullptr; 347 return nullptr;
348 348
349 CPDFXFA_Document* pDoc = pFormFillEnv->GetSDKDocument()->GetXFADocument(); 349 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
350 if (!pDoc) 350 if (!pDoc)
351 return nullptr; 351 return nullptr;
352 352
353 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 353 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
354 if (!pDocView) 354 if (!pDocView)
355 return nullptr; 355 return nullptr;
356 356
357 return pDocView->GetWidgetHandler(); 357 return pDocView->GetWidgetHandler();
358 } 358 }
359 359
(...skipping 15 matching lines...) Expand all
375 dwFWLFlag |= FWL_KEYFLAG_MButton; 375 dwFWLFlag |= FWL_KEYFLAG_MButton;
376 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) 376 if (dwFlag & FWL_EVENTFLAG_RightButtonDown)
377 dwFWLFlag |= FWL_KEYFLAG_RButton; 377 dwFWLFlag |= FWL_KEYFLAG_RButton;
378 if (dwFlag & FWL_EVENTFLAG_ShiftKey) 378 if (dwFlag & FWL_EVENTFLAG_ShiftKey)
379 dwFWLFlag |= FWL_KEYFLAG_Shift; 379 dwFWLFlag |= FWL_KEYFLAG_Shift;
380 if (dwFlag & FWL_EVENTFLAG_AltKey) 380 if (dwFlag & FWL_EVENTFLAG_AltKey)
381 dwFWLFlag |= FWL_KEYFLAG_Alt; 381 dwFWLFlag |= FWL_KEYFLAG_Alt;
382 382
383 return dwFWLFlag; 383 return dwFWLFlag;
384 } 384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698