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

Side by Side Diff: xfa/fxfa/app/xfa_ffpageview.cpp

Issue 1878963004: Cleanup CPDFXFA_Page. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: and a little more Created 4 years, 8 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 | « xfa/fxfa/app/xfa_ffdocview.cpp ('k') | xfa/fxfa/include/xfa_ffpageview.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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "xfa/fxfa/include/xfa_ffpageview.h" 7 #include "xfa/fxfa/include/xfa_ffpageview.h"
8 8
9 #include "xfa/fde/fde_render.h" 9 #include "xfa/fde/fde_render.h"
10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h" 10 #include "xfa/fxfa/app/xfa_ffcheckbutton.h"
11 #include "xfa/fxfa/app/xfa_ffchoicelist.h" 11 #include "xfa/fxfa/app/xfa_ffchoicelist.h"
12 #include "xfa/fxfa/app/xfa_fffield.h" 12 #include "xfa/fxfa/app/xfa_fffield.h"
13 #include "xfa/fxfa/app/xfa_ffimageedit.h" 13 #include "xfa/fxfa/app/xfa_ffimageedit.h"
14 #include "xfa/fxfa/app/xfa_ffpushbutton.h" 14 #include "xfa/fxfa/app/xfa_ffpushbutton.h"
15 #include "xfa/fxfa/app/xfa_fftextedit.h" 15 #include "xfa/fxfa/app/xfa_fftextedit.h"
16 #include "xfa/fxfa/app/xfa_fwladapter.h" 16 #include "xfa/fxfa/app/xfa_fwladapter.h"
17 #include "xfa/fxfa/include/xfa_ffdoc.h" 17 #include "xfa/fxfa/include/xfa_ffdoc.h"
18 #include "xfa/fxfa/include/xfa_ffdocview.h" 18 #include "xfa/fxfa/include/xfa_ffdocview.h"
19 #include "xfa/fxfa/include/xfa_ffwidget.h" 19 #include "xfa/fxfa/include/xfa_ffwidget.h"
20 20
21 CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) 21 CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
22 : CXFA_ContainerLayoutItem(pPageArea), 22 : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {}
23 m_pDocView(pDocView), 23
24 m_bLoaded(FALSE) {}
25 CXFA_FFPageView::~CXFA_FFPageView() {} 24 CXFA_FFPageView::~CXFA_FFPageView() {}
26 CXFA_FFDocView* CXFA_FFPageView::GetDocView() { 25
26 CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
27 return m_pDocView; 27 return m_pDocView;
28 } 28 }
29 int32_t CXFA_FFPageView::GetPageViewIndex() { 29
30 int32_t CXFA_FFPageView::GetPageViewIndex() const {
30 return GetPageIndex(); 31 return GetPageIndex();
31 } 32 }
32 void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) { 33
34 void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const {
33 CFX_SizeF sz; 35 CFX_SizeF sz;
34 GetPageSize(sz); 36 GetPageSize(sz);
35 rtPage.Set(0, 0, sz); 37 rtPage.Set(0, 0, sz);
36 } 38 }
37 void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt, 39 void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
38 const CFX_Rect& rtDisp, 40 const CFX_Rect& rtDisp,
39 int32_t iRotate) { 41 int32_t iRotate) const {
40 CFX_SizeF sz; 42 CFX_SizeF sz;
41 GetPageSize(sz); 43 GetPageSize(sz);
42 CFX_RectF fdePage; 44 CFX_RectF fdePage;
43 fdePage.Set(0, 0, sz.x, sz.y); 45 fdePage.Set(0, 0, sz.x, sz.y);
44 FDE_GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0); 46 FDE_GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0);
45 } 47 }
46 int32_t CXFA_FFPageView::LoadPageView(IFX_Pause* pPause) { 48
47 if (m_bLoaded) {
48 return 100;
49 }
50 m_bLoaded = TRUE;
51 return 100;
52 }
53 void CXFA_FFPageView::UnloadPageView() {
54 if (!m_bLoaded) {
55 return;
56 }
57 }
58 FX_BOOL CXFA_FFPageView::IsPageViewLoaded() {
59 return m_bLoaded;
60 }
61 CXFA_FFWidget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) {
62 if (!m_bLoaded) {
63 return nullptr;
64 }
65 IXFA_WidgetIterator* pIterator = CreateWidgetIterator();
66 CXFA_FFWidget* pWidget = nullptr;
67 while ((pWidget = static_cast<CXFA_FFWidget*>(pIterator->MoveToNext()))) {
68 if (!(pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
69 continue;
70 }
71 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
72 int32_t type = pAcc->GetClassID();
73 if (type != XFA_ELEMENT_Field && type != XFA_ELEMENT_Draw) {
74 continue;
75 }
76 FX_FLOAT fWidgetx = fx;
77 FX_FLOAT fWidgety = fy;
78 pWidget->Rotate2Normal(fWidgetx, fWidgety);
79 uint32_t dwFlag = pWidget->OnHitTest(fWidgetx, fWidgety);
80 if ((FWL_WGTHITTEST_Client == dwFlag ||
81 FWL_WGTHITTEST_HyperLink == dwFlag)) {
82 break;
83 }
84 }
85 pIterator->Release();
86 return pWidget;
87 }
88 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator( 49 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
89 uint32_t dwTraverseWay, 50 uint32_t dwTraverseWay,
90 uint32_t dwWidgetFilter) { 51 uint32_t dwWidgetFilter) {
91 switch (dwTraverseWay) { 52 switch (dwTraverseWay) {
92 case XFA_TRAVERSEWAY_Tranvalse: 53 case XFA_TRAVERSEWAY_Tranvalse:
93 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter); 54 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
94 case XFA_TRAVERSEWAY_Form: 55 case XFA_TRAVERSEWAY_Form:
95 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter); 56 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
96 } 57 }
97 return NULL; 58 return nullptr;
98 } 59 }
60
99 static FX_BOOL XFA_PageWidgetFilter(CXFA_FFWidget* pWidget, 61 static FX_BOOL XFA_PageWidgetFilter(CXFA_FFWidget* pWidget,
100 uint32_t dwFilter, 62 uint32_t dwFilter,
101 FX_BOOL bTraversal, 63 FX_BOOL bTraversal,
102 FX_BOOL bIgnorerelevant) { 64 FX_BOOL bIgnorerelevant) {
103 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); 65 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
104 uint32_t dwType = dwFilter & XFA_WIDGETFILTER_AllType; 66 uint32_t dwType = dwFilter & XFA_WIDGETFILTER_AllType;
105 if ((dwType == XFA_WIDGETFILTER_Field) && 67 if ((dwType == XFA_WIDGETFILTER_Field) &&
106 (pWidgetAcc->GetClassID() != XFA_ELEMENT_Field)) { 68 (pWidgetAcc->GetClassID() != XFA_ELEMENT_Field)) {
107 return FALSE; 69 return FALSE;
108 } 70 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 CXFA_LayoutItem* pLayoutItem) { 375 CXFA_LayoutItem* pLayoutItem) {
414 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { 376 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
415 if (!pWidget->IsLoaded() && 377 if (!pWidget->IsLoaded() &&
416 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { 378 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
417 pWidget->LoadWidget(); 379 pWidget->LoadWidget();
418 } 380 }
419 return pWidget; 381 return pWidget;
420 } 382 }
421 return NULL; 383 return NULL;
422 } 384 }
OLDNEW
« no previous file with comments | « xfa/fxfa/app/xfa_ffdocview.cpp ('k') | xfa/fxfa/include/xfa_ffpageview.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698