diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-15 10:31:17 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-15 15:22:12 +0000 |
commit | 22fcbeaa80c54bef3bb6fd4180ba5519fab30962 (patch) | |
tree | b1642f91b36d45b11b76d02c59547186dc6c524b /xfa/fde/cfde_txtedtdorecord_deleterange.cpp | |
parent | a0377dc31bccf0e3427bd94fab5fed17c1283098 (diff) | |
download | pdfium-22fcbeaa80c54bef3bb6fd4180ba5519fab30962.tar.xz |
Hide the undo/redo record classes inside the engine
This CL moves the implementation of the records which handle undo/redo
in the text edit engine into an anonymous namespace in the engine.
Change-Id: I299b9738b72e3eccbbec972fd3ea956c491859fa
Reviewed-on: https://pdfium-review.googlesource.com/11010
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fde/cfde_txtedtdorecord_deleterange.cpp')
-rw-r--r-- | xfa/fde/cfde_txtedtdorecord_deleterange.cpp | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp b/xfa/fde/cfde_txtedtdorecord_deleterange.cpp deleted file mode 100644 index df6387e084..0000000000 --- a/xfa/fde/cfde_txtedtdorecord_deleterange.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fde/cfde_txtedtdorecord_deleterange.h" - -#include "xfa/fde/cfde_txtedtengine.h" -#include "xfa/fwl/cfwl_edit.h" - -CFDE_TxtEdtDoRecord_DeleteRange::CFDE_TxtEdtDoRecord_DeleteRange( - CFDE_TxtEdtEngine* pEngine, - int32_t nIndex, - int32_t nCaret, - const CFX_WideString& wsRange, - bool bSel) - : m_pEngine(pEngine), - m_bSel(bSel), - m_nIndex(nIndex), - m_nCaret(nCaret), - m_wsRange(wsRange) { - ASSERT(pEngine); -} - -CFDE_TxtEdtDoRecord_DeleteRange::~CFDE_TxtEdtDoRecord_DeleteRange() {} - -bool CFDE_TxtEdtDoRecord_DeleteRange::Undo() const { - if (m_pEngine->IsSelect()) - m_pEngine->ClearSelection(); - - m_pEngine->Inner_Insert(m_nIndex, m_wsRange.c_str(), m_wsRange.GetLength()); - if (m_bSel) - m_pEngine->AddSelRange(m_nIndex, m_wsRange.GetLength()); - - FDE_TXTEDTPARAMS& Param = m_pEngine->m_Param; - m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; - m_pEngine->m_ChangeInfo.wsDelete = m_wsRange; - Param.pEventSink->OnTextChanged(m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, true); - return true; -} - -bool CFDE_TxtEdtDoRecord_DeleteRange::Redo() const { - m_pEngine->Inner_DeleteRange(m_nIndex, m_wsRange.GetLength()); - if (m_bSel) - m_pEngine->RemoveSelRange(m_nIndex, m_wsRange.GetLength()); - - FDE_TXTEDTPARAMS& Param = m_pEngine->m_Param; - m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; - m_pEngine->m_ChangeInfo.wsDelete = m_wsRange; - Param.pEventSink->OnTextChanged(m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nIndex, true); - return true; -} |