diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-07-24 09:42:55 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-24 13:59:00 +0000 |
commit | 6b0158fdc229e7fc45fdb61c700b709bd82b2309 (patch) | |
tree | acb36f7f20b7a1280613deae74bcedcd500f3547 /fpdfsdk | |
parent | c08dc39850188d96ad81f5800c7a51d2663eeb44 (diff) | |
download | pdfium-6b0158fdc229e7fc45fdb61c700b709bd82b2309.tar.xz |
Remove fxedit place classes in pdfwindow/
This CL removes the fpdfsdk/fxedit folder and moves the code to
fpdfsdk/pdfwindow which is the primary consumer. The classes were
renamed from CFX_* to CPWL_*.
Change-Id: I6c6178adccf978193bbb9685204657ebd3f438bb
Reviewed-on: https://pdfium-review.googlesource.com/8552
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_appstream.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 2 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit.cpp | 13 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp | 6 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_ctrl.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_impl.cpp (renamed from fpdfsdk/fxedit/fxet_edit.cpp) | 430 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_edit_impl.h (renamed from fpdfsdk/fxedit/fxet_edit.h) | 154 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_list_box.cpp | 27 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_list_box.h | 4 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_list_impl.cpp (renamed from fpdfsdk/fxedit/fxet_list.cpp) | 142 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/cpwl_list_impl.h (renamed from fpdfsdk/fxedit/fxet_list.h) | 24 |
13 files changed, 417 insertions, 405 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 9ae2aa44f4..c9736126d3 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -28,7 +28,6 @@ #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/fsdk_actionhandler.h" #include "fpdfsdk/fsdk_define.h" -#include "fpdfsdk/fxedit/fxet_edit.h" #include "fpdfsdk/ipdfsdk_annothandler.h" #include "fpdfsdk/javascript/ijs_event_context.h" #include "fpdfsdk/javascript/ijs_runtime.h" diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index afc83edb07..4b85333a2a 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -29,7 +29,6 @@ #include "fpdfsdk/formfiller/cba_fontmap.h" #include "fpdfsdk/fsdk_actionhandler.h" #include "fpdfsdk/fsdk_define.h" -#include "fpdfsdk/fxedit/fxet_edit.h" #include "fpdfsdk/pdfwindow/cpwl_appstream.h" #include "fpdfsdk/pdfwindow/cpwl_edit.h" diff --git a/fpdfsdk/pdfwindow/cpwl_appstream.cpp b/fpdfsdk/pdfwindow/cpwl_appstream.cpp index f7ba4c465c..9ac08fa078 100644 --- a/fpdfsdk/pdfwindow/cpwl_appstream.cpp +++ b/fpdfsdk/pdfwindow/cpwl_appstream.cpp @@ -22,8 +22,8 @@ #include "fpdfsdk/cpdfsdk_pageview.h" #include "fpdfsdk/cpdfsdk_widget.h" #include "fpdfsdk/formfiller/cba_fontmap.h" -#include "fpdfsdk/fxedit/fxet_edit.h" #include "fpdfsdk/pdfwindow/cpwl_edit.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" #include "fpdfsdk/pdfwindow/cpwl_icon.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" @@ -523,11 +523,11 @@ CFX_ByteString GetWordRenderString(const CFX_ByteString& strWords) { return CFX_ByteString(); } -CFX_ByteString GetEditAppStream(CFX_Edit* pEdit, +CFX_ByteString GetEditAppStream(CPWL_EditImpl* pEdit, const CFX_PointF& ptOffset, bool bContinuous, uint16_t SubWord) { - CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator(); pIterator->SetAt(0); std::ostringstream sEditStream; @@ -686,7 +686,7 @@ CFX_ByteString GetPushButtonAppStream(const CFX_FloatRect& rcBBox, ButtonStyle nLayOut) { const float fAutoFontScale = 1.0f / 3.0f; - auto pEdit = pdfium::MakeUnique<CFX_Edit>(); + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); pEdit->SetFontMap(pFontMap); pEdit->SetAlignmentH(1, true); pEdit->SetAlignmentV(1, true); @@ -1515,7 +1515,7 @@ void CPWL_AppStream::SetAsComboBox(const CFX_WideString* sValue) { rcButton.left = rcButton.right - 13; rcButton.Normalize(); - auto pEdit = pdfium::MakeUnique<CFX_Edit>(); + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); pEdit->EnableRefresh(false); CBA_FontMap font_map( @@ -1578,7 +1578,7 @@ void CPWL_AppStream::SetAsListBox() { CFX_FloatRect rcClient = widget_->GetClientRect(); std::ostringstream sBody; - auto pEdit = pdfium::MakeUnique<CFX_Edit>(); + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); pEdit->EnableRefresh(false); CBA_FontMap font_map( @@ -1658,7 +1658,7 @@ void CPWL_AppStream::SetAsTextField(const CFX_WideString* sValue) { std::ostringstream sBody; std::ostringstream sLines; - auto pEdit = pdfium::MakeUnique<CFX_Edit>(); + auto pEdit = pdfium::MakeUnique<CPWL_EditImpl>(); pEdit->EnableRefresh(false); CBA_FontMap font_map( diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index 484027eba2..8de2f1e733 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -11,10 +11,10 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" -#include "fpdfsdk/fxedit/fxet_list.h" #include "fpdfsdk/pdfwindow/cpwl_edit.h" #include "fpdfsdk/pdfwindow/cpwl_edit_ctrl.h" #include "fpdfsdk/pdfwindow/cpwl_list_box.h" +#include "fpdfsdk/pdfwindow/cpwl_list_impl.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" #include "public/fpdf_fwlevent.h" diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp index 89361b5835..8588de73c6 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp @@ -20,9 +20,9 @@ #include "core/fxge/cfx_pathdata.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_font.h" -#include "fpdfsdk/fxedit/fxet_edit.h" #include "fpdfsdk/pdfwindow/cpwl_caret.h" #include "fpdfsdk/pdfwindow/cpwl_edit_ctrl.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" #include "fpdfsdk/pdfwindow/cpwl_font_map.h" #include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" @@ -281,9 +281,10 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, } CFX_SystemHandler* pSysHandler = GetSystemHandler(); - CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pEdit.get(), - GetTextColor().ToFXColor(GetTransparency()), rcClip, - CFX_PointF(), pRange, pSysHandler, m_pFormFiller.Get()); + CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pEdit.get(), + GetTextColor().ToFXColor(GetTransparency()), rcClip, + CFX_PointF(), pRange, pSysHandler, + m_pFormFiller.Get()); } bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { @@ -373,7 +374,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { } CFX_PointF CPWL_Edit::GetWordRightBottomPoint(const CPVT_WordPlace& wpWord) { - CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_WordPlace wpOld = pIterator->GetAt(); pIterator->SetAt(wpWord); @@ -660,7 +661,7 @@ CPVT_WordRange CPWL_Edit::GetSameWordsRange(const CPVT_WordPlace& place, bool bArabic) const { CPVT_WordRange range; - CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = m_pEdit->GetIterator(); CPVT_Word wordinfo; CPVT_WordPlace wpStart(place), wpEnd(place); pIterator->SetAt(place); diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp index 7b90579a5f..c7e1f14499 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp @@ -9,15 +9,15 @@ #include "core/fpdfdoc/cpvt_section.h" #include "core/fpdfdoc/cpvt_word.h" #include "core/fxge/fx_font.h" -#include "fpdfsdk/fxedit/fxet_edit.h" #include "fpdfsdk/pdfwindow/cpwl_caret.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" #include "fpdfsdk/pdfwindow/cpwl_font_map.h" #include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" #include "public/fpdf_fwlevent.h" CPWL_EditCtrl::CPWL_EditCtrl() - : m_pEdit(new CFX_Edit), + : m_pEdit(new CPWL_EditImpl), m_pEditCaret(nullptr), m_bMouseDown(false), m_nCharSet(FX_CHARSET_Default) {} @@ -302,7 +302,7 @@ void CPWL_EditCtrl::SetEditCaret(bool bVisible) { } void CPWL_EditCtrl::GetCaretInfo(CFX_PointF* ptHead, CFX_PointF* ptFoot) const { - CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(m_pEdit->GetCaret()); CPVT_Word word; CPVT_Line line; diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h index fca3bd8fe4..ef6989e637 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h @@ -12,7 +12,7 @@ #include "core/fxcrt/fx_string.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" -class CFX_Edit; +class CPWL_EditImpl; class CPWL_Caret; struct CPVT_WordPlace; @@ -82,7 +82,7 @@ class CPWL_EditCtrl : public CPWL_Wnd { void SetEditCaret(bool bVisible); - std::unique_ptr<CFX_Edit> m_pEdit; + std::unique_ptr<CPWL_EditImpl> m_pEdit; CPWL_Caret* m_pEditCaret; bool m_bMouseDown; diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit_impl.cpp index 6c4595408f..0f5cf05b10 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_impl.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fxedit/fxet_edit.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" #include <algorithm> #include <memory> @@ -72,21 +72,22 @@ void DrawTextString(CFX_RenderDevice* pDevice, } // namespace -CFX_Edit_Iterator::CFX_Edit_Iterator(CFX_Edit* pEdit, - CPDF_VariableText::Iterator* pVTIterator) +CPWL_EditImpl_Iterator::CPWL_EditImpl_Iterator( + CPWL_EditImpl* pEdit, + CPDF_VariableText::Iterator* pVTIterator) : m_pEdit(pEdit), m_pVTIterator(pVTIterator) {} -CFX_Edit_Iterator::~CFX_Edit_Iterator() {} +CPWL_EditImpl_Iterator::~CPWL_EditImpl_Iterator() {} -bool CFX_Edit_Iterator::NextWord() { +bool CPWL_EditImpl_Iterator::NextWord() { return m_pVTIterator->NextWord(); } -bool CFX_Edit_Iterator::PrevWord() { +bool CPWL_EditImpl_Iterator::PrevWord() { return m_pVTIterator->PrevWord(); } -bool CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { +bool CPWL_EditImpl_Iterator::GetWord(CPVT_Word& word) const { ASSERT(m_pEdit); if (m_pVTIterator->GetWord(word)) { @@ -96,7 +97,7 @@ bool CFX_Edit_Iterator::GetWord(CPVT_Word& word) const { return false; } -bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { +bool CPWL_EditImpl_Iterator::GetLine(CPVT_Line& line) const { ASSERT(m_pEdit); if (m_pVTIterator->GetLine(line)) { @@ -106,30 +107,31 @@ bool CFX_Edit_Iterator::GetLine(CPVT_Line& line) const { return false; } -void CFX_Edit_Iterator::SetAt(int32_t nWordIndex) { +void CPWL_EditImpl_Iterator::SetAt(int32_t nWordIndex) { m_pVTIterator->SetAt(nWordIndex); } -void CFX_Edit_Iterator::SetAt(const CPVT_WordPlace& place) { +void CPWL_EditImpl_Iterator::SetAt(const CPVT_WordPlace& place) { m_pVTIterator->SetAt(place); } -const CPVT_WordPlace& CFX_Edit_Iterator::GetAt() const { +const CPVT_WordPlace& CPWL_EditImpl_Iterator::GetAt() const { return m_pVTIterator->GetAt(); } -CFX_Edit_Provider::CFX_Edit_Provider(IPVT_FontMap* pFontMap) +CPWL_EditImpl_Provider::CPWL_EditImpl_Provider(IPVT_FontMap* pFontMap) : CPDF_VariableText::Provider(pFontMap), m_pFontMap(pFontMap) { ASSERT(m_pFontMap); } -CFX_Edit_Provider::~CFX_Edit_Provider() {} +CPWL_EditImpl_Provider::~CPWL_EditImpl_Provider() {} -IPVT_FontMap* CFX_Edit_Provider::GetFontMap() const { +IPVT_FontMap* CPWL_EditImpl_Provider::GetFontMap() const { return m_pFontMap; } -int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, uint16_t word) { +int32_t CPWL_EditImpl_Provider::GetCharWidth(int32_t nFontIndex, + uint16_t word) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) { uint32_t charcode = word; @@ -145,84 +147,82 @@ int32_t CFX_Edit_Provider::GetCharWidth(int32_t nFontIndex, uint16_t word) { return 0; } -int32_t CFX_Edit_Provider::GetTypeAscent(int32_t nFontIndex) { +int32_t CPWL_EditImpl_Provider::GetTypeAscent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) return pPDFFont->GetTypeAscent(); return 0; } -int32_t CFX_Edit_Provider::GetTypeDescent(int32_t nFontIndex) { +int32_t CPWL_EditImpl_Provider::GetTypeDescent(int32_t nFontIndex) { if (CPDF_Font* pPDFFont = m_pFontMap->GetPDFFont(nFontIndex)) return pPDFFont->GetTypeDescent(); return 0; } -int32_t CFX_Edit_Provider::GetWordFontIndex(uint16_t word, - int32_t charset, - int32_t nFontIndex) { +int32_t CPWL_EditImpl_Provider::GetWordFontIndex(uint16_t word, + int32_t charset, + int32_t nFontIndex) { return m_pFontMap->GetWordFontIndex(word, charset, nFontIndex); } -int32_t CFX_Edit_Provider::GetDefaultFontIndex() { +int32_t CPWL_EditImpl_Provider::GetDefaultFontIndex() { return 0; } -bool CFX_Edit_Provider::IsLatinWord(uint16_t word) { +bool CPWL_EditImpl_Provider::IsLatinWord(uint16_t word) { return FX_EDIT_ISLATINWORD(word); } -CFX_Edit_Refresh::CFX_Edit_Refresh() {} +CPWL_EditImpl_Refresh::CPWL_EditImpl_Refresh() {} -CFX_Edit_Refresh::~CFX_Edit_Refresh() {} +CPWL_EditImpl_Refresh::~CPWL_EditImpl_Refresh() {} -void CFX_Edit_Refresh::BeginRefresh() { +void CPWL_EditImpl_Refresh::BeginRefresh() { m_RefreshRects.Clear(); m_OldLineRects = std::move(m_NewLineRects); } -void CFX_Edit_Refresh::Push(const CPVT_WordRange& linerange, - const CFX_FloatRect& rect) { +void CPWL_EditImpl_Refresh::Push(const CPVT_WordRange& linerange, + const CFX_FloatRect& rect) { m_NewLineRects.Add(linerange, rect); } -void CFX_Edit_Refresh::NoAnalyse() { +void CPWL_EditImpl_Refresh::NoAnalyse() { { for (int32_t i = 0, sz = m_OldLineRects.GetSize(); i < sz; i++) - if (CFX_Edit_LineRect* pOldRect = m_OldLineRects.GetAt(i)) + if (CPWL_EditImpl_LineRect* pOldRect = m_OldLineRects.GetAt(i)) m_RefreshRects.Add(pOldRect->m_rcLine); } { for (int32_t i = 0, sz = m_NewLineRects.GetSize(); i < sz; i++) - if (CFX_Edit_LineRect* pNewRect = m_NewLineRects.GetAt(i)) + if (CPWL_EditImpl_LineRect* pNewRect = m_NewLineRects.GetAt(i)) m_RefreshRects.Add(pNewRect->m_rcLine); } } -const CFX_Edit_RectArray* CFX_Edit_Refresh::GetRefreshRects() const { +const CPWL_EditImpl_RectArray* CPWL_EditImpl_Refresh::GetRefreshRects() const { return &m_RefreshRects; } -void CFX_Edit_Refresh::EndRefresh() { +void CPWL_EditImpl_Refresh::EndRefresh() { m_RefreshRects.Clear(); } -CFX_Edit_Undo::CFX_Edit_Undo(int32_t nBufsize) - : m_nCurUndoPos(0), - m_nBufSize(nBufsize), - m_bWorking(false) {} +CPWL_EditImpl_Undo::CPWL_EditImpl_Undo(int32_t nBufsize) + : m_nCurUndoPos(0), m_nBufSize(nBufsize), m_bWorking(false) {} -CFX_Edit_Undo::~CFX_Edit_Undo() { +CPWL_EditImpl_Undo::~CPWL_EditImpl_Undo() { Reset(); } -bool CFX_Edit_Undo::CanUndo() const { +bool CPWL_EditImpl_Undo::CanUndo() const { return m_nCurUndoPos > 0; } -void CFX_Edit_Undo::Undo() { +void CPWL_EditImpl_Undo::Undo() { m_bWorking = true; if (m_nCurUndoPos > 0) { m_UndoItemStack[m_nCurUndoPos - 1]->Undo(); @@ -231,11 +231,11 @@ void CFX_Edit_Undo::Undo() { m_bWorking = false; } -bool CFX_Edit_Undo::CanRedo() const { +bool CPWL_EditImpl_Undo::CanRedo() const { return m_nCurUndoPos < m_UndoItemStack.size(); } -void CFX_Edit_Undo::Redo() { +void CPWL_EditImpl_Undo::Redo() { m_bWorking = true; if (m_nCurUndoPos < m_UndoItemStack.size()) { m_UndoItemStack[m_nCurUndoPos]->Redo(); @@ -244,7 +244,7 @@ void CFX_Edit_Undo::Redo() { m_bWorking = false; } -void CFX_Edit_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) { +void CPWL_EditImpl_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) { ASSERT(!m_bWorking); ASSERT(pItem); ASSERT(m_nBufSize > 1); @@ -258,42 +258,43 @@ void CFX_Edit_Undo::AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem) { m_nCurUndoPos = m_UndoItemStack.size(); } -void CFX_Edit_Undo::RemoveHeads() { +void CPWL_EditImpl_Undo::RemoveHeads() { ASSERT(m_UndoItemStack.size() > 1); m_UndoItemStack.pop_front(); } -void CFX_Edit_Undo::RemoveTails() { +void CPWL_EditImpl_Undo::RemoveTails() { while (m_UndoItemStack.size() > m_nCurUndoPos) m_UndoItemStack.pop_back(); } -void CFX_Edit_Undo::Reset() { +void CPWL_EditImpl_Undo::Reset() { m_UndoItemStack.clear(); m_nCurUndoPos = 0; } -CFX_Edit_UndoItem::CFX_Edit_UndoItem() : m_bFirst(true), m_bLast(true) {} +CPWL_EditImpl_UndoItem::CPWL_EditImpl_UndoItem() + : m_bFirst(true), m_bLast(true) {} -CFX_Edit_UndoItem::~CFX_Edit_UndoItem() {} +CPWL_EditImpl_UndoItem::~CPWL_EditImpl_UndoItem() {} -CFX_WideString CFX_Edit_UndoItem::GetUndoTitle() const { +CFX_WideString CPWL_EditImpl_UndoItem::GetUndoTitle() const { return CFX_WideString(); } -void CFX_Edit_UndoItem::SetFirst(bool bFirst) { +void CPWL_EditImpl_UndoItem::SetFirst(bool bFirst) { m_bFirst = bFirst; } -void CFX_Edit_UndoItem::SetLast(bool bLast) { +void CPWL_EditImpl_UndoItem::SetLast(bool bLast) { m_bLast = bLast; } -bool CFX_Edit_UndoItem::IsLast() { +bool CPWL_EditImpl_UndoItem::IsLast() { return m_bLast; } -CFXEU_InsertWord::CFXEU_InsertWord(CFX_Edit* pEdit, +CFXEU_InsertWord::CFXEU_InsertWord(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -327,7 +328,7 @@ void CFXEU_InsertWord::Undo() { } } -CFXEU_InsertReturn::CFXEU_InsertReturn(CFX_Edit* pEdit, +CFXEU_InsertReturn::CFXEU_InsertReturn(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, const CPVT_SecProps* pSecProps, @@ -361,7 +362,7 @@ void CFXEU_InsertReturn::Undo() { } } -CFXEU_Backspace::CFXEU_Backspace(CFX_Edit* pEdit, +CFXEU_Backspace::CFXEU_Backspace(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -399,7 +400,7 @@ void CFXEU_Backspace::Undo() { m_pEdit->InsertWord(m_Word, m_nCharset, &m_WordProps, false, true); } -CFXEU_Delete::CFXEU_Delete(CFX_Edit* pEdit, +CFXEU_Delete::CFXEU_Delete(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -438,7 +439,7 @@ void CFXEU_Delete::Undo() { } } -CFXEU_Clear::CFXEU_Clear(CFX_Edit* pEdit, +CFXEU_Clear::CFXEU_Clear(CPWL_EditImpl* pEdit, const CPVT_WordRange& wrSel, const CFX_WideString& swText) : m_pEdit(pEdit), m_wrSel(wrSel), m_swText(swText) {} @@ -462,7 +463,7 @@ void CFXEU_Clear::Undo() { } } -CFXEU_InsertText::CFXEU_InsertText(CFX_Edit* pEdit, +CFXEU_InsertText::CFXEU_InsertText(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, const CFX_WideString& swText, @@ -492,15 +493,15 @@ void CFXEU_InsertText::Undo() { } // static -void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, - CFX_Matrix* pUser2Device, - CFX_Edit* pEdit, - FX_COLORREF crTextFill, - const CFX_FloatRect& rcClip, - const CFX_PointF& ptOffset, - const CPVT_WordRange* pRange, - CFX_SystemHandler* pSystemHandler, - CFFL_FormFiller* pFFLData) { +void CPWL_EditImpl::DrawEdit(CFX_RenderDevice* pDevice, + CFX_Matrix* pUser2Device, + CPWL_EditImpl* pEdit, + FX_COLORREF crTextFill, + const CFX_FloatRect& rcClip, + const CFX_PointF& ptOffset, + const CPVT_WordRange* pRange, + CFX_SystemHandler* pSystemHandler, + CFFL_FormFiller* pFFLData) { const bool bContinuous = pEdit->GetCharArray() == 0 && pEdit->GetCharSpace() <= 0.0f; uint16_t SubWord = pEdit->GetPasswordChar(); @@ -525,7 +526,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, pDevice->SetClip_Rect(rcTemp.ToFxRect()); } - CFX_Edit_Iterator* pIterator = pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = pEdit->GetIterator(); if (IPVT_FontMap* pFontMap = pEdit->GetFontMap()) { if (pRange) pIterator->SetAt(pRange->BeginPos); @@ -609,7 +610,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, } } -CFX_Edit::CFX_Edit() +CPWL_EditImpl::CPWL_EditImpl() : m_pVT(new CPDF_VariableText), m_pNotify(nullptr), m_pOprNotify(nullptr), @@ -626,114 +627,114 @@ CFX_Edit::CFX_Edit() m_bEnableUndo(true), m_bOprNotify(false) {} -CFX_Edit::~CFX_Edit() {} +CPWL_EditImpl::~CPWL_EditImpl() {} -void CFX_Edit::Initialize() { +void CPWL_EditImpl::Initialize() { m_pVT->Initialize(); SetCaret(m_pVT->GetBeginWordPlace()); SetCaretOrigin(); } -void CFX_Edit::SetFontMap(IPVT_FontMap* pFontMap) { - m_pVTProvider = pdfium::MakeUnique<CFX_Edit_Provider>(pFontMap); +void CPWL_EditImpl::SetFontMap(IPVT_FontMap* pFontMap) { + m_pVTProvider = pdfium::MakeUnique<CPWL_EditImpl_Provider>(pFontMap); m_pVT->SetProvider(m_pVTProvider.get()); } -void CFX_Edit::SetNotify(CPWL_EditCtrl* pNotify) { +void CPWL_EditImpl::SetNotify(CPWL_EditCtrl* pNotify) { m_pNotify = pNotify; } -void CFX_Edit::SetOprNotify(CPWL_Edit* pOprNotify) { +void CPWL_EditImpl::SetOprNotify(CPWL_Edit* pOprNotify) { m_pOprNotify = pOprNotify; } -CFX_Edit_Iterator* CFX_Edit::GetIterator() { +CPWL_EditImpl_Iterator* CPWL_EditImpl::GetIterator() { if (!m_pIterator) { m_pIterator = - pdfium::MakeUnique<CFX_Edit_Iterator>(this, m_pVT->GetIterator()); + pdfium::MakeUnique<CPWL_EditImpl_Iterator>(this, m_pVT->GetIterator()); } return m_pIterator.get(); } -IPVT_FontMap* CFX_Edit::GetFontMap() { +IPVT_FontMap* CPWL_EditImpl::GetFontMap() { return m_pVTProvider ? m_pVTProvider->GetFontMap() : nullptr; } -void CFX_Edit::SetPlateRect(const CFX_FloatRect& rect) { +void CPWL_EditImpl::SetPlateRect(const CFX_FloatRect& rect) { m_pVT->SetPlateRect(rect); m_ptScrollPos = CFX_PointF(rect.left, rect.top); Paint(); } -void CFX_Edit::SetAlignmentH(int32_t nFormat, bool bPaint) { +void CPWL_EditImpl::SetAlignmentH(int32_t nFormat, bool bPaint) { m_pVT->SetAlignment(nFormat); if (bPaint) Paint(); } -void CFX_Edit::SetAlignmentV(int32_t nFormat, bool bPaint) { +void CPWL_EditImpl::SetAlignmentV(int32_t nFormat, bool bPaint) { m_nAlignment = nFormat; if (bPaint) Paint(); } -void CFX_Edit::SetPasswordChar(uint16_t wSubWord, bool bPaint) { +void CPWL_EditImpl::SetPasswordChar(uint16_t wSubWord, bool bPaint) { m_pVT->SetPasswordChar(wSubWord); if (bPaint) Paint(); } -void CFX_Edit::SetLimitChar(int32_t nLimitChar) { +void CPWL_EditImpl::SetLimitChar(int32_t nLimitChar) { m_pVT->SetLimitChar(nLimitChar); Paint(); } -void CFX_Edit::SetCharArray(int32_t nCharArray) { +void CPWL_EditImpl::SetCharArray(int32_t nCharArray) { m_pVT->SetCharArray(nCharArray); Paint(); } -void CFX_Edit::SetCharSpace(float fCharSpace) { +void CPWL_EditImpl::SetCharSpace(float fCharSpace) { m_pVT->SetCharSpace(fCharSpace); Paint(); } -void CFX_Edit::SetMultiLine(bool bMultiLine, bool bPaint) { +void CPWL_EditImpl::SetMultiLine(bool bMultiLine, bool bPaint) { m_pVT->SetMultiLine(bMultiLine); if (bPaint) Paint(); } -void CFX_Edit::SetAutoReturn(bool bAuto, bool bPaint) { +void CPWL_EditImpl::SetAutoReturn(bool bAuto, bool bPaint) { m_pVT->SetAutoReturn(bAuto); if (bPaint) Paint(); } -void CFX_Edit::SetAutoFontSize(bool bAuto, bool bPaint) { +void CPWL_EditImpl::SetAutoFontSize(bool bAuto, bool bPaint) { m_pVT->SetAutoFontSize(bAuto); if (bPaint) Paint(); } -void CFX_Edit::SetFontSize(float fFontSize) { +void CPWL_EditImpl::SetFontSize(float fFontSize) { m_pVT->SetFontSize(fFontSize); Paint(); } -void CFX_Edit::SetAutoScroll(bool bAuto, bool bPaint) { +void CPWL_EditImpl::SetAutoScroll(bool bAuto, bool bPaint) { m_bEnableScroll = bAuto; if (bPaint) Paint(); } -void CFX_Edit::SetTextOverflow(bool bAllowed, bool bPaint) { +void CPWL_EditImpl::SetTextOverflow(bool bAllowed, bool bPaint) { m_bEnableOverflow = bAllowed; if (bPaint) Paint(); } -void CFX_Edit::SetSelection(int32_t nStartChar, int32_t nEndChar) { +void CPWL_EditImpl::SetSelection(int32_t nStartChar, int32_t nEndChar) { if (m_pVT->IsValid()) { if (nStartChar == 0 && nEndChar < 0) { SelectAll(); @@ -751,8 +752,8 @@ void CFX_Edit::SetSelection(int32_t nStartChar, int32_t nEndChar) { } } -void CFX_Edit::SetSelection(const CPVT_WordPlace& begin, - const CPVT_WordPlace& end) { +void CPWL_EditImpl::SetSelection(const CPVT_WordPlace& begin, + const CPVT_WordPlace& end) { if (!m_pVT->IsValid()) return; @@ -765,7 +766,7 @@ void CFX_Edit::SetSelection(const CPVT_WordPlace& begin, SetCaretInfo(); } -void CFX_Edit::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { +void CPWL_EditImpl::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = -1; nEndChar = -1; if (!m_pVT->IsValid()) @@ -785,18 +786,18 @@ void CFX_Edit::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { nEndChar = m_pVT->WordPlaceToWordIndex(m_SelState.BeginPos); } -int32_t CFX_Edit::GetCaret() const { +int32_t CPWL_EditImpl::GetCaret() const { if (m_pVT->IsValid()) return m_pVT->WordPlaceToWordIndex(m_wpCaret); return -1; } -CPVT_WordPlace CFX_Edit::GetCaretWordPlace() const { +CPVT_WordPlace CPWL_EditImpl::GetCaretWordPlace() const { return m_wpCaret; } -CFX_WideString CFX_Edit::GetText() const { +CFX_WideString CPWL_EditImpl::GetText() const { CFX_WideString swRet; if (!m_pVT->IsValid()) return swRet; @@ -817,7 +818,7 @@ CFX_WideString CFX_Edit::GetText() const { return swRet; } -CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const { +CFX_WideString CPWL_EditImpl::GetRangeText(const CPVT_WordRange& range) const { CFX_WideString swRet; if (!m_pVT->IsValid()) return swRet; @@ -843,11 +844,11 @@ CFX_WideString CFX_Edit::GetRangeText(const CPVT_WordRange& range) const { return swRet; } -CFX_WideString CFX_Edit::GetSelectedText() const { +CFX_WideString CPWL_EditImpl::GetSelectedText() const { return GetRangeText(m_SelState.ConvertToWordRange()); } -int32_t CFX_Edit::GetTotalLines() const { +int32_t CPWL_EditImpl::GetTotalLines() const { int32_t nLines = 1; CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); @@ -858,72 +859,72 @@ int32_t CFX_Edit::GetTotalLines() const { return nLines; } -CPVT_WordRange CFX_Edit::GetSelectWordRange() const { +CPVT_WordRange CPWL_EditImpl::GetSelectWordRange() const { return m_SelState.ConvertToWordRange(); } -void CFX_Edit::SetText(const CFX_WideString& sText) { +void CPWL_EditImpl::SetText(const CFX_WideString& sText) { Empty(); DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FX_CHARSET_Default); Paint(); } -bool CFX_Edit::InsertWord(uint16_t word, int32_t charset) { +bool CPWL_EditImpl::InsertWord(uint16_t word, int32_t charset) { return InsertWord(word, charset, nullptr, true, true); } -bool CFX_Edit::InsertReturn() { +bool CPWL_EditImpl::InsertReturn() { return InsertReturn(nullptr, nullptr, true, true); } -bool CFX_Edit::Backspace() { +bool CPWL_EditImpl::Backspace() { return Backspace(true, true); } -bool CFX_Edit::Delete() { +bool CPWL_EditImpl::Delete() { return Delete(true, true); } -bool CFX_Edit::ClearSelection() { +bool CPWL_EditImpl::ClearSelection() { return Clear(true, true); } -bool CFX_Edit::InsertText(const CFX_WideString& sText, int32_t charset) { +bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, int32_t charset) { return InsertText(sText, charset, true, true); } -float CFX_Edit::GetFontSize() const { +float CPWL_EditImpl::GetFontSize() const { return m_pVT->GetFontSize(); } -uint16_t CFX_Edit::GetPasswordChar() const { +uint16_t CPWL_EditImpl::GetPasswordChar() const { return m_pVT->GetPasswordChar(); } -int32_t CFX_Edit::GetCharArray() const { +int32_t CPWL_EditImpl::GetCharArray() const { return m_pVT->GetCharArray(); } -CFX_FloatRect CFX_Edit::GetContentRect() const { +CFX_FloatRect CPWL_EditImpl::GetContentRect() const { return VTToEdit(m_pVT->GetContentRect()); } -int32_t CFX_Edit::GetHorzScale() const { +int32_t CPWL_EditImpl::GetHorzScale() const { return m_pVT->GetHorzScale(); } -float CFX_Edit::GetCharSpace() const { +float CPWL_EditImpl::GetCharSpace() const { return m_pVT->GetCharSpace(); } -CPVT_WordRange CFX_Edit::GetWholeWordRange() const { +CPVT_WordRange CPWL_EditImpl::GetWholeWordRange() const { if (m_pVT->IsValid()) return CPVT_WordRange(m_pVT->GetBeginWordPlace(), m_pVT->GetEndWordPlace()); return CPVT_WordRange(); } -CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { +CPVT_WordRange CPWL_EditImpl::GetVisibleWordRange() const { if (m_bEnableOverflow) return GetWholeWordRange(); @@ -941,7 +942,7 @@ CPVT_WordRange CFX_Edit::GetVisibleWordRange() const { return CPVT_WordRange(); } -CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_PointF& point) const { +CPVT_WordPlace CPWL_EditImpl::SearchWordPlace(const CFX_PointF& point) const { if (m_pVT->IsValid()) { return m_pVT->SearchWordPlace(EditToVT(point)); } @@ -949,7 +950,7 @@ CPVT_WordPlace CFX_Edit::SearchWordPlace(const CFX_PointF& point) const { return CPVT_WordPlace(); } -void CFX_Edit::Paint() { +void CPWL_EditImpl::Paint() { if (m_pVT->IsValid()) { RearrangeAll(); ScrollToCaret(); @@ -959,7 +960,7 @@ void CFX_Edit::Paint() { } } -void CFX_Edit::RearrangeAll() { +void CPWL_EditImpl::RearrangeAll() { if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); m_pVT->RearrangeAll(); @@ -969,7 +970,7 @@ void CFX_Edit::RearrangeAll() { } } -void CFX_Edit::RearrangePart(const CPVT_WordRange& range) { +void CPWL_EditImpl::RearrangePart(const CPVT_WordRange& range) { if (m_pVT->IsValid()) { m_pVT->UpdateWordPlace(m_wpCaret); m_pVT->RearrangePart(range); @@ -979,7 +980,7 @@ void CFX_Edit::RearrangePart(const CPVT_WordRange& range) { } } -void CFX_Edit::SetContentChanged() { +void CPWL_EditImpl::SetContentChanged() { if (m_pNotify) { CFX_FloatRect rcContent = m_pVT->GetContentRect(); if (rcContent.Width() != m_rcOldContent.Width() || @@ -989,17 +990,17 @@ void CFX_Edit::SetContentChanged() { } } -void CFX_Edit::SelectAll() { +void CPWL_EditImpl::SelectAll() { if (!m_pVT->IsValid()) return; - m_SelState = CFX_Edit_Select(GetWholeWordRange()); + m_SelState = CPWL_EditImpl_Select(GetWholeWordRange()); SetCaret(m_SelState.EndPos); ScrollToCaret(); Refresh(); SetCaretInfo(); } -void CFX_Edit::SelectNone() { +void CPWL_EditImpl::SelectNone() { if (!m_pVT->IsValid() || m_SelState.IsEmpty()) return; @@ -1007,11 +1008,11 @@ void CFX_Edit::SelectNone() { Refresh(); } -bool CFX_Edit::IsSelected() const { +bool CPWL_EditImpl::IsSelected() const { return !m_SelState.IsEmpty(); } -CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { +CFX_PointF CPWL_EditImpl::VTToEdit(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1033,7 +1034,7 @@ CFX_PointF CFX_Edit::VTToEdit(const CFX_PointF& point) const { point.y - (m_ptScrollPos.y + fPadding - rcPlate.top)); } -CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { +CFX_PointF CPWL_EditImpl::EditToVT(const CFX_PointF& point) const { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1055,7 +1056,7 @@ CFX_PointF CFX_Edit::EditToVT(const CFX_PointF& point) const { point.y + (m_ptScrollPos.y + fPadding - rcPlate.top)); } -CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { +CFX_FloatRect CPWL_EditImpl::VTToEdit(const CFX_FloatRect& rect) const { CFX_PointF ptLeftBottom = VTToEdit(CFX_PointF(rect.left, rect.bottom)); CFX_PointF ptRightTop = VTToEdit(CFX_PointF(rect.right, rect.top)); @@ -1063,7 +1064,7 @@ CFX_FloatRect CFX_Edit::VTToEdit(const CFX_FloatRect& rect) const { ptRightTop.y); } -void CFX_Edit::SetScrollInfo() { +void CPWL_EditImpl::SetScrollInfo() { if (!m_pNotify) return; @@ -1084,7 +1085,7 @@ void CFX_Edit::SetScrollInfo() { m_pNotify->SetScrollInfo(Info); } -void CFX_Edit::SetScrollPosX(float fx) { +void CPWL_EditImpl::SetScrollPosX(float fx) { if (!m_bEnableScroll) return; @@ -1096,7 +1097,7 @@ void CFX_Edit::SetScrollPosX(float fx) { } } -void CFX_Edit::SetScrollPosY(float fy) { +void CPWL_EditImpl::SetScrollPosY(float fy) { if (!m_bEnableScroll) return; @@ -1116,18 +1117,18 @@ void CFX_Edit::SetScrollPosY(float fy) { } } -void CFX_Edit::SetScrollPos(const CFX_PointF& point) { +void CPWL_EditImpl::SetScrollPos(const CFX_PointF& point) { SetScrollPosX(point.x); SetScrollPosY(point.y); SetScrollLimit(); SetCaretInfo(); } -CFX_PointF CFX_Edit::GetScrollPos() const { +CFX_PointF CPWL_EditImpl::GetScrollPos() const { return m_ptScrollPos; } -void CFX_Edit::SetScrollLimit() { +void CPWL_EditImpl::SetScrollLimit() { if (m_pVT->IsValid()) { CFX_FloatRect rcContent = m_pVT->GetContentRect(); CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); @@ -1156,7 +1157,7 @@ void CFX_Edit::SetScrollLimit() { } } -void CFX_Edit::ScrollToCaret() { +void CPWL_EditImpl::ScrollToCaret() { SetScrollLimit(); if (!m_pVT->IsValid()) @@ -1207,7 +1208,7 @@ void CFX_Edit::ScrollToCaret() { } } -void CFX_Edit::Refresh() { +void CPWL_EditImpl::Refresh() { if (m_bEnableRefresh && m_pVT->IsValid()) { m_Refresh.BeginRefresh(); RefreshPushLineRects(GetVisibleWordRange()); @@ -1219,7 +1220,8 @@ void CFX_Edit::Refresh() { if (!m_bNotifyFlag) { CFX_AutoRestorer<bool> restorer(&m_bNotifyFlag); m_bNotifyFlag = true; - if (const CFX_Edit_RectArray* pRects = m_Refresh.GetRefreshRects()) { + if (const CPWL_EditImpl_RectArray* pRects = + m_Refresh.GetRefreshRects()) { for (int32_t i = 0, sz = pRects->GetSize(); i < sz; i++) m_pNotify->InvalidateRect(pRects->GetAt(i)); } @@ -1230,7 +1232,7 @@ void CFX_Edit::Refresh() { } } -void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { +void CPWL_EditImpl::RefreshPushLineRects(const CPVT_WordRange& wr) { if (!m_pVT->IsValid()) return; @@ -1258,7 +1260,7 @@ void CFX_Edit::RefreshPushLineRects(const CPVT_WordRange& wr) { } while (pIterator->NextLine()); } -void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { +void CPWL_EditImpl::RefreshWordRange(const CPVT_WordRange& wr) { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); CPVT_WordRange wrTemp = wr; @@ -1312,12 +1314,12 @@ void CFX_Edit::RefreshWordRange(const CPVT_WordRange& wr) { } } -void CFX_Edit::SetCaret(const CPVT_WordPlace& place) { +void CPWL_EditImpl::SetCaret(const CPVT_WordPlace& place) { m_wpOldCaret = m_wpCaret; m_wpCaret = place; } -void CFX_Edit::SetCaretInfo() { +void CPWL_EditImpl::SetCaretInfo() { if (m_pNotify) { if (!m_bNotifyFlag) { CPDF_VariableText::Iterator* pIterator = m_pVT->GetIterator(); @@ -1347,7 +1349,9 @@ void CFX_Edit::SetCaretInfo() { } } -void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnMouseDown(const CFX_PointF& point, + bool bShift, + bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1359,7 +1363,9 @@ void CFX_Edit::OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl) { SetCaretInfo(); } -void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnMouseMove(const CFX_PointF& point, + bool bShift, + bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1374,7 +1380,7 @@ void CFX_Edit::OnMouseMove(const CFX_PointF& point, bool bShift, bool bCtrl) { SetCaretInfo(); } -void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_UP(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1397,7 +1403,7 @@ void CFX_Edit::OnVK_UP(bool bShift, bool bCtrl) { } } -void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_DOWN(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1420,7 +1426,7 @@ void CFX_Edit::OnVK_DOWN(bool bShift, bool bCtrl) { } } -void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_LEFT(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1463,7 +1469,7 @@ void CFX_Edit::OnVK_LEFT(bool bShift, bool bCtrl) { } } -void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_RIGHT(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1506,7 +1512,7 @@ void CFX_Edit::OnVK_RIGHT(bool bShift, bool bCtrl) { } } -void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_HOME(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1543,7 +1549,7 @@ void CFX_Edit::OnVK_HOME(bool bShift, bool bCtrl) { } } -void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) { +void CPWL_EditImpl::OnVK_END(bool bShift, bool bCtrl) { if (!m_pVT->IsValid()) return; @@ -1580,11 +1586,11 @@ void CFX_Edit::OnVK_END(bool bShift, bool bCtrl) { } } -bool CFX_Edit::InsertWord(uint16_t word, - int32_t charset, - const CPVT_WordProps* pWordProps, - bool bAddUndo, - bool bPaint) { +bool CPWL_EditImpl::InsertWord(uint16_t word, + int32_t charset, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow() || !m_pVT->IsValid()) return false; @@ -1608,10 +1614,10 @@ bool CFX_Edit::InsertWord(uint16_t word, return true; } -bool CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, - const CPVT_WordProps* pWordProps, - bool bAddUndo, - bool bPaint) { +bool CPWL_EditImpl::InsertReturn(const CPVT_SecProps* pSecProps, + const CPVT_WordProps* pWordProps, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow() || !m_pVT->IsValid()) return false; @@ -1638,7 +1644,7 @@ bool CFX_Edit::InsertReturn(const CPVT_SecProps* pSecProps, return true; } -bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) { +bool CPWL_EditImpl::Backspace(bool bAddUndo, bool bPaint) { if (!m_pVT->IsValid() || m_wpCaret == m_pVT->GetBeginWordPlace()) return false; @@ -1680,7 +1686,7 @@ bool CFX_Edit::Backspace(bool bAddUndo, bool bPaint) { return true; } -bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) { +bool CPWL_EditImpl::Delete(bool bAddUndo, bool bPaint) { if (!m_pVT->IsValid() || m_wpCaret == m_pVT->GetEndWordPlace()) return false; @@ -1720,7 +1726,7 @@ bool CFX_Edit::Delete(bool bAddUndo, bool bPaint) { return true; } -bool CFX_Edit::Empty() { +bool CPWL_EditImpl::Empty() { if (m_pVT->IsValid()) { m_pVT->DeleteWords(GetWholeWordRange()); SetCaret(m_pVT->GetBeginWordPlace()); @@ -1731,7 +1737,7 @@ bool CFX_Edit::Empty() { return false; } -bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) { +bool CPWL_EditImpl::Clear(bool bAddUndo, bool bPaint) { if (!m_pVT->IsValid() || m_SelState.IsEmpty()) return false; @@ -1757,10 +1763,10 @@ bool CFX_Edit::Clear(bool bAddUndo, bool bPaint) { return true; } -bool CFX_Edit::InsertText(const CFX_WideString& sText, - int32_t charset, - bool bAddUndo, - bool bPaint) { +bool CPWL_EditImpl::InsertText(const CFX_WideString& sText, + int32_t charset, + bool bAddUndo, + bool bPaint) { if (IsTextOverflow()) return false; @@ -1783,8 +1789,8 @@ bool CFX_Edit::InsertText(const CFX_WideString& sText, return true; } -void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, - const CPVT_WordPlace& wpNew) { +void CPWL_EditImpl::PaintInsertText(const CPVT_WordPlace& wpOld, + const CPVT_WordPlace& wpNew) { if (m_pVT->IsValid()) { RearrangePart(CPVT_WordRange(wpOld, wpNew)); ScrollToCaret(); @@ -1794,7 +1800,7 @@ void CFX_Edit::PaintInsertText(const CPVT_WordPlace& wpOld, } } -bool CFX_Edit::Redo() { +bool CPWL_EditImpl::Redo() { if (m_bEnableUndo) { if (m_Undo.CanRedo()) { m_Undo.Redo(); @@ -1805,7 +1811,7 @@ bool CFX_Edit::Redo() { return false; } -bool CFX_Edit::Undo() { +bool CPWL_EditImpl::Undo() { if (m_bEnableUndo) { if (m_Undo.CanUndo()) { m_Undo.Undo(); @@ -1816,7 +1822,7 @@ bool CFX_Edit::Undo() { return false; } -void CFX_Edit::SetCaretOrigin() { +void CPWL_EditImpl::SetCaretOrigin() { if (!m_pVT->IsValid()) return; @@ -1833,14 +1839,14 @@ void CFX_Edit::SetCaretOrigin() { } } -CPVT_WordPlace CFX_Edit::WordIndexToWordPlace(int32_t index) const { +CPVT_WordPlace CPWL_EditImpl::WordIndexToWordPlace(int32_t index) const { if (m_pVT->IsValid()) return m_pVT->WordIndexToWordPlace(index); return CPVT_WordPlace(); } -bool CFX_Edit::IsTextFull() const { +bool CPWL_EditImpl::IsTextFull() const { int32_t nTotalWords = m_pVT->GetTotalWords(); int32_t nLimitChar = m_pVT->GetLimitChar(); int32_t nCharArray = m_pVT->GetCharArray(); @@ -1849,7 +1855,7 @@ bool CFX_Edit::IsTextFull() const { (nCharArray > 0 && nTotalWords >= nCharArray); } -bool CFX_Edit::IsTextOverflow() const { +bool CPWL_EditImpl::IsTextOverflow() const { if (!m_bEnableScroll && !m_bEnableOverflow) { CFX_FloatRect rcPlate = m_pVT->GetPlateRect(); CFX_FloatRect rcContent = m_pVT->GetContentRect(); @@ -1866,7 +1872,7 @@ bool CFX_Edit::IsTextOverflow() const { return false; } -bool CFX_Edit::CanUndo() const { +bool CPWL_EditImpl::CanUndo() const { if (m_bEnableUndo) { return m_Undo.CanUndo(); } @@ -1874,7 +1880,7 @@ bool CFX_Edit::CanUndo() const { return false; } -bool CFX_Edit::CanRedo() const { +bool CPWL_EditImpl::CanRedo() const { if (m_bEnableUndo) { return m_Undo.CanRedo(); } @@ -1882,21 +1888,21 @@ bool CFX_Edit::CanRedo() const { return false; } -void CFX_Edit::EnableRefresh(bool bRefresh) { +void CPWL_EditImpl::EnableRefresh(bool bRefresh) { m_bEnableRefresh = bRefresh; } -void CFX_Edit::EnableUndo(bool bUndo) { +void CPWL_EditImpl::EnableUndo(bool bUndo) { m_bEnableUndo = bUndo; } -void CFX_Edit::EnableOprNotify(bool bNotify) { +void CPWL_EditImpl::EnableOprNotify(bool bNotify) { m_bOprNotify = bNotify; } -CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, - const CFX_WideString& sText, - int32_t charset) { +CPVT_WordPlace CPWL_EditImpl::DoInsertText(const CPVT_WordPlace& place, + const CFX_WideString& sText, + int32_t charset) { CPVT_WordPlace wp = place; if (m_pVT->IsValid()) { @@ -1926,20 +1932,21 @@ CPVT_WordPlace CFX_Edit::DoInsertText(const CPVT_WordPlace& place, return wp; } -int32_t CFX_Edit::GetCharSetFromUnicode(uint16_t word, int32_t nOldCharset) { +int32_t CPWL_EditImpl::GetCharSetFromUnicode(uint16_t word, + int32_t nOldCharset) { if (IPVT_FontMap* pFontMap = GetFontMap()) return pFontMap->CharSetFromUnicode(word, nOldCharset); return nOldCharset; } -void CFX_Edit::AddEditUndoItem( - std::unique_ptr<CFX_Edit_UndoItem> pEditUndoItem) { +void CPWL_EditImpl::AddEditUndoItem( + std::unique_ptr<CPWL_EditImpl_UndoItem> pEditUndoItem) { m_Undo.AddItem(std::move(pEditUndoItem)); } -CFX_ByteString CFX_Edit::GetPDFWordString(int32_t nFontIndex, - uint16_t Word, - uint16_t SubWord) { +CFX_ByteString CPWL_EditImpl::GetPDFWordString(int32_t nFontIndex, + uint16_t Word, + uint16_t SubWord) { IPVT_FontMap* pFontMap = GetFontMap(); CPDF_Font* pPDFFont = pFontMap->GetPDFFont(nFontIndex); if (!pPDFFont) @@ -1961,68 +1968,71 @@ CFX_ByteString CFX_Edit::GetPDFWordString(int32_t nFontIndex, return sWord; } -CFX_Edit_LineRectArray::CFX_Edit_LineRectArray() {} +CPWL_EditImpl_LineRectArray::CPWL_EditImpl_LineRectArray() {} -CFX_Edit_LineRectArray::~CFX_Edit_LineRectArray() {} +CPWL_EditImpl_LineRectArray::~CPWL_EditImpl_LineRectArray() {} -void CFX_Edit_LineRectArray::operator=(CFX_Edit_LineRectArray&& that) { +void CPWL_EditImpl_LineRectArray::operator=( + CPWL_EditImpl_LineRectArray&& that) { m_LineRects = std::move(that.m_LineRects); } -void CFX_Edit_LineRectArray::Add(const CPVT_WordRange& wrLine, - const CFX_FloatRect& rcLine) { - m_LineRects.push_back(pdfium::MakeUnique<CFX_Edit_LineRect>(wrLine, rcLine)); +void CPWL_EditImpl_LineRectArray::Add(const CPVT_WordRange& wrLine, + const CFX_FloatRect& rcLine) { + m_LineRects.push_back( + pdfium::MakeUnique<CPWL_EditImpl_LineRect>(wrLine, rcLine)); } -int32_t CFX_Edit_LineRectArray::GetSize() const { +int32_t CPWL_EditImpl_LineRectArray::GetSize() const { return pdfium::CollectionSize<int32_t>(m_LineRects); } -CFX_Edit_LineRect* CFX_Edit_LineRectArray::GetAt(int32_t nIndex) const { +CPWL_EditImpl_LineRect* CPWL_EditImpl_LineRectArray::GetAt( + int32_t nIndex) const { if (nIndex < 0 || nIndex >= GetSize()) return nullptr; return m_LineRects[nIndex].get(); } -CFX_Edit_Select::CFX_Edit_Select() {} +CPWL_EditImpl_Select::CPWL_EditImpl_Select() {} -CFX_Edit_Select::CFX_Edit_Select(const CPVT_WordRange& range) { +CPWL_EditImpl_Select::CPWL_EditImpl_Select(const CPVT_WordRange& range) { Set(range.BeginPos, range.EndPos); } -CPVT_WordRange CFX_Edit_Select::ConvertToWordRange() const { +CPVT_WordRange CPWL_EditImpl_Select::ConvertToWordRange() const { return CPVT_WordRange(BeginPos, EndPos); } -void CFX_Edit_Select::Reset() { +void CPWL_EditImpl_Select::Reset() { BeginPos.Reset(); EndPos.Reset(); } -void CFX_Edit_Select::Set(const CPVT_WordPlace& begin, - const CPVT_WordPlace& end) { +void CPWL_EditImpl_Select::Set(const CPVT_WordPlace& begin, + const CPVT_WordPlace& end) { BeginPos = begin; EndPos = end; } -void CFX_Edit_Select::SetEndPos(const CPVT_WordPlace& end) { +void CPWL_EditImpl_Select::SetEndPos(const CPVT_WordPlace& end) { EndPos = end; } -bool CFX_Edit_Select::IsEmpty() const { +bool CPWL_EditImpl_Select::IsEmpty() const { return BeginPos == EndPos; } -CFX_Edit_RectArray::CFX_Edit_RectArray() {} +CPWL_EditImpl_RectArray::CPWL_EditImpl_RectArray() {} -CFX_Edit_RectArray::~CFX_Edit_RectArray() {} +CPWL_EditImpl_RectArray::~CPWL_EditImpl_RectArray() {} -void CFX_Edit_RectArray::Clear() { +void CPWL_EditImpl_RectArray::Clear() { m_Rects.clear(); } -void CFX_Edit_RectArray::Add(const CFX_FloatRect& rect) { +void CPWL_EditImpl_RectArray::Add(const CFX_FloatRect& rect) { // check for overlapped area for (const auto& pRect : m_Rects) { if (pRect && pRect->Contains(rect)) @@ -2031,11 +2041,11 @@ void CFX_Edit_RectArray::Add(const CFX_FloatRect& rect) { m_Rects.push_back(pdfium::MakeUnique<CFX_FloatRect>(rect)); } -int32_t CFX_Edit_RectArray::GetSize() const { +int32_t CPWL_EditImpl_RectArray::GetSize() const { return pdfium::CollectionSize<int32_t>(m_Rects); } -CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { +CFX_FloatRect* CPWL_EditImpl_RectArray::GetAt(int32_t nIndex) const { if (nIndex < 0 || nIndex >= GetSize()) return nullptr; diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/pdfwindow/cpwl_edit_impl.h index 4aaee69f96..53ed8da0c2 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_impl.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef FPDFSDK_FXEDIT_FXET_EDIT_H_ -#define FPDFSDK_FXEDIT_FXET_EDIT_H_ +#ifndef FPDFSDK_PDFWINDOW_CPWL_EDIT_IMPL_H_ +#define FPDFSDK_PDFWINDOW_CPWL_EDIT_IMPL_H_ #include <deque> #include <memory> @@ -20,42 +20,43 @@ (u <= 0x007A && u >= 0x0061) || (u <= 0x02AF && u >= 0x00C0)) class CFFL_FormFiller; -class CFX_Edit; -class CFX_Edit_Iterator; -class CFX_Edit_Provider; +class CPWL_EditImpl; +class CPWL_EditImpl_Iterator; +class CPWL_EditImpl_Provider; class CFX_RenderDevice; class CFX_SystemHandler; class CPWL_Edit; class CPWL_EditCtrl; class IFX_Edit_UndoItem; -struct CFX_Edit_LineRect { - CFX_Edit_LineRect(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine) +struct CPWL_EditImpl_LineRect { + CPWL_EditImpl_LineRect(const CPVT_WordRange& wrLine, + const CFX_FloatRect& rcLine) : m_wrLine(wrLine), m_rcLine(rcLine) {} CPVT_WordRange m_wrLine; CFX_FloatRect m_rcLine; }; -class CFX_Edit_LineRectArray { +class CPWL_EditImpl_LineRectArray { public: - CFX_Edit_LineRectArray(); - ~CFX_Edit_LineRectArray(); + CPWL_EditImpl_LineRectArray(); + ~CPWL_EditImpl_LineRectArray(); - void operator=(CFX_Edit_LineRectArray&& rects); + void operator=(CPWL_EditImpl_LineRectArray&& rects); void Add(const CPVT_WordRange& wrLine, const CFX_FloatRect& rcLine); int32_t GetSize() const; - CFX_Edit_LineRect* GetAt(int32_t nIndex) const; + CPWL_EditImpl_LineRect* GetAt(int32_t nIndex) const; private: - std::vector<std::unique_ptr<CFX_Edit_LineRect>> m_LineRects; + std::vector<std::unique_ptr<CPWL_EditImpl_LineRect>> m_LineRects; }; -class CFX_Edit_RectArray { +class CPWL_EditImpl_RectArray { public: - CFX_Edit_RectArray(); - ~CFX_Edit_RectArray(); + CPWL_EditImpl_RectArray(); + ~CPWL_EditImpl_RectArray(); void Clear(); void Add(const CFX_FloatRect& rect); @@ -67,27 +68,27 @@ class CFX_Edit_RectArray { std::vector<std::unique_ptr<CFX_FloatRect>> m_Rects; }; -class CFX_Edit_Refresh { +class CPWL_EditImpl_Refresh { public: - CFX_Edit_Refresh(); - ~CFX_Edit_Refresh(); + CPWL_EditImpl_Refresh(); + ~CPWL_EditImpl_Refresh(); void BeginRefresh(); void Push(const CPVT_WordRange& linerange, const CFX_FloatRect& rect); void NoAnalyse(); - const CFX_Edit_RectArray* GetRefreshRects() const; + const CPWL_EditImpl_RectArray* GetRefreshRects() const; void EndRefresh(); private: - CFX_Edit_LineRectArray m_NewLineRects; - CFX_Edit_LineRectArray m_OldLineRects; - CFX_Edit_RectArray m_RefreshRects; + CPWL_EditImpl_LineRectArray m_NewLineRects; + CPWL_EditImpl_LineRectArray m_OldLineRects; + CPWL_EditImpl_RectArray m_RefreshRects; }; -class CFX_Edit_Select { +class CPWL_EditImpl_Select { public: - CFX_Edit_Select(); - explicit CFX_Edit_Select(const CPVT_WordRange& range); + CPWL_EditImpl_Select(); + explicit CPWL_EditImpl_Select(const CPVT_WordRange& range); void Reset(); void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); @@ -100,10 +101,10 @@ class CFX_Edit_Select { CPVT_WordPlace EndPos; }; -class CFX_Edit_Undo { +class CPWL_EditImpl_Undo { public: - explicit CFX_Edit_Undo(int32_t nBufsize); - ~CFX_Edit_Undo(); + explicit CPWL_EditImpl_Undo(int32_t nBufsize); + ~CPWL_EditImpl_Undo(); void AddItem(std::unique_ptr<IFX_Edit_UndoItem> pItem); void Undo(); @@ -131,10 +132,10 @@ class IFX_Edit_UndoItem { virtual CFX_WideString GetUndoTitle() const = 0; }; -class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { +class CPWL_EditImpl_UndoItem : public IFX_Edit_UndoItem { public: - CFX_Edit_UndoItem(); - ~CFX_Edit_UndoItem() override; + CPWL_EditImpl_UndoItem(); + ~CPWL_EditImpl_UndoItem() override; CFX_WideString GetUndoTitle() const override; @@ -147,9 +148,9 @@ class CFX_Edit_UndoItem : public IFX_Edit_UndoItem { bool m_bLast; }; -class CFXEU_InsertWord : public CFX_Edit_UndoItem { +class CFXEU_InsertWord : public CPWL_EditImpl_UndoItem { public: - CFXEU_InsertWord(CFX_Edit* pEdit, + CFXEU_InsertWord(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -157,12 +158,12 @@ class CFXEU_InsertWord : public CFX_Edit_UndoItem { const CPVT_WordProps* pWordProps); ~CFXEU_InsertWord() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; @@ -171,21 +172,21 @@ class CFXEU_InsertWord : public CFX_Edit_UndoItem { CPVT_WordProps m_WordProps; }; -class CFXEU_InsertReturn : public CFX_Edit_UndoItem { +class CFXEU_InsertReturn : public CPWL_EditImpl_UndoItem { public: - CFXEU_InsertReturn(CFX_Edit* pEdit, + CFXEU_InsertReturn(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, const CPVT_SecProps* pSecProps, const CPVT_WordProps* pWordProps); ~CFXEU_InsertReturn() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; @@ -193,9 +194,9 @@ class CFXEU_InsertReturn : public CFX_Edit_UndoItem { CPVT_WordProps m_WordProps; }; -class CFXEU_Backspace : public CFX_Edit_UndoItem { +class CFXEU_Backspace : public CPWL_EditImpl_UndoItem { public: - CFXEU_Backspace(CFX_Edit* pEdit, + CFXEU_Backspace(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -204,12 +205,12 @@ class CFXEU_Backspace : public CFX_Edit_UndoItem { const CPVT_WordProps& WordProps); ~CFXEU_Backspace() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; @@ -219,9 +220,9 @@ class CFXEU_Backspace : public CFX_Edit_UndoItem { CPVT_WordProps m_WordProps; }; -class CFXEU_Delete : public CFX_Edit_UndoItem { +class CFXEU_Delete : public CPWL_EditImpl_UndoItem { public: - CFXEU_Delete(CFX_Edit* pEdit, + CFXEU_Delete(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, uint16_t word, @@ -231,12 +232,12 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { bool bSecEnd); ~CFXEU_Delete() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; @@ -247,39 +248,39 @@ class CFXEU_Delete : public CFX_Edit_UndoItem { bool m_bSecEnd; }; -class CFXEU_Clear : public CFX_Edit_UndoItem { +class CFXEU_Clear : public CPWL_EditImpl_UndoItem { public: - CFXEU_Clear(CFX_Edit* pEdit, + CFXEU_Clear(CPWL_EditImpl* pEdit, const CPVT_WordRange& wrSel, const CFX_WideString& swText); ~CFXEU_Clear() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordRange m_wrSel; CFX_WideString m_swText; }; -class CFXEU_InsertText : public CFX_Edit_UndoItem { +class CFXEU_InsertText : public CPWL_EditImpl_UndoItem { public: - CFXEU_InsertText(CFX_Edit* pEdit, + CFXEU_InsertText(CPWL_EditImpl* pEdit, const CPVT_WordPlace& wpOldPlace, const CPVT_WordPlace& wpNewPlace, const CFX_WideString& swText, int32_t charset); ~CFXEU_InsertText() override; - // CFX_Edit_UndoItem + // CPWL_EditImpl_UndoItem void Redo() override; void Undo() override; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPVT_WordPlace m_wpOld; CPVT_WordPlace m_wpNew; @@ -287,11 +288,11 @@ class CFXEU_InsertText : public CFX_Edit_UndoItem { int32_t m_nCharset; }; -class CFX_Edit { +class CPWL_EditImpl { public: static void DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, - CFX_Edit* pEdit, + CPWL_EditImpl* pEdit, FX_COLORREF crTextFill, const CFX_FloatRect& rcClip, const CFX_PointF& ptOffset, @@ -299,15 +300,15 @@ class CFX_Edit { CFX_SystemHandler* pSystemHandler, CFFL_FormFiller* pFFLData); - CFX_Edit(); - ~CFX_Edit(); + CPWL_EditImpl(); + ~CPWL_EditImpl(); void SetFontMap(IPVT_FontMap* pFontMap); void SetNotify(CPWL_EditCtrl* pNotify); void SetOprNotify(CPWL_Edit* pOprNotify); // Returns an iterator for the contents. Should not be released. - CFX_Edit_Iterator* GetIterator(); + CPWL_EditImpl_Iterator* GetIterator(); IPVT_FontMap* GetFontMap(); void Initialize(); @@ -396,7 +397,7 @@ class CFX_Edit { uint16_t SubWord); private: - friend class CFX_Edit_Iterator; + friend class CPWL_EditImpl_Iterator; friend class CFXEU_InsertWord; friend class CFXEU_InsertReturn; friend class CFXEU_Backspace; @@ -445,23 +446,23 @@ class CFX_Edit { void SetCaretInfo(); void SetCaretOrigin(); - void AddEditUndoItem(std::unique_ptr<CFX_Edit_UndoItem> pEditUndoItem); + void AddEditUndoItem(std::unique_ptr<CPWL_EditImpl_UndoItem> pEditUndoItem); private: std::unique_ptr<CPDF_VariableText> m_pVT; CFX_UnownedPtr<CPWL_EditCtrl> m_pNotify; CFX_UnownedPtr<CPWL_Edit> m_pOprNotify; - std::unique_ptr<CFX_Edit_Provider> m_pVTProvider; + std::unique_ptr<CPWL_EditImpl_Provider> m_pVTProvider; CPVT_WordPlace m_wpCaret; CPVT_WordPlace m_wpOldCaret; - CFX_Edit_Select m_SelState; + CPWL_EditImpl_Select m_SelState; CFX_PointF m_ptScrollPos; CFX_PointF m_ptRefreshScrollPos; bool m_bEnableScroll; - std::unique_ptr<CFX_Edit_Iterator> m_pIterator; - CFX_Edit_Refresh m_Refresh; + std::unique_ptr<CPWL_EditImpl_Iterator> m_pIterator; + CPWL_EditImpl_Refresh m_Refresh; CFX_PointF m_ptCaret; - CFX_Edit_Undo m_Undo; + CPWL_EditImpl_Undo m_Undo; int32_t m_nAlignment; bool m_bNotifyFlag; bool m_bEnableOverflow; @@ -471,10 +472,11 @@ class CFX_Edit { bool m_bOprNotify; }; -class CFX_Edit_Iterator { +class CPWL_EditImpl_Iterator { public: - CFX_Edit_Iterator(CFX_Edit* pEdit, CPDF_VariableText::Iterator* pVTIterator); - ~CFX_Edit_Iterator(); + CPWL_EditImpl_Iterator(CPWL_EditImpl* pEdit, + CPDF_VariableText::Iterator* pVTIterator); + ~CPWL_EditImpl_Iterator(); bool NextWord(); bool PrevWord(); @@ -485,14 +487,14 @@ class CFX_Edit_Iterator { const CPVT_WordPlace& GetAt() const; private: - CFX_UnownedPtr<CFX_Edit> m_pEdit; + CFX_UnownedPtr<CPWL_EditImpl> m_pEdit; CPDF_VariableText::Iterator* m_pVTIterator; }; -class CFX_Edit_Provider : public CPDF_VariableText::Provider { +class CPWL_EditImpl_Provider : public CPDF_VariableText::Provider { public: - explicit CFX_Edit_Provider(IPVT_FontMap* pFontMap); - ~CFX_Edit_Provider() override; + explicit CPWL_EditImpl_Provider(IPVT_FontMap* pFontMap); + ~CPWL_EditImpl_Provider() override; IPVT_FontMap* GetFontMap() const; @@ -510,4 +512,4 @@ class CFX_Edit_Provider : public CPDF_VariableText::Provider { IPVT_FontMap* m_pFontMap; }; -#endif // FPDFSDK_FXEDIT_FXET_EDIT_H_ +#endif // FPDFSDK_PDFWINDOW_CPWL_EDIT_IMPL_H_ diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.cpp b/fpdfsdk/pdfwindow/cpwl_list_box.cpp index ffa5b4780f..7e820bfbfa 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_list_box.cpp @@ -9,10 +9,10 @@ #include <sstream> #include "core/fxge/cfx_renderdevice.h" -#include "fpdfsdk/fxedit/fxet_edit.h" -#include "fpdfsdk/fxedit/fxet_list.h" #include "fpdfsdk/pdfwindow/cpwl_edit.h" #include "fpdfsdk/pdfwindow/cpwl_edit_ctrl.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" +#include "fpdfsdk/pdfwindow/cpwl_list_impl.h" #include "fpdfsdk/pdfwindow/cpwl_scroll_bar.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" #include "public/fpdf_fwlevent.h" @@ -63,7 +63,7 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { } CPWL_ListBox::CPWL_ListBox() - : m_pList(new CFX_ListCtrl), + : m_pList(new CPWL_ListCtrl), m_bMouseDown(false), m_bHoverSel(false), m_pFillerNotify(nullptr) {} @@ -107,7 +107,7 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, continue; CFX_PointF ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f); - if (CFX_Edit* pEdit = m_pList->GetItemEdit(i)) { + if (CPWL_EditImpl* pEdit = m_pList->GetItemEdit(i)) { CFX_FloatRect rcContent = pEdit->GetContentRect(); if (rcContent.Width() > rcClient.Width()) rcItem.Intersect(rcList); @@ -118,22 +118,23 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (m_pList->IsItemSelected(i)) { CFX_SystemHandler* pSysHandler = GetSystemHandler(); if (pSysHandler && pSysHandler->IsSelectionImplemented()) { - CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - GetTextColor().ToFXColor(255), rcList, ptOffset, - nullptr, pSysHandler, m_pFormFiller.Get()); + CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), + GetTextColor().ToFXColor(255), rcList, ptOffset, + nullptr, pSysHandler, m_pFormFiller.Get()); pSysHandler->OutputSelectedRect(m_pFormFiller.Get(), rcItem); } else { pDevice->DrawFillRect(pUser2Device, rcItem, ArgbEncode(255, 0, 51, 113)); - CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - ArgbEncode(255, 255, 255, 255), rcList, ptOffset, - nullptr, pSysHandler, m_pFormFiller.Get()); + CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), + ArgbEncode(255, 255, 255, 255), rcList, + ptOffset, nullptr, pSysHandler, + m_pFormFiller.Get()); } } else { CFX_SystemHandler* pSysHandler = GetSystemHandler(); - CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - GetTextColor().ToFXColor(255), rcList, ptOffset, - nullptr, pSysHandler, nullptr); + CPWL_EditImpl::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), + GetTextColor().ToFXColor(255), rcList, ptOffset, + nullptr, pSysHandler, nullptr); } } } diff --git a/fpdfsdk/pdfwindow/cpwl_list_box.h b/fpdfsdk/pdfwindow/cpwl_list_box.h index f41a6dd87f..d76c7a5c5a 100644 --- a/fpdfsdk/pdfwindow/cpwl_list_box.h +++ b/fpdfsdk/pdfwindow/cpwl_list_box.h @@ -12,7 +12,7 @@ #include "core/fxcrt/cfx_unowned_ptr.h" #include "fpdfsdk/pdfwindow/cpwl_wnd.h" -class CFX_ListCtrl; +class CPWL_ListCtrl; class CPWL_List_Notify; class CPWL_ListBox; class IPWL_Filler_Notify; @@ -97,7 +97,7 @@ class CPWL_ListBox : public CPWL_Wnd { void AttachFFLData(CFFL_FormFiller* pData) { m_pFormFiller = pData; } protected: - std::unique_ptr<CFX_ListCtrl> m_pList; + std::unique_ptr<CPWL_ListCtrl> m_pList; std::unique_ptr<CPWL_List_Notify> m_pListNotify; bool m_bMouseDown; bool m_bHoverSel; diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/pdfwindow/cpwl_list_impl.cpp index fa085f237f..66b2e77747 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/pdfwindow/cpwl_list_impl.cpp @@ -4,52 +4,52 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "fpdfsdk/fxedit/fxet_list.h" +#include "fpdfsdk/pdfwindow/cpwl_list_impl.h" #include <algorithm> #include <utility> #include "core/fpdfdoc/cpvt_word.h" #include "core/fxcrt/fx_extension.h" -#include "fpdfsdk/fxedit/fxet_edit.h" +#include "fpdfsdk/pdfwindow/cpwl_edit_impl.h" #include "fpdfsdk/pdfwindow/cpwl_list_box.h" #include "third_party/base/stl_util.h" -CFX_ListCtrl::Item::Item() - : m_pEdit(new CFX_Edit), +CPWL_ListCtrl::Item::Item() + : m_pEdit(new CPWL_EditImpl), m_bSelected(false), m_rcListItem(0.0f, 0.0f, 0.0f, 0.0f) { m_pEdit->SetAlignmentV(1, true); m_pEdit->Initialize(); } -CFX_ListCtrl::Item::~Item() {} +CPWL_ListCtrl::Item::~Item() {} -void CFX_ListCtrl::Item::SetFontMap(IPVT_FontMap* pFontMap) { +void CPWL_ListCtrl::Item::SetFontMap(IPVT_FontMap* pFontMap) { m_pEdit->SetFontMap(pFontMap); } -void CFX_ListCtrl::Item::SetText(const CFX_WideString& text) { +void CPWL_ListCtrl::Item::SetText(const CFX_WideString& text) { m_pEdit->SetText(text); } -void CFX_ListCtrl::Item::SetFontSize(float fFontSize) { +void CPWL_ListCtrl::Item::SetFontSize(float fFontSize) { m_pEdit->SetFontSize(fFontSize); } -float CFX_ListCtrl::Item::GetItemHeight() const { +float CPWL_ListCtrl::Item::GetItemHeight() const { return m_pEdit->GetContentRect().Height(); } -uint16_t CFX_ListCtrl::Item::GetFirstChar() const { +uint16_t CPWL_ListCtrl::Item::GetFirstChar() const { CPVT_Word word; - CFX_Edit_Iterator* pIterator = m_pEdit->GetIterator(); + CPWL_EditImpl_Iterator* pIterator = m_pEdit->GetIterator(); pIterator->SetAt(1); pIterator->GetWord(word); return word.Word; } -CFX_WideString CFX_ListCtrl::Item::GetText() const { +CFX_WideString CPWL_ListCtrl::Item::GetText() const { return m_pEdit->GetText(); } @@ -98,7 +98,7 @@ void CPLST_Select::Done() { } } -CFX_ListCtrl::CFX_ListCtrl() +CPWL_ListCtrl::CPWL_ListCtrl() : m_pNotify(nullptr), m_bNotifyFlag(false), m_nSelItem(-1), @@ -109,61 +109,61 @@ CFX_ListCtrl::CFX_ListCtrl() m_pFontMap(nullptr), m_bMultiple(false) {} -CFX_ListCtrl::~CFX_ListCtrl() { +CPWL_ListCtrl::~CPWL_ListCtrl() { Empty(); } -CFX_PointF CFX_ListCtrl::InToOut(const CFX_PointF& point) const { +CFX_PointF CPWL_ListCtrl::InToOut(const CFX_PointF& point) const { CFX_FloatRect rcPlate = m_rcPlate; return CFX_PointF(point.x - (m_ptScrollPos.x - rcPlate.left), point.y - (m_ptScrollPos.y - rcPlate.top)); } -CFX_PointF CFX_ListCtrl::OutToIn(const CFX_PointF& point) const { +CFX_PointF CPWL_ListCtrl::OutToIn(const CFX_PointF& point) const { CFX_FloatRect rcPlate = m_rcPlate; return CFX_PointF(point.x + (m_ptScrollPos.x - rcPlate.left), point.y + (m_ptScrollPos.y - rcPlate.top)); } -CFX_FloatRect CFX_ListCtrl::InToOut(const CFX_FloatRect& rect) const { +CFX_FloatRect CPWL_ListCtrl::InToOut(const CFX_FloatRect& rect) const { CFX_PointF ptLeftBottom = InToOut(CFX_PointF(rect.left, rect.bottom)); CFX_PointF ptRightTop = InToOut(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } -CFX_FloatRect CFX_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { +CFX_FloatRect CPWL_ListCtrl::OutToIn(const CFX_FloatRect& rect) const { CFX_PointF ptLeftBottom = OutToIn(CFX_PointF(rect.left, rect.bottom)); CFX_PointF ptRightTop = OutToIn(CFX_PointF(rect.right, rect.top)); return CFX_FloatRect(ptLeftBottom.x, ptLeftBottom.y, ptRightTop.x, ptRightTop.y); } -CFX_PointF CFX_ListCtrl::InnerToOuter(const CFX_PointF& point) const { +CFX_PointF CPWL_ListCtrl::InnerToOuter(const CFX_PointF& point) const { return CFX_PointF(point.x + GetBTPoint().x, GetBTPoint().y - point.y); } -CFX_PointF CFX_ListCtrl::OuterToInner(const CFX_PointF& point) const { +CFX_PointF CPWL_ListCtrl::OuterToInner(const CFX_PointF& point) const { return CFX_PointF(point.x - GetBTPoint().x, GetBTPoint().y - point.y); } -CFX_FloatRect CFX_ListCtrl::InnerToOuter(const CFX_FloatRect& rect) const { +CFX_FloatRect CPWL_ListCtrl::InnerToOuter(const CFX_FloatRect& rect) const { CFX_PointF ptLeftTop = InnerToOuter(CFX_PointF(rect.left, rect.top)); CFX_PointF ptRightBottom = InnerToOuter(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } -CFX_FloatRect CFX_ListCtrl::OuterToInner(const CFX_FloatRect& rect) const { +CFX_FloatRect CPWL_ListCtrl::OuterToInner(const CFX_FloatRect& rect) const { CFX_PointF ptLeftTop = OuterToInner(CFX_PointF(rect.left, rect.top)); CFX_PointF ptRightBottom = OuterToInner(CFX_PointF(rect.right, rect.bottom)); return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x, ptLeftTop.y); } -void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, - bool bShift, - bool bCtrl) { +void CPWL_ListCtrl::OnMouseDown(const CFX_PointF& point, + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -200,9 +200,9 @@ void CFX_ListCtrl::OnMouseDown(const CFX_PointF& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnMouseMove(const CFX_PointF& point, - bool bShift, - bool bCtrl) { +void CPWL_ListCtrl::OnMouseMove(const CFX_PointF& point, + bool bShift, + bool bCtrl) { int32_t nHitIndex = GetItemIndex(point); if (IsMultipleSel()) { @@ -228,7 +228,7 @@ void CFX_ListCtrl::OnMouseMove(const CFX_PointF& point, ScrollToListItem(nHitIndex); } -void CFX_ListCtrl::OnVK(int32_t nItemIndex, bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK(int32_t nItemIndex, bool bShift, bool bCtrl) { if (IsMultipleSel()) { if (nItemIndex >= 0 && nItemIndex < GetCount()) { if (bCtrl) { @@ -253,31 +253,31 @@ void CFX_ListCtrl::OnVK(int32_t nItemIndex, bool bShift, bool bCtrl) { ScrollToListItem(nItemIndex); } -void CFX_ListCtrl::OnVK_UP(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_UP(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() - 1 : GetSelect() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_DOWN(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_DOWN(bool bShift, bool bCtrl) { OnVK(IsMultipleSel() ? GetCaret() + 1 : GetSelect() + 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_LEFT(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_LEFT(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_RIGHT(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_RIGHT(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_HOME(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_HOME(bool bShift, bool bCtrl) { OnVK(0, bShift, bCtrl); } -void CFX_ListCtrl::OnVK_END(bool bShift, bool bCtrl) { +void CPWL_ListCtrl::OnVK_END(bool bShift, bool bCtrl) { OnVK(GetCount() - 1, bShift, bCtrl); } -bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { +bool CPWL_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { int32_t nIndex = GetLastSelected(); int32_t nFindIndex = FindNext(nIndex, nChar); @@ -288,7 +288,7 @@ bool CFX_ListCtrl::OnChar(uint16_t nChar, bool bShift, bool bCtrl) { return false; } -void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { +void CPWL_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; m_ptScrollPos.x = rect.left; SetScrollPos(CFX_PointF(rect.left, rect.top)); @@ -296,11 +296,11 @@ void CFX_ListCtrl::SetPlateRect(const CFX_FloatRect& rect) { InvalidateItem(-1); } -CFX_FloatRect CFX_ListCtrl::GetItemRect(int32_t nIndex) const { +CFX_FloatRect CPWL_ListCtrl::GetItemRect(int32_t nIndex) const { return InToOut(GetItemRectInternal(nIndex)); } -CFX_FloatRect CFX_ListCtrl::GetItemRectInternal(int32_t nIndex) const { +CFX_FloatRect CPWL_ListCtrl::GetItemRectInternal(int32_t nIndex) const { if (!pdfium::IndexInBounds(m_ListItems, nIndex) || !m_ListItems[nIndex]) return CFX_FloatRect(); @@ -310,12 +310,12 @@ CFX_FloatRect CFX_ListCtrl::GetItemRectInternal(int32_t nIndex) const { return InnerToOuter(rcItem); } -void CFX_ListCtrl::AddString(const CFX_WideString& str) { +void CPWL_ListCtrl::AddString(const CFX_WideString& str) { AddItem(str); ReArrange(GetCount() - 1); } -void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, bool bSelected) { +void CPWL_ListCtrl::SetMultipleSelect(int32_t nItemIndex, bool bSelected) { if (!IsValid(nItemIndex)) return; @@ -330,7 +330,7 @@ void CFX_ListCtrl::SetMultipleSelect(int32_t nItemIndex, bool bSelected) { } } -void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) { +void CPWL_ListCtrl::SetSingleSelect(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -346,7 +346,7 @@ void CFX_ListCtrl::SetSingleSelect(int32_t nItemIndex) { } } -void CFX_ListCtrl::SetCaret(int32_t nItemIndex) { +void CPWL_ListCtrl::SetCaret(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -361,7 +361,7 @@ void CFX_ListCtrl::SetCaret(int32_t nItemIndex) { } } -void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { +void CPWL_ListCtrl::InvalidateItem(int32_t nItemIndex) { if (m_pNotify) { if (nItemIndex == -1) { if (!m_bNotifyFlag) { @@ -386,7 +386,7 @@ void CFX_ListCtrl::InvalidateItem(int32_t nItemIndex) { } } -void CFX_ListCtrl::SelectItems() { +void CPWL_ListCtrl::SelectItems() { for (const auto& item : m_aSelItems) { if (item.second != CPLST_Select::NORMAL) SetMultipleSelect(item.first, item.second == CPLST_Select::SELECTING); @@ -394,7 +394,7 @@ void CFX_ListCtrl::SelectItems() { m_aSelItems.Done(); } -void CFX_ListCtrl::Select(int32_t nItemIndex) { +void CPWL_ListCtrl::Select(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -406,14 +406,14 @@ void CFX_ListCtrl::Select(int32_t nItemIndex) { } } -bool CFX_ListCtrl::IsItemVisible(int32_t nItemIndex) const { +bool CPWL_ListCtrl::IsItemVisible(int32_t nItemIndex) const { CFX_FloatRect rcPlate = m_rcPlate; CFX_FloatRect rcItem = GetItemRect(nItemIndex); return rcItem.bottom >= rcPlate.bottom && rcItem.top <= rcPlate.top; } -void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { +void CPWL_ListCtrl::ScrollToListItem(int32_t nItemIndex) { if (!IsValid(nItemIndex)) return; @@ -432,7 +432,7 @@ void CFX_ListCtrl::ScrollToListItem(int32_t nItemIndex) { } } -void CFX_ListCtrl::SetScrollInfo() { +void CPWL_ListCtrl::SetScrollInfo() { if (m_pNotify) { CFX_FloatRect rcPlate = m_rcPlate; CFX_FloatRect rcContent = GetContentRectInternal(); @@ -447,11 +447,11 @@ void CFX_ListCtrl::SetScrollInfo() { } } -void CFX_ListCtrl::SetScrollPos(const CFX_PointF& point) { +void CPWL_ListCtrl::SetScrollPos(const CFX_PointF& point) { SetScrollPosY(point.y); } -void CFX_ListCtrl::SetScrollPosY(float fy) { +void CPWL_ListCtrl::SetScrollPosY(float fy) { if (!IsFloatEqual(m_ptScrollPos.y, fy)) { CFX_FloatRect rcPlate = m_rcPlate; CFX_FloatRect rcContent = GetContentRectInternal(); @@ -479,15 +479,15 @@ void CFX_ListCtrl::SetScrollPosY(float fy) { } } -CFX_FloatRect CFX_ListCtrl::GetContentRectInternal() const { +CFX_FloatRect CPWL_ListCtrl::GetContentRectInternal() const { return InnerToOuter(m_rcContent); } -CFX_FloatRect CFX_ListCtrl::GetContentRect() const { +CFX_FloatRect CPWL_ListCtrl::GetContentRect() const { return InToOut(GetContentRectInternal()); } -void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { +void CPWL_ListCtrl::ReArrange(int32_t nItemIndex) { float fPosY = 0.0f; if (pdfium::IndexInBounds(m_ListItems, nItemIndex - 1) && m_ListItems[nItemIndex - 1]) { @@ -505,14 +505,14 @@ void CFX_ListCtrl::ReArrange(int32_t nItemIndex) { SetScrollInfo(); } -void CFX_ListCtrl::SetTopItem(int32_t nIndex) { +void CPWL_ListCtrl::SetTopItem(int32_t nIndex) { if (IsValid(nIndex)) { CFX_FloatRect rcItem = GetItemRectInternal(nIndex); SetScrollPosY(rcItem.top); } } -int32_t CFX_ListCtrl::GetTopItem() const { +int32_t CPWL_ListCtrl::GetTopItem() const { int32_t nItemIndex = GetItemIndex(GetBTPoint()); if (!IsItemVisible(nItemIndex) && IsItemVisible(nItemIndex + 1)) nItemIndex += 1; @@ -520,16 +520,16 @@ int32_t CFX_ListCtrl::GetTopItem() const { return nItemIndex; } -void CFX_ListCtrl::Empty() { +void CPWL_ListCtrl::Empty() { m_ListItems.clear(); InvalidateItem(-1); } -void CFX_ListCtrl::Cancel() { +void CPWL_ListCtrl::Cancel() { m_aSelItems.DeselectAll(); } -int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const { +int32_t CPWL_ListCtrl::GetItemIndex(const CFX_PointF& point) const { CFX_PointF pt = OuterToInner(OutToIn(point)); bool bFirst = true; bool bLast = true; @@ -551,13 +551,13 @@ int32_t CFX_ListCtrl::GetItemIndex(const CFX_PointF& point) const { return -1; } -CFX_WideString CFX_ListCtrl::GetText() const { +CFX_WideString CPWL_ListCtrl::GetText() const { if (IsMultipleSel()) return GetItemText(m_nCaretIndex); return GetItemText(m_nSelItem); } -void CFX_ListCtrl::AddItem(const CFX_WideString& str) { +void CPWL_ListCtrl::AddItem(const CFX_WideString& str) { auto pListItem = pdfium::MakeUnique<Item>(); pListItem->SetFontMap(m_pFontMap.Get()); pListItem->SetFontSize(m_fFontSize); @@ -565,23 +565,23 @@ void CFX_ListCtrl::AddItem(const CFX_WideString& str) { m_ListItems.push_back(std::move(pListItem)); } -CFX_Edit* CFX_ListCtrl::GetItemEdit(int32_t nIndex) const { +CPWL_EditImpl* CPWL_ListCtrl::GetItemEdit(int32_t nIndex) const { if (!pdfium::IndexInBounds(m_ListItems, nIndex) || !m_ListItems[nIndex]) return nullptr; return m_ListItems[nIndex]->GetEdit(); } -int32_t CFX_ListCtrl::GetCount() const { +int32_t CPWL_ListCtrl::GetCount() const { return pdfium::CollectionSize<int32_t>(m_ListItems); } -float CFX_ListCtrl::GetFirstHeight() const { +float CPWL_ListCtrl::GetFirstHeight() const { if (m_ListItems.empty() || !m_ListItems.front()) return 1.0f; return m_ListItems.front()->GetItemHeight(); } -int32_t CFX_ListCtrl::GetFirstSelected() const { +int32_t CPWL_ListCtrl::GetFirstSelected() const { int32_t i = 0; for (const auto& pListItem : m_ListItems) { if (pListItem && pListItem->IsSelected()) @@ -591,7 +591,7 @@ int32_t CFX_ListCtrl::GetFirstSelected() const { return -1; } -int32_t CFX_ListCtrl::GetLastSelected() const { +int32_t CPWL_ListCtrl::GetLastSelected() const { for (auto iter = m_ListItems.rbegin(); iter != m_ListItems.rend(); ++iter) { if (*iter && (*iter)->IsSelected()) return &*iter - &m_ListItems.front(); @@ -599,7 +599,7 @@ int32_t CFX_ListCtrl::GetLastSelected() const { return -1; } -int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const { +int32_t CPWL_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const { int32_t nCircleIndex = nIndex; int32_t sz = pdfium::CollectionSize<int32_t>(m_ListItems); for (int32_t i = 0; i < sz; i++) { @@ -616,21 +616,21 @@ int32_t CFX_ListCtrl::FindNext(int32_t nIndex, wchar_t nChar) const { return nCircleIndex; } -bool CFX_ListCtrl::IsItemSelected(int32_t nIndex) const { +bool CPWL_ListCtrl::IsItemSelected(int32_t nIndex) const { return pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex] && m_ListItems[nIndex]->IsSelected(); } -void CFX_ListCtrl::SetItemSelect(int32_t nIndex, bool bSelected) { +void CPWL_ListCtrl::SetItemSelect(int32_t nIndex, bool bSelected) { if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex]) m_ListItems[nIndex]->SetSelect(bSelected); } -bool CFX_ListCtrl::IsValid(int32_t nItemIndex) const { +bool CPWL_ListCtrl::IsValid(int32_t nItemIndex) const { return pdfium::IndexInBounds(m_ListItems, nItemIndex); } -CFX_WideString CFX_ListCtrl::GetItemText(int32_t nIndex) const { +CFX_WideString CPWL_ListCtrl::GetItemText(int32_t nIndex) const { if (pdfium::IndexInBounds(m_ListItems, nIndex) && m_ListItems[nIndex]) return m_ListItems[nIndex]->GetText(); return L""; diff --git a/fpdfsdk/fxedit/fxet_list.h b/fpdfsdk/pdfwindow/cpwl_list_impl.h index 83b8d9e865..167def057e 100644 --- a/fpdfsdk/fxedit/fxet_list.h +++ b/fpdfsdk/pdfwindow/cpwl_list_impl.h @@ -4,8 +4,8 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#ifndef FPDFSDK_FXEDIT_FXET_LIST_H_ -#define FPDFSDK_FXEDIT_FXET_LIST_H_ +#ifndef FPDFSDK_PDFWINDOW_CPWL_LIST_IMPL_H_ +#define FPDFSDK_PDFWINDOW_CPWL_LIST_IMPL_H_ #include <map> #include <memory> @@ -14,8 +14,8 @@ #include "core/fxcrt/cfx_unowned_ptr.h" #include "core/fxcrt/fx_coordinates.h" -class CFX_Edit; -class CFX_Edit_Iterator; +class CPWL_EditImpl; +class CPWL_EditImpl_Iterator; class CPWL_List_Notify; class IPVT_FontMap; @@ -41,10 +41,10 @@ class CPLST_Select { std::map<int32_t, State> m_Items; }; -class CFX_ListCtrl { +class CPWL_ListCtrl { public: - CFX_ListCtrl(); - ~CFX_ListCtrl(); + CPWL_ListCtrl(); + ~CPWL_ListCtrl(); void SetNotify(CPWL_List_Notify* pNotify) { m_pNotify = pNotify; } void OnMouseDown(const CFX_PointF& point, bool bShift, bool bCtrl); @@ -81,7 +81,7 @@ class CFX_ListCtrl { void SetPlateRect(const CFX_FloatRect& rect); float GetFontSize() const { return m_fFontSize; } - CFX_Edit* GetItemEdit(int32_t nIndex) const; + CPWL_EditImpl* GetItemEdit(int32_t nIndex) const; int32_t GetCount() const; bool IsItemSelected(int32_t nIndex) const; float GetFirstHeight() const; @@ -97,7 +97,7 @@ class CFX_ListCtrl { ~Item(); void SetFontMap(IPVT_FontMap* pFontMap); - CFX_Edit* GetEdit() const { return m_pEdit.get(); } + CPWL_EditImpl* GetEdit() const { return m_pEdit.get(); } void SetRect(const CFX_FloatRect& rect) { m_rcListItem = rect; } void SetSelect(bool bSelected) { m_bSelected = bSelected; } @@ -111,9 +111,9 @@ class CFX_ListCtrl { uint16_t GetFirstChar() const; private: - CFX_Edit_Iterator* GetIterator() const; + CPWL_EditImpl_Iterator* GetIterator() const; - std::unique_ptr<CFX_Edit> m_pEdit; + std::unique_ptr<CPWL_EditImpl> m_pEdit; bool m_bSelected; CFX_FloatRect m_rcListItem; }; @@ -165,4 +165,4 @@ class CFX_ListCtrl { bool m_bMultiple; }; -#endif // FPDFSDK_FXEDIT_FXET_LIST_H_ +#endif // FPDFSDK_PDFWINDOW_CPWL_LIST_IMPL_H_ |