• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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_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_Page;
18 class CPDF_Stream;
19 
20 class CPDF_AnnotContext {
21  public:
22   CPDF_AnnotContext(CPDF_Dictionary* pAnnotDict, CPDF_Page* pPage);
23   ~CPDF_AnnotContext();
24 
25   void SetForm(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.
GetAnnotDict()30   CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict.Get(); }
31 
32   // Never nullptr.
GetPage()33   CPDF_Page* GetPage() const { return m_pPage.Get(); }
34 
35  private:
36   std::unique_ptr<CPDF_Form> m_pAnnotForm;
37   RetainPtr<CPDF_Dictionary> const m_pAnnotDict;
38   UnownedPtr<CPDF_Page> const m_pPage;
39 };
40 
41 #endif  // CORE_FPDFAPI_PAGE_CPDF_ANNOTCONTEXT_H_
42