• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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_FPDFAPI_PAGE_CPDF_ANNOTCONTEXT_H_
8 #define CORE_FPDFAPI_PAGE_CPDF_ANNOTCONTEXT_H_
9 
10 #include <memory>
11 
12 #include "core/fxcrt/retain_ptr.h"
13 #include "core/fxcrt/unowned_ptr.h"
14 
15 class CPDF_Dictionary;
16 class CPDF_Form;
17 class CPDF_Stream;
18 class IPDF_Page;
19 
20 class CPDF_AnnotContext {
21  public:
22   CPDF_AnnotContext(RetainPtr<CPDF_Dictionary> pAnnotDict, IPDF_Page* pPage);
23   ~CPDF_AnnotContext();
24 
25   void SetForm(RetainPtr<CPDF_Stream> pStream);
HasForm()26   bool HasForm() const { return !!m_pAnnotForm; }
GetForm()27   CPDF_Form* GetForm() const { return m_pAnnotForm.get(); }
28 
29   // Never nullptr.
GetMutableAnnotDict()30   RetainPtr<CPDF_Dictionary> GetMutableAnnotDict() { return m_pAnnotDict; }
GetAnnotDict()31   const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
32 
33   // Never nullptr.
GetPage()34   IPDF_Page* GetPage() const { return m_pPage; }
35 
36  private:
37   std::unique_ptr<CPDF_Form> m_pAnnotForm;
38   RetainPtr<CPDF_Dictionary> const m_pAnnotDict;
39   UnownedPtr<IPDF_Page> const m_pPage;
40 };
41 
42 #endif  // CORE_FPDFAPI_PAGE_CPDF_ANNOTCONTEXT_H_
43