From 9ddafc82bddb984ae46ee0df801ba20b446d5158 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Mon, 19 Oct 2015 14:14:48 -0700 Subject: Remove dead code that was reactivated when fixing overrides. BUG=pdfium:205 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1409743004 . --- fpdfsdk/include/formfiller/FFL_ComboBox.h | 1 - fpdfsdk/include/formfiller/FFL_FormFiller.h | 2 -- fpdfsdk/include/formfiller/FFL_IFormFiller.h | 8 +---- fpdfsdk/include/formfiller/FFL_ListBox.h | 1 - fpdfsdk/include/pdfwindow/PWL_Edit.h | 8 +---- fpdfsdk/src/formfiller/FFL_ComboBox.cpp | 18 ---------- fpdfsdk/src/formfiller/FFL_FormFiller.cpp | 2 -- fpdfsdk/src/formfiller/FFL_IFormFiller.cpp | 17 +--------- fpdfsdk/src/formfiller/FFL_ListBox.cpp | 18 ---------- fpdfsdk/src/pdfwindow/PWL_Edit.cpp | 51 ++++++---------------------- fpdfsdk/src/pdfwindow/PWL_ListBox.cpp | 25 ++++++-------- 11 files changed, 24 insertions(+), 127 deletions(-) diff --git a/fpdfsdk/include/formfiller/FFL_ComboBox.h b/fpdfsdk/include/formfiller/FFL_ComboBox.h index 5bfbc12a8e..c18fb74282 100644 --- a/fpdfsdk/include/formfiller/FFL_ComboBox.h +++ b/fpdfsdk/include/formfiller/FFL_ComboBox.h @@ -47,7 +47,6 @@ class CFFL_ComboBox : public CFFL_FormFiller, void RestoreState(CPDFSDK_PageView* pPageView) override; CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) override; - void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) override; // IPWL_FocusHandler: void OnSetFocus(CPWL_Wnd* pWnd) override; diff --git a/fpdfsdk/include/formfiller/FFL_FormFiller.h b/fpdfsdk/include/formfiller/FFL_FormFiller.h index 35b4bdf59b..eb82bda2f4 100644 --- a/fpdfsdk/include/formfiller/FFL_FormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_FormFiller.h @@ -103,8 +103,6 @@ class CFFL_FormFiller : public IPWL_Provider, public CPWL_TimerHandler { virtual CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue); - virtual void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag); - CPDF_Matrix GetCurMatrix(); CPDF_Rect FFLtoPWL(const CPDF_Rect& rect); diff --git a/fpdfsdk/include/formfiller/FFL_IFormFiller.h b/fpdfsdk/include/formfiller/FFL_IFormFiller.h index 8421774bcb..3eb4a4689a 100644 --- a/fpdfsdk/include/formfiller/FFL_IFormFiller.h +++ b/fpdfsdk/include/formfiller/FFL_IFormFiller.h @@ -122,9 +122,7 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify { FX_FLOAT fPopupMax, int32_t& nRet, FX_FLOAT& fPopupRet) override; - void OnBeforeKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - int32_t nKeyCode, + void OnBeforeKeyStroke(void* pPrivateData, CFX_WideString& strChange, const CFX_WideString& strChangeEx, int nSelStart, @@ -133,10 +131,6 @@ class CFFL_IFormFiller : public IPWL_Filler_Notify { FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) override; - void OnAfterKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - FX_BOOL& bExit, - FX_DWORD nFlag) override; void UnRegisterFormFiller(CPDFSDK_Annot* pAnnot); diff --git a/fpdfsdk/include/formfiller/FFL_ListBox.h b/fpdfsdk/include/formfiller/FFL_ListBox.h index 01ad2218d0..227f062e46 100644 --- a/fpdfsdk/include/formfiller/FFL_ListBox.h +++ b/fpdfsdk/include/formfiller/FFL_ListBox.h @@ -35,7 +35,6 @@ class CFFL_ListBox : public CFFL_FormFiller { void RestoreState(CPDFSDK_PageView* pPageView) override; CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, FX_BOOL bRestoreValue) override; - void OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) override; private: CBA_FontMap* m_pFontMap; diff --git a/fpdfsdk/include/pdfwindow/PWL_Edit.h b/fpdfsdk/include/pdfwindow/PWL_Edit.h index 11249a3193..71123b8368 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Edit.h +++ b/fpdfsdk/include/pdfwindow/PWL_Edit.h @@ -24,9 +24,7 @@ class IPWL_Filler_Notify { FX_FLOAT fPopupMax, int32_t& nRet, FX_FLOAT& fPopupRet) = 0; // nRet: (0:bottom 1:top) - virtual void OnBeforeKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - int32_t nKeyCode, + virtual void OnBeforeKeyStroke(void* pPrivateData, CFX_WideString& strChange, const CFX_WideString& strChangeEx, int nSelStart, @@ -35,10 +33,6 @@ class IPWL_Filler_Notify { FX_BOOL& bRC, FX_BOOL& bExit, FX_DWORD nFlag) = 0; - virtual void OnAfterKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - FX_BOOL& bExit, - FX_DWORD nFlag) = 0; }; class CPWL_Edit : public CPWL_EditCtrl, public IFX_Edit_OprNotify { diff --git a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp index 29352216ab..3925e14347 100644 --- a/fpdfsdk/src/formfiller/FFL_ComboBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ComboBox.cpp @@ -256,24 +256,6 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, return pRet; } -void CFFL_ComboBox::OnKeyStroke(FX_BOOL bKeyDown, FX_UINT nFlag) { - ASSERT(m_pWidget != NULL); - - int nFlags = m_pWidget->GetFieldFlags(); - - if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { - if (m_bValid) { - CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); - - if (CommitData(pPageView, nFlag)) { - DestroyPDFWindow(pPageView); - m_bValid = FALSE; - } - } - } -} - void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) { ASSERT(m_pApp != NULL); diff --git a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp index 1bd2944636..40d5ede335 100644 --- a/fpdfsdk/src/formfiller/FFL_FormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_FormFiller.cpp @@ -598,8 +598,6 @@ IFX_SystemHandler* CFFL_FormFiller::GetSystemHandler() const { return m_pApp->GetSysHandler(); } -void CFFL_FormFiller::OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) {} - void CFFL_FormFiller::EscapeFiller(CPDFSDK_PageView* pPageView, FX_BOOL bDestroyPDFWindow) { m_bValid = FALSE; diff --git a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp index ce0a67f4fe..2126c2a903 100644 --- a/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp +++ b/fpdfsdk/src/formfiller/FFL_IFormFiller.cpp @@ -800,9 +800,7 @@ FX_BOOL CFFL_IFormFiller::IsValidAnnot(CPDFSDK_PageView* pPageView, return FALSE; } -void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - int32_t nKeyCode, +void CFFL_IFormFiller::OnBeforeKeyStroke(void* pPrivateData, CFX_WideString& strChange, const CFX_WideString& strChangeEx, int nSelStart, @@ -881,16 +879,3 @@ void CFFL_IFormFiller::OnBeforeKeyStroke(FX_BOOL bEditOrList, } } } - -void CFFL_IFormFiller::OnAfterKeyStroke(FX_BOOL bEditOrList, - void* pPrivateData, - FX_BOOL& bExit, - FX_DWORD nFlag) { - CFFL_PrivateData* pData = (CFFL_PrivateData*)pPrivateData; - ASSERT(pData->pWidget); - - CFFL_FormFiller* pFormFiller = GetFormFiller(pData->pWidget, FALSE); - - if (!bEditOrList) - pFormFiller->OnKeyStroke(bExit, nFlag); -} diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp index 0f478fe7e0..343683016f 100644 --- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp +++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp @@ -228,21 +228,3 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, return pRet; } - -void CFFL_ListBox::OnKeyStroke(FX_BOOL bKeyDown, FX_DWORD nFlag) { - ASSERT(m_pWidget != NULL); - - int nFlags = m_pWidget->GetFieldFlags(); - - if (nFlags & FIELDFLAG_COMMITONSELCHANGE) { - if (m_bValid) { - CPDFSDK_PageView* pPageView = GetCurPageView(); - ASSERT(pPageView != NULL); - - if (CommitData(pPageView, nFlag)) { - DestroyPDFWindow(pPageView); - m_bValid = FALSE; - } - } - } -} diff --git a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp index 3271c80fdb..8e45060ea9 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Edit.cpp @@ -163,7 +163,7 @@ void CPWL_Edit::PasteText() { int nSelStart = 0; int nSelEnd = 0; GetSel(nSelStart, nSelEnd); - m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), 0, swClipboard, + m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swClipboard, strChangeEx, nSelStart, nSelEnd, TRUE, bRC, bExit, 0); if (!bRC) @@ -176,13 +176,6 @@ void CPWL_Edit::PasteText() { Clear(); InsertText(swClipboard.c_str()); } - - if (m_pFillerNotify) { - FX_BOOL bExit = FALSE; - m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, 0); - if (bExit) - return; - } } void CPWL_Edit::CutText() { @@ -883,9 +876,9 @@ FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; - m_pFillerNotify->OnBeforeKeyStroke( - TRUE, GetAttachedData(), FWL_VKEY_Delete, strChange, strChangeEx, - nSelStart, nSelEnd, TRUE, bRC, bExit, nFlag); + m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, + strChangeEx, nSelStart, nSelEnd, TRUE, + bRC, bExit, nFlag); if (!bRC) return FALSE; if (bExit) @@ -895,15 +888,6 @@ FX_BOOL CPWL_Edit::OnKeyDown(FX_WORD nChar, FX_DWORD nFlag) { FX_BOOL bRet = CPWL_EditCtrl::OnKeyDown(nChar, nFlag); - if (nChar == FWL_VKEY_Delete) { - if (m_pFillerNotify) { - FX_BOOL bExit = FALSE; - m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, nFlag); - if (bExit) - return FALSE; - } - } - // In case of implementation swallow the OnKeyDown event. if (IsProceedtoOnChar(nChar, nFlag)) return TRUE; @@ -940,9 +924,8 @@ FX_BOOL CPWL_Edit::IsProceedtoOnChar(FX_WORD nKeyCode, FX_DWORD nFlag) { case FWL_VKEY_Space: return TRUE; default: - break; + return FALSE; } - return FALSE; } FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) { @@ -952,11 +935,9 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) { FX_BOOL bRC = TRUE; FX_BOOL bExit = FALSE; - FX_BOOL bCtrl = IsCTRLpressed(nFlag); - if (!bCtrl) { + if (!IsCTRLpressed(nFlag)) { if (m_pFillerNotify) { CFX_WideString swChange; - int32_t nKeyCode; int nSelStart = 0; int nSelEnd = 0; @@ -964,23 +945,20 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) { switch (nChar) { case FWL_VKEY_Back: - nKeyCode = nChar; if (nSelStart == nSelEnd) nSelStart = nSelEnd - 1; break; case FWL_VKEY_Return: - nKeyCode = nChar; break; default: - nKeyCode = 0; swChange += nChar; break; } CFX_WideString strChangeEx; - m_pFillerNotify->OnBeforeKeyStroke(TRUE, GetAttachedData(), nKeyCode, - swChange, strChangeEx, nSelStart, - nSelEnd, TRUE, bRC, bExit, nFlag); + m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, + strChangeEx, nSelStart, nSelEnd, TRUE, + bRC, bExit, nFlag); } } @@ -996,17 +974,8 @@ FX_BOOL CPWL_Edit::OnChar(FX_WORD nChar, FX_DWORD nFlag) { SetCharSet(nNewCharSet); } } - FX_BOOL bRet = CPWL_EditCtrl::OnChar(nChar, nFlag); - - if (!bCtrl) { - if (m_pFillerNotify) { - m_pFillerNotify->OnAfterKeyStroke(TRUE, GetAttachedData(), bExit, nFlag); - if (bExit) - return FALSE; - } - } - return bRet; + return CPWL_EditCtrl::OnChar(nChar, nFlag); } FX_BOOL CPWL_Edit::OnMouseWheel(short zDelta, diff --git a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp index b252bffb8e..4bdcb5d1f3 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListBox.cpp @@ -374,20 +374,17 @@ void CPWL_ListBox::RePosChildWnd() { void CPWL_ListBox::OnNotifySelChanged(FX_BOOL bKeyDown, FX_BOOL& bExit, FX_DWORD nFlag) { - if (m_pFillerNotify) { - FX_BOOL bRC = TRUE; - CFX_WideString swChange = GetText(); - CFX_WideString strChangeEx; - int nSelStart = 0; - int nSelEnd = swChange.GetLength(); - m_pFillerNotify->OnBeforeKeyStroke(FALSE, GetAttachedData(), 0, swChange, - strChangeEx, nSelStart, nSelEnd, - bKeyDown, bRC, bExit, nFlag); - if (bExit) - return; - - m_pFillerNotify->OnAfterKeyStroke(FALSE, GetAttachedData(), bExit, nFlag); - } + if (!m_pFillerNotify) + return; + + FX_BOOL bRC = TRUE; + CFX_WideString swChange = GetText(); + CFX_WideString strChangeEx; + int nSelStart = 0; + int nSelEnd = swChange.GetLength(); + m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, strChangeEx, + nSelStart, nSelEnd, bKeyDown, bRC, bExit, + nFlag); } CPDF_Rect CPWL_ListBox::GetFocusRect() const { -- cgit v1.2.3