From 60fa2fce1f6fc02b3039166d84ed8ec152312566 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Fri, 21 Jul 2017 17:42:19 -0700 Subject: Simplify code in CPDFSDK_FormFillEnvironment. This makes various IsFooKeyDown() methods static. Transitively apply that to callers too. Change-Id: Ia43b1fd62889c1943e0d8407e9696225b05125a8 Reviewed-on: https://pdfium-review.googlesource.com/7190 Commit-Queue: Lei Zhang Reviewed-by: dsinclair Reviewed-by: Tom Sepez --- fpdfsdk/cpdfsdk_formfillenvironment.cpp | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'fpdfsdk/cpdfsdk_formfillenvironment.cpp') diff --git a/fpdfsdk/cpdfsdk_formfillenvironment.cpp b/fpdfsdk/cpdfsdk_formfillenvironment.cpp index de7947556d..5c847fc1df 100644 --- a/fpdfsdk/cpdfsdk_formfillenvironment.cpp +++ b/fpdfsdk/cpdfsdk_formfillenvironment.cpp @@ -289,25 +289,6 @@ void CPDFSDK_FormFillEnvironment::OnChange() { m_pInfo->FFI_OnChange(m_pInfo); } -bool CPDFSDK_FormFillEnvironment::IsSHIFTKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_ShiftKey) != 0; -} - -bool CPDFSDK_FormFillEnvironment::IsCTRLKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_ControlKey) != 0; -} - -bool CPDFSDK_FormFillEnvironment::IsALTKeyDown(uint32_t nFlag) const { - return (nFlag & FWL_EVENTFLAG_AltKey) != 0; -} - -FPDF_PAGE CPDFSDK_FormFillEnvironment::GetPage(UnderlyingDocumentType* document, - int nPageIndex) { - if (m_pInfo && m_pInfo->FFI_GetPage) - return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex); - return nullptr; -} - FPDF_PAGE CPDFSDK_FormFillEnvironment::GetCurrentPage( UnderlyingDocumentType* document) { if (m_pInfo && m_pInfo->FFI_GetCurrentPage) @@ -589,8 +570,7 @@ CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetCurrentView() { } CPDFSDK_PageView* CPDFSDK_FormFillEnvironment::GetPageView(int nIndex) { - UnderlyingPageType* pTempPage = - UnderlyingFromFPDFPage(GetPage(m_pUnderlyingDoc.Get(), nIndex)); + UnderlyingPageType* pTempPage = GetPage(nIndex); if (!pTempPage) return nullptr; @@ -663,7 +643,10 @@ void CPDFSDK_FormFillEnvironment::RemovePageView( } UnderlyingPageType* CPDFSDK_FormFillEnvironment::GetPage(int nIndex) { - return UnderlyingFromFPDFPage(GetPage(m_pUnderlyingDoc.Get(), nIndex)); + if (!m_pInfo || !m_pInfo->FFI_GetPage) + return nullptr; + return UnderlyingFromFPDFPage( + m_pInfo->FFI_GetPage(m_pInfo, m_pUnderlyingDoc.Get(), nIndex)); } CPDFSDK_InterForm* CPDFSDK_FormFillEnvironment::GetInterForm() { -- cgit v1.2.3