diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-30 23:42:33 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-30 23:42:33 -0700 |
commit | c88c42f317c0e94c4c7b98949bfe1a495aef07a9 (patch) | |
tree | 338bce5904097056be9afc47796ad1ba22f05c53 /core/include | |
parent | 1630dffdc1d554d8f2319e83cdbd7b12f480362d (diff) | |
download | pdfium-c88c42f317c0e94c4c7b98949bfe1a495aef07a9.tar.xz |
Clean up CPDF_AnnotList.
- Remove dead code
- Stop using CFX_PtrArray
- Mark more things const
- Fix style nits
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1425093003 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fpdfdoc/fpdf_doc.h | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h index 770133b739..a86ae62610 100644 --- a/core/include/fpdfdoc/fpdf_doc.h +++ b/core/include/fpdfdoc/fpdf_doc.h @@ -394,7 +394,8 @@ class CPDF_Annot : public CFX_PrivateData { void GetRect(CFX_FloatRect& rect) const; - CPDF_Dictionary* GetAnnotDict(); + const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } + CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } FX_BOOL DrawAppearance(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, @@ -427,45 +428,18 @@ class CPDF_Annot : public CFX_PrivateData { class CPDF_AnnotList { public: - CPDF_AnnotList(CPDF_Page* pPage); - + explicit CPDF_AnnotList(CPDF_Page* pPage); ~CPDF_AnnotList(); - void GetAnnotMatrix(const CPDF_Dictionary* pAnnotDict, - const CFX_Matrix* pUser2Device, - CFX_Matrix& matrix) const; - - void GetAnnotRect(const CPDF_Dictionary* pAnnotDict, - const CFX_Matrix* pUser2Device, - CPDF_Rect& rtAnnot) const; - - void DisplayAnnots(const CPDF_Page* pPage, - CFX_RenderDevice* pDevice, - CFX_AffineMatrix* pMatrix, - FX_BOOL bShowWidget, - CPDF_RenderOptions* pOptions); - void DisplayAnnots(const CPDF_Page* pPage, CPDF_RenderContext* pContext, FX_BOOL bPrinting, CFX_AffineMatrix* pMatrix, FX_BOOL bShowWidget, CPDF_RenderOptions* pOptions) { - DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, - bShowWidget ? 3 : 1, pOptions, NULL); + DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, + bShowWidget ? 3 : 1, pOptions, nullptr); } - - void DisplayAnnots(const CPDF_Page* pPage, - CPDF_RenderContext* pContext, - FX_BOOL bPrinting, - CFX_AffineMatrix* pMatrix, - FX_BOOL bShowWidget, - CPDF_RenderOptions* pOptions, - FX_RECT* pClipRect) { - DisplayAnnots(pPage, NULL, pContext, bPrinting, pMatrix, - bShowWidget ? 3 : 1, pOptions, pClipRect); - } - void DisplayAnnots(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, @@ -474,24 +448,12 @@ class CPDF_AnnotList { FX_DWORD dwAnnotFlags, CPDF_RenderOptions* pOptions, FX_RECT* pClipRect); - - CPDF_Annot* GetAt(int index) { return (CPDF_Annot*)m_AnnotList.GetAt(index); } - - int Count() { return m_AnnotList.GetSize(); } - - int GetIndex(CPDF_Annot* pAnnot); - + size_t Count() const { return m_AnnotList.size(); } + CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index]; } + const std::vector<CPDF_Annot*>& All() const { return m_AnnotList; } CPDF_Document* GetDocument() const { return m_pDocument; } protected: - CFX_PtrArray m_AnnotList; - - CPDF_Dictionary* m_pPageDict; - - CPDF_Document* m_pDocument; - - CFX_PtrArray m_Borders; - void DisplayPass(const CPDF_Page* pPage, CFX_RenderDevice* pDevice, CPDF_RenderContext* pContext, @@ -500,8 +462,11 @@ class CPDF_AnnotList { FX_BOOL bWidget, CPDF_RenderOptions* pOptions, FX_RECT* clip_rect); - friend class CPDF_Annot; + + CPDF_Document* const m_pDocument; + std::vector<CPDF_Annot*> m_AnnotList; }; + #define COLORTYPE_TRANSPARENT 0 #define COLORTYPE_GRAY 1 #define COLORTYPE_RGB 2 @@ -623,7 +588,7 @@ class CPDF_InterForm : public CFX_PrivateData { FX_FLOAT pdf_y, int* z_order) const; - CPDF_FormControl* GetControlByDict(CPDF_Dictionary* pWidgetDict) const; + CPDF_FormControl* GetControlByDict(const CPDF_Dictionary* pWidgetDict) const; CPDF_Document* GetDocument() const { return m_pDocument; } |