xref: /aosp_15_r20/external/pdfium/core/fpdfdoc/cpdf_annotlist.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2016 The PDFium Authors
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 <stddef.h>
11 #include <stdint.h>
12 
13 #include <memory>
14 #include <vector>
15 
16 #include "core/fpdfapi/render/cpdf_pagerendercontext.h"
17 #include "core/fxcrt/fx_coordinates.h"
18 #include "core/fxcrt/unowned_ptr.h"
19 
20 class CFX_RenderDevice;
21 class CPDF_Annot;
22 class CPDF_Document;
23 class CPDF_Page;
24 class CPDF_RenderContext;
25 
26 class CPDF_AnnotList final : public CPDF_PageRenderContext::AnnotListIface {
27  public:
28   explicit CPDF_AnnotList(CPDF_Page* pPage);
29   ~CPDF_AnnotList() override;
30 
31   void DisplayAnnots(CPDF_Page* pPage,
32                      CFX_RenderDevice* pDevice,
33                      CPDF_RenderContext* pContext,
34                      bool bPrinting,
35                      const CFX_Matrix& mtUser2Device,
36                      bool bShowWidget);
37 
Count()38   size_t Count() const { return m_AnnotList.size(); }
GetAt(size_t index)39   CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); }
40   bool Contains(const CPDF_Annot* pAnnot) const;
41 
42  private:
43   void DisplayPass(CPDF_Page* pPage,
44                    CFX_RenderDevice* pDevice,
45                    CPDF_RenderContext* pContext,
46                    bool bPrinting,
47                    const CFX_Matrix& mtMatrix,
48                    bool bWidget);
49 
50   UnownedPtr<CPDF_Document> const m_pDocument;
51 
52   // The first |m_nAnnotCount| elements are from the PDF itself. The rest are
53   // generated pop-up annotations.
54   std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList;
55   size_t m_nAnnotCount = 0;
56 };
57 
58 #endif  // CORE_FPDFDOC_CPDF_ANNOTLIST_H_
59