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

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: remove more cruft 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
Lei Zhang 2016/04/13 00:56:53 Uhh.
47 if (m_bLoaded) {
48 return 100;
49 }
50 m_bLoaded = TRUE;
51 return 100;
52 }
53 void CXFA_FFPageView::UnloadPageView() {
Lei Zhang 2016/04/13 00:56:53 Unused.
54 if (!m_bLoaded) {
55 return;
56 }
57 }
58 FX_BOOL CXFA_FFPageView::IsPageViewLoaded() {
Lei Zhang 2016/04/13 00:56:53 Unused.
59 return m_bLoaded;
60 }
61 CXFA_FFWidget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) { 49 CXFA_FFWidget* CXFA_FFPageView::GetWidgetByPos(FX_FLOAT fx, FX_FLOAT fy) {
Lei Zhang 2016/04/13 00:56:53 Oh, also unused.
62 if (!m_bLoaded) {
63 return nullptr;
64 }
65 IXFA_WidgetIterator* pIterator = CreateWidgetIterator(); 50 IXFA_WidgetIterator* pIterator = CreateWidgetIterator();
66 CXFA_FFWidget* pWidget = nullptr; 51 CXFA_FFWidget* pWidget = nullptr;
67 while ((pWidget = static_cast<CXFA_FFWidget*>(pIterator->MoveToNext()))) { 52 while ((pWidget = static_cast<CXFA_FFWidget*>(pIterator->MoveToNext()))) {
68 if (!(pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { 53 if (!(pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
69 continue; 54 continue;
70 } 55 }
71 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc(); 56 CXFA_WidgetAcc* pAcc = pWidget->GetDataAcc();
72 int32_t type = pAcc->GetClassID(); 57 int32_t type = pAcc->GetClassID();
73 if (type != XFA_ELEMENT_Field && type != XFA_ELEMENT_Draw) { 58 if (type != XFA_ELEMENT_Field && type != XFA_ELEMENT_Draw) {
74 continue; 59 continue;
75 } 60 }
76 FX_FLOAT fWidgetx = fx; 61 FX_FLOAT fWidgetx = fx;
77 FX_FLOAT fWidgety = fy; 62 FX_FLOAT fWidgety = fy;
78 pWidget->Rotate2Normal(fWidgetx, fWidgety); 63 pWidget->Rotate2Normal(fWidgetx, fWidgety);
79 uint32_t dwFlag = pWidget->OnHitTest(fWidgetx, fWidgety); 64 uint32_t dwFlag = pWidget->OnHitTest(fWidgetx, fWidgety);
80 if ((FWL_WGTHITTEST_Client == dwFlag || 65 if ((FWL_WGTHITTEST_Client == dwFlag ||
81 FWL_WGTHITTEST_HyperLink == dwFlag)) { 66 FWL_WGTHITTEST_HyperLink == dwFlag)) {
82 break; 67 break;
83 } 68 }
84 } 69 }
85 pIterator->Release(); 70 pIterator->Release();
86 return pWidget; 71 return pWidget;
87 } 72 }
73
88 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator( 74 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
89 uint32_t dwTraverseWay, 75 uint32_t dwTraverseWay,
90 uint32_t dwWidgetFilter) { 76 uint32_t dwWidgetFilter) {
91 switch (dwTraverseWay) { 77 switch (dwTraverseWay) {
92 case XFA_TRAVERSEWAY_Tranvalse: 78 case XFA_TRAVERSEWAY_Tranvalse:
93 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter); 79 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
94 case XFA_TRAVERSEWAY_Form: 80 case XFA_TRAVERSEWAY_Form:
95 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter); 81 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
96 } 82 }
97 return NULL; 83 return nullptr;
98 } 84 }
85
99 static FX_BOOL XFA_PageWidgetFilter(CXFA_FFWidget* pWidget, 86 static FX_BOOL XFA_PageWidgetFilter(CXFA_FFWidget* pWidget,
100 uint32_t dwFilter, 87 uint32_t dwFilter,
101 FX_BOOL bTraversal, 88 FX_BOOL bTraversal,
102 FX_BOOL bIgnorerelevant) { 89 FX_BOOL bIgnorerelevant) {
103 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc(); 90 CXFA_WidgetAcc* pWidgetAcc = pWidget->GetDataAcc();
104 uint32_t dwType = dwFilter & XFA_WIDGETFILTER_AllType; 91 uint32_t dwType = dwFilter & XFA_WIDGETFILTER_AllType;
105 if ((dwType == XFA_WIDGETFILTER_Field) && 92 if ((dwType == XFA_WIDGETFILTER_Field) &&
106 (pWidgetAcc->GetClassID() != XFA_ELEMENT_Field)) { 93 (pWidgetAcc->GetClassID() != XFA_ELEMENT_Field)) {
107 return FALSE; 94 return FALSE;
108 } 95 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 CXFA_LayoutItem* pLayoutItem) { 400 CXFA_LayoutItem* pLayoutItem) {
414 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { 401 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
415 if (!pWidget->IsLoaded() && 402 if (!pWidget->IsLoaded() &&
416 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { 403 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
417 pWidget->LoadWidget(); 404 pWidget->LoadWidget();
418 } 405 }
419 return pWidget; 406 return pWidget;
420 } 407 }
421 return NULL; 408 return NULL;
422 } 409 }
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