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