OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 PDFium Authors. All rights reserved. | |
dsinclair
2016/07/20 13:25:37
This file should be named cpdf_annot.h to match th
jaepark
2016/07/20 19:13:25
Done.
| |
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_DOC_ANNOT_H_ | |
8 #define CORE_FPDFDOC_DOC_ANNOT_H_ | |
9 | |
10 #include <map> | |
11 #include <memory> | |
12 #include <vector> | |
13 | |
14 #include "core/fxcrt/include/fx_coordinates.h" | |
15 #include "core/fxcrt/include/fx_string.h" | |
16 #include "core/fxcrt/include/fx_system.h" | |
17 | |
18 class CFX_RenderDevice; | |
19 class CPDF_Annot; | |
20 class CPDF_AnnotList; | |
21 class CPDF_Dictionary; | |
22 class CPDF_Document; | |
23 class CPDF_Form; | |
24 class CPDF_Page; | |
25 class CPDF_RenderContext; | |
26 class CPDF_RenderOptions; | |
27 class CPDF_Stream; | |
28 | |
29 #define ANNOTFLAG_UNKNOWN 0x0000 | |
30 #define ANNOTFLAG_INVISIBLE 0x0001 | |
31 #define ANNOTFLAG_HIDDEN 0x0002 | |
32 #define ANNOTFLAG_PRINT 0x0004 | |
33 #define ANNOTFLAG_NOZOOM 0x0008 | |
34 #define ANNOTFLAG_NOROTATE 0x0010 | |
35 #define ANNOTFLAG_NOVIEW 0x0020 | |
36 #define ANNOTFLAG_READONLY 0x0040 | |
37 #define ANNOTFLAG_LOCKED 0x0080 | |
38 #define ANNOTFLAG_TOGGLENOVIEW 0x0100 | |
39 #define ANNOTFLAG_LOCKEDCONTENTS 0x0200 | |
40 | |
41 class CPDF_Annot { | |
42 public: | |
43 enum AppearanceMode { Normal, Rollover, Down }; | |
44 | |
45 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList); | |
46 ~CPDF_Annot(); | |
47 | |
48 CFX_ByteString GetSubType() const; | |
49 uint32_t GetFlags() const; | |
50 void GetRect(CFX_FloatRect& rect) const; | |
51 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } | |
52 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } | |
53 FX_BOOL DrawAppearance(CPDF_Page* pPage, | |
54 CFX_RenderDevice* pDevice, | |
55 const CFX_Matrix* pUser2Device, | |
56 AppearanceMode mode, | |
57 const CPDF_RenderOptions* pOptions); | |
58 FX_BOOL DrawInContext(const CPDF_Page* pPage, | |
59 CPDF_RenderContext* pContext, | |
60 const CFX_Matrix* pUser2Device, | |
61 AppearanceMode mode); | |
62 void ClearCachedAP(); | |
63 void DrawBorder(CFX_RenderDevice* pDevice, | |
64 const CFX_Matrix* pUser2Device, | |
65 const CPDF_RenderOptions* pOptions); | |
66 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); | |
67 | |
68 private: | |
69 CPDF_Dictionary* const m_pAnnotDict; | |
70 CPDF_AnnotList* const m_pList; | |
71 const CFX_ByteString m_sSubtype; | |
72 std::map<CPDF_Stream*, CPDF_Form*> m_APMap; | |
73 }; | |
74 | |
75 class CPDF_AnnotList { | |
76 public: | |
77 explicit CPDF_AnnotList(CPDF_Page* pPage); | |
78 ~CPDF_AnnotList(); | |
79 | |
80 void DisplayAnnots(CPDF_Page* pPage, | |
81 CPDF_RenderContext* pContext, | |
82 FX_BOOL bPrinting, | |
83 CFX_Matrix* pMatrix, | |
84 FX_BOOL bShowWidget, | |
85 CPDF_RenderOptions* pOptions) { | |
86 DisplayAnnots(pPage, nullptr, pContext, bPrinting, pMatrix, | |
87 bShowWidget ? 3 : 1, pOptions, nullptr); | |
88 } | |
89 | |
90 void DisplayAnnots(CPDF_Page* pPage, | |
91 CFX_RenderDevice* pDevice, | |
92 CPDF_RenderContext* pContext, | |
93 FX_BOOL bPrinting, | |
94 CFX_Matrix* pMatrix, | |
95 uint32_t dwAnnotFlags, | |
96 CPDF_RenderOptions* pOptions, | |
97 FX_RECT* pClipRect); | |
98 size_t Count() const { return m_AnnotList.size(); } | |
99 CPDF_Annot* GetAt(size_t index) const { return m_AnnotList[index].get(); } | |
100 const std::vector<std::unique_ptr<CPDF_Annot>>& All() const { | |
101 return m_AnnotList; | |
102 } | |
103 CPDF_Document* GetDocument() const { return m_pDocument; } | |
104 | |
105 protected: | |
dsinclair
2016/07/20 13:25:37
This should be able to be private, yea? I don't se
jaepark
2016/07/20 19:13:25
Done.
| |
106 void DisplayPass(CPDF_Page* pPage, | |
107 CFX_RenderDevice* pDevice, | |
108 CPDF_RenderContext* pContext, | |
109 FX_BOOL bPrinting, | |
110 CFX_Matrix* pMatrix, | |
111 FX_BOOL bWidget, | |
112 CPDF_RenderOptions* pOptions, | |
113 FX_RECT* clip_rect); | |
114 | |
115 CPDF_Document* const m_pDocument; | |
116 std::vector<std::unique_ptr<CPDF_Annot>> m_AnnotList; | |
117 }; | |
118 | |
119 #endif // CORE_FPDFDOC_DOC_ANNOT_H_ | |
OLD | NEW |