summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
diff options
context:
space:
mode:
authorthestig <thestig@chromium.org>2016-04-13 13:18:21 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-13 13:18:21 -0700
commit9f3dbbc54c6981f069b57e6714393ac6c0c64231 (patch)
tree9f76b6cee117e34a737bd46f146356931786d3cc /fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
parentf063abf4d50ab466080714df584660854ceb8709 (diff)
downloadpdfium-9f3dbbc54c6981f069b57e6714393ac6c0c64231.tar.xz
Cleanup CPDFXFA_Page.
- Use std::unique_ptr. - Make dtor protected. - Simplify logic. - Remove unused bits from CXFA_FFPageView as well. Review URL: https://codereview.chromium.org/1878963004
Diffstat (limited to 'fpdfsdk/fpdfxfa/include/fpdfxfa_page.h')
-rw-r--r--fpdfsdk/fpdfxfa/include/fpdfxfa_page.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
index 2c860ffbdc..0f278912d6 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_page.h
@@ -7,6 +7,8 @@
#ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
#define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_PAGE_H_
+#include <memory>
+
#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fxcrt/include/fx_coordinates.h"
@@ -19,22 +21,23 @@ class CXFA_FFPageView;
class CPDFXFA_Page {
public:
CPDFXFA_Page(CPDFXFA_Document* pDoc, int page_index);
- ~CPDFXFA_Page();
- void Release();
void AddRef() { m_iRef++; }
+ void Release();
+
FX_BOOL LoadPage();
FX_BOOL LoadPDFPage(CPDF_Dictionary* pageDict);
- CPDFXFA_Document* GetDocument() { return m_pDocument; }
- int GetPageIndex() { return m_iPageIndex; }
- CPDF_Page* GetPDFPage() { return m_pPDFPage; }
- CXFA_FFPageView* GetXFAPageView() { return m_pXFAPageView; }
+ CPDFXFA_Document* GetDocument() const { return m_pDocument; }
+ int GetPageIndex() const { return m_iPageIndex; }
+ CPDF_Page* GetPDFPage() const { return m_pPDFPage.get(); }
+ CXFA_FFPageView* GetXFAPageView() const { return m_pXFAPageView; }
+
void SetXFAPageView(CXFA_FFPageView* pPageView) {
m_pXFAPageView = pPageView;
}
- FX_FLOAT GetPageWidth();
- FX_FLOAT GetPageHeight();
+ FX_FLOAT GetPageWidth() const;
+ FX_FLOAT GetPageHeight() const;
void DeviceToPage(int start_x,
int start_y,
@@ -63,14 +66,17 @@ class CPDFXFA_Page {
int iRotate) const;
protected:
+ // Refcounted class.
+ ~CPDFXFA_Page();
+
FX_BOOL LoadPDFPage();
FX_BOOL LoadXFAPageView();
private:
- CPDF_Page* m_pPDFPage;
+ std::unique_ptr<CPDF_Page> m_pPDFPage;
CXFA_FFPageView* m_pXFAPageView;
- int m_iPageIndex;
- CPDFXFA_Document* m_pDocument;
+ CPDFXFA_Document* const m_pDocument;
+ const int m_iPageIndex;
int m_iRef;
};