From 4d02e904b01502cea5b76f316e07b0f6db5c5dbc Mon Sep 17 00:00:00 2001 From: Diana Gage Date: Thu, 20 Jul 2017 17:20:31 -0700 Subject: Change "Sel" abbreviation to "Selection". This CL changes SetSel() and GetSel() to SetSelection() and GetSelection() in CFX_Edit and CPWL_EditCtrl, and SetEditSel() and GetEditSel() to SetEditSelection() and GetEditSelection() in CPWL_ComboBox. Change-Id: Idd984932bda139a04e99193e519756980b7d4397 Reviewed-on: https://pdfium-review.googlesource.com/8610 Reviewed-by: Lei Zhang Commit-Queue: Lei Zhang --- fpdfsdk/formfiller/cffl_combobox.cpp | 8 +++--- fpdfsdk/formfiller/cffl_textfield.cpp | 6 ++--- fpdfsdk/fxedit/fxet_edit.cpp | 21 ++++++++------- fpdfsdk/fxedit/fxet_edit.h | 6 ++--- fpdfsdk/pdfwindow/cpwl_combo_box.cpp | 9 ++++--- fpdfsdk/pdfwindow/cpwl_combo_box.h | 4 +-- fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp | 32 +++++++++++------------ fpdfsdk/pdfwindow/cpwl_edit.cpp | 6 ++--- fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp | 8 +++--- fpdfsdk/pdfwindow/cpwl_edit_ctrl.h | 4 +-- fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp | 18 ++++++------- 11 files changed, 62 insertions(+), 60 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp index 175ccb7409..cbd00bc171 100644 --- a/fpdfsdk/formfiller/cffl_combobox.cpp +++ b/fpdfsdk/formfiller/cffl_combobox.cpp @@ -132,7 +132,7 @@ void CFFL_ComboBox::GetActionData(CPDFSDK_PageView* pPageView, fa.bFieldFull = pEdit->IsTextFull(); int nSelStart = 0; int nSelEnd = 0; - pEdit->GetSel(nSelStart, nSelEnd); + pEdit->GetSelection(nSelStart, nSelEnd); fa.nSelEnd = nSelEnd; fa.nSelStart = nSelStart; fa.sValue = pEdit->GetText(); @@ -170,7 +170,7 @@ void CFFL_ComboBox::SetActionData(CPDFSDK_PageView* pPageView, if (CPWL_ComboBox* pComboBox = static_cast(GetPDFWindow(pPageView, false))) { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { - pEdit->SetSel(fa.nSelStart, fa.nSelEnd); + pEdit->SetSelection(fa.nSelStart, fa.nSelEnd); pEdit->ReplaceSel(fa.sChange); } } @@ -203,7 +203,7 @@ void CFFL_ComboBox::SaveState(CPDFSDK_PageView* pPageView) { m_State.nIndex = pComboBox->GetSelect(); if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { - pEdit->GetSel(m_State.nStart, m_State.nEnd); + pEdit->GetSelection(m_State.nStart, m_State.nEnd); m_State.sValue = pEdit->GetText(); } } @@ -219,7 +219,7 @@ void CFFL_ComboBox::RestoreState(CPDFSDK_PageView* pPageView) { } else { if (CPWL_Edit* pEdit = pComboBox->GetEdit()) { pEdit->SetText(m_State.sValue); - pEdit->SetSel(m_State.nStart, m_State.nEnd); + pEdit->SetSelection(m_State.nStart, m_State.nEnd); } } } diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp index d598419c1b..0f330b58f1 100644 --- a/fpdfsdk/formfiller/cffl_textfield.cpp +++ b/fpdfsdk/formfiller/cffl_textfield.cpp @@ -186,7 +186,7 @@ void CFFL_TextField::SetActionData(CPDFSDK_PageView* pPageView, case CPDF_AAction::KeyStroke: if (CPWL_Edit* pEdit = GetEdit(pPageView, false)) { pEdit->SetFocus(); - pEdit->SetSel(fa.nSelStart, fa.nSelEnd); + pEdit->SetSelection(fa.nSelStart, fa.nSelEnd); pEdit->ReplaceSel(fa.sChange); } break; @@ -217,7 +217,7 @@ void CFFL_TextField::SaveState(CPDFSDK_PageView* pPageView) { if (!pWnd) return; - pWnd->GetSel(m_State.nStart, m_State.nEnd); + pWnd->GetSelection(m_State.nStart, m_State.nEnd); m_State.sValue = pWnd->GetText(); } @@ -229,7 +229,7 @@ void CFFL_TextField::RestoreState(CPDFSDK_PageView* pPageView) { return; pWnd->SetText(m_State.sValue); - pWnd->SetSel(m_State.nStart, m_State.nEnd); + pWnd->SetSelection(m_State.nStart, m_State.nEnd); } CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 41019b3459..a1ddc149e5 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -449,7 +449,7 @@ CFXEU_Clear::~CFXEU_Clear() {} void CFXEU_Clear::Redo() { if (m_pEdit) { m_pEdit->SelectNone(); - m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); + m_pEdit->SetSelection(m_wrSel.BeginPos, m_wrSel.EndPos); m_pEdit->Clear(false, true); } } @@ -459,7 +459,7 @@ void CFXEU_Clear::Undo() { m_pEdit->SelectNone(); m_pEdit->SetCaret(m_wrSel.BeginPos); m_pEdit->InsertText(m_swText, FX_CHARSET_Default, false, true); - m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos); + m_pEdit->SetSelection(m_wrSel.BeginPos, m_wrSel.EndPos); } } @@ -487,7 +487,7 @@ void CFXEU_InsertText::Redo() { void CFXEU_InsertText::Undo() { if (m_pEdit) { m_pEdit->SelectNone(); - m_pEdit->SetSel(m_wpOld, m_wpNew); + m_pEdit->SetSelection(m_wpOld, m_wpNew); m_pEdit->Clear(false, true); } } @@ -733,7 +733,7 @@ void CFX_Edit::SetTextOverflow(bool bAllowed, bool bPaint) { Paint(); } -void CFX_Edit::SetSel(int32_t nStartChar, int32_t nEndChar) { +void CFX_Edit::SetSelection(int32_t nStartChar, int32_t nEndChar) { if (m_pVT->IsValid()) { if (nStartChar == 0 && nEndChar < 0) { SelectAll(); @@ -741,17 +741,18 @@ void CFX_Edit::SetSel(int32_t nStartChar, int32_t nEndChar) { SelectNone(); } else { if (nStartChar < nEndChar) { - SetSel(m_pVT->WordIndexToWordPlace(nStartChar), - m_pVT->WordIndexToWordPlace(nEndChar)); + SetSelection(m_pVT->WordIndexToWordPlace(nStartChar), + m_pVT->WordIndexToWordPlace(nEndChar)); } else { - SetSel(m_pVT->WordIndexToWordPlace(nEndChar), - m_pVT->WordIndexToWordPlace(nStartChar)); + SetSelection(m_pVT->WordIndexToWordPlace(nEndChar), + m_pVT->WordIndexToWordPlace(nStartChar)); } } } } -void CFX_Edit::SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) { +void CFX_Edit::SetSelection(const CPVT_WordPlace& begin, + const CPVT_WordPlace& end) { if (!m_pVT->IsValid()) return; @@ -764,7 +765,7 @@ void CFX_Edit::SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) { SetCaretInfo(); } -void CFX_Edit::GetSel(int32_t& nStartChar, int32_t& nEndChar) const { +void CFX_Edit::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { nStartChar = -1; nEndChar = -1; if (!m_pVT->IsValid()) diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index c0c8442d52..4ae03e2303 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -361,8 +361,8 @@ class CFX_Edit { CFX_WideString GetRangeText(const CPVT_WordRange& range) const; int32_t GetHorzScale() const; float GetCharSpace() const; - void SetSel(int32_t nStartChar, int32_t nEndChar); - void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; + void SetSelection(int32_t nStartChar, int32_t nEndChar); + void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const; void SelectAll(); void SelectNone(); bool IsSelected() const; @@ -397,7 +397,7 @@ class CFX_Edit { friend class CFXEU_Clear; friend class CFXEU_InsertText; - void SetSel(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); + void SetSelection(const CPVT_WordPlace& begin, const CPVT_WordPlace& end); void RearrangeAll(); void RearrangePart(const CPVT_WordRange& range); diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp index d86c9db8a9..e5076332f6 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.cpp @@ -213,17 +213,18 @@ void CPWL_ComboBox::SetSelect(int32_t nItemIndex) { m_nSelectItem = nItemIndex; } -void CPWL_ComboBox::SetEditSel(int32_t nStartChar, int32_t nEndChar) { +void CPWL_ComboBox::SetEditSelection(int32_t nStartChar, int32_t nEndChar) { if (m_pEdit) - m_pEdit->SetSel(nStartChar, nEndChar); + m_pEdit->SetSelection(nStartChar, nEndChar); } -void CPWL_ComboBox::GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const { +void CPWL_ComboBox::GetEditSelection(int32_t& nStartChar, + int32_t& nEndChar) const { nStartChar = -1; nEndChar = -1; if (m_pEdit) - m_pEdit->GetSel(nStartChar, nEndChar); + m_pEdit->GetSelection(nStartChar, nEndChar); } void CPWL_ComboBox::Clear() { diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box.h b/fpdfsdk/pdfwindow/cpwl_combo_box.h index 7dc348a711..a38ffa785f 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box.h +++ b/fpdfsdk/pdfwindow/cpwl_combo_box.h @@ -72,8 +72,8 @@ class CPWL_ComboBox : public CPWL_Wnd { int32_t GetSelect() const; void SetSelect(int32_t nItemIndex); - void SetEditSel(int32_t nStartChar, int32_t nEndChar); - void GetEditSel(int32_t& nStartChar, int32_t& nEndChar) const; + void SetEditSelection(int32_t nStartChar, int32_t nEndChar); + void GetEditSelection(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); bool IsPopup() const; diff --git a/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp b/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp index 35c7b2264b..9ca994f2e1 100644 --- a/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp +++ b/fpdfsdk/pdfwindow/cpwl_combo_box_embeddertest.cpp @@ -114,25 +114,25 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextFragmentsNormal) { FormFillerAndWindowSetup(GetCPDFSDKAnnotNormal()); EXPECT_STREQ(L"Banana", GetCPWLComboBox()->GetText().c_str()); - GetCPWLComboBox()->SetEditSel(0, 0); + GetCPWLComboBox()->SetEditSelection(0, 0); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 1); + GetCPWLComboBox()->SetEditSelection(0, 1); EXPECT_STREQ(L"B", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(0, -1); + GetCPWLComboBox()->SetEditSelection(0, -1); EXPECT_STREQ(L"Banana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(-8, -1); + GetCPWLComboBox()->SetEditSelection(-8, -1); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(4, 1); + GetCPWLComboBox()->SetEditSelection(4, 1); EXPECT_STREQ(L"ana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(1, 4); + GetCPWLComboBox()->SetEditSelection(1, 4); EXPECT_STREQ(L"ana", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(5, 6); + GetCPWLComboBox()->SetEditSelection(5, 6); EXPECT_STREQ(L"a", GetCPWLComboBox()->GetSelectedText().c_str()); } @@ -149,7 +149,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextEmptyAndBasicEditable) { // Select another option and then select last char of that option. GetCPWLComboBox()->SetSelect(1); EXPECT_STREQ(L"Bar", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(2, 3); + GetCPWLComboBox()->SetEditSelection(2, 3); EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); // Type into editable combobox text field and select new text. @@ -161,7 +161,7 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextEmptyAndBasicEditable) { GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnotUserEditable(), 'c', 0)); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 5); + GetCPWLComboBox()->SetEditSelection(0, 5); EXPECT_STREQ(L"Baabc", GetCPWLComboBox()->GetSelectedText().c_str()); } @@ -172,25 +172,25 @@ TEST_F(CPWLComboBoxEditEmbeddertest, GetSelectedTextFragmentsEditable) { GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnotUserEditable(), i + 'A', 0)); } - GetCPWLComboBox()->SetEditSel(0, 0); + GetCPWLComboBox()->SetEditSelection(0, 0); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(0, 1); + GetCPWLComboBox()->SetEditSelection(0, 1); EXPECT_STREQ(L"A", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(0, -1); + GetCPWLComboBox()->SetEditSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(-8, -1); + GetCPWLComboBox()->SetEditSelection(-8, -1); EXPECT_TRUE(GetCPWLComboBox()->GetSelectedText().IsEmpty()); - GetCPWLComboBox()->SetEditSel(23, 12); + GetCPWLComboBox()->SetEditSelection(23, 12); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(12, 23); + GetCPWLComboBox()->SetEditSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLComboBox()->GetSelectedText().c_str()); - GetCPWLComboBox()->SetEditSel(49, 50); + GetCPWLComboBox()->SetEditSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLComboBox()->GetSelectedText().c_str()); } diff --git a/fpdfsdk/pdfwindow/cpwl_edit.cpp b/fpdfsdk/pdfwindow/cpwl_edit.cpp index 046fb5789f..ac1cfa94ba 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit.cpp @@ -361,7 +361,7 @@ CPVT_WordRange CPWL_Edit::GetSelectWordRange() const { int32_t nStart = -1; int32_t nEnd = -1; - m_pEdit->GetSel(nStart, nEnd); + m_pEdit->GetSelection(nStart, nEnd); CPVT_WordPlace wpStart = m_pEdit->WordIndexToWordPlace(nStart); CPVT_WordPlace wpEnd = m_pEdit->WordIndexToWordPlace(nEnd); @@ -455,7 +455,7 @@ bool CPWL_Edit::OnKeyDown(uint16_t nChar, uint32_t nFlag) { int nSelStart = 0; int nSelEnd = 0; - GetSel(nSelStart, nSelEnd); + GetSelection(nSelStart, nSelEnd); if (nSelStart == nSelEnd) nSelEnd = nSelStart + 1; @@ -527,7 +527,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) { int nSelStart = 0; int nSelEnd = 0; - GetSel(nSelStart, nSelEnd); + GetSelection(nSelStart, nSelEnd); switch (nChar) { case FWL_VKEY_Back: diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp index 63d03929e2..357b552330 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.cpp @@ -334,12 +334,12 @@ CFX_WideString CPWL_EditCtrl::GetText() const { return m_pEdit->GetText(); } -void CPWL_EditCtrl::SetSel(int32_t nStartChar, int32_t nEndChar) { - m_pEdit->SetSel(nStartChar, nEndChar); +void CPWL_EditCtrl::SetSelection(int32_t nStartChar, int32_t nEndChar) { + m_pEdit->SetSelection(nStartChar, nEndChar); } -void CPWL_EditCtrl::GetSel(int32_t& nStartChar, int32_t& nEndChar) const { - m_pEdit->GetSel(nStartChar, nEndChar); +void CPWL_EditCtrl::GetSelection(int32_t& nStartChar, int32_t& nEndChar) const { + m_pEdit->GetSelection(nStartChar, nEndChar); } void CPWL_EditCtrl::Clear() { diff --git a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h index 454e579622..04ec6e8a25 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h +++ b/fpdfsdk/pdfwindow/cpwl_edit_ctrl.h @@ -26,8 +26,8 @@ class CPWL_EditCtrl : public CPWL_Wnd { ~CPWL_EditCtrl() override; CFX_WideString GetText() const; - void SetSel(int32_t nStartChar, int32_t nEndChar); - void GetSel(int32_t& nStartChar, int32_t& nEndChar) const; + void SetSelection(int32_t nStartChar, int32_t nEndChar); + void GetSelection(int32_t& nStartChar, int32_t& nEndChar) const; void Clear(); void SelectAll(); diff --git a/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp b/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp index e206cd16e3..9b15ad887d 100644 --- a/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp +++ b/fpdfsdk/pdfwindow/cpwl_edit_embeddertest.cpp @@ -85,13 +85,13 @@ TEST_F(CPWLEditEmbeddertest, GetSelectedTextEmptyAndBasic) { // selection is identified as empty. // // Select from character index [0, 3) within form text field. - GetCPWLEdit()->SetSel(0, 3); + GetCPWLEdit()->SetSelection(0, 3); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'a', 0)); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'b', 0)); EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), 'c', 0)); - GetCPWLEdit()->SetSel(0, 2); + GetCPWLEdit()->SetSelection(0, 2); EXPECT_STREQ(L"ab", GetCPWLEdit()->GetSelectedText().c_str()); } @@ -101,25 +101,25 @@ TEST_F(CPWLEditEmbeddertest, GetSelectedTextFragments) { EXPECT_TRUE(GetCFFLFormFiller()->OnChar(GetCPDFSDKAnnot(), i + 'A', 0)); } - GetCPWLEdit()->SetSel(0, 0); + GetCPWLEdit()->SetSelection(0, 0); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); - GetCPWLEdit()->SetSel(0, 1); + GetCPWLEdit()->SetSelection(0, 1); EXPECT_STREQ(L"A", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(0, -1); + GetCPWLEdit()->SetSelection(0, -1); EXPECT_STREQ(L"ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqr", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(-8, -1); + GetCPWLEdit()->SetSelection(-8, -1); EXPECT_TRUE(GetCPWLEdit()->GetSelectedText().IsEmpty()); - GetCPWLEdit()->SetSel(23, 12); + GetCPWLEdit()->SetSelection(23, 12); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(12, 23); + GetCPWLEdit()->SetSelection(12, 23); EXPECT_STREQ(L"MNOPQRSTUVW", GetCPWLEdit()->GetSelectedText().c_str()); - GetCPWLEdit()->SetSel(49, 50); + GetCPWLEdit()->SetSelection(49, 50); EXPECT_STREQ(L"r", GetCPWLEdit()->GetSelectedText().c_str()); } -- cgit v1.2.3