1 // Copyright 2016 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 CORE_FPDFDOC_CPDF_ANNOTLIST_H_
8 #define CORE_FPDFDOC_CPDF_ANNOTLIST_H_
9 
10 #include <memory>
11 #include <vector>
12 
13 #include "core/fpdfapi/render/cpdf_pagerendercontext.h"
14 #include "core/fxcrt/fx_coordinates.h"
15 #include "core/fxcrt/fx_system.h"
16 #include "core/fxcrt/unowned_ptr.h"
17 
18 class CFX_RenderDevice;
19 class CPDF_Annot;
20 class CPDF_Document;
21 class CPDF_Page;
22 class CPDF_RenderContext;
23 class CPDF_RenderOptions;
24 
25 class CPDF_AnnotList : public CPDF_PageRenderContext::AnnotListIface {
26  public:
27   explicit CPDF_AnnotList(CPDF_Page* pPage);
28   ~CPDF_AnnotList() override;
29 
30   void DisplayAnnots(CPDF_Page* pPage,
31                      CPDF_RenderContext* pContext,
32                      bool bPrinting,
33                      const CFX_Matrix* pMatrix,
34                      bool bShowWidget,
35                      CPDF_RenderOptions* pOptions);
36 
37   void DisplayAnnots(CPDF_Page* pPage,
38                      CFX_RenderDevice* pDevice,
39                      CPDF_RenderContext* pContext,
40                      bool bPrinting,
41                      const CFX_Matrix* pUser2Device,
42                      uint32_t dwAnnotFlags,
43                      CPDF_RenderOptions* pOptions,
44                      FX_RECT* pClipRect);
45 
Count()46   size_t Count() const { return m_AnnotList.size(); }
GetAt(size_t index)47   CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); }
All()48   const std::vector<std::unique_ptr<CPDF_Annot>>& All() const {
49     return m_AnnotList;
50   }
51 
52  private:
53   void DisplayPass(CPDF_Page* pPage,
54                    CFX_RenderDevice* pDevice,
55                    CPDF_RenderContext* pContext,
56                    bool bPrinting,
57                    const CFX_Matrix* pMatrix,
58                    bool bWidget,
59                    CPDF_RenderOptions* pOptions,
60                    FX_RECT* clip_rect);
61 
62   UnownedPtr<CPDF_Document> const m_pDocument;
63 
64   // The first |m_nAnnotCount| elements are from the PDF itself. The rest are
65   // generated pop-up annotations.
66   std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList;
67   size_t m_nAnnotCount = 0;
68 };
69 
70 #endif  // CORE_FPDFDOC_CPDF_ANNOTLIST_H_
71