summaryrefslogtreecommitdiff
path: root/fpdfsdk/include
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 /fpdfsdk/include
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 'fpdfsdk/include')
-rw-r--r--fpdfsdk/include/cba_annotiterator.h5
-rw-r--r--fpdfsdk/include/cpdfsdk_annot.h2
-rw-r--r--fpdfsdk/include/cpdfsdk_annothandlermgr.h4
-rw-r--r--fpdfsdk/include/cpdfsdk_baannot.h2
-rw-r--r--fpdfsdk/include/cpdfsdk_baannothandler.h1
-rw-r--r--fpdfsdk/include/cpdfsdk_widgethandler.h1
-rw-r--r--fpdfsdk/include/cpdfsdk_xfawidget.h2
-rw-r--r--fpdfsdk/include/cpdfsdk_xfawidgethandler.h1
-rw-r--r--fpdfsdk/include/ipdfsdk_annothandler.h5
9 files changed, 8 insertions, 15 deletions
diff --git a/fpdfsdk/include/cba_annotiterator.h b/fpdfsdk/include/cba_annotiterator.h
index 0cf6e6a0ef..aa0ad2d72b 100644
--- a/fpdfsdk/include/cba_annotiterator.h
+++ b/fpdfsdk/include/cba_annotiterator.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "core/fpdfdoc/include/cpdf_annot.h"
#include "core/fxcrt/include/fx_coordinates.h"
#include "core/fxcrt/include/fx_string.h"
@@ -20,7 +21,7 @@ class CBA_AnnotIterator {
enum TabOrder { STRUCTURE = 0, ROW, COLUMN };
CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
- const CFX_ByteString& sAnnotSubtype);
+ CPDF_Annot::Subtype nAnnotSubtype);
~CBA_AnnotIterator();
CPDFSDK_Annot* GetFirstAnnot();
@@ -40,7 +41,7 @@ class CBA_AnnotIterator {
TabOrder m_eTabOrder;
CPDFSDK_PageView* m_pPageView;
- CFX_ByteString m_sAnnotSubtype;
+ CPDF_Annot::Subtype m_nAnnotSubtype;
std::vector<CPDFSDK_Annot*> m_Annots;
};
diff --git a/fpdfsdk/include/cpdfsdk_annot.h b/fpdfsdk/include/cpdfsdk_annot.h
index 9501037cd6..967226e9db 100644
--- a/fpdfsdk/include/cpdfsdk_annot.h
+++ b/fpdfsdk/include/cpdfsdk_annot.h
@@ -35,7 +35,7 @@ class CPDFSDK_Annot {
virtual FX_FLOAT GetMinHeight() const;
virtual int GetLayoutOrder() const;
virtual CPDF_Annot* GetPDFAnnot() const;
- virtual CFX_ByteString GetAnnotSubtype() const;
+ virtual CPDF_Annot::Subtype GetAnnotSubtype() const;
virtual bool IsSignatureWidget() const;
virtual CFX_FloatRect GetRect() const;
diff --git a/fpdfsdk/include/cpdfsdk_annothandlermgr.h b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
index 016135c0d0..3c36692bb5 100644
--- a/fpdfsdk/include/cpdfsdk_annothandlermgr.h
+++ b/fpdfsdk/include/cpdfsdk_annothandlermgr.h
@@ -10,12 +10,12 @@
#include <map>
#include <memory>
+#include "core/fpdfdoc/include/cpdf_annot.h"
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
class CFX_Matrix;
class CFX_RenderDevice;
-class CPDF_Annot;
class CPDFDoc_Environment;
class CPDFSDK_Annot;
class CPDFSDK_BAAnnotHandler;
@@ -109,7 +109,7 @@ class CPDFSDK_AnnotHandlerMgr {
const CFX_FloatPoint& point);
private:
- IPDFSDK_AnnotHandler* GetAnnotHandler(const CFX_ByteString& sType) const;
+ IPDFSDK_AnnotHandler* GetAnnotHandler(CPDF_Annot::Subtype nSubtype) const;
CPDFSDK_Annot* GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, FX_BOOL bNext);
std::unique_ptr<CPDFSDK_BAAnnotHandler> m_pBAAnnotHandler;
diff --git a/fpdfsdk/include/cpdfsdk_baannot.h b/fpdfsdk/include/cpdfsdk_baannot.h
index 0f417383c2..4575bfe087 100644
--- a/fpdfsdk/include/cpdfsdk_baannot.h
+++ b/fpdfsdk/include/cpdfsdk_baannot.h
@@ -28,7 +28,7 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot {
~CPDFSDK_BAAnnot() override;
// CPDFSDK_Annot
- CFX_ByteString GetAnnotSubtype() const override;
+ CPDF_Annot::Subtype GetAnnotSubtype() const override;
void SetRect(const CFX_FloatRect& rect) override;
CFX_FloatRect GetRect() const override;
CPDF_Annot* GetPDFAnnot() const override;
diff --git a/fpdfsdk/include/cpdfsdk_baannothandler.h b/fpdfsdk/include/cpdfsdk_baannothandler.h
index c1936a798e..ac93a597cc 100644
--- a/fpdfsdk/include/cpdfsdk_baannothandler.h
+++ b/fpdfsdk/include/cpdfsdk_baannothandler.h
@@ -28,7 +28,6 @@ class CPDFSDK_BAAnnotHandler : public IPDFSDK_AnnotHandler {
CPDFSDK_BAAnnotHandler();
~CPDFSDK_BAAnnotHandler() override;
- CFX_ByteString GetType() override;
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/include/cpdfsdk_widgethandler.h b/fpdfsdk/include/cpdfsdk_widgethandler.h
index 0155967f3a..042fc2b316 100644
--- a/fpdfsdk/include/cpdfsdk_widgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_widgethandler.h
@@ -28,7 +28,6 @@ class CPDFSDK_WidgetHandler : public IPDFSDK_AnnotHandler {
explicit CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp);
~CPDFSDK_WidgetHandler() override;
- CFX_ByteString GetType() override;
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/include/cpdfsdk_xfawidget.h b/fpdfsdk/include/cpdfsdk_xfawidget.h
index 00cc01249c..311c22587b 100644
--- a/fpdfsdk/include/cpdfsdk_xfawidget.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidget.h
@@ -24,7 +24,7 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot {
FX_BOOL IsXFAField() override;
CXFA_FFWidget* GetXFAWidget() const override;
- CFX_ByteString GetAnnotSubtype() const override;
+ CPDF_Annot::Subtype GetAnnotSubtype() const override;
CFX_FloatRect GetRect() const override;
CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; }
diff --git a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
index 84e74b4a73..269b416544 100644
--- a/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidgethandler.h
@@ -25,7 +25,6 @@ class CPDFSDK_XFAWidgetHandler : public IPDFSDK_AnnotHandler {
explicit CPDFSDK_XFAWidgetHandler(CPDFDoc_Environment* pApp);
~CPDFSDK_XFAWidgetHandler() override;
- CFX_ByteString GetType() override;
FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) override;
CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) override;
CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot,
diff --git a/fpdfsdk/include/ipdfsdk_annothandler.h b/fpdfsdk/include/ipdfsdk_annothandler.h
index 0dd1a93cc8..1a6ba8699c 100644
--- a/fpdfsdk/include/ipdfsdk_annothandler.h
+++ b/fpdfsdk/include/ipdfsdk_annothandler.h
@@ -10,10 +10,6 @@
#include "core/fxcrt/include/fx_basic.h"
#include "core/fxcrt/include/fx_coordinates.h"
-#ifdef PDF_ENABLE_XFA
-#define FSDK_XFAWIDGET_TYPENAME "XFAWidget"
-#endif // PDF_ENABLE_XFA
-
class CFX_Matrix;
class CFX_RenderDevice;
class CPDF_Annot;
@@ -28,7 +24,6 @@ class IPDFSDK_AnnotHandler {
public:
virtual ~IPDFSDK_AnnotHandler() {}
- virtual CFX_ByteString GetType() = 0;
virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot) = 0;
virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot,
CPDFSDK_PageView* pPage) = 0;