From ee96772e0878fa385b9a4a736a2fc109e19fd01e Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 19 Apr 2018 20:55:54 +0000 Subject: Add public APIs for undo / redo in forms. Add FORM_CanUndo(), FORM_CanRedo(), FORM_Undo(), and FORM_Redo(). BUG=chromium:764260 Change-Id: I1d9ea67152d9b35d9b8e1d7ef7d019706fdfa30a Reviewed-on: https://pdfium-review.googlesource.com/30872 Commit-Queue: Lei Zhang Reviewed-by: dsinclair --- fpdfsdk/pwl/cpwl_edit_ctrl.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'fpdfsdk/pwl/cpwl_edit_ctrl.cpp') diff --git a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp index 5e2f7acda6..579a587175 100644 --- a/fpdfsdk/pwl/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pwl/cpwl_edit_ctrl.cpp @@ -401,22 +401,20 @@ void CPWL_EditCtrl::Backspace() { m_pEdit->Backspace(); } -bool CPWL_EditCtrl::CanUndo() const { +bool CPWL_EditCtrl::CanUndo() { return !IsReadOnly() && m_pEdit->CanUndo(); } -bool CPWL_EditCtrl::CanRedo() const { +bool CPWL_EditCtrl::CanRedo() { return !IsReadOnly() && m_pEdit->CanRedo(); } -void CPWL_EditCtrl::Redo() { - if (CanRedo()) - m_pEdit->Redo(); +bool CPWL_EditCtrl::Undo() { + return CanUndo() && m_pEdit->Undo(); } -void CPWL_EditCtrl::Undo() { - if (CanUndo()) - m_pEdit->Undo(); +bool CPWL_EditCtrl::Redo() { + return CanRedo() && m_pEdit->Redo(); } int32_t CPWL_EditCtrl::GetCharSet() const { -- cgit v1.2.3