OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include "xfa/fee/fde_txtedtengine.h" | 7 #include "xfa/fee/fde_txtedtengine.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 } | 384 } |
385 } | 385 } |
386 if (IsSelect()) { | 386 if (IsSelect()) { |
387 DeleteSelect(); | 387 DeleteSelect(); |
388 } | 388 } |
389 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { | 389 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { |
390 IFDE_TxtEdtDoRecord* pRecord = | 390 IFDE_TxtEdtDoRecord* pRecord = |
391 new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength); | 391 new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength); |
392 CFX_ByteString bsDoRecord; | 392 CFX_ByteString bsDoRecord; |
393 pRecord->Serialize(bsDoRecord); | 393 pRecord->Serialize(bsDoRecord); |
394 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC()); | 394 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsStringC()); |
395 pRecord->Release(); | 395 pRecord->Release(); |
396 } | 396 } |
397 GetText(m_ChangeInfo.wsPrevText, 0); | 397 GetText(m_ChangeInfo.wsPrevText, 0); |
398 Inner_Insert(m_nCaret, lpBuffer, nLength); | 398 Inner_Insert(m_nCaret, lpBuffer, nLength); |
399 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; | 399 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Insert; |
400 m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); | 400 m_ChangeInfo.wsInsert = CFX_WideString(lpBuffer, nLength); |
401 nStart = m_nCaret; | 401 nStart = m_nCaret; |
402 nStart += nLength; | 402 nStart += nLength; |
403 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); | 403 FX_WCHAR wChar = m_pTxtBuf->GetCharByIndex(nStart - 1); |
404 FX_BOOL bBefore = TRUE; | 404 FX_BOOL bBefore = TRUE; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; | 447 return FDE_TXTEDT_MODIFY_RET_F_Invalidate; |
448 } | 448 } |
449 } | 449 } |
450 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { | 450 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { |
451 CFX_WideString wsRange; | 451 CFX_WideString wsRange; |
452 m_pTxtBuf->GetRange(wsRange, nStart, nCount); | 452 m_pTxtBuf->GetRange(wsRange, nStart, nCount); |
453 IFDE_TxtEdtDoRecord* pRecord = | 453 IFDE_TxtEdtDoRecord* pRecord = |
454 new CFDE_TxtEdtDoRecord_DeleteRange(this, nStart, m_nCaret, wsRange); | 454 new CFDE_TxtEdtDoRecord_DeleteRange(this, nStart, m_nCaret, wsRange); |
455 CFX_ByteString bsDoRecord; | 455 CFX_ByteString bsDoRecord; |
456 pRecord->Serialize(bsDoRecord); | 456 pRecord->Serialize(bsDoRecord); |
457 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC()); | 457 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsStringC()); |
458 pRecord->Release(); | 458 pRecord->Release(); |
459 } | 459 } |
460 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; | 460 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; |
461 GetText(m_ChangeInfo.wsDelete, nStart, nCount); | 461 GetText(m_ChangeInfo.wsDelete, nStart, nCount); |
462 Inner_DeleteRange(nStart, nCount); | 462 Inner_DeleteRange(nStart, nCount); |
463 SetCaretPos(nStart + ((!bBackspace && nStart > 0) ? -1 : 0), | 463 SetCaretPos(nStart + ((!bBackspace && nStart > 0) ? -1 : 0), |
464 (bBackspace || nStart == 0)); | 464 (bBackspace || nStart == 0)); |
465 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); | 465 m_Param.pEventSink->On_TextChanged(this, m_ChangeInfo); |
466 return FDE_TXTEDT_MODIFY_RET_S_Normal; | 466 return FDE_TXTEDT_MODIFY_RET_S_Normal; |
467 } | 467 } |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 } | 937 } |
938 FXSYS_assert((nStart + nCount) <= m_pTxtBuf->GetTextLength()); | 938 FXSYS_assert((nStart + nCount) <= m_pTxtBuf->GetTextLength()); |
939 | 939 |
940 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { | 940 if (!(m_Param.dwMode & FDE_TEXTEDITMODE_NoRedoUndo)) { |
941 CFX_WideString wsRange; | 941 CFX_WideString wsRange; |
942 m_pTxtBuf->GetRange(wsRange, nStart, nCount); | 942 m_pTxtBuf->GetRange(wsRange, nStart, nCount); |
943 IFDE_TxtEdtDoRecord* pRecord = new CFDE_TxtEdtDoRecord_DeleteRange( | 943 IFDE_TxtEdtDoRecord* pRecord = new CFDE_TxtEdtDoRecord_DeleteRange( |
944 this, nStart, m_nCaret, wsRange, bSel); | 944 this, nStart, m_nCaret, wsRange, bSel); |
945 CFX_ByteString bsDoRecord; | 945 CFX_ByteString bsDoRecord; |
946 pRecord->Serialize(bsDoRecord); | 946 pRecord->Serialize(bsDoRecord); |
947 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC()); | 947 m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsStringC()); |
948 pRecord->Release(); | 948 pRecord->Release(); |
949 } | 949 } |
950 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; | 950 m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete; |
951 GetText(m_ChangeInfo.wsDelete, nStart, nCount); | 951 GetText(m_ChangeInfo.wsDelete, nStart, nCount); |
952 Inner_DeleteRange(nStart, nCount); | 952 Inner_DeleteRange(nStart, nCount); |
953 } | 953 } |
954 void CFDE_TxtEdtEngine::ResetEngine() { | 954 void CFDE_TxtEdtEngine::ResetEngine() { |
955 RemoveAllPages(); | 955 RemoveAllPages(); |
956 RemoveAllParags(); | 956 RemoveAllParags(); |
957 ClearSelection(); | 957 ClearSelection(); |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 int32_t nEngine = 0; | 1776 int32_t nEngine = 0; |
1777 ArchiveLoader >> nEngine; | 1777 ArchiveLoader >> nEngine; |
1778 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; | 1778 m_pEngine = (CFDE_TxtEdtEngine*)(uintptr_t)nEngine; |
1779 int32_t iSel = 0; | 1779 int32_t iSel = 0; |
1780 ArchiveLoader >> iSel; | 1780 ArchiveLoader >> iSel; |
1781 m_bSel = !!iSel; | 1781 m_bSel = !!iSel; |
1782 ArchiveLoader >> m_nIndex; | 1782 ArchiveLoader >> m_nIndex; |
1783 ArchiveLoader >> m_nCaret; | 1783 ArchiveLoader >> m_nCaret; |
1784 ArchiveLoader >> m_wsRange; | 1784 ArchiveLoader >> m_wsRange; |
1785 } | 1785 } |
OLD | NEW |