summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp148
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp2
-rw-r--r--core/fpdfdoc/include/cpdf_annot.h37
-rw-r--r--fpdfsdk/cba_annotiterator.cpp10
-rw-r--r--fpdfsdk/cpdfsdk_annot.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_annothandlermgr.cpp13
-rw-r--r--fpdfsdk/cpdfsdk_baannot.cpp2
-rw-r--r--fpdfsdk/cpdfsdk_baannothandler.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_widgethandler.cpp6
-rw-r--r--fpdfsdk/cpdfsdk_xfawidget.cpp4
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp4
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp2
-rw-r--r--fpdfsdk/formfiller/cffl_iformfiller.cpp26
-rw-r--r--fpdfsdk/fpdf_ext.cpp22
-rw-r--r--fpdfsdk/fsdk_baseform_embeddertest.cpp9
-rw-r--r--fpdfsdk/fsdk_mgr.cpp12
-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
-rw-r--r--fpdfsdk/javascript/Annot.cpp2
27 files changed, 235 insertions, 99 deletions
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index e79acab7a0..6525ff620c 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -21,9 +21,9 @@
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument)
: m_pAnnotDict(pDict),
m_pDocument(pDocument),
- m_sSubtype(m_pAnnotDict->GetStringBy("Subtype")),
m_bOpenState(false),
m_pPopupAnnot(nullptr) {
+ m_nSubtype = StringToAnnotSubtype(m_pAnnotDict->GetStringBy("Subtype"));
GenerateAPIfNeeded();
}
@@ -32,31 +32,32 @@ CPDF_Annot::~CPDF_Annot() {
}
void CPDF_Annot::GenerateAPIfNeeded() {
- if (m_sSubtype == "Circle")
+ if (m_nSubtype == CPDF_Annot::Subtype::CIRCLE)
CPVT_GenerateAP::GenerateCircleAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Highlight")
+ else if (m_nSubtype == CPDF_Annot::Subtype::HIGHLIGHT)
CPVT_GenerateAP::GenerateHighlightAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Ink")
+ else if (m_nSubtype == CPDF_Annot::Subtype::INK)
CPVT_GenerateAP::GenerateInkAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Popup")
+ else if (m_nSubtype == CPDF_Annot::Subtype::POPUP)
CPVT_GenerateAP::GeneratePopupAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Square")
+ else if (m_nSubtype == CPDF_Annot::Subtype::SQUARE)
CPVT_GenerateAP::GenerateSquareAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Squiggly")
+ else if (m_nSubtype == CPDF_Annot::Subtype::SQUIGGLY)
CPVT_GenerateAP::GenerateSquigglyAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "StrikeOut")
+ else if (m_nSubtype == CPDF_Annot::Subtype::STRIKEOUT)
CPVT_GenerateAP::GenerateStrikeOutAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Text")
+ else if (m_nSubtype == CPDF_Annot::Subtype::TEXT)
CPVT_GenerateAP::GenerateTextAP(m_pDocument, m_pAnnotDict);
- else if (m_sSubtype == "Underline")
+ else if (m_nSubtype == CPDF_Annot::Subtype::UNDERLINE)
CPVT_GenerateAP::GenerateUnderlineAP(m_pDocument, m_pAnnotDict);
}
void CPDF_Annot::ClearCachedAP() {
m_APMap.clear();
}
-CFX_ByteString CPDF_Annot::GetSubtype() const {
- return m_sSubtype;
+
+CPDF_Annot::Subtype CPDF_Annot::GetSubtype() const {
+ return m_nSubtype;
}
CFX_FloatRect CPDF_Annot::GetRect() const {
@@ -148,6 +149,125 @@ bool CPDF_Annot::IsAnnotationHidden(CPDF_Dictionary* pAnnotDict) {
return !!(pAnnotDict->GetIntegerBy("F") & ANNOTFLAG_HIDDEN);
}
+// Static.
+CPDF_Annot::Subtype CPDF_Annot::StringToAnnotSubtype(
+ const CFX_ByteString& sSubtype) {
+ if (sSubtype == "Text")
+ return CPDF_Annot::Subtype::TEXT;
+ if (sSubtype == "Link")
+ return CPDF_Annot::Subtype::LINK;
+ if (sSubtype == "FreeText")
+ return CPDF_Annot::Subtype::FREETEXT;
+ if (sSubtype == "Line")
+ return CPDF_Annot::Subtype::LINE;
+ if (sSubtype == "Square")
+ return CPDF_Annot::Subtype::SQUARE;
+ if (sSubtype == "Circle")
+ return CPDF_Annot::Subtype::CIRCLE;
+ if (sSubtype == "Polygon")
+ return CPDF_Annot::Subtype::POLYGON;
+ if (sSubtype == "PolyLine")
+ return CPDF_Annot::Subtype::POLYLINE;
+ if (sSubtype == "Highlight")
+ return CPDF_Annot::Subtype::HIGHLIGHT;
+ if (sSubtype == "Underline")
+ return CPDF_Annot::Subtype::UNDERLINE;
+ if (sSubtype == "Squiggly")
+ return CPDF_Annot::Subtype::SQUIGGLY;
+ if (sSubtype == "StrikeOut")
+ return CPDF_Annot::Subtype::STRIKEOUT;
+ if (sSubtype == "Stamp")
+ return CPDF_Annot::Subtype::STAMP;
+ if (sSubtype == "Caret")
+ return CPDF_Annot::Subtype::CARET;
+ if (sSubtype == "Ink")
+ return CPDF_Annot::Subtype::INK;
+ if (sSubtype == "Popup")
+ return CPDF_Annot::Subtype::POPUP;
+ if (sSubtype == "FileAttachment")
+ return CPDF_Annot::Subtype::FILEATTACHMENT;
+ if (sSubtype == "Sound")
+ return CPDF_Annot::Subtype::SOUND;
+ if (sSubtype == "Movie")
+ return CPDF_Annot::Subtype::MOVIE;
+ if (sSubtype == "Widget")
+ return CPDF_Annot::Subtype::WIDGET;
+ if (sSubtype == "Screen")
+ return CPDF_Annot::Subtype::SCREEN;
+ if (sSubtype == "PrinterMark")
+ return CPDF_Annot::Subtype::PRINTERMARK;
+ if (sSubtype == "TrapNet")
+ return CPDF_Annot::Subtype::TRAPNET;
+ if (sSubtype == "Watermark")
+ return CPDF_Annot::Subtype::WATERMARK;
+ if (sSubtype == "3D")
+ return CPDF_Annot::Subtype::THREED;
+ if (sSubtype == "RichMedia")
+ return CPDF_Annot::Subtype::RICHMEDIA;
+ if (sSubtype == "XFAWidget")
+ return CPDF_Annot::Subtype::XFAWIDGET;
+ return CPDF_Annot::Subtype::UNKNOWN;
+}
+
+// Static.
+CFX_ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) {
+ if (nSubtype == CPDF_Annot::Subtype::TEXT)
+ return "Text";
+ if (nSubtype == CPDF_Annot::Subtype::LINK)
+ return "Link";
+ if (nSubtype == CPDF_Annot::Subtype::FREETEXT)
+ return "FreeText";
+ if (nSubtype == CPDF_Annot::Subtype::LINE)
+ return "Line";
+ if (nSubtype == CPDF_Annot::Subtype::SQUARE)
+ return "Square";
+ if (nSubtype == CPDF_Annot::Subtype::CIRCLE)
+ return "Circle";
+ if (nSubtype == CPDF_Annot::Subtype::POLYGON)
+ return "Polygon";
+ if (nSubtype == CPDF_Annot::Subtype::POLYLINE)
+ return "PolyLine";
+ if (nSubtype == CPDF_Annot::Subtype::HIGHLIGHT)
+ return "Highlight";
+ if (nSubtype == CPDF_Annot::Subtype::UNDERLINE)
+ return "Underline";
+ if (nSubtype == CPDF_Annot::Subtype::SQUIGGLY)
+ return "Squiggly";
+ if (nSubtype == CPDF_Annot::Subtype::STRIKEOUT)
+ return "StrikeOut";
+ if (nSubtype == CPDF_Annot::Subtype::STAMP)
+ return "Stamp";
+ if (nSubtype == CPDF_Annot::Subtype::CARET)
+ return "Caret";
+ if (nSubtype == CPDF_Annot::Subtype::INK)
+ return "Ink";
+ if (nSubtype == CPDF_Annot::Subtype::POPUP)
+ return "Popup";
+ if (nSubtype == CPDF_Annot::Subtype::FILEATTACHMENT)
+ return "FileAttachment";
+ if (nSubtype == CPDF_Annot::Subtype::SOUND)
+ return "Sound";
+ if (nSubtype == CPDF_Annot::Subtype::MOVIE)
+ return "Movie";
+ if (nSubtype == CPDF_Annot::Subtype::WIDGET)
+ return "Widget";
+ if (nSubtype == CPDF_Annot::Subtype::SCREEN)
+ return "Screen";
+ if (nSubtype == CPDF_Annot::Subtype::PRINTERMARK)
+ return "PrinterMark";
+ if (nSubtype == CPDF_Annot::Subtype::TRAPNET)
+ return "TrapNet";
+ if (nSubtype == CPDF_Annot::Subtype::WATERMARK)
+ return "Watermark";
+ if (nSubtype == CPDF_Annot::Subtype::THREED)
+ return "3D";
+ if (nSubtype == CPDF_Annot::Subtype::RICHMEDIA)
+ return "RichMedia";
+ if (nSubtype == CPDF_Annot::Subtype::XFAWIDGET)
+ return "XFAWidget";
+ return "";
+}
+
FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
CFX_RenderDevice* pDevice,
const CFX_Matrix* pUser2Device,
@@ -156,7 +276,7 @@ FX_BOOL CPDF_Annot::DrawAppearance(CPDF_Page* pPage,
if (IsAnnotationHidden(m_pAnnotDict))
return FALSE;
- if (m_sSubtype == "Popup" && !m_bOpenState)
+ if (m_nSubtype == CPDF_Annot::Subtype::POPUP && !m_bOpenState)
return FALSE;
// It might happen that by the time this annotation instance was created,
@@ -193,7 +313,7 @@ FX_BOOL CPDF_Annot::DrawInContext(const CPDF_Page* pPage,
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
const CFX_Matrix* pUser2Device,
const CPDF_RenderOptions* pOptions) {
- if (GetSubtype() == "Popup")
+ if (GetSubtype() == CPDF_Annot::Subtype::POPUP)
return;
uint32_t annot_flags = GetFlags();
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 4c569892c2..61122ed59b 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -110,7 +110,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
for (const auto& pAnnot : m_AnnotList) {
- bool bWidget = pAnnot->GetSubtype() == "Widget";
+ bool bWidget = pAnnot->GetSubtype() == CPDF_Annot::Subtype::WIDGET;
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget))
continue;
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;
diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp
index 773fe610cd..b99fabfabe 100644
--- a/fpdfsdk/cba_annotiterator.cpp
+++ b/fpdfsdk/cba_annotiterator.cpp
@@ -23,10 +23,10 @@ bool CBA_AnnotIterator::CompareByTopDescending(const CPDFSDK_Annot* p1,
}
CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
- const CFX_ByteString& sAnnotSubtype)
+ CPDF_Annot::Subtype nAnnotSubtype)
: m_eTabOrder(STRUCTURE),
m_pPageView(pPageView),
- m_sAnnotSubtype(sAnnotSubtype) {
+ m_nAnnotSubtype(nAnnotSubtype) {
CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringBy("Tabs");
if (sTabs == "R")
@@ -71,7 +71,7 @@ void CBA_AnnotIterator::GenerateResults() {
case STRUCTURE: {
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ if (pAnnot->GetAnnotSubtype() == m_nAnnotSubtype &&
!pAnnot->IsSignatureWidget())
m_Annots.push_back(pAnnot);
}
@@ -81,7 +81,7 @@ void CBA_AnnotIterator::GenerateResults() {
std::vector<CPDFSDK_Annot*> sa;
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ if (pAnnot->GetAnnotSubtype() == m_nAnnotSubtype &&
!pAnnot->IsSignatureWidget())
sa.push_back(pAnnot);
}
@@ -123,7 +123,7 @@ void CBA_AnnotIterator::GenerateResults() {
std::vector<CPDFSDK_Annot*> sa;
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ if (pAnnot->GetAnnotSubtype() == m_nAnnotSubtype &&
!pAnnot->IsSignatureWidget())
sa.push_back(pAnnot);
}
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index 5ca439d8f7..59d8f24e82 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -58,8 +58,8 @@ CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const {
return nullptr;
}
-CFX_ByteString CPDFSDK_Annot::GetAnnotSubtype() const {
- return "";
+CPDF_Annot::Subtype CPDFSDK_Annot::GetAnnotSubtype() const {
+ return CPDF_Annot::Subtype::UNKNOWN;
}
bool CPDFSDK_Annot::IsSignatureWidget() const {
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 9f5a545d65..d909f5bc0d 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -46,7 +46,8 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot,
ASSERT(pAnnot);
ASSERT(pPageView);
- return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME)->NewAnnot(pAnnot, pPageView);
+ return GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET)
+ ->NewAnnot(pAnnot, pPageView);
}
#endif // PDF_ENABLE_XFA
@@ -77,12 +78,12 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
}
IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler(
- const CFX_ByteString& sType) const {
- if (sType == "Widget")
+ CPDF_Annot::Subtype nAnnotSubtype) const {
+ if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET)
return m_pWidgetHandler.get();
#ifdef PDF_ENABLE_XFA
- if (sType == FSDK_XFAWIDGET_TYPENAME)
+ if (nAnnotSubtype == CPDF_Annot::Subtype::XFAWIDGET)
return m_pXFAWidgetHandler.get();
#endif // PDF_ENABLE_XFA
@@ -242,7 +243,7 @@ FX_BOOL CPDFSDK_AnnotHandlerMgr::Annot_OnChangeFocus(
if (bXFA) {
if (IPDFSDK_AnnotHandler* pXFAAnnotHandler =
- GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME))
+ GetAnnotHandler(CPDF_Annot::Subtype::XFAWIDGET))
return pXFAAnnotHandler->OnXFAChangedFocus(pKillAnnot, pSetAnnot);
}
@@ -299,7 +300,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot,
return pPageView->GetAnnotByXFAWidget(hNextFocus);
#else // PDF_ENABLE_XFA
- CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget");
+ CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), CPDF_Annot::Subtype::WIDGET);
return bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
#endif // PDF_ENABLE_XFA
}
diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp
index 5e3e14572c..a2fd7c79bb 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -42,7 +42,7 @@ CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const {
return m_pAnnot->GetRect();
}
-CFX_ByteString CPDFSDK_BAAnnot::GetAnnotSubtype() const {
+CPDF_Annot::Subtype CPDFSDK_BAAnnot::GetAnnotSubtype() const {
return m_pAnnot->GetSubtype();
}
diff --git a/fpdfsdk/cpdfsdk_baannothandler.cpp b/fpdfsdk/cpdfsdk_baannothandler.cpp
index 2fe3623099..4422dc4ee9 100644
--- a/fpdfsdk/cpdfsdk_baannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_baannothandler.cpp
@@ -37,10 +37,6 @@ CPDFSDK_BAAnnotHandler::CPDFSDK_BAAnnotHandler() {}
CPDFSDK_BAAnnotHandler::~CPDFSDK_BAAnnotHandler() {}
-CFX_ByteString CPDFSDK_BAAnnotHandler::GetType() {
- return CFX_ByteString("");
-}
-
FX_BOOL CPDFSDK_BAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
return FALSE;
}
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 1346deb2bc..345487ad49 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -71,8 +71,8 @@ FX_BOOL CPDFSDK_InterForm::HighlightWidgets() {
CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
FX_BOOL bNext) const {
- std::unique_ptr<CBA_AnnotIterator> pIterator(
- new CBA_AnnotIterator(pWidget->GetPageView(), "Widget"));
+ std::unique_ptr<CBA_AnnotIterator> pIterator(new CBA_AnnotIterator(
+ pWidget->GetPageView(), CPDF_Annot::Subtype::WIDGET));
if (bNext)
return static_cast<CPDFSDK_Widget*>(pIterator->GetNextAnnot(pWidget));
diff --git a/fpdfsdk/cpdfsdk_widgethandler.cpp b/fpdfsdk/cpdfsdk_widgethandler.cpp
index 0fb64dfaec..77e14f0404 100644
--- a/fpdfsdk/cpdfsdk_widgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_widgethandler.cpp
@@ -27,12 +27,8 @@ CPDFSDK_WidgetHandler::CPDFSDK_WidgetHandler(CPDFDoc_Environment* pApp)
CPDFSDK_WidgetHandler::~CPDFSDK_WidgetHandler() {}
-CFX_ByteString CPDFSDK_WidgetHandler::GetType() {
- return CFX_ByteString("Widget");
-}
-
FX_BOOL CPDFSDK_WidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot->GetAnnotSubtype() == "Widget");
+ ASSERT(pAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET);
if (pAnnot->IsSignatureWidget())
return FALSE;
diff --git a/fpdfsdk/cpdfsdk_xfawidget.cpp b/fpdfsdk/cpdfsdk_xfawidget.cpp
index 445abc53cb..b5e26d660a 100644
--- a/fpdfsdk/cpdfsdk_xfawidget.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidget.cpp
@@ -24,8 +24,8 @@ CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const {
return m_hXFAWidget;
}
-CFX_ByteString CPDFSDK_XFAWidget::GetAnnotSubtype() const {
- return FSDK_XFAWIDGET_TYPENAME;
+CPDF_Annot::Subtype CPDFSDK_XFAWidget::GetAnnotSubtype() const {
+ return CPDF_Annot::Subtype::XFAWIDGET;
}
CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index 9a9a7a8a4a..59fa5c7241 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -25,10 +25,6 @@ CPDFSDK_XFAWidgetHandler::CPDFSDK_XFAWidgetHandler(CPDFDoc_Environment* pApp)
CPDFSDK_XFAWidgetHandler::~CPDFSDK_XFAWidgetHandler() {}
-CFX_ByteString CPDFSDK_XFAWidgetHandler::GetType() {
- return FSDK_XFAWIDGET_TYPENAME;
-}
-
FX_BOOL CPDFSDK_XFAWidgetHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
return !!pAnnot->GetXFAWidget();
}
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 90b83d6e46..6a8ec5da33 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -85,7 +85,7 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView,
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
uint32_t dwFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CPWL_Wnd* pWnd = GetPDFWindow(pPageView, FALSE)) {
CFX_Matrix mt = GetCurMatrix();
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp
index 0f5ed89fb2..111294726c 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -124,7 +124,7 @@ void CFFL_IFormFiller::OnDelete(CPDFSDK_Annot* pAnnot) {
void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -160,7 +160,7 @@ void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -197,7 +197,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -239,7 +239,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
@@ -319,7 +319,7 @@ FX_BOOL CFFL_IFormFiller::OnLButtonDblClk(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
@@ -332,7 +332,7 @@ FX_BOOL CFFL_IFormFiller::OnMouseMove(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
// change cursor
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
@@ -347,7 +347,7 @@ FX_BOOL CFFL_IFormFiller::OnMouseWheel(CPDFSDK_PageView* pPageView,
FX_UINT nFlags,
short zDelta,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
@@ -360,7 +360,7 @@ FX_BOOL CFFL_IFormFiller::OnRButtonDown(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
@@ -373,7 +373,7 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
@@ -385,7 +385,7 @@ FX_BOOL CFFL_IFormFiller::OnRButtonUp(CPDFSDK_PageView* pPageView,
FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
FX_UINT nKeyCode,
FX_UINT nFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
@@ -397,7 +397,7 @@ FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
FX_UINT nChar,
FX_UINT nFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (nChar == FWL_VKEY_Tab)
return TRUE;
@@ -411,7 +411,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
if (!pAnnot)
return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -454,7 +454,7 @@ FX_BOOL CFFL_IFormFiller::OnSetFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
if (!pAnnot)
return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == CPDF_Annot::Subtype::WIDGET);
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
pFormFiller->KillFocusForAnnot(pAnnot, nFlag);
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index d03b4383ca..46bc7e57a4 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -46,33 +46,31 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) {
}
void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
- CFX_ByteString cbSubType = pPDFAnnot->GetSubtype();
- if (cbSubType.Compare("3D") == 0) {
+ CPDF_Annot::Subtype nAnnotSubtype = pPDFAnnot->GetSubtype();
+ if (nAnnotSubtype == CPDF_Annot::Subtype::THREED) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
- } else if (cbSubType.Compare("Screen") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::SCREEN) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
if (pAnnotDict->KeyExist("IT"))
cbString = pAnnotDict->GetStringBy("IT");
if (cbString.Compare("Img") != 0)
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_MEDIA);
- } else if (cbSubType.Compare("Movie") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::MOVIE) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_MOVIE);
- } else if (cbSubType.Compare("Sound") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::SOUND) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SOUND);
- } else if (cbSubType.Compare("RichMedia") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::RICHMEDIA) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA);
- } else if (cbSubType.Compare("FileAttachment") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::FILEATTACHMENT) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_ATTACHMENT);
- } else if (cbSubType.Compare("Widget") == 0) {
+ } else if (nAnnotSubtype == CPDF_Annot::Subtype::WIDGET) {
const CPDF_Dictionary* pAnnotDict = pPDFAnnot->GetAnnotDict();
CFX_ByteString cbString;
- if (pAnnotDict->KeyExist("FT")) {
+ if (pAnnotDict->KeyExist("FT"))
cbString = pAnnotDict->GetStringBy("FT");
- }
- if (cbString.Compare("Sig") == 0) {
+ if (cbString.Compare("Sig") == 0)
FPDF_UnSupportError(FPDF_UNSP_ANNOT_SIG);
- }
}
}
diff --git a/fpdfsdk/fsdk_baseform_embeddertest.cpp b/fpdfsdk/fsdk_baseform_embeddertest.cpp
index c87073d38b..53611ae698 100644
--- a/fpdfsdk/fsdk_baseform_embeddertest.cpp
+++ b/fpdfsdk/fsdk_baseform_embeddertest.cpp
@@ -42,7 +42,8 @@ TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) {
CPDFSDK_Document::FromFPDFFormHandle(form_handle());
{
// Page 0 specifies "row order".
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(0),
+ CPDF_Annot::Subtype::WIDGET);
CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
CheckRect(pAnnot->GetRect(), RightTop);
pAnnot = iter.GetNextAnnot(pAnnot);
@@ -67,7 +68,8 @@ TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) {
}
{
// Page 1 specifies "column order"
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(1), "Widget");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(1),
+ CPDF_Annot::Subtype::WIDGET);
CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
CheckRect(pAnnot->GetRect(), RightTop);
pAnnot = iter.GetNextAnnot(pAnnot);
@@ -92,7 +94,8 @@ TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) {
}
{
// Page 2 specifies "struct order"
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(2), "Widget");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(2),
+ CPDF_Annot::Subtype::WIDGET);
CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
CheckRect(pAnnot->GetRect(), LeftBottom);
pAnnot = iter.GetNextAnnot(pAnnot);
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index fda00e0e6e..4ca2e6cc50 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -442,7 +442,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) {
#endif // PDF_ENABLE_XFA
if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
- if (pFocusAnnot->GetAnnotSubtype() == "Widget") {
+ if (pFocusAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
int nFieldType = pWidget->GetFieldType();
if (FIELDTYPE_TEXTFIELD == nFieldType ||
@@ -586,7 +586,7 @@ const CPDF_Annot* CPDFSDK_PageView::GetPDFAnnotAtPoint(FX_FLOAT pageX,
const CPDF_Annot* CPDFSDK_PageView::GetPDFWidgetAtPoint(FX_FLOAT pageX,
FX_FLOAT pageY) {
for (const auto& pAnnot : m_pAnnotList->All()) {
- if (pAnnot->GetSubtype() == "Widget") {
+ if (pAnnot->GetSubtype() == CPDF_Annot::Subtype::WIDGET) {
CFX_FloatRect annotRect = pAnnot->GetRect();
if (annotRect.Contains(pageX, pageY))
return pAnnot.get();
@@ -602,7 +602,7 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXAnnotAtPoint(FX_FLOAT pageX,
CPDFSDK_AnnotIterator annotIterator(this, false);
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
CFX_FloatRect rc = pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
- if (pSDKAnnot->GetAnnotSubtype() == "Popup")
+ if (pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::POPUP)
continue;
if (rc.Contains(pageX, pageY))
return pSDKAnnot;
@@ -617,10 +617,10 @@ CPDFSDK_Annot* CPDFSDK_PageView::GetFXWidgetAtPoint(FX_FLOAT pageX,
CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
CPDFSDK_AnnotIterator annotIterator(this, false);
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
- bool bHitTest = pSDKAnnot->GetAnnotSubtype() == "Widget";
+ bool bHitTest = pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::WIDGET;
#ifdef PDF_ENABLE_XFA
- bHitTest =
- bHitTest || pSDKAnnot->GetAnnotSubtype() == FSDK_XFAWIDGET_TYPENAME;
+ bHitTest = bHitTest ||
+ pSDKAnnot->GetAnnotSubtype() == CPDF_Annot::Subtype::XFAWIDGET;
#endif // PDF_ENABLE_XFA
if (bHitTest) {
pAnnotMgr->Annot_OnGetViewBBox(this, pSDKAnnot);
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;
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index 9945217198..a23d42f72a 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -80,7 +80,7 @@ FX_BOOL Annot::type(IJS_Context* cc,
return FALSE;
}
- vp << m_BAAnnot->GetAnnotSubtype();
+ vp << CPDF_Annot::AnnotSubtypeToString(m_BAAnnot->GetAnnotSubtype());
return TRUE;
}