From d97f2eee71036c09823dea18b2c5f74731317fe9 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 6 Jul 2017 13:56:04 -0400 Subject: Convert OnBeforeKeyStoke to remove in-out param This CL removes the in-out params from OnBeforeKeyStroke and instead returns a std::pair. Change-Id: I246cf51652da7e05ea71f582b523aa428cbbd3b8 Reviewed-on: https://pdfium-review.googlesource.com/7337 Reviewed-by: Henrique Nakashima Commit-Queue: dsinclair --- fpdfsdk/pdfwindow/cpwl_edit.cpp | 17 +++++++++-------- fpdfsdk/pdfwindow/cpwl_edit.h | 19 ++++++++++--------- fpdfsdk/pdfwindow/cpwl_list_box.cpp | 10 +++++----- 3 files changed, 24 insertions(+), 22 deletions(-) (limited to 'fpdfsdk/pdfwindow') diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp index de21dac144..a378156d41 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp @@ -586,8 +586,6 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nChar == FWL_VKEY_Delete) { if (m_pFillerNotify) { - bool bRC = true; - bool bExit = false; CFX_WideString strChange; CFX_WideString strChangeEx; @@ -597,9 +595,12 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; - m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), strChange, - strChangeEx, nSelStart, nSelEnd, true, - bRC, bExit, nFlag); + + bool bRC; + bool bExit; + std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke( + GetAttachedData(), strChange, strChangeEx, nSelStart, nSelEnd, true, + nFlag); if (!bRC) return false; if (bExit) @@ -677,9 +678,9 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { } CFX_WideString strChangeEx; - m_pFillerNotify->OnBeforeKeyStroke(GetAttachedData(), swChange, - strChangeEx, nSelStart, nSelEnd, true, - bRC, bExit, nFlag); + std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke( + GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, true, + nFlag); } } diff --git a/fpdfsdk/pdfwindow/cpwl_edit.h b/fpdfsdk/pdfwindow/cpwl_edit.h index 038aba955f..ebf556ad71 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.h +++ b/fpdfsdk/pdfwindow/cpwl_edit.h @@ -7,6 +7,8 @@ #ifndef FPDFSDK_PDFWINDOW_CPWL_EDIT_H_ #define FPDFSDK_PDFWINDOW_CPWL_EDIT_H_ +#include + #include "core/fpdfdoc/cpvt_wordrange.h" #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_basic.h" @@ -22,15 +24,14 @@ class IPWL_Filler_Notify { float fPopupMax, bool* bBottom, float* fPopupRet) = 0; - virtual void OnBeforeKeyStroke(void* pPrivateData, - CFX_WideString& strChange, - const CFX_WideString& strChangeEx, - int nSelStart, - int nSelEnd, - bool bKeyDown, - bool& bRC, - bool& bExit, - uint32_t nFlag) = 0; + virtual std::pair OnBeforeKeyStroke( + void* pPrivateData, + CFX_WideString& strChange, + const CFX_WideString& strChangeEx, + int nSelStart, + int nSelEnd, + bool bKeyDown, + uint32_t nFlag) = 0; #ifdef PDF_ENABLE_XFA virtual bool OnPopupPreOpen(void* pPrivateData, uint32_t nFlag) = 0; virtual bool OnPopupPostOpen(void* pPrivateData, uint32_t nFlag) = 0; diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp index bd2bdb5d19..e3a2e77b94 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp @@ -305,15 +305,15 @@ bool CPWL_ListBox::OnNotifySelChanged(bool bKeyDown, uint32_t nFlag) { if (!m_pFillerNotify) return false; - bool bRC = true; - bool bExit = false; 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); + bool bRC; + bool bExit; + std::tie(bRC, bExit) = m_pFillerNotify->OnBeforeKeyStroke( + GetAttachedData(), swChange, strChangeEx, nSelStart, nSelEnd, bKeyDown, + nFlag); return bExit; } -- cgit v1.2.3