OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ | 7 #ifndef CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ |
8 #define CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ | 8 #define CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 WATERMARK, | 64 WATERMARK, |
65 THREED, | 65 THREED, |
66 RICHMEDIA, | 66 RICHMEDIA, |
67 XFAWIDGET | 67 XFAWIDGET |
68 }; | 68 }; |
69 | 69 |
70 static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict); | 70 static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict); |
71 static CPDF_Annot::Subtype StringToAnnotSubtype( | 71 static CPDF_Annot::Subtype StringToAnnotSubtype( |
72 const CFX_ByteString& sSubtype); | 72 const CFX_ByteString& sSubtype); |
73 static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype); | 73 static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype); |
| 74 static CFX_FloatRect RectFromQuadPoints(CPDF_Dictionary* pAnnotDict); |
74 | 75 |
75 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument, bool bToOwnDict); | 76 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument, bool bToOwnDict); |
76 ~CPDF_Annot(); | 77 ~CPDF_Annot(); |
77 | 78 |
78 CPDF_Annot::Subtype GetSubtype() const; | 79 CPDF_Annot::Subtype GetSubtype() const; |
79 uint32_t GetFlags() const; | 80 uint32_t GetFlags() const; |
80 CFX_FloatRect GetRect() const; | 81 CFX_FloatRect GetRect() const; |
81 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } | 82 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } |
82 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } | 83 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } |
83 FX_BOOL DrawAppearance(CPDF_Page* pPage, | 84 FX_BOOL DrawAppearance(CPDF_Page* pPage, |
(...skipping 11 matching lines...) Expand all Loading... |
95 const CPDF_RenderOptions* pOptions); | 96 const CPDF_RenderOptions* pOptions); |
96 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); | 97 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); |
97 void SetOpenState(bool bOpenState) { m_bOpenState = bOpenState; } | 98 void SetOpenState(bool bOpenState) { m_bOpenState = bOpenState; } |
98 CPDF_Annot* GetPopupAnnot() const { return m_pPopupAnnot; } | 99 CPDF_Annot* GetPopupAnnot() const { return m_pPopupAnnot; } |
99 void SetPopupAnnot(CPDF_Annot* pAnnot) { m_pPopupAnnot = pAnnot; } | 100 void SetPopupAnnot(CPDF_Annot* pAnnot) { m_pPopupAnnot = pAnnot; } |
100 | 101 |
101 private: | 102 private: |
102 void GenerateAPIfNeeded(); | 103 void GenerateAPIfNeeded(); |
103 bool ShouldDrawAnnotation(); | 104 bool ShouldDrawAnnotation(); |
104 | 105 |
| 106 CFX_FloatRect RectForDrawing() const; |
| 107 |
105 // For regular annotations, |m_pAnnotDict| is not owned. For | 108 // For regular annotations, |m_pAnnotDict| is not owned. For |
106 // our artificially created popup annotations, |m_pAnnotDict| | 109 // our artificially created popup annotations, |m_pAnnotDict| |
107 // is owned by this class. | 110 // is owned by this class. |
108 bool m_bOwnedAnnotDict; | 111 bool m_bOwnedAnnotDict; |
109 CPDF_Dictionary* m_pAnnotDict; | 112 CPDF_Dictionary* m_pAnnotDict; |
110 CPDF_Document* const m_pDocument; | 113 CPDF_Document* const m_pDocument; |
111 CPDF_Annot::Subtype m_nSubtype; | 114 CPDF_Annot::Subtype m_nSubtype; |
112 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap; | 115 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap; |
113 // |m_bOpenState| is only set for popup annotations. | 116 // |m_bOpenState| is only set for popup annotations. |
114 bool m_bOpenState; | 117 bool m_bOpenState; |
| 118 bool m_bHasGeneratedAP; |
| 119 bool m_bIsTextMarkupAnnotation; |
115 // Not owned. If there is a valid pointer in |m_pPopupAnnot|, | 120 // Not owned. If there is a valid pointer in |m_pPopupAnnot|, |
116 // then this annot is never a popup. | 121 // then this annot is never a popup. |
117 CPDF_Annot* m_pPopupAnnot; | 122 CPDF_Annot* m_pPopupAnnot; |
118 }; | 123 }; |
119 | 124 |
120 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 125 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
121 CPDF_Annot::AppearanceMode mode); | 126 CPDF_Annot::AppearanceMode mode); |
122 | 127 |
123 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ | 128 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ |
OLD | NEW |