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

Side by Side Diff: fpdfsdk/cpdfsdk_xfawidgethandler.cpp

Issue 2400473002: Start proxying CPDFSDK_Document methods through CPDFSDK_FormFillEnvironment (Closed)
Patch Set: Rebase to master 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
« no previous file with comments | « fpdfsdk/cpdfsdk_xfawidgethandler.h ('k') | fpdfsdk/formfiller/cffl_interactiveformfiller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_document.h" 11 #include "fpdfsdk/cpdfsdk_document.h"
12 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" 12 #include "fpdfsdk/cpdfsdk_formfillenvironment.h"
13 #include "fpdfsdk/cpdfsdk_interform.h" 13 #include "fpdfsdk/cpdfsdk_interform.h"
14 #include "fpdfsdk/cpdfsdk_pageview.h" 14 #include "fpdfsdk/cpdfsdk_pageview.h"
15 #include "fpdfsdk/cpdfsdk_xfawidget.h" 15 #include "fpdfsdk/cpdfsdk_xfawidget.h"
16 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h" 16 #include "fpdfsdk/fpdfxfa/cpdfxfa_document.h"
17 #include "xfa/fwl/core/fwl_widgethit.h" 17 #include "xfa/fwl/core/fwl_widgethit.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(
26 CPDFSDK_FormFillEnvironment* pEnv) 26 CPDFSDK_FormFillEnvironment* pFormFillEnv)
27 : m_pEnv(pEnv) {} 27 : m_pFormFillEnv(pFormFillEnv) {}
28 28
29 CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {} 29 CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {}
30 30
31 FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) { 31 FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
32 return !!pAnnot->GetXFAWidget(); 32 return !!pAnnot->GetXFAWidget();
33 } 33 }
34 34
35 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CPDF_Annot* pAnnot, 35 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CPDF_Annot* pAnnot,
36 CPDFSDK_PageView* pPage) { 36 CPDFSDK_PageView* pPage) {
37 return nullptr; 37 return nullptr;
38 } 38 }
39 39
40 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot, 40 CPDFSDK_Annot* CPDFSDK_XFAWidgetHandler::NewAnnot(CXFA_FFWidget* pAnnot,
41 CPDFSDK_PageView* pPage) { 41 CPDFSDK_PageView* pPage) {
42 CPDFSDK_Document* pSDKDoc = m_pEnv->GetSDKDocument(); 42 CPDFSDK_InterForm* pInterForm = m_pFormFillEnv->GetInterForm();
43 CPDFSDK_InterForm* pInterForm = pSDKDoc->GetInterForm();
44 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm); 43 CPDFSDK_XFAWidget* pWidget = new CPDFSDK_XFAWidget(pAnnot, pPage, pInterForm);
45 pInterForm->AddXFAMap(pAnnot, pWidget); 44 pInterForm->AddXFAMap(pAnnot, pWidget);
46 return pWidget; 45 return pWidget;
47 } 46 }
48 47
49 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView, 48 void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
50 CPDFSDK_Annot* pAnnot, 49 CPDFSDK_Annot* pAnnot,
51 CFX_RenderDevice* pDevice, 50 CFX_RenderDevice* pDevice,
52 CFX_Matrix* pUser2Device, 51 CFX_Matrix* pUser2Device,
53 bool bDrawAnnots) { 52 bool bDrawAnnots) {
54 ASSERT(pPageView); 53 ASSERT(pPageView);
55 ASSERT(pAnnot); 54 ASSERT(pAnnot);
56 55
57 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); 56 CPDFSDK_Document* pSDKDoc = pPageView->GetFormFillEnv()->GetSDKDocument();
58 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot); 57 CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
59 58
60 CFX_Graphics gs; 59 CFX_Graphics gs;
61 gs.Create(pDevice); 60 gs.Create(pDevice);
62 61
63 CFX_Matrix mt; 62 CFX_Matrix mt;
64 mt = *pUser2Device; 63 mt = *pUser2Device;
65 64
66 FX_BOOL bIsHighlight = FALSE; 65 FX_BOOL bIsHighlight = FALSE;
67 if (pSDKDoc->GetFocusAnnot() != pAnnot) 66 if (pSDKDoc->GetFocusAnnot() != pAnnot)
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 109
111 return rcWidget; 110 return rcWidget;
112 } 111 }
113 112
114 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView, 113 FX_BOOL CPDFSDK_XFAWidgetHandler::HitTest(CPDFSDK_PageView* pPageView,
115 CPDFSDK_Annot* pAnnot, 114 CPDFSDK_Annot* pAnnot,
116 const CFX_FloatPoint& point) { 115 const CFX_FloatPoint& point) {
117 if (!pPageView || !pAnnot) 116 if (!pPageView || !pAnnot)
118 return FALSE; 117 return FALSE;
119 118
120 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); 119 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
121 if (!pSDKDoc) 120 if (!pFormFillEnv)
122 return FALSE; 121 return FALSE;
123 122
124 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 123 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
125 if (!pDoc) 124 if (!pDoc)
126 return FALSE; 125 return FALSE;
127 126
128 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 127 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
129 if (!pDocView) 128 if (!pDocView)
130 return FALSE; 129 return FALSE;
131 130
132 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler(); 131 CXFA_FFWidgetHandler* pWidgetHandler = pDocView->GetWidgetHandler();
133 if (!pWidgetHandler) 132 if (!pWidgetHandler)
134 return FALSE; 133 return FALSE;
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 338
340 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler( 339 CXFA_FFWidgetHandler* CPDFSDK_XFAWidgetHandler::GetXFAWidgetHandler(
341 CPDFSDK_Annot* pAnnot) { 340 CPDFSDK_Annot* pAnnot) {
342 if (!pAnnot) 341 if (!pAnnot)
343 return nullptr; 342 return nullptr;
344 343
345 CPDFSDK_PageView* pPageView = pAnnot->GetPageView(); 344 CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
346 if (!pPageView) 345 if (!pPageView)
347 return nullptr; 346 return nullptr;
348 347
349 CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument(); 348 CPDFSDK_FormFillEnvironment* pFormFillEnv = pPageView->GetFormFillEnv();
350 if (!pSDKDoc) 349 if (!pFormFillEnv)
351 return nullptr; 350 return nullptr;
352 351
353 CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument(); 352 CPDFXFA_Document* pDoc = pFormFillEnv->GetXFADocument();
354 if (!pDoc) 353 if (!pDoc)
355 return nullptr; 354 return nullptr;
356 355
357 CXFA_FFDocView* pDocView = pDoc->GetXFADocView(); 356 CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
358 if (!pDocView) 357 if (!pDocView)
359 return nullptr; 358 return nullptr;
360 359
361 return pDocView->GetWidgetHandler(); 360 return pDocView->GetWidgetHandler();
362 } 361 }
363 362
(...skipping 15 matching lines...) Expand all
379 dwFWLFlag |= FWL_KEYFLAG_MButton; 378 dwFWLFlag |= FWL_KEYFLAG_MButton;
380 if (dwFlag & FWL_EVENTFLAG_RightButtonDown) 379 if (dwFlag & FWL_EVENTFLAG_RightButtonDown)
381 dwFWLFlag |= FWL_KEYFLAG_RButton; 380 dwFWLFlag |= FWL_KEYFLAG_RButton;
382 if (dwFlag & FWL_EVENTFLAG_ShiftKey) 381 if (dwFlag & FWL_EVENTFLAG_ShiftKey)
383 dwFWLFlag |= FWL_KEYFLAG_Shift; 382 dwFWLFlag |= FWL_KEYFLAG_Shift;
384 if (dwFlag & FWL_EVENTFLAG_AltKey) 383 if (dwFlag & FWL_EVENTFLAG_AltKey)
385 dwFWLFlag |= FWL_KEYFLAG_Alt; 384 dwFWLFlag |= FWL_KEYFLAG_Alt;
386 385
387 return dwFWLFlag; 386 return dwFWLFlag;
388 } 387 }
OLDNEW
« no previous file with comments | « fpdfsdk/cpdfsdk_xfawidgethandler.h ('k') | fpdfsdk/formfiller/cffl_interactiveformfiller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698