diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-30 23:55:35 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-30 23:55:35 -0700 |
commit | 1b700c3c452429dacde3c163a6edb2706f93d4a7 (patch) | |
tree | 4efaf4dcec5b28a4d6cac575727dc61356e8a4fe /core/include | |
parent | de6088db8403e775e2963ce6e0bd55e5356beb73 (diff) | |
download | pdfium-1b700c3c452429dacde3c163a6edb2706f93d4a7.tar.xz |
Merge to XFA: Clean up CPDF_AnnotList.
- Remove dead code
- Stop using CFX_PtrArray
- Mark more things const
- Fix style nits
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1425093003 .
(cherry picked from commit c88c42f317c0e94c4c7b98949bfe1a495aef07a9)
Review URL: https://codereview.chromium.org/1430803003 .
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 168d9ebee0..cc5cf08005 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; } |