From 9ed91376d562f3c6e7ca0a99035a74502f648776 Mon Sep 17 00:00:00 2001 From: jaepark Date: Fri, 26 Aug 2016 16:16:10 -0700 Subject: 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 --- core/fpdfdoc/cpdf_annot.cpp | 6 ++--- core/fpdfdoc/cpdf_annotlist.cpp | 2 +- core/fpdfdoc/include/cpdf_annot.h | 2 +- fpdfsdk/cba_annotiterator.cpp | 15 +++++++------ fpdfsdk/cpdfsdk_annot.cpp | 6 ++--- fpdfsdk/cpdfsdk_annothandlermgr.cpp | 9 ++++---- fpdfsdk/cpdfsdk_baannot.cpp | 8 ++----- fpdfsdk/cpdfsdk_bfannothandler.cpp | 40 ++++++++++++++++----------------- fpdfsdk/cpdfsdk_interform.cpp | 2 +- fpdfsdk/cpdfsdk_widget.cpp | 8 ++----- fpdfsdk/cpdfsdk_xfawidget.cpp | 6 +---- fpdfsdk/formfiller/cffl_formfiller.cpp | 2 +- fpdfsdk/formfiller/cffl_iformfiller.cpp | 26 ++++++++++----------- fpdfsdk/fpdf_ext.cpp | 2 +- fpdfsdk/fsdk_baseform_embeddertest.cpp | 6 ++--- fpdfsdk/fsdk_mgr.cpp | 9 ++++---- fpdfsdk/include/cba_annotiterator.h | 6 ++--- fpdfsdk/include/cpdfsdk_annot.h | 4 ++-- fpdfsdk/include/cpdfsdk_baannot.h | 3 +-- fpdfsdk/include/cpdfsdk_widget.h | 2 +- fpdfsdk/include/cpdfsdk_xfawidget.h | 3 +-- fpdfsdk/include/fsdk_common.h | 2 -- fpdfsdk/javascript/Annot.cpp | 2 +- 23 files changed, 77 insertions(+), 94 deletions(-) diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index e70ee27a98..10360eaf68 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -51,7 +51,7 @@ void CPDF_Annot::GenerateAPIfNeeded() { 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 @@ 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() == "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 153b25fac4..e6c93c1d1e 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -62,7 +62,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() == "Widget"; if ((bWidgetPass && !bWidget) || (!bWidgetPass && bWidget)) continue; diff --git a/core/fpdfdoc/include/cpdf_annot.h b/core/fpdfdoc/include/cpdf_annot.h index 9f8671633c..914393a818 100644 --- a/core/fpdfdoc/include/cpdf_annot.h +++ b/core/fpdfdoc/include/cpdf_annot.h @@ -42,7 +42,7 @@ class CPDF_Annot { 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 bd68997ad9..773fe610cd 100644 --- a/fpdfsdk/cba_annotiterator.cpp +++ b/fpdfsdk/cba_annotiterator.cpp @@ -23,12 +23,10 @@ bool CBA_AnnotIterator::CompareByTopDescending(const CPDFSDK_Annot* p1, } 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 @@ 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->GetType() == m_sType && pAnnot->GetSubType() == m_sSubType) + if (pAnnot->GetAnnotSubtype() == m_sAnnotSubtype && + !pAnnot->IsSignatureWidget()) m_Annots.push_back(pAnnot); } break; @@ -82,7 +81,8 @@ void CBA_AnnotIterator::GenerateResults() { std::vector 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 @@ void CBA_AnnotIterator::GenerateResults() { std::vector 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 36bec1553e..5ca439d8f7 100644 --- a/fpdfsdk/cpdfsdk_annot.cpp +++ b/fpdfsdk/cpdfsdk_annot.cpp @@ -58,12 +58,12 @@ CPDF_Annot* CPDFSDK_Annot::GetPDFAnnot() const { 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 bca2c9baa9..e7744bfa46 100644 --- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp +++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp @@ -53,7 +53,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CPDF_Annot* pAnnot, ASSERT(pPageView); if (IPDFSDK_AnnotHandler* pAnnotHandler = - GetAnnotHandler(pAnnot->GetSubType())) { + GetAnnotHandler(pAnnot->GetSubtype())) { return pAnnotHandler->NewAnnot(pAnnot, pPageView); } @@ -106,7 +106,7 @@ IPDFSDK_AnnotHandler* CPDFSDK_AnnotHandlerMgr::GetAnnotHandler( 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 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, 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 @@ 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(), "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 99dd2e0538..d1d3a0f63a 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -38,12 +38,8 @@ CFX_FloatRect CPDFSDK_BAAnnot::GetRect() const { 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 4742e5d275..ff0c26404c 100644 --- a/fpdfsdk/cpdfsdk_bfannothandler.cpp +++ b/fpdfsdk/cpdfsdk_bfannothandler.cpp @@ -32,8 +32,8 @@ CFX_ByteString CPDFSDK_BFAnnotHandler::GetType() { } 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(pAnnot); @@ -98,9 +98,7 @@ void CPDFSDK_BFAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, uint32_t dwFlags) { - CFX_ByteString sSubType = pAnnot->GetSubType(); - - if (sSubType == BFFT_SIGNATURE) { + if (pAnnot->IsSignatureWidget()) { static_cast(pAnnot)->DrawAppearance( pDevice, pUser2Device, CPDF_Annot::Normal, nullptr); } else { @@ -123,14 +121,14 @@ void CPDFSDK_BFAnnotHandler::OnRelease(CPDFSDK_Annot* pAnnot) {} 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDown(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonUp(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnLButtonDblClk(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseMove(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnMouseWheel(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonDown(CPDFSDK_PageView* pPageView, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnRButtonUp(CPDFSDK_PageView* pPageView, 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::OnRButtonDblClk(CPDFSDK_PageView* pPageView, 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::OnChar(CPDFSDK_Annot* pAnnot, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnKeyUp(CPDFSDK_Annot* pAnnot, } 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(pAnnot); @@ -273,7 +271,7 @@ void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { 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::OnSetFocus(CPDFSDK_Annot* pAnnot, 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 @@ FX_BOOL CPDFSDK_BFAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, 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 65e778d2c4..1346deb2bc 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -72,7 +72,7 @@ FX_BOOL CPDFSDK_InterForm::HighlightWidgets() { CPDFSDK_Widget* CPDFSDK_InterForm::GetSibling(CPDFSDK_Widget* pWidget, FX_BOOL bNext) const { std::unique_ptr pIterator( - new CBA_AnnotIterator(pWidget->GetPageView(), "Widget", "")); + new CBA_AnnotIterator(pWidget->GetPageView(), "Widget")); if (bNext) return static_cast(pIterator->GetNextAnnot(pWidget)); diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index dcccf0ce1a..73ba23d076 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -546,12 +546,8 @@ int CPDFSDK_Widget::GetFieldFlags() const { 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 b866156da8..445abc53cb 100644 --- a/fpdfsdk/cpdfsdk_xfawidget.cpp +++ b/fpdfsdk/cpdfsdk_xfawidget.cpp @@ -24,14 +24,10 @@ CXFA_FFWidget* CPDFSDK_XFAWidget::GetXFAWidget() const { 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 0779f261a7..90b83d6e46 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() == "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 1f638444af..0f5ed89fb2 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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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() == "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 0f679eab3c..d03b4383ca 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -46,7 +46,7 @@ FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info) { } 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 7af8262c55..c87073d38b 100644 --- a/fpdfsdk/fsdk_baseform_embeddertest.cpp +++ b/fpdfsdk/fsdk_baseform_embeddertest.cpp @@ -42,7 +42,7 @@ 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), "Widget"); CPDFSDK_Annot* pAnnot = iter.GetFirstAnnot(); CheckRect(pAnnot->GetRect(), RightTop); pAnnot = iter.GetNextAnnot(pAnnot); @@ -67,7 +67,7 @@ TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) { } { // 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 @@ TEST_F(FSDKBaseFormEmbeddertest, CBA_AnnotIterator) { } { // 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 e0d78a2197..9f16098e12 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->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::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() == "Widget") { CFX_FloatRect annotRect = pAnnot->GetRect(); if (annotRect.Contains(pageX, pageY)) return pAnnot.get(); @@ -615,9 +615,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->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 6161cbc814..0cf6e6a0ef 100644 --- a/fpdfsdk/include/cba_annotiterator.h +++ b/fpdfsdk/include/cba_annotiterator.h @@ -20,8 +20,7 @@ class CBA_AnnotIterator { 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 @@ class CBA_AnnotIterator { TabOrder m_eTabOrder; CPDFSDK_PageView* m_pPageView; - CFX_ByteString m_sType; - CFX_ByteString m_sSubType; + CFX_ByteString m_sAnnotSubtype; std::vector m_Annots; }; diff --git a/fpdfsdk/include/cpdfsdk_annot.h b/fpdfsdk/include/cpdfsdk_annot.h index 0fbee9ed7f..9501037cd6 100644 --- a/fpdfsdk/include/cpdfsdk_annot.h +++ b/fpdfsdk/include/cpdfsdk_annot.h @@ -35,8 +35,8 @@ class CPDFSDK_Annot { 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 abe23fe1b9..e83cb0fe45 100644 --- a/fpdfsdk/include/cpdfsdk_baannot.h +++ b/fpdfsdk/include/cpdfsdk_baannot.h @@ -28,8 +28,7 @@ class CPDFSDK_BAAnnot : public CPDFSDK_Annot { ~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 7f5e34586d..51116f9581 100644 --- a/fpdfsdk/include/cpdfsdk_widget.h +++ b/fpdfsdk/include/cpdfsdk_widget.h @@ -78,7 +78,7 @@ class CPDFSDK_Widget : public CPDFSDK_BAAnnot { 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 46e71b6481..00cc01249c 100644 --- a/fpdfsdk/include/cpdfsdk_xfawidget.h +++ b/fpdfsdk/include/cpdfsdk_xfawidget.h @@ -24,8 +24,7 @@ class CPDFSDK_XFAWidget : public CPDFSDK_Annot { 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 5c5d24f2c8..a33958a08d 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 df123274d5..9945217198 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->GetType(); + vp << m_BAAnnot->GetAnnotSubtype(); return TRUE; } -- cgit v1.2.3