Chromium Code Reviews| 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 RectFromQuads(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, |
| 84 CFX_RenderDevice* pDevice, | 85 CFX_RenderDevice* pDevice, |
| 85 const CFX_Matrix* pUser2Device, | 86 const CFX_Matrix* pUser2Device, |
| 86 AppearanceMode mode, | 87 AppearanceMode mode, |
| 87 const CPDF_RenderOptions* pOptions); | 88 const CPDF_RenderOptions* pOptions); |
| 88 FX_BOOL DrawInContext(const CPDF_Page* pPage, | 89 FX_BOOL DrawInContext(const CPDF_Page* pPage, |
| 89 CPDF_RenderContext* pContext, | 90 CPDF_RenderContext* pContext, |
| 90 const CFX_Matrix* pUser2Device, | 91 const CFX_Matrix* pUser2Device, |
| 91 AppearanceMode mode); | 92 AppearanceMode mode); |
| 92 void ClearCachedAP(); | 93 void ClearCachedAP(); |
| 93 void DrawBorder(CFX_RenderDevice* pDevice, | 94 void DrawBorder(CFX_RenderDevice* pDevice, |
| 94 const CFX_Matrix* pUser2Device, | 95 const CFX_Matrix* pUser2Device, |
| 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(); |
| 104 CFX_FloatRect RectForDrawing() const; | |
| 103 | 105 |
| 104 // For regular annotations, |m_pAnnotDict| is not owned. For | 106 // For regular annotations, |m_pAnnotDict| is not owned. For |
| 105 // our artificially created popup annotations, |m_pAnnotDict| | 107 // our artificially created popup annotations, |m_pAnnotDict| |
| 106 // is owned by this class. | 108 // is owned by this class. |
| 107 bool m_bOwnedAnnotDict; | 109 bool m_bOwnedAnnotDict; |
| 108 CPDF_Dictionary* m_pAnnotDict; | 110 CPDF_Dictionary* m_pAnnotDict; |
| 109 CPDF_Document* const m_pDocument; | 111 CPDF_Document* const m_pDocument; |
| 110 CPDF_Annot::Subtype m_nSubtype; | 112 CPDF_Annot::Subtype m_nSubtype; |
| 111 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap; | 113 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap; |
| 112 // |m_bOpenState| is only set for popup annotations. | 114 // |m_bOpenState| is only set for popup annotations. |
| 113 bool m_bOpenState; | 115 bool m_bOpenState; |
| 116 bool m_bHasGeneratedAP; | |
| 117 bool m_isMarkupAnnotation; | |
|
Lei Zhang
2016/09/06 21:27:03
m_bIsMarkupAnnotation
| |
| 114 // Not owned. If there is a valid pointer in |m_pPopupAnnot|, | 118 // Not owned. If there is a valid pointer in |m_pPopupAnnot|, |
| 115 // then this annot is never a popup. | 119 // then this annot is never a popup. |
| 116 CPDF_Annot* m_pPopupAnnot; | 120 CPDF_Annot* m_pPopupAnnot; |
| 117 }; | 121 }; |
| 118 | 122 |
| 119 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, | 123 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, |
| 120 CPDF_Annot::AppearanceMode mode); | 124 CPDF_Annot::AppearanceMode mode); |
| 121 | 125 |
| 122 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ | 126 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ |
| OLD | NEW |