OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ | |
8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ | |
9 | |
10 #include <memory> | |
11 | |
12 #include "core/fxcrt/fx_system.h" | |
13 | |
14 class CFX_Matrix; | |
15 class CPDFXFA_Document; | |
16 class CPDF_Dictionary; | |
17 class CPDF_Page; | |
18 class CXFA_FFPageView; | |
19 | |
20 class CPDFXFA_Page { | |
21 public: | |
22 CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index); | |
23 | |
24 void Retain() { m_iRef++; } | |
25 void Release() { | |
26 if (--m_iRef <= 0) | |
27 delete this; | |
28 } | |
29 | |
30 FX_BOOL LoadPage(); | |
31 FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict); | |
32 CPDFXFA_Document* GetDocument() const { return m_pDocument; } | |
33 int GetPageIndex() const { return m_iPageIndex; } | |
34 CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); } | |
35 CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; } | |
36 | |
37 void SetXFAPageView(CXFA_FFPageView* pPageView) { | |
38 m_pXFAPageView = pPageView; | |
39 } | |
40 | |
41 FX_FLOAT GetPageWidth() const; | |
42 FX_FLOAT GetPageHeight() const; | |
43 | |
44 void DeviceToPage(int start_x, | |
45 int start_y, | |
46 int size_x, | |
47 int size_y, | |
48 int rotate, | |
49 int device_x, | |
50 int device_y, | |
51 double* page_x, | |
52 double* page_y); | |
53 void PageToDevice(int start_x, | |
54 int start_y, | |
55 int size_x, | |
56 int size_y, | |
57 int rotate, | |
58 double page_x, | |
59 double page_y, | |
60 int* device_x, | |
61 int* device_y); | |
62 | |
63 void GetDisplayMatrix(CFX_Matrix& matrix, | |
64 int xPos, | |
65 int yPos, | |
66 int xSize, | |
67 int ySize, | |
68 int iRotate) const; | |
69 | |
70 protected: | |
71 // Refcounted class. | |
72 ~CPDFXFA_Page(); | |
73 | |
74 FX_BOOL LoadPDFPage(); | |
75 FX_BOOL LoadXFAPageView(); | |
76 | |
77 private: | |
78 std::unique_ptr<CPDF_Page> m_pPDFPage; | |
79 CXFA_FFPageView* m_pXFAPageView; | |
80 CPDFXFA_Document* const m_pDocument; | |
81 const int m_iPageIndex; | |
82 int m_iRef; | |
83 }; | |
84 | |
85 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_ | |
OLD | NEW |