Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(459)

Side by Side Diff: core/fpdfdoc/include/cpdf_annot.h

Issue 2295953002: Use enum class for subtypes of CPDF_Annot. (Closed)
Patch Set: Use enum class for subtypes of CPDF_Annot. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_annotlist.cpp ('k') | fpdfsdk/cba_annotiterator.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 #define ANNOTFLAG_NOZOOM 0x0008 29 #define ANNOTFLAG_NOZOOM 0x0008
30 #define ANNOTFLAG_NOROTATE 0x0010 30 #define ANNOTFLAG_NOROTATE 0x0010
31 #define ANNOTFLAG_NOVIEW 0x0020 31 #define ANNOTFLAG_NOVIEW 0x0020
32 #define ANNOTFLAG_READONLY 0x0040 32 #define ANNOTFLAG_READONLY 0x0040
33 #define ANNOTFLAG_LOCKED 0x0080 33 #define ANNOTFLAG_LOCKED 0x0080
34 #define ANNOTFLAG_TOGGLENOVIEW 0x0100 34 #define ANNOTFLAG_TOGGLENOVIEW 0x0100
35 35
36 class CPDF_Annot { 36 class CPDF_Annot {
37 public: 37 public:
38 enum AppearanceMode { Normal, Rollover, Down }; 38 enum AppearanceMode { Normal, Rollover, Down };
39 enum class Subtype {
40 UNKNOWN = 0,
41 TEXT,
42 LINK,
43 FREETEXT,
44 LINE,
45 SQUARE,
46 CIRCLE,
47 POLYGON,
48 POLYLINE,
49 HIGHLIGHT,
50 UNDERLINE,
51 SQUIGGLY,
52 STRIKEOUT,
53 STAMP,
54 CARET,
55 INK,
56 POPUP,
57 FILEATTACHMENT,
58 SOUND,
59 MOVIE,
60 WIDGET,
61 SCREEN,
62 PRINTERMARK,
63 TRAPNET,
64 WATERMARK,
65 THREED,
66 RICHMEDIA,
67 XFAWIDGET
68 };
39 69
40 static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict); 70 static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict);
71 static CPDF_Annot::Subtype StringToAnnotSubtype(
72 const CFX_ByteString& sSubtype);
73 static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
41 74
42 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument); 75 CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument);
43 ~CPDF_Annot(); 76 ~CPDF_Annot();
44 77
45 CFX_ByteString GetSubtype() const; 78 CPDF_Annot::Subtype GetSubtype() const;
46 uint32_t GetFlags() const; 79 uint32_t GetFlags() const;
47 CFX_FloatRect GetRect() const; 80 CFX_FloatRect GetRect() const;
48 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; } 81 const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
49 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; } 82 CPDF_Dictionary* GetAnnotDict() { return m_pAnnotDict; }
50 FX_BOOL DrawAppearance(CPDF_Page* pPage, 83 FX_BOOL DrawAppearance(CPDF_Page* pPage,
51 CFX_RenderDevice* pDevice, 84 CFX_RenderDevice* pDevice,
52 const CFX_Matrix* pUser2Device, 85 const CFX_Matrix* pUser2Device,
53 AppearanceMode mode, 86 AppearanceMode mode,
54 const CPDF_RenderOptions* pOptions); 87 const CPDF_RenderOptions* pOptions);
55 FX_BOOL DrawInContext(const CPDF_Page* pPage, 88 FX_BOOL DrawInContext(const CPDF_Page* pPage,
56 CPDF_RenderContext* pContext, 89 CPDF_RenderContext* pContext,
57 const CFX_Matrix* pUser2Device, 90 const CFX_Matrix* pUser2Device,
58 AppearanceMode mode); 91 AppearanceMode mode);
59 void ClearCachedAP(); 92 void ClearCachedAP();
60 void DrawBorder(CFX_RenderDevice* pDevice, 93 void DrawBorder(CFX_RenderDevice* pDevice,
61 const CFX_Matrix* pUser2Device, 94 const CFX_Matrix* pUser2Device,
62 const CPDF_RenderOptions* pOptions); 95 const CPDF_RenderOptions* pOptions);
63 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode); 96 CPDF_Form* GetAPForm(const CPDF_Page* pPage, AppearanceMode mode);
64 void SetOpenState(bool bOpenState) { m_bOpenState = bOpenState; } 97 void SetOpenState(bool bOpenState) { m_bOpenState = bOpenState; }
65 CPDF_Annot* GetPopupAnnot() const { return m_pPopupAnnot; } 98 CPDF_Annot* GetPopupAnnot() const { return m_pPopupAnnot; }
66 void SetPopupAnnot(CPDF_Annot* pAnnot) { m_pPopupAnnot = pAnnot; } 99 void SetPopupAnnot(CPDF_Annot* pAnnot) { m_pPopupAnnot = pAnnot; }
67 100
68 private: 101 private:
69 void GenerateAPIfNeeded(); 102 void GenerateAPIfNeeded();
70 103
71 CPDF_Dictionary* const m_pAnnotDict; 104 CPDF_Dictionary* const m_pAnnotDict;
72 CPDF_Document* const m_pDocument; 105 CPDF_Document* const m_pDocument;
73 const CFX_ByteString m_sSubtype; 106 CPDF_Annot::Subtype m_nSubtype;
74 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap; 107 std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap;
75 // |m_bOpenState| is only set for popup annotations. 108 // |m_bOpenState| is only set for popup annotations.
76 bool m_bOpenState; 109 bool m_bOpenState;
77 // Not owned. If there is a valid pointer in |m_pPopupAnnot|, 110 // Not owned. If there is a valid pointer in |m_pPopupAnnot|,
78 // then this annot is never a popup. 111 // then this annot is never a popup.
79 CPDF_Annot* m_pPopupAnnot; 112 CPDF_Annot* m_pPopupAnnot;
80 }; 113 };
81 114
82 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict, 115 CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
83 CPDF_Annot::AppearanceMode mode); 116 CPDF_Annot::AppearanceMode mode);
84 117
85 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_ 118 #endif // CORE_FPDFDOC_INCLUDE_CPDF_ANNOT_H_
OLDNEW
« no previous file with comments | « core/fpdfdoc/cpdf_annotlist.cpp ('k') | fpdfsdk/cba_annotiterator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698