Rename CPDFSDK_Annot::GetType to CPDFSDK_Annot::GetAnnotSubtype.
CPDFSDK_Annot::GetType should be renamed to GetAnnotSubtype as it returns
annotation subtype. Also, CPDFSDK_Annot::GetSubType is only used to check if
the annotation is signature widget. Thus, change the method to
IsSignatureWidget. Lastly, rename CPDF_Annot::GetSubType to
CPDF_Annot::GetSubtype to match with spec.
Review-Url: https://codereview.chromium.org/2287703002
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index e70ee27..10360ea 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -51,7 +51,7 @@
void CPDF_Annot::ClearCachedAP() {
m_APMap.clear();
}
-CFX_ByteString CPDF_Annot::GetSubType() const {
+CFX_ByteString CPDF_Annot::GetSubtype() const {
return m_sSubtype;
}
@@ -186,9 +186,9 @@
void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
const CFX_Matrix* pUser2Device,
const CPDF_RenderOptions* pOptions) {
- if (GetSubType() == "Popup") {
+ if (GetSubtype() == "Popup")
return;
- }
+
uint32_t annot_flags = GetFlags();
if (annot_flags & ANNOTFLAG_HIDDEN) {
return;
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 153b25f..e6c93c1 100644
--- a/core/fpdfdoc/cpdf_annotlist.cpp
+++ b/core/fpdfdoc/cpdf_annotlist.cpp
@@ -62,7 +62,7 @@
CPDF_RenderOptions* pOptions,
FX_RECT* clip_rect) {
for (const auto& pAnnot : m_AnnotList) {
- bool bWidget = pAnnot->GetSubType() == "Widget";
+ bool bWidget = pAnnot->GetSubtype() == "Widget";
if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget))
continue;
diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h
index 9f86716..914393a 100644
--- a/core/fpdfdoc/include/cpdf_annot.h
+++ b/core/fpdfdoc/include/cpdf_annot.h
@@ -42,7 +42,7 @@
CPDF_Annot(CPDF_Dictionary* pDict, CPDF_Document* pDocument);
~CPDF_Annot();
- CFX_ByteString GetSubType() const;
+ CFX_ByteString GetSubtype() const;
uint32_t GetFlags() const;
CFX_FloatRect GetRect() const;
const CPDF_Dictionary* GetAnnotDict() const { return m_pAnnotDict; }
diff --git a/fpdfsdk/cba_annotiterator.cpp b/fpdfsdk/cba_annotiterator.cpp
index bd68997..773fe61 100644
--- a/fpdfsdk/cba_annotiterator.cpp
+++ b/fpdfsdk/cba_annotiterator.cpp
@@ -23,12 +23,10 @@
}
CBA_AnnotIterator::CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
- const CFX_ByteString& sType,
- const CFX_ByteString& sSubType)
+ const CFX_ByteString& sAnnotSubtype)
: m_eTabOrder(STRUCTURE),
m_pPageView(pPageView),
- m_sType(sType),
- m_sSubType(sSubType) {
+ m_sAnnotSubtype(sAnnotSubtype) {
CPDF_Page* pPDFPage = m_pPageView->GetPDFPage();
CFX_ByteString sTabs = pPDFPage->m_pFormDict->GetStringBy("Tabs");
if (sTabs == "R")
@@ -73,7 +71,8 @@
case STRUCTURE: {
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType)
+ if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ !pAnnot->IsSignatureWidget())
m_Annots.push_back(pAnnot);
}
break;
@@ -82,7 +81,8 @@
std::vector<CPDFSDK_Annot*> sa;
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType)
+ if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ !pAnnot->IsSignatureWidget())
sa.push_back(pAnnot);
}
@@ -123,7 +123,8 @@
std::vector<CPDFSDK_Annot*> sa;
for (size_t i = 0; i < m_pPageView->CountAnnots(); ++i) {
CPDFSDK_Annot* pAnnot = m_pPageView->GetAnnot(i);
- if (pAnnot->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType)
+ if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype &&
+ !pAnnot->IsSignatureWidget())
sa.push_back(pAnnot);
}
diff --git a/fpdfsdk/cpdfsdk_annot.cpp b/fpdfsdk/cpdfsdk_annot.cpp
index 36bec15..5ca439d 100644
--- a/fpdfsdk/cpdfsdk_annot.cpp
+++ b/fpdfsdk/cpdfsdk_annot.cpp
@@ -58,12 +58,12 @@
return nullptr;
}
-CFX_ByteString CPDFSDK_Annot::GetType() const {
+CFX_ByteString CPDFSDK_Annot::GetAnnotSubtype() const {
return "";
}
-CFX_ByteString CPDFSDK_Annot::GetSubType() const {
- return "";
+bool CPDFSDK_Annot::IsSignatureWidget() const {
+ return false;
}
void CPDFSDK_Annot::SetRect(const CFX_FloatRect& rect) {}
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index bca2c9b..e7744bf 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -53,7 +53,7 @@
ASSERT(pPageView);
if (IPDFSDK_AnnotHandler* pAnnotHandler =
- GetAnnotHandler(pAnnot->GetSubType())) {
+ GetAnnotHandler(pAnnot->GetSubtype())) {
return pAnnotHandler->NewAnnot(pAnnot, pPageView);
}
@@ -106,7 +106,7 @@
CPDFSDK_Annot* pAnnot) const {
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
if (pPDFAnnot)
- return GetAnnotHandler(pPDFAnnot->GetSubType());
+ return GetAnnotHandler(pPDFAnnot->GetSubtype());
#ifdef PDF_ENABLE_XFA
if (pAnnot->GetXFAWidget())
return GetAnnotHandler(FSDK_XFAWIDGET_TYPENAME);
@@ -359,7 +359,8 @@
if (!pPage)
return nullptr;
if (pPage->GetPDFPage()) { // for pdf annots.
- CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetType(), "");
+ CBA_AnnotIterator ai(pSDKAnnot->GetPageView(),
+ pSDKAnnot->GetAnnotSubtype());
CPDFSDK_Annot* pNext =
bNext ? ai.GetNextAnnot(pSDKAnnot) : ai.GetPrevAnnot(pSDKAnnot);
return pNext;
@@ -381,7 +382,7 @@
return pPageView->GetAnnotByXFAWidget(hNextFocus);
#else // PDF_ENABLE_XFA
- CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "Widget", "");
+ CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), "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 99dd2e0..d1d3a0f 100644
--- a/fpdfsdk/cpdfsdk_baannot.cpp
+++ b/fpdfsdk/cpdfsdk_baannot.cpp
@@ -38,12 +38,8 @@
return m_pAnnot->GetRect();
}
-CFX_ByteString CPDFSDK_BAAnnot::GetType() const {
- return m_pAnnot->GetSubType();
-}
-
-CFX_ByteString CPDFSDK_BAAnnot::GetSubType() const {
- return "";
+CFX_ByteString CPDFSDK_BAAnnot::GetAnnotSubtype() const {
+ return m_pAnnot->GetSubtype();
}
void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice,
diff --git a/fpdfsdk/cpdfsdk_bfannothandler.cpp b/fpdfsdk/cpdfsdk_bfannothandler.cpp
index 4742e5d..ff0c264 100644
--- a/fpdfsdk/cpdfsdk_bfannothandler.cpp
+++ b/fpdfsdk/cpdfsdk_bfannothandler.cpp
@@ -32,8 +32,8 @@
}
FX_BOOL CPDFSDK_BFAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
- ASSERT(pAnnot->GetType() == "Widget");
- if (pAnnot->GetSubType() == BFFT_SIGNATURE)
+ ASSERT(pAnnot->GetAnnotSubtype() == "Widget");
+ if (pAnnot->IsSignatureWidget())
return FALSE;
CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
@@ -98,9 +98,7 @@
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
uint32_t dwFlags) {
- CFX_ByteString sSubType = pAnnot->GetSubType();
-
- if (sSubType == BFFT_SIGNATURE) {
+ if (pAnnot->IsSignatureWidget()) {
static_cast<CPDFSDK_BAAnnot*>(pAnnot)->DrawAppearance(
pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
} else {
@@ -123,14 +121,14 @@
void CPDFSDK_BFAnnotHandler::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
uint32_t nFlag) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
m_pFormFiller->OnMouseEnter(pPageView, pAnnot, nFlag);
}
void CPDFSDK_BFAnnotHandler::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
uint32_t nFlag) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
m_pFormFiller->OnMouseExit(pPageView, pAnnot, nFlag);
}
@@ -138,7 +136,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnLButtonDown(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -148,7 +146,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnLButtonUp(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -158,7 +156,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -168,7 +166,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnMouseMove(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -179,7 +177,7 @@
uint32_t nFlags,
short zDelta,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta,
point);
@@ -190,7 +188,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -200,7 +198,7 @@
CPDFSDK_Annot* pAnnot,
uint32_t nFlags,
const CFX_FloatPoint& point) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
return FALSE;
@@ -216,7 +214,7 @@
FX_BOOL CPDFSDK_BFAnnotHandler::OnChar(CPDFSDK_Annot* pAnnot,
uint32_t nChar,
uint32_t nFlags) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnChar(pAnnot, nChar, nFlags);
return FALSE;
@@ -225,7 +223,7 @@
FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyDown(CPDFSDK_Annot* pAnnot,
int nKeyCode,
int nFlag) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlag);
return FALSE;
@@ -238,12 +236,12 @@
}
void CPDFSDK_BFAnnotHandler::OnCreate(CPDFSDK_Annot* pAnnot) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
m_pFormFiller->OnCreate(pAnnot);
}
void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) {
- if (pAnnot->GetSubType() == BFFT_SIGNATURE)
+ if (pAnnot->IsSignatureWidget())
return;
CPDFSDK_Widget* pWidget = static_cast<CPDFSDK_Widget*>(pAnnot);
@@ -273,7 +271,7 @@
FX_BOOL CPDFSDK_BFAnnotHandler::OnSetFocus(CPDFSDK_Annot* pAnnot,
uint32_t nFlag) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnSetFocus(pAnnot, nFlag);
return TRUE;
@@ -281,7 +279,7 @@
FX_BOOL CPDFSDK_BFAnnotHandler::OnKillFocus(CPDFSDK_Annot* pAnnot,
uint32_t nFlag) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return m_pFormFiller->OnKillFocus(pAnnot, nFlag);
return TRUE;
@@ -296,7 +294,7 @@
CFX_FloatRect CPDFSDK_BFAnnotHandler::GetViewBBox(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot) {
- if (pAnnot->GetSubType() != BFFT_SIGNATURE && m_pFormFiller)
+ if (!pAnnot->IsSignatureWidget() && m_pFormFiller)
return CFX_FloatRect(m_pFormFiller->GetViewBBox(pPageView, pAnnot));
return CFX_FloatRect(0, 0, 0, 0);
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp
index 65e778d..1346deb 100644
--- a/fpdfsdk/cpdfsdk_interform.cpp
+++ b/fpdfsdk/cpdfsdk_interform.cpp
@@ -72,7 +72,7 @@
CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget,
FX_BOOL bNext) const {
std::unique_ptr<CBA_AnnotIterator> pIterator(
- new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", ""));
+ new CBA_AnnotIterator(pWidget->GetPageView(), "Widget"));
if (bNext)
return static_cast<CPDFSDK_Widget*>(pIterator->GetNextAnnot(pWidget));
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp
index dcccf0c..73ba23d 100644
--- a/fpdfsdk/cpdfsdk_widget.cpp
+++ b/fpdfsdk/cpdfsdk_widget.cpp
@@ -546,12 +546,8 @@
return pFormField->GetFieldFlags();
}
-CFX_ByteString CPDFSDK_Widget::GetSubType() const {
- int nType = GetFieldType();
-
- if (nType == FIELDTYPE_SIGNATURE)
- return BFFT_SIGNATURE;
- return CPDFSDK_Annot::GetSubType();
+bool CPDFSDK_Widget::IsSignatureWidget() const {
+ return GetFieldType() == FIELDTYPE_SIGNATURE;
}
CPDF_FormField* CPDFSDK_Widget::GetFormField() const {
diff --git a/fpdfsdk/cpdfsdk_xfawidget.cpp b/fpdfsdk/cpdfsdk_xfawidget.cpp
index b866156..445abc5 100644
--- a/fpdfsdk/cpdfsdk_xfawidget.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidget.cpp
@@ -24,14 +24,10 @@
return m_hXFAWidget;
}
-CFX_ByteString CPDFSDK_XFAWidget::GetType() const {
+CFX_ByteString CPDFSDK_XFAWidget::GetAnnotSubtype() const {
return FSDK_XFAWIDGET_TYPENAME;
}
-CFX_ByteString CPDFSDK_XFAWidget::GetSubType() const {
- return "";
-}
-
CFX_FloatRect CPDFSDK_XFAWidget::GetRect() const {
CFX_RectF rcBBox;
GetXFAWidget()->GetRect(rcBBox);
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 0779f26..90b83d6 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -85,7 +85,7 @@
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
uint32_t dwFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "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 1f63844..0f5ed89 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -124,7 +124,7 @@
void CFFL_IFormFiller::OnMouseEnter(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -160,7 +160,7 @@
void CFFL_IFormFiller::OnMouseExit(CPDFSDK_PageView* pPageView,
CPDFSDK_Annot* pAnnot,
FX_UINT nFlag) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -197,7 +197,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -239,7 +239,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument();
@@ -319,7 +319,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnLButtonDblClk(pPageView, pAnnot, nFlags, point);
@@ -332,7 +332,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
// change cursor
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, TRUE)) {
@@ -347,7 +347,7 @@
FX_UINT nFlags,
short zDelta,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnMouseWheel(pPageView, pAnnot, nFlags, zDelta, point);
@@ -360,7 +360,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnRButtonDown(pPageView, pAnnot, nFlags, point);
@@ -373,7 +373,7 @@
CPDFSDK_Annot* pAnnot,
FX_UINT nFlags,
const CFX_FloatPoint& point) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnRButtonUp(pPageView, pAnnot, nFlags, point);
@@ -385,7 +385,7 @@
FX_BOOL CFFL_IFormFiller::OnKeyDown(CPDFSDK_Annot* pAnnot,
FX_UINT nKeyCode,
FX_UINT nFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) {
return pFormFiller->OnKeyDown(pAnnot, nKeyCode, nFlags);
@@ -397,7 +397,7 @@
FX_BOOL CFFL_IFormFiller::OnChar(CPDFSDK_Annot* pAnnot,
FX_UINT nChar,
FX_UINT nFlags) {
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (nChar == FWL_VKEY_Tab)
return TRUE;
@@ -411,7 +411,7 @@
if (!pAnnot)
return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "Widget");
if (!m_bNotifying) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
@@ -454,7 +454,7 @@
FX_BOOL CFFL_IFormFiller::OnKillFocus(CPDFSDK_Annot* pAnnot, FX_UINT nFlag) {
if (!pAnnot)
return FALSE;
- ASSERT(pAnnot->GetPDFAnnot()->GetSubType() == "Widget");
+ ASSERT(pAnnot->GetPDFAnnot()->GetSubtype() == "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 0f679ea..d03b438 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -46,7 +46,7 @@
}
void CheckUnSupportAnnot(CPDF_Document* pDoc, const CPDF_Annot* pPDFAnnot) {
- CFX_ByteString cbSubType = pPDFAnnot->GetSubType();
+ CFX_ByteString cbSubType = pPDFAnnot->GetSubtype();
if (cbSubType.Compare("3D") == 0) {
FPDF_UnSupportError(FPDF_UNSP_ANNOT_3DANNOT);
} else if (cbSubType.Compare("Screen") == 0) {
diff --git a/fpdfsdk/fsdk_baseform_embeddertest.cpp b/fpdfsdk/fsdk_baseform_embeddertest.cpp
index 7af8262..c87073d 100644
--- a/fpdfsdk/fsdk_baseform_embeddertest.cpp
+++ b/fpdfsdk/fsdk_baseform_embeddertest.cpp
@@ -42,7 +42,7 @@
CPDFSDK_Document::FromFPDFFormHandle(form_handle());
{
// Page 0 specifies "row order".
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget", "");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(0), "Widget");
CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
CheckRect(pAnnot->GetRect(), RightTop);
pAnnot = iter.GetNextAnnot(pAnnot);
@@ -67,7 +67,7 @@
}
{
// Page 1 specifies "column order"
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(1), "Widget", "");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(1), "Widget");
CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot();
CheckRect(pAnnot->GetRect(), RightTop);
pAnnot = iter.GetNextAnnot(pAnnot);
@@ -92,7 +92,7 @@
}
{
// Page 2 specifies "struct order"
- CBA_AnnotIterator iter(pSDKDoc->GetPageView(2), "Widget", "");
+ CBA_AnnotIterator iter(pSDKDoc->GetPageView(2), "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 e0d78a2..9f16098 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -442,7 +442,7 @@
#endif // PDF_ENABLE_XFA
if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
- if (pFocusAnnot->GetType() == "Widget") {
+ if (pFocusAnnot->GetAnnotSubtype() == "Widget") {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
int nFieldType = pWidget->GetFieldType();
if (FIELDTYPE_TEXTFIELD == nFieldType ||
@@ -586,7 +586,7 @@
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() == "Widget") {
CFX_FloatRect annotRect = pAnnot->GetRect();
if (annotRect.Contains(pageX, pageY))
return pAnnot.get();
@@ -615,9 +615,10 @@
CPDFSDK_AnnotHandlerMgr* pAnnotMgr = pEnv->GetAnnotHandlerMgr();
CPDFSDK_AnnotIterator annotIterator(this, false);
while (CPDFSDK_Annot* pSDKAnnot = annotIterator.Next()) {
- bool bHitTest = pSDKAnnot->GetType() == "Widget";
+ bool bHitTest = pSDKAnnot->GetAnnotSubtype() == "Widget";
#ifdef PDF_ENABLE_XFA
- bHitTest = bHitTest || pSDKAnnot->GetType() == FSDK_XFAWIDGET_TYPENAME;
+ bHitTest =
+ bHitTest || pSDKAnnot->GetAnnotSubtype() == FSDK_XFAWIDGET_TYPENAME;
#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 6161cbc..0cf6e6a 100644
--- a/fpdfsdk/include/cba_annotiterator.h
+++ b/fpdfsdk/include/cba_annotiterator.h
@@ -20,8 +20,7 @@
enum TabOrder { STRUCTURE = 0, ROW, COLUMN };
CBA_AnnotIterator(CPDFSDK_PageView* pPageView,
- const CFX_ByteString& sType,
- const CFX_ByteString& sSubType);
+ const CFX_ByteString& sAnnotSubtype);
~CBA_AnnotIterator();
CPDFSDK_Annot* GetFirstAnnot();
@@ -41,8 +40,7 @@
TabOrder m_eTabOrder;
CPDFSDK_PageView* m_pPageView;
- CFX_ByteString m_sType;
- CFX_ByteString m_sSubType;
+ CFX_ByteString m_sAnnotSubtype;
std::vector<CPDFSDK_Annot*> m_Annots;
};
diff --git a/fpdfsdk/include/cpdfsdk_annot.h b/fpdfsdk/include/cpdfsdk_annot.h
index 0fbee9e..9501037 100644
--- a/fpdfsdk/include/cpdfsdk_annot.h
+++ b/fpdfsdk/include/cpdfsdk_annot.h
@@ -35,8 +35,8 @@
virtual FX_FLOAT GetMinHeight() const;
virtual int GetLayoutOrder() const;
virtual CPDF_Annot* GetPDFAnnot() const;
- virtual CFX_ByteString GetType() const;
- virtual CFX_ByteString GetSubType() const;
+ virtual CFX_ByteString GetAnnotSubtype() const;
+ virtual bool IsSignatureWidget() const;
virtual CFX_FloatRect GetRect() const;
virtual void SetRect(const CFX_FloatRect& rect);
diff --git a/fpdfsdk/include/cpdfsdk_baannot.h b/fpdfsdk/include/cpdfsdk_baannot.h
index abe23fe..e83cb0f 100644
--- a/fpdfsdk/include/cpdfsdk_baannot.h
+++ b/fpdfsdk/include/cpdfsdk_baannot.h
@@ -28,8 +28,7 @@
~CPDFSDK_BAAnnot() override;
// CPDFSDK_Annot
- CFX_ByteString GetType() const override;
- CFX_ByteString GetSubType() const override;
+ CFX_ByteString 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_widget.h b/fpdfsdk/include/cpdfsdk_widget.h
index 7f5e345..51116f9 100644
--- a/fpdfsdk/include/cpdfsdk_widget.h
+++ b/fpdfsdk/include/cpdfsdk_widget.h
@@ -78,7 +78,7 @@
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
- CFX_ByteString GetSubType() const override;
+ bool IsSignatureWidget() const override;
CPDF_Action GetAAction(CPDF_AAction::AActionType eAAT) override;
FX_BOOL IsAppearanceValid() override;
diff --git a/fpdfsdk/include/cpdfsdk_xfawidget.h b/fpdfsdk/include/cpdfsdk_xfawidget.h
index 46e71b6..00cc012 100644
--- a/fpdfsdk/include/cpdfsdk_xfawidget.h
+++ b/fpdfsdk/include/cpdfsdk_xfawidget.h
@@ -24,8 +24,7 @@
FX_BOOL IsXFAField() override;
CXFA_FFWidget* GetXFAWidget() const override;
- CFX_ByteString GetType() const override;
- CFX_ByteString GetSubType() const override;
+ CFX_ByteString GetAnnotSubtype() const override;
CFX_FloatRect GetRect() const override;
CPDFSDK_InterForm* GetInterForm() { return m_pInterForm; }
diff --git a/fpdfsdk/include/fsdk_common.h b/fpdfsdk/include/fsdk_common.h
index 5c5d24f..a33958a 100644
--- a/fpdfsdk/include/fsdk_common.h
+++ b/fpdfsdk/include/fsdk_common.h
@@ -7,8 +7,6 @@
#ifndef FPDFSDK_INCLUDE_FSDK_COMMON_H_
#define FPDFSDK_INCLUDE_FSDK_COMMON_H_
-#define BFFT_SIGNATURE "Signature"
-
// for all fields
#define FIELDFLAG_READONLY 1
#define FIELDFLAG_REQUIRED 2
diff --git a/fpdfsdk/javascript/Annot.cpp b/fpdfsdk/javascript/Annot.cpp
index df12327..9945217 100644
--- a/fpdfsdk/javascript/Annot.cpp
+++ b/fpdfsdk/javascript/Annot.cpp
@@ -80,7 +80,7 @@
return FALSE;
}
- vp << m_BAAnnot->GetType();
+ vp << m_BAAnnot->GetAnnotSubtype();
return TRUE;
}