From 5688d624690e1fdc3cbbbbf23a5b475f40818728 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Sat, 12 Aug 2017 07:04:19 -0700 Subject: Remove CPWL_EditImpl::EnableOprNotify(). It's redundant with SetOprNotify(). Change-Id: Iee2741744017ea6bd1b9839fc6395197c560f1e7 Reviewed-on: https://pdfium-review.googlesource.com/10850 Reviewed-by: dsinclair Commit-Queue: Lei Zhang --- fpdfsdk/pwl/cpwl_edit.cpp | 3 +-- fpdfsdk/pwl/cpwl_edit_impl.cpp | 43 ++++++++++++++++-------------------------- fpdfsdk/pwl/cpwl_edit_impl.h | 6 ++---- 3 files changed, 19 insertions(+), 33 deletions(-) diff --git a/fpdfsdk/pwl/cpwl_edit.cpp b/fpdfsdk/pwl/cpwl_edit.cpp index 4a19e70eb6..2f3f20b4dd 100644 --- a/fpdfsdk/pwl/cpwl_edit.cpp +++ b/fpdfsdk/pwl/cpwl_edit.cpp @@ -151,8 +151,7 @@ void CPWL_Edit::OnCreated() { m_rcOldWindow = GetWindowRect(); - m_pEdit->SetOprNotify(this); - m_pEdit->EnableOprNotify(true); + m_pEdit->SetOperationNotify(this); } void CPWL_Edit::SetParamByFlag() { diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp index c59a74068d..b962e6d937 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp @@ -611,21 +611,14 @@ void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, } CPWL_EditImpl::CPWL_EditImpl() - : m_pVT(new CPDF_VariableText), - m_pNotify(nullptr), - m_pOprNotify(nullptr), - m_wpCaret(-1, -1, -1), - m_wpOldCaret(-1, -1, -1), - m_SelState(), + : m_pVT(pdfium::MakeUnique()), m_bEnableScroll(false), m_Undo(kEditUndoMaxItems), m_nAlignment(0), m_bNotifyFlag(false), m_bEnableOverflow(false), m_bEnableRefresh(true), - m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), - m_bEnableUndo(true), - m_bOprNotify(false) {} + m_bEnableUndo(true) {} CPWL_EditImpl::~CPWL_EditImpl() {} @@ -644,8 +637,8 @@ void CPWL_EditImpl::SetNotify(CPWL_EditCtrl* pNotify) { m_pNotify = pNotify; } -void CPWL_EditImpl::SetOprNotify(CPWL_Edit* pOprNotify) { - m_pOprNotify = pOprNotify; +void CPWL_EditImpl::SetOperationNotify(CPWL_Edit* pOperationNotify) { + m_pOperationNotify = pOperationNotify; } CPWL_EditImpl_Iterator* CPWL_EditImpl::GetIterator() { @@ -1608,8 +1601,8 @@ bool CPWL_EditImpl::InsertWord(uint16_t word, if (bPaint) PaintInsertText(m_wpOldCaret, m_wpCaret); - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnInsertWord(m_wpCaret, m_wpOldCaret); return true; } @@ -1638,8 +1631,8 @@ bool CPWL_EditImpl::InsertReturn(const CPVT_SecProps* pSecProps, SetCaretOrigin(); SetCaretInfo(); } - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnInsertReturn(m_wpCaret, m_wpOldCaret); return true; } @@ -1680,8 +1673,8 @@ bool CPWL_EditImpl::Backspace(bool bAddUndo, bool bPaint) { SetCaretOrigin(); SetCaretInfo(); } - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnBackSpace(m_wpCaret, m_wpOldCaret); return true; } @@ -1720,8 +1713,8 @@ bool CPWL_EditImpl::Delete(bool bAddUndo, bool bPaint) { SetCaretOrigin(); SetCaretInfo(); } - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnDelete(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnDelete(m_wpCaret, m_wpOldCaret); return true; } @@ -1757,8 +1750,8 @@ bool CPWL_EditImpl::Clear(bool bAddUndo, bool bPaint) { SetCaretOrigin(); SetCaretInfo(); } - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnClear(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnClear(m_wpCaret, m_wpOldCaret); return true; } @@ -1783,8 +1776,8 @@ bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, if (bPaint) PaintInsertText(m_wpOldCaret, m_wpCaret); - if (m_bOprNotify && m_pOprNotify) - m_pOprNotify->OnInsertText(m_wpCaret, m_wpOldCaret); + if (m_pOperationNotify) + m_pOperationNotify->OnInsertText(m_wpCaret, m_wpOldCaret); return true; } @@ -1896,10 +1889,6 @@ void CPWL_EditImpl::EnableUndo(bool bUndo) { m_bEnableUndo = bUndo; } -void CPWL_EditImpl::EnableOprNotify(bool bNotify) { - m_bOprNotify = bNotify; -} - CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place, const CFX_WideString& sText, int32_t charset) { diff --git a/fpdfsdk/pwl/cpwl_edit_impl.h b/fpdfsdk/pwl/cpwl_edit_impl.h index 697ca84994..48b94c1057 100644 --- a/fpdfsdk/pwl/cpwl_edit_impl.h +++ b/fpdfsdk/pwl/cpwl_edit_impl.h @@ -305,7 +305,7 @@ class CPWL_EditImpl { void SetFontMap(IPVT_FontMap* pFontMap); void SetNotify(CPWL_EditCtrl* pNotify); - void SetOprNotify(CPWL_Edit* pOprNotify); + void SetOperationNotify(CPWL_Edit* pOperationNotify); // Returns an iterator for the contents. Should not be released. CPWL_EditImpl_Iterator* GetIterator(); @@ -376,7 +376,6 @@ class CPWL_EditImpl { CPVT_WordRange GetWholeWordRange() const; CPVT_WordRange GetSelectWordRange() const; void EnableUndo(bool bUndo); - void EnableOprNotify(bool bNotify); bool IsTextFull() const; bool IsTextOverflow() const; bool CanUndo() const; @@ -451,7 +450,7 @@ class CPWL_EditImpl { private: std::unique_ptr m_pVT; CFX_UnownedPtr m_pNotify; - CFX_UnownedPtr m_pOprNotify; + CFX_UnownedPtr m_pOperationNotify; std::unique_ptr m_pVTProvider; CPVT_WordPlace m_wpCaret; CPVT_WordPlace m_wpOldCaret; @@ -469,7 +468,6 @@ class CPWL_EditImpl { bool m_bEnableRefresh; CFX_FloatRect m_rcOldContent; bool m_bEnableUndo; - bool m_bOprNotify; }; class CPWL_EditImpl_Iterator { -- cgit v1.2.3