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

Side by Side Diff: fpdfsdk/fpdfxfa/include/fpdfxfa_page.h

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 | « fpdfsdk/fpdfxfa/fpdfxfa_page.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.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 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ 7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ 8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
9 9
10 #include <memory>
11
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" 12 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
11 #include "core/fpdfapi/include/cpdf_modulemgr.h" 13 #include "core/fpdfapi/include/cpdf_modulemgr.h"
12 #include "core/fxcrt/include/fx_coordinates.h" 14 #include "core/fxcrt/include/fx_coordinates.h"
13 #include "core/fxcrt/include/fx_system.h" 15 #include "core/fxcrt/include/fx_system.h"
14 16
15 class CPDFXFA_Document; 17 class CPDFXFA_Document;
16 class CPDF_Page; 18 class CPDF_Page;
17 class CXFA_FFPageView; 19 class CXFA_FFPageView;
18 20
19 class CPDFXFA_Page { 21 class CPDFXFA_Page {
20 public: 22 public:
21 CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index); 23 CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
22 ~CPDFXFA_Page();
23 24
25 void AddRef() { m_iRef++; }
24 void Release(); 26 void Release();
25 void AddRef() { m_iRef++; } 27
26 FX_BOOL LoadPage(); 28 FX_BOOL LoadPage();
27 FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict); 29 FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
28 CPDFXFA_Document* GetDocument() { return m_pDocument; } 30 CPDFXFA_Document* GetDocument() const { return m_pDocument; }
29 int GetPageIndex() { return m_iPageIndex; } 31 int GetPageIndex() const { return m_iPageIndex; }
30 CPDF_Page* GetPDFPage() { return m_pPDFPage; } 32 CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); }
31 CXFA_FFPageView* GetXFAPageView() { return m_pXFAPageView; } 33 CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; }
34
32 void SetXFAPageView(CXFA_FFPageView* pPageView) { 35 void SetXFAPageView(CXFA_FFPageView* pPageView) {
33 m_pXFAPageView = pPageView; 36 m_pXFAPageView = pPageView;
34 } 37 }
35 38
36 FX_FLOAT GetPageWidth(); 39 FX_FLOAT GetPageWidth() const;
37 FX_FLOAT GetPageHeight(); 40 FX_FLOAT GetPageHeight() const;
38 41
39 void DeviceToPage(int start_x, 42 void DeviceToPage(int start_x,
40 int start_y, 43 int start_y,
41 int size_x, 44 int size_x,
42 int size_y, 45 int size_y,
43 int rotate, 46 int rotate,
44 int device_x, 47 int device_x,
45 int device_y, 48 int device_y,
46 double* page_x, 49 double* page_x,
47 double* page_y); 50 double* page_y);
48 void PageToDevice(int start_x, 51 void PageToDevice(int start_x,
49 int start_y, 52 int start_y,
50 int size_x, 53 int size_x,
51 int size_y, 54 int size_y,
52 int rotate, 55 int rotate,
53 double page_x, 56 double page_x,
54 double page_y, 57 double page_y,
55 int* device_x, 58 int* device_x,
56 int* device_y); 59 int* device_y);
57 60
58 void GetDisplayMatrix(CFX_Matrix& matrix, 61 void GetDisplayMatrix(CFX_Matrix& matrix,
59 int xPos, 62 int xPos,
60 int yPos, 63 int yPos,
61 int xSize, 64 int xSize,
62 int ySize, 65 int ySize,
63 int iRotate) const; 66 int iRotate) const;
64 67
65 protected: 68 protected:
69 // Refcounted class.
70 ~CPDFXFA_Page();
71
66 FX_BOOL LoadPDFPage(); 72 FX_BOOL LoadPDFPage();
67 FX_BOOL LoadXFAPageView(); 73 FX_BOOL LoadXFAPageView();
68 74
69 private: 75 private:
70 CPDF_Page* m_pPDFPage; 76 std::unique_ptr<CPDF_Page> m_pPDFPage;
71 CXFA_FFPageView* m_pXFAPageView; 77 CXFA_FFPageView* m_pXFAPageView;
72 int m_iPageIndex; 78 CPDFXFA_Document* const m_pDocument;
73 CPDFXFA_Document* m_pDocument; 79 const int m_iPageIndex;
74 int m_iRef; 80 int m_iRef;
75 }; 81 };
76 82
77 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ 83 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
OLDNEW
« no previous file with comments | « fpdfsdk/fpdfxfa/fpdfxfa_page.cpp ('k') | xfa/fxfa/app/xfa_ffdocview.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698