• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 CPDF_Annot;
21 class CPDF_Document;
22 class CPDF_Page;
23 class CPDF_RenderContext;
24 
25 class CPDF_AnnotList final : public CPDF_PageRenderContext::AnnotListIface {
26  public:
27   explicit CPDF_AnnotList(CPDF_Page* pPage);
28   ~CPDF_AnnotList() override;
29 
30   void DisplayAnnots(CPDF_RenderContext* pContext,
31                      bool bPrinting,
32                      const CFX_Matrix& mtUser2Device,
33                      bool bShowWidget);
34 
Count()35   size_t Count() const { return m_AnnotList.size(); }
GetAt(size_t index)36   CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); }
37   bool Contains(const CPDF_Annot* pAnnot) const;
38 
39  private:
40   void DisplayPass(CPDF_RenderContext* pContext,
41                    bool bPrinting,
42                    const CFX_Matrix& mtMatrix,
43                    bool bWidget);
44 
45   UnownedPtr<CPDF_Page> const m_pPage;
46   UnownedPtr<CPDF_Document> const m_pDocument;
47 
48   // The first |m_nAnnotCount| elements are from the PDF itself. The rest are
49   // generated pop-up annotations.
50   std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList;
51   size_t m_nAnnotCount = 0;
52 };
53 
54 #endif  // CORE_FPDFDOC_CPDF_ANNOTLIST_H_
55