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

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

Issue 1896893003: Cleanup FDE interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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/fwl/theme/cfwl_widgettp.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('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 namespace {
22
23 void GetPageMatrix(CFX_Matrix& pageMatrix,
24 const CFX_RectF& docPageRect,
25 const CFX_Rect& devicePageRect,
26 int32_t iRotate,
27 uint32_t dwCoordinatesType) {
28 FXSYS_assert(iRotate >= 0 && iRotate <= 3);
29 FX_BOOL bFlipX = (dwCoordinatesType & 0x01) != 0;
30 FX_BOOL bFlipY = (dwCoordinatesType & 0x02) != 0;
31 CFX_Matrix m;
32 m.Set((bFlipX ? -1.0f : 1.0f), 0, 0, (bFlipY ? -1.0f : 1.0f), 0, 0);
33 if (iRotate == 0 || iRotate == 2) {
34 m.a *= (FX_FLOAT)devicePageRect.width / docPageRect.width;
35 m.d *= (FX_FLOAT)devicePageRect.height / docPageRect.height;
36 } else {
37 m.a *= (FX_FLOAT)devicePageRect.height / docPageRect.width;
38 m.d *= (FX_FLOAT)devicePageRect.width / docPageRect.height;
39 }
40 m.Rotate(iRotate * 1.57079632675f);
41 switch (iRotate) {
42 case 0:
43 m.e = bFlipX ? (FX_FLOAT)devicePageRect.right()
44 : (FX_FLOAT)devicePageRect.left;
45 m.f = bFlipY ? (FX_FLOAT)devicePageRect.bottom()
46 : (FX_FLOAT)devicePageRect.top;
47 break;
48 case 1:
49 m.e = bFlipY ? (FX_FLOAT)devicePageRect.left
50 : (FX_FLOAT)devicePageRect.right();
51 m.f = bFlipX ? (FX_FLOAT)devicePageRect.bottom()
52 : (FX_FLOAT)devicePageRect.top;
53 break;
54 case 2:
55 m.e = bFlipX ? (FX_FLOAT)devicePageRect.left
56 : (FX_FLOAT)devicePageRect.right();
57 m.f = bFlipY ? (FX_FLOAT)devicePageRect.top
58 : (FX_FLOAT)devicePageRect.bottom();
59 break;
60 case 3:
61 m.e = bFlipY ? (FX_FLOAT)devicePageRect.right()
62 : (FX_FLOAT)devicePageRect.left;
63 m.f = bFlipX ? (FX_FLOAT)devicePageRect.top
64 : (FX_FLOAT)devicePageRect.bottom();
65 break;
66 default:
67 break;
68 }
69 pageMatrix = m;
70 }
71
72 } // namespace
21 CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea) 73 CXFA_FFPageView::CXFA_FFPageView(CXFA_FFDocView* pDocView, CXFA_Node* pPageArea)
22 : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {} 74 : CXFA_ContainerLayoutItem(pPageArea), m_pDocView(pDocView) {}
23 75
24 CXFA_FFPageView::~CXFA_FFPageView() {} 76 CXFA_FFPageView::~CXFA_FFPageView() {}
25 77
26 CXFA_FFDocView* CXFA_FFPageView::GetDocView() const { 78 CXFA_FFDocView* CXFA_FFPageView::GetDocView() const {
27 return m_pDocView; 79 return m_pDocView;
28 } 80 }
29 81
30 int32_t CXFA_FFPageView::GetPageViewIndex() const { 82 int32_t CXFA_FFPageView::GetPageViewIndex() const {
31 return GetPageIndex(); 83 return GetPageIndex();
32 } 84 }
33 85
34 void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const { 86 void CXFA_FFPageView::GetPageViewRect(CFX_RectF& rtPage) const {
35 CFX_SizeF sz; 87 CFX_SizeF sz;
36 GetPageSize(sz); 88 GetPageSize(sz);
37 rtPage.Set(0, 0, sz); 89 rtPage.Set(0, 0, sz);
38 } 90 }
39 void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt, 91 void CXFA_FFPageView::GetDisplayMatrix(CFX_Matrix& mt,
40 const CFX_Rect& rtDisp, 92 const CFX_Rect& rtDisp,
41 int32_t iRotate) const { 93 int32_t iRotate) const {
42 CFX_SizeF sz; 94 CFX_SizeF sz;
43 GetPageSize(sz); 95 GetPageSize(sz);
44 CFX_RectF fdePage; 96 CFX_RectF fdePage;
45 fdePage.Set(0, 0, sz.x, sz.y); 97 fdePage.Set(0, 0, sz.x, sz.y);
46 FDE_GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0); 98 GetPageMatrix(mt, fdePage, rtDisp, iRotate, 0);
47 } 99 }
48 100
49 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator( 101 IXFA_WidgetIterator* CXFA_FFPageView::CreateWidgetIterator(
50 uint32_t dwTraverseWay, 102 uint32_t dwTraverseWay,
51 uint32_t dwWidgetFilter) { 103 uint32_t dwWidgetFilter) {
52 switch (dwTraverseWay) { 104 switch (dwTraverseWay) {
53 case XFA_TRAVERSEWAY_Tranvalse: 105 case XFA_TRAVERSEWAY_Tranvalse:
54 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter); 106 return new CXFA_FFTabOrderPageWidgetIterator(this, dwWidgetFilter);
55 case XFA_TRAVERSEWAY_Form: 107 case XFA_TRAVERSEWAY_Form:
56 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter); 108 return new CXFA_FFPageWidgetIterator(this, dwWidgetFilter);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 CXFA_LayoutItem* pLayoutItem) { 427 CXFA_LayoutItem* pLayoutItem) {
376 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) { 428 if (CXFA_FFWidget* pWidget = XFA_GetWidgetFromLayoutItem(pLayoutItem)) {
377 if (!pWidget->IsLoaded() && 429 if (!pWidget->IsLoaded() &&
378 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) { 430 (pWidget->GetStatus() & XFA_WIDGETSTATUS_Visible)) {
379 pWidget->LoadWidget(); 431 pWidget->LoadWidget();
380 } 432 }
381 return pWidget; 433 return pWidget;
382 } 434 }
383 return NULL; 435 return NULL;
384 } 436 }
OLDNEW
« no previous file with comments | « xfa/fwl/theme/cfwl_widgettp.cpp ('k') | xfa/fxfa/app/xfa_ffwidgetacc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698