From 22fcbeaa80c54bef3bb6fd4180ba5519fab30962 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 15 Aug 2017 10:31:17 -0400 Subject: 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 Commit-Queue: dsinclair --- xfa/fde/cfde_txtedtdorecord_insert.cpp | 47 ---------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 xfa/fde/cfde_txtedtdorecord_insert.cpp (limited to 'xfa/fde/cfde_txtedtdorecord_insert.cpp') diff --git a/xfa/fde/cfde_txtedtdorecord_insert.cpp b/xfa/fde/cfde_txtedtdorecord_insert.cpp deleted file mode 100644 index f752d911f6..0000000000 --- a/xfa/fde/cfde_txtedtdorecord_insert.cpp +++ /dev/null @@ -1,47 +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_insert.h" - -#include "xfa/fde/cfde_txtedtengine.h" -#include "xfa/fwl/cfwl_edit.h" - -CFDE_TxtEdtDoRecord_Insert::CFDE_TxtEdtDoRecord_Insert( - CFDE_TxtEdtEngine* pEngine, - int32_t nCaret, - const wchar_t* lpText, - int32_t nLength) - : m_pEngine(pEngine), m_nCaret(nCaret) { - ASSERT(pEngine); - wchar_t* lpBuffer = m_wsInsert.GetBuffer(nLength); - memcpy(lpBuffer, lpText, nLength * sizeof(wchar_t)); - m_wsInsert.ReleaseBuffer(m_wsInsert.GetStringLength()); -} - -CFDE_TxtEdtDoRecord_Insert::~CFDE_TxtEdtDoRecord_Insert() {} - -bool CFDE_TxtEdtDoRecord_Insert::Undo() const { - if (m_pEngine->IsSelect()) - m_pEngine->ClearSelection(); - - m_pEngine->Inner_DeleteRange(m_nCaret, m_wsInsert.GetLength()); - FDE_TXTEDTPARAMS& Param = m_pEngine->m_Param; - m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; - m_pEngine->m_ChangeInfo.wsDelete = m_wsInsert; - Param.pEventSink->OnTextChanged(m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, true); - return true; -} - -bool CFDE_TxtEdtDoRecord_Insert::Redo() const { - m_pEngine->Inner_Insert(m_nCaret, m_wsInsert.c_str(), m_wsInsert.GetLength()); - FDE_TXTEDTPARAMS& Param = m_pEngine->m_Param; - m_pEngine->m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; - m_pEngine->m_ChangeInfo.wsDelete = m_wsInsert; - Param.pEventSink->OnTextChanged(m_pEngine->m_ChangeInfo); - m_pEngine->SetCaretPos(m_nCaret, false); - return true; -} -- cgit v1.2.3