| 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 "fpdfsdk/fxedit/include/fxet_edit.h" | 7 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| 11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 11 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
| 12 #include "core/fpdfdoc/include/cpvt_section.h" | 12 #include "core/fpdfdoc/include/cpvt_section.h" |
| 13 #include "core/fpdfdoc/include/cpvt_word.h" | 13 #include "core/fpdfdoc/include/cpvt_word.h" |
| 14 #include "core/fpdfdoc/include/ipvt_fontmap.h" | 14 #include "core/fpdfdoc/include/ipvt_fontmap.h" |
| 15 | 15 |
| 16 #define FX_EDIT_UNDO_MAXITEM 10000 | 16 namespace { |
| 17 |
| 18 const int kEditUndoMaxItems = 10000; |
| 19 |
| 20 } // namespace |
| 17 | 21 |
| 18 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, | 22 CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, |
| 19 CPDF_VariableText::Iterator* pVTIterator) | 23 CPDF_VariableText::Iterator* pVTIterator) |
| 20 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} | 24 : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} |
| 21 | 25 |
| 22 CFX_Edit_Iterator::~CFX_Edit_Iterator() {} | 26 CFX_Edit_Iterator::~CFX_Edit_Iterator() {} |
| 23 | 27 |
| 24 FX_BOOL CFX_Edit_Iterator::NextWord() { | 28 FX_BOOL CFX_Edit_Iterator::NextWord() { |
| 25 return m_pVTIterator->NextWord(); | 29 return m_pVTIterator->NextWord(); |
| 26 } | 30 } |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 m_pOprNotify(NULL), | 752 m_pOprNotify(NULL), |
| 749 m_pVTProvide(NULL), | 753 m_pVTProvide(NULL), |
| 750 m_wpCaret(-1, -1, -1), | 754 m_wpCaret(-1, -1, -1), |
| 751 m_wpOldCaret(-1, -1, -1), | 755 m_wpOldCaret(-1, -1, -1), |
| 752 m_SelState(), | 756 m_SelState(), |
| 753 m_ptScrollPos(0, 0), | 757 m_ptScrollPos(0, 0), |
| 754 m_ptRefreshScrollPos(0, 0), | 758 m_ptRefreshScrollPos(0, 0), |
| 755 m_bEnableScroll(FALSE), | 759 m_bEnableScroll(FALSE), |
| 756 m_pIterator(NULL), | 760 m_pIterator(NULL), |
| 757 m_ptCaret(0.0f, 0.0f), | 761 m_ptCaret(0.0f, 0.0f), |
| 758 m_Undo(FX_EDIT_UNDO_MAXITEM), | 762 m_Undo(kEditUndoMaxItems), |
| 759 m_nAlignment(0), | 763 m_nAlignment(0), |
| 760 m_bNotifyFlag(FALSE), | 764 m_bNotifyFlag(FALSE), |
| 761 m_bEnableOverflow(FALSE), | 765 m_bEnableOverflow(FALSE), |
| 762 m_bEnableRefresh(TRUE), | 766 m_bEnableRefresh(TRUE), |
| 763 m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), | 767 m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), |
| 764 m_bEnableUndo(TRUE), | 768 m_bEnableUndo(TRUE), |
| 765 m_bNotify(TRUE), | 769 m_bNotify(TRUE), |
| 766 m_bOprNotify(FALSE), | 770 m_bOprNotify(FALSE), |
| 767 m_pGroupUndoItem(NULL) { | 771 m_pGroupUndoItem(NULL) { |
| 768 ASSERT(pVT); | 772 ASSERT(pVT); |
| (...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3028 if (m_bOprNotify && m_pOprNotify) | 3032 if (m_bOprNotify && m_pOprNotify) |
| 3029 m_pOprNotify->OnAddUndo(pEditUndoItem); | 3033 m_pOprNotify->OnAddUndo(pEditUndoItem); |
| 3030 } | 3034 } |
| 3031 } | 3035 } |
| 3032 | 3036 |
| 3033 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { | 3037 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { |
| 3034 m_Undo.AddItem(pUndoItem); | 3038 m_Undo.AddItem(pUndoItem); |
| 3035 if (m_bOprNotify && m_pOprNotify) | 3039 if (m_bOprNotify && m_pOprNotify) |
| 3036 m_pOprNotify->OnAddUndo(pUndoItem); | 3040 m_pOprNotify->OnAddUndo(pUndoItem); |
| 3037 } | 3041 } |
| OLD | NEW |