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

Side by Side Diff: fpdfsdk/cpdfsdk_xfawidgethandler.cpp

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

Powered by Google App Engine
This is Rietveld 408576698