diff options
author | Lei Zhang <thestig@chromium.org> | 2017-03-23 15:27:25 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-03-23 22:42:16 +0000 |
commit | 1a89e3691b320b2e577dad8e4617be6356545396 (patch) | |
tree | 076938d15d2f0dbd9ead356e097e381d7abc6a30 /fpdfsdk | |
parent | 6bbb6097b7150dcace3e2fd69caff8b73d59647a (diff) | |
download | pdfium-chromium/3050.tar.xz |
Remove dead code in fxet_edit.h.chromium/3050
Change-Id: Ide1702bbe07bd973293331fe6389b41c057691ba
Reviewed-on: https://pdfium-review.googlesource.com/3123
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 103 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.h | 39 |
2 files changed, 8 insertions, 134 deletions
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 884232dc76..7e2cf04b3f 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -125,16 +125,6 @@ bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { return false; } -bool CFX_Edit_Iterator::GetSection(CPVT_Section& section) const { - ASSERT(m_pEdit); - - if (m_pVTIterator->GetSection(section)) { - section.rcSection = m_pEdit->VTToEdit(section.rcSection); - return true; - } - return false; -} - void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { m_pVTIterator->SetAt(nWordIndex); } @@ -230,10 +220,6 @@ void CFX_Edit_Refresh::NoAnalyse() { } } -void CFX_Edit_Refresh::AddRefresh(const CFX_FloatRect& rect) { - m_RefreshRects.Add(rect); -} - const CFX_Edit_RectArray* CFX_Edit_Refresh::GetRefreshRects() const { return &m_RefreshRects; } @@ -245,8 +231,6 @@ void CFX_Edit_Refresh::EndRefresh() { CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) : m_nCurUndoPos(0), m_nBufSize(nBufsize), - m_bModified(false), - m_bVirgin(true), m_bWorking(false) {} CFX_Edit_Undo::~CFX_Edit_Undo() { @@ -262,7 +246,6 @@ void CFX_Edit_Undo::Undo() { if (m_nCurUndoPos > 0) { m_UndoItemStack[m_nCurUndoPos - 1]->Undo(); m_nCurUndoPos--; - m_bModified = (m_nCurUndoPos != 0); } m_bWorking = false; } @@ -276,7 +259,6 @@ void CFX_Edit_Undo::Redo() { if (m_nCurUndoPos < m_UndoItemStack.size()) { m_UndoItemStack[m_nCurUndoPos]->Redo(); m_nCurUndoPos++; - m_bModified = true; } m_bWorking = false; } @@ -288,18 +270,11 @@ void CFX_Edit_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) { if (m_nCurUndoPos < m_UndoItemStack.size()) RemoveTails(); - if (m_UndoItemStack.size() >= m_nBufSize) { + if (m_UndoItemStack.size() >= m_nBufSize) RemoveHeads(); - m_bVirgin = false; - } m_UndoItemStack.push_back(std::move(pItem)); m_nCurUndoPos = m_UndoItemStack.size(); - m_bModified = true; -} - -bool CFX_Edit_Undo::IsModified() const { - return m_bVirgin ? m_bModified : true; } void CFX_Edit_Undo::RemoveHeads() { @@ -337,42 +312,6 @@ bool CFX_Edit_UndoItem::IsLast() { return m_bLast; } -CFX_Edit_GroupUndoItem::CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle) - : m_sTitle(sTitle) {} - -CFX_Edit_GroupUndoItem::~CFX_Edit_GroupUndoItem() {} - -void CFX_Edit_GroupUndoItem::AddUndoItem( - std::unique_ptr<CFX_Edit_UndoItem> pUndoItem) { - pUndoItem->SetFirst(false); - pUndoItem->SetLast(false); - if (m_sTitle.IsEmpty()) - m_sTitle = pUndoItem->GetUndoTitle(); - - m_Items.push_back(std::move(pUndoItem)); -} - -void CFX_Edit_GroupUndoItem::UpdateItems() { - if (!m_Items.empty()) { - m_Items.front()->SetFirst(true); - m_Items.back()->SetLast(true); - } -} - -void CFX_Edit_GroupUndoItem::Undo() { - for (auto iter = m_Items.rbegin(); iter != m_Items.rend(); ++iter) - (*iter)->Undo(); -} - -void CFX_Edit_GroupUndoItem::Redo() { - for (auto iter = m_Items.begin(); iter != m_Items.end(); ++iter) - (*iter)->Redo(); -} - -CFX_WideString CFX_Edit_GroupUndoItem::GetUndoTitle() const { - return m_sTitle; -} - CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, @@ -849,12 +788,9 @@ CFX_Edit::CFX_Edit() m_bEnableRefresh(true), m_rcOldContent(0.0f, 0.0f, 0.0f, 0.0f), m_bEnableUndo(true), - m_bOprNotify(false), - m_pGroupUndoItem(nullptr) {} + m_bOprNotify(false) {} -CFX_Edit::~CFX_Edit() { - ASSERT(!m_pGroupUndoItem); -} +CFX_Edit::~CFX_Edit() {} void CFX_Edit::Initialize() { m_pVT->Initialize(); @@ -1568,18 +1504,6 @@ void CFX_Edit::SetCaretInfo() { } } -void CFX_Edit::SetCaret(int32_t nPos) { - if (!m_pVT->IsValid()) - return; - - SelectNone(); - SetCaret(m_pVT->WordIndexToWordPlace(nPos)); - m_SelState.Set(m_wpCaret, m_wpCaret); - ScrollToCaret(); - SetCaretOrigin(); - SetCaretInfo(); -} - void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -2064,13 +1988,6 @@ void CFX_Edit::SetCaretOrigin() { } } -int32_t CFX_Edit::WordPlaceToWordIndex(const CPVT_WordPlace& place) const { - if (m_pVT->IsValid()) - return m_pVT->WordPlaceToWordIndex(place); - - return -1; -} - CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { if (m_pVT->IsValid()) return m_pVT->WordIndexToWordPlace(index); @@ -2172,10 +2089,7 @@ int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { void CFX_Edit::AddEditUndoItem( std::unique_ptr<CFX_Edit_UndoItem> pEditUndoItem) { - if (m_pGroupUndoItem) - m_pGroupUndoItem->AddUndoItem(std::move(pEditUndoItem)); - else - m_Undo.AddItem(std::move(pEditUndoItem)); + m_Undo.AddItem(std::move(pEditUndoItem)); } CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} @@ -2204,11 +2118,6 @@ CFX_Edit_LineRect* CFX_Edit_LineRectArray::GetAt(int32_t nIndex) const { CFX_Edit_Select::CFX_Edit_Select() {} -CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordPlace& begin, - const CPVT_WordPlace& end) { - Set(begin, end); -} - CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordRange& range) { Set(range.BeginPos, range.EndPos); } @@ -2228,10 +2137,6 @@ void CFX_Edit_Select::Set(const CPVT_WordPlace& begin, EndPos = end; } -void CFX_Edit_Select::SetBeginPos(const CPVT_WordPlace& begin) { - BeginPos = begin; -} - void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) { EndPos = end; } diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index a279d1c1b6..ebc326f5a9 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -21,11 +21,8 @@ class CFX_Edit_Iterator; class CFX_Edit_Provider; class CFX_RenderDevice; class CFX_SystemHandler; -class CPDF_PageObjectHolder; -class CPDF_TextObject; class CPWL_Edit; class CPWL_EditCtrl; - class IFX_Edit_UndoItem; struct CFX_Edit_LineRect { @@ -39,7 +36,7 @@ struct CFX_Edit_LineRect { class CFX_Edit_LineRectArray { public: CFX_Edit_LineRectArray(); - virtual ~CFX_Edit_LineRectArray(); + ~CFX_Edit_LineRectArray(); void operator=(CFX_Edit_LineRectArray&& rects); void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine); @@ -54,7 +51,7 @@ class CFX_Edit_LineRectArray { class CFX_Edit_RectArray { public: CFX_Edit_RectArray(); - virtual ~CFX_Edit_RectArray(); + ~CFX_Edit_RectArray(); void Clear(); void Add(const CFX_FloatRect& rect); @@ -69,12 +66,11 @@ class CFX_Edit_RectArray { class CFX_Edit_Refresh { public: CFX_Edit_Refresh(); - virtual ~CFX_Edit_Refresh(); + ~CFX_Edit_Refresh(); void BeginRefresh(); void Push(const CPVT_WordRange& linerange, const CFX_FloatRect& rect); void NoAnalyse(); - void AddRefresh(const CFX_FloatRect& rect); const CFX_Edit_RectArray* GetRefreshRects() const; void EndRefresh(); @@ -87,12 +83,10 @@ class CFX_Edit_Refresh { class CFX_Edit_Select { public: CFX_Edit_Select(); - CFX_Edit_Select(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); explicit CFX_Edit_Select(const CPVT_WordRange& range); void Reset(); void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); - void SetBeginPos(const CPVT_WordPlace& begin); void SetEndPos(const CPVT_WordPlace& end); CPVT_WordRange ConvertToWordRange() const; @@ -105,14 +99,13 @@ class CFX_Edit_Select { class CFX_Edit_Undo { public: explicit CFX_Edit_Undo(int32_t nBufsize); - virtual ~CFX_Edit_Undo(); + ~CFX_Edit_Undo(); void AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem); void Undo(); void Redo(); bool CanUndo() const; bool CanRedo() const; - bool IsModified() const; void Reset(); private: @@ -122,8 +115,6 @@ class CFX_Edit_Undo { std::deque<std::unique_ptr<IFX_Edit_UndoItem>> m_UndoItemStack; size_t m_nCurUndoPos; size_t m_nBufSize; - bool m_bModified; - bool m_bVirgin; bool m_bWorking; }; @@ -152,24 +143,6 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { bool m_bLast; }; -class CFX_Edit_GroupUndoItem : public IFX_Edit_UndoItem { - public: - explicit CFX_Edit_GroupUndoItem(const CFX_WideString& sTitle); - ~CFX_Edit_GroupUndoItem() override; - - // IFX_Edit_UndoItem - void Undo() override; - void Redo() override; - CFX_WideString GetUndoTitle() const override; - - void AddUndoItem(std::unique_ptr<CFX_Edit_UndoItem> pUndoItem); - void UpdateItems(); - - private: - CFX_WideString m_sTitle; - std::vector<std::unique_ptr<CFX_Edit_UndoItem>> m_Items; -}; - class CFXEU_InsertWord : public CFX_Edit_UndoItem { public: CFXEU_InsertWord(CFX_Edit* pEdit, @@ -381,7 +354,6 @@ class CFX_Edit { bool InsertText(const CFX_WideString& sText, int32_t charset); bool Redo(); bool Undo(); - int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const; CPVT_WordPlace WordIndexToWordPlace(int32_t index) const; CPVT_WordPlace SearchWordPlace(const CFX_PointF& point) const; int32_t GetCaret() const; @@ -404,7 +376,6 @@ class CFX_Edit { void Paint(); void EnableRefresh(bool bRefresh); void RefreshWordRange(const CPVT_WordRange& wr); - void SetCaret(int32_t nPos); CPVT_WordRange GetWholeWordRange() const; CPVT_WordRange GetSelectWordRange() const; void EnableUndo(bool bUndo); @@ -498,7 +469,6 @@ class CFX_Edit { CFX_FloatRect m_rcOldContent; bool m_bEnableUndo; bool m_bOprNotify; - CFX_Edit_GroupUndoItem* m_pGroupUndoItem; }; class CFX_Edit_Iterator { @@ -510,7 +480,6 @@ class CFX_Edit_Iterator { bool PrevWord(); bool GetWord(CPVT_Word& word) const; bool GetLine(CPVT_Line& line) const; - bool GetSection(CPVT_Section& section) const; void SetAt(int32_t nWordIndex); void SetAt(const CPVT_WordPlace& place); const CPVT_WordPlace& GetAt() const; |