summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/include/cpdf_annot.h
diff options
context:
space:
mode:
authorjaepark <jaepark@google.com>2016-08-31 06:49:27 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-31 06:49:27 -0700
commit956553e715787cfc4dd8423d5e9a04a0131878c3 (patch)
tree08622d504322d5dae37b5bb5025a90c81ebdee6b /core/fpdfdoc/include/cpdf_annot.h
parent87dffc0315477150c9c1964913b65bc97bdf654f (diff)
downloadpdfium-956553e715787cfc4dd8423d5e9a04a0131878c3.tar.xz
Use enum class for subtypes of CPDF_Annot.
Comparing CFX_ByteString for annotation subtypes is inefficient and error-prone. This CL uses enum class to compare annotation subtypes. Also, remove unused IPDFSDK_AnnotHandler::GetType() and FSDK_XFAWIDGET_TYPENAME. Review-Url: https://codereview.chromium.org/2295953002
Diffstat (limited to 'core/fpdfdoc/include/cpdf_annot.h')
-rw-r--r--core/fpdfdoc/include/cpdf_annot.h37
1 files changed, 35 insertions, 2 deletions
diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h
index 416c540cc3..82b3d3ca31 100644
--- a/core/fpdfdoc/include/cpdf_annot.h
+++ b/core/fpdfdoc/include/cpdf_annot.h
@@ -36,13 +36,46 @@ class CPDF_Stream;
class CPDF_Annot {
public:
enum AppearanceMode { Normal, Rollover, Down };
+ enum class Subtype {
+ UNKNOWN = 0,
+ TEXT,
+ LINK,
+ FREETEXT,
+ LINE,
+ SQUARE,
+ CIRCLE,
+ POLYGON,
+ POLYLINE,
+ HIGHLIGHT,
+ UNDERLINE,
+ SQUIGGLY,
+ STRIKEOUT,
+ STAMP,
+ CARET,
+ INK,
+ POPUP,
+ FILEATTACHMENT,
+ SOUND,
+ MOVIE,
+ WIDGET,
+ SCREEN,
+ PRINTERMARK,
+ TRAPNET,
+ WATERMARK,
+ THREED,
+ RICHMEDIA,
+ XFAWIDGET
+ };
static bool IsAnnotationHidden(CPDF_Dictionary* pAnnotDict);
+ static CPDF_Annot::Subtype StringToAnnotSubtype(
+ const CFX_ByteString& sSubtype);
+ static CFX_ByteString AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype);
CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument);
~CPDF_Annot();
- CFX_ByteString GetSubtype() const;
+ CPDF_Annot::Subtype GetSubtype() const;
uint32_t GetFlags() const;
CFX_FloatRect GetRect() const;
const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
@@ -70,7 +103,7 @@ class CPDF_Annot {
CPDF_Dictionary* const m_pAnnotDict;
CPDF_Document* const m_pDocument;
- const CFX_ByteString m_sSubtype;
+ CPDF_Annot::Subtype m_nSubtype;
std::map<CPDF_Stream*, std::unique_ptr<CPDF_Form>> m_APMap;
// |m_bOpenState| is only set for popup annotations.
bool m_bOpenState;