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 |
(...skipping 3076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3087 | 3087 |
3088 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { | 3088 void CFX_Edit::BeginGroupUndo(const CFX_WideString& sTitle) { |
3089 ASSERT(!m_pGroupUndoItem); | 3089 ASSERT(!m_pGroupUndoItem); |
3090 | 3090 |
3091 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); | 3091 m_pGroupUndoItem = new CFX_Edit_GroupUndoItem(sTitle); |
3092 } | 3092 } |
3093 | 3093 |
3094 void CFX_Edit::EndGroupUndo() { | 3094 void CFX_Edit::EndGroupUndo() { |
3095 m_pGroupUndoItem->UpdateItems(); | 3095 m_pGroupUndoItem->UpdateItems(); |
3096 m_Undo.AddItem(m_pGroupUndoItem); | 3096 m_Undo.AddItem(m_pGroupUndoItem); |
3097 if (m_bOprNotify && m_pOprNotify) | |
3098 m_pOprNotify->OnAddUndo(m_pGroupUndoItem); | |
3099 m_pGroupUndoItem = nullptr; | 3097 m_pGroupUndoItem = nullptr; |
3100 } | 3098 } |
3101 | 3099 |
3102 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { | 3100 void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) { |
3103 if (m_pGroupUndoItem) { | 3101 if (m_pGroupUndoItem) { |
3104 m_pGroupUndoItem->AddUndoItem(pEditUndoItem); | 3102 m_pGroupUndoItem->AddUndoItem(pEditUndoItem); |
3105 } else { | 3103 } else { |
3106 m_Undo.AddItem(pEditUndoItem); | 3104 m_Undo.AddItem(pEditUndoItem); |
3107 if (m_bOprNotify && m_pOprNotify) | |
3108 m_pOprNotify->OnAddUndo(pEditUndoItem); | |
3109 } | 3105 } |
3110 } | 3106 } |
3111 | 3107 |
3112 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { | 3108 void CFX_Edit::AddUndoItem(IFX_Edit_UndoItem* pUndoItem) { |
3113 m_Undo.AddItem(pUndoItem); | 3109 m_Undo.AddItem(pUndoItem); |
3114 if (m_bOprNotify && m_pOprNotify) | |
3115 m_pOprNotify->OnAddUndo(pUndoItem); | |
3116 } | 3110 } |
3117 | 3111 |
3118 CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} | 3112 CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} |
3119 | 3113 |
3120 CFX_Edit_LineRectArray::~CFX_Edit_LineRectArray() { | 3114 CFX_Edit_LineRectArray::~CFX_Edit_LineRectArray() { |
3121 Empty(); | 3115 Empty(); |
3122 } | 3116 } |
3123 | 3117 |
3124 void CFX_Edit_LineRectArray::Empty() { | 3118 void CFX_Edit_LineRectArray::Empty() { |
3125 for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++) | 3119 for (int32_t i = 0, sz = m_LineRects.GetSize(); i < sz; i++) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3225 int32_t CFX_Edit_RectArray::GetSize() const { | 3219 int32_t CFX_Edit_RectArray::GetSize() const { |
3226 return m_Rects.GetSize(); | 3220 return m_Rects.GetSize(); |
3227 } | 3221 } |
3228 | 3222 |
3229 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { | 3223 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { |
3230 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) | 3224 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) |
3231 return nullptr; | 3225 return nullptr; |
3232 | 3226 |
3233 return m_Rects.GetAt(nIndex); | 3227 return m_Rects.GetAt(nIndex); |
3234 } | 3228 } |
OLD | NEW |