Nest class CPLST_Select as CPWL_ListCtrl::SelectState.

The CPLST_ prefix is meaningless.

Change-Id: Ic24d5c824fd62ef05553ae92d5b32b84e914e292
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75051
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/pwl/cpwl_list_ctrl.cpp b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
index 0ff1a41..1eb3dd1 100644
--- a/fpdfsdk/pwl/cpwl_list_ctrl.cpp
+++ b/fpdfsdk/pwl/cpwl_list_ctrl.cpp
@@ -50,15 +50,15 @@
   return m_pEdit->GetText();
 }
 
-CPLST_Select::CPLST_Select() {}
+CPWL_ListCtrl::SelectState::SelectState() = default;
 
-CPLST_Select::~CPLST_Select() = default;
+CPWL_ListCtrl::SelectState::~SelectState() = default;
 
-void CPLST_Select::Add(int32_t nItemIndex) {
+void CPWL_ListCtrl::SelectState::Add(int32_t nItemIndex) {
   m_Items[nItemIndex] = SELECTING;
 }
 
-void CPLST_Select::Add(int32_t nBeginIndex, int32_t nEndIndex) {
+void CPWL_ListCtrl::SelectState::Add(int32_t nBeginIndex, int32_t nEndIndex) {
   if (nBeginIndex > nEndIndex)
     std::swap(nBeginIndex, nEndIndex);
 
@@ -66,13 +66,13 @@
     Add(i);
 }
 
-void CPLST_Select::Sub(int32_t nItemIndex) {
+void CPWL_ListCtrl::SelectState::Sub(int32_t nItemIndex) {
   auto it = m_Items.find(nItemIndex);
   if (it != m_Items.end())
     it->second = DESELECTING;
 }
 
-void CPLST_Select::Sub(int32_t nBeginIndex, int32_t nEndIndex) {
+void CPWL_ListCtrl::SelectState::Sub(int32_t nBeginIndex, int32_t nEndIndex) {
   if (nBeginIndex > nEndIndex)
     std::swap(nBeginIndex, nEndIndex);
 
@@ -80,12 +80,12 @@
     Sub(i);
 }
 
-void CPLST_Select::DeselectAll() {
+void CPWL_ListCtrl::SelectState::DeselectAll() {
   for (auto& item : m_Items)
     item.second = DESELECTING;
 }
 
-void CPLST_Select::Done() {
+void CPWL_ListCtrl::SelectState::Done() {
   auto it = m_Items.begin();
   while (it != m_Items.end()) {
     if (it->second == DESELECTING)
@@ -157,23 +157,23 @@
   if (IsMultipleSel()) {
     if (bCtrl) {
       if (IsItemSelected(nHitIndex)) {
-        m_aSelItems.Sub(nHitIndex);
+        m_SelectState.Sub(nHitIndex);
         SelectItems();
         m_bCtrlSel = false;
       } else {
-        m_aSelItems.Add(nHitIndex);
+        m_SelectState.Add(nHitIndex);
         SelectItems();
         m_bCtrlSel = true;
       }
 
       m_nFootIndex = nHitIndex;
     } else if (bShift) {
-      m_aSelItems.DeselectAll();
-      m_aSelItems.Add(m_nFootIndex, nHitIndex);
+      m_SelectState.DeselectAll();
+      m_SelectState.Add(m_nFootIndex, nHitIndex);
       SelectItems();
     } else {
-      m_aSelItems.DeselectAll();
-      m_aSelItems.Add(nHitIndex);
+      m_SelectState.DeselectAll();
+      m_SelectState.Add(nHitIndex);
       SelectItems();
 
       m_nFootIndex = nHitIndex;
@@ -196,14 +196,14 @@
   if (IsMultipleSel()) {
     if (bCtrl) {
       if (m_bCtrlSel)
-        m_aSelItems.Add(m_nFootIndex, nHitIndex);
+        m_SelectState.Add(m_nFootIndex, nHitIndex);
       else
-        m_aSelItems.Sub(m_nFootIndex, nHitIndex);
+        m_SelectState.Sub(m_nFootIndex, nHitIndex);
 
       SelectItems();
     } else {
-      m_aSelItems.DeselectAll();
-      m_aSelItems.Add(m_nFootIndex, nHitIndex);
+      m_SelectState.DeselectAll();
+      m_SelectState.Add(m_nFootIndex, nHitIndex);
       SelectItems();
     }
 
@@ -221,12 +221,12 @@
     if (nItemIndex >= 0 && nItemIndex < GetCount()) {
       if (bCtrl) {
       } else if (bShift) {
-        m_aSelItems.DeselectAll();
-        m_aSelItems.Add(m_nFootIndex, nItemIndex);
+        m_SelectState.DeselectAll();
+        m_SelectState.Add(m_nFootIndex, nItemIndex);
         SelectItems();
       } else {
-        m_aSelItems.DeselectAll();
-        m_aSelItems.Add(nItemIndex);
+        m_SelectState.DeselectAll();
+        m_SelectState.Add(nItemIndex);
         SelectItems();
         m_nFootIndex = nItemIndex;
       }
@@ -375,11 +375,11 @@
 }
 
 void CPWL_ListCtrl::SelectItems() {
-  for (const auto& item : m_aSelItems) {
-    if (item.second != CPLST_Select::NORMAL)
-      SetMultipleSelect(item.first, item.second == CPLST_Select::SELECTING);
+  for (const auto& item : m_SelectState) {
+    if (item.second != SelectState::NORMAL)
+      SetMultipleSelect(item.first, item.second == SelectState::SELECTING);
   }
-  m_aSelItems.Done();
+  m_SelectState.Done();
 }
 
 void CPWL_ListCtrl::Select(int32_t nItemIndex) {
@@ -387,7 +387,7 @@
     return;
 
   if (IsMultipleSel()) {
-    m_aSelItems.Add(nItemIndex);
+    m_SelectState.Add(nItemIndex);
     SelectItems();
   } else {
     SetSingleSelect(nItemIndex);
@@ -521,7 +521,7 @@
 }
 
 void CPWL_ListCtrl::Cancel() {
-  m_aSelItems.DeselectAll();
+  m_SelectState.DeselectAll();
 }
 
 int32_t CPWL_ListCtrl::GetItemIndex(const CFX_PointF& point) const {
diff --git a/fpdfsdk/pwl/cpwl_list_ctrl.h b/fpdfsdk/pwl/cpwl_list_ctrl.h
index b8aeaeb..6d02b7d 100644
--- a/fpdfsdk/pwl/cpwl_list_ctrl.h
+++ b/fpdfsdk/pwl/cpwl_list_ctrl.h
@@ -20,28 +20,6 @@
 class CPWL_List_Notify;
 class IPVT_FontMap;
 
-class CPLST_Select final {
- public:
-  enum State { DESELECTING = -1, NORMAL = 0, SELECTING = 1 };
-  using const_iterator = std::map<int32_t, State>::const_iterator;
-
-  CPLST_Select();
-  ~CPLST_Select();
-
-  void Add(int32_t nItemIndex);
-  void Add(int32_t nBeginIndex, int32_t nEndIndex);
-  void Sub(int32_t nItemIndex);
-  void Sub(int32_t nBeginIndex, int32_t nEndIndex);
-  void DeselectAll();
-  void Done();
-
-  const_iterator begin() const { return m_Items.begin(); }
-  const_iterator end() const { return m_Items.end(); }
-
- private:
-  std::map<int32_t, State> m_Items;
-};
-
 class CPWL_ListCtrl {
  public:
   CPWL_ListCtrl();
@@ -120,6 +98,28 @@
     std::unique_ptr<CPWL_EditImpl> const m_pEdit;
   };
 
+  class SelectState {
+   public:
+    enum State { DESELECTING = -1, NORMAL = 0, SELECTING = 1 };
+    using const_iterator = std::map<int32_t, State>::const_iterator;
+
+    SelectState();
+    ~SelectState();
+
+    void Add(int32_t nItemIndex);
+    void Add(int32_t nBeginIndex, int32_t nEndIndex);
+    void Sub(int32_t nItemIndex);
+    void Sub(int32_t nBeginIndex, int32_t nEndIndex);
+    void DeselectAll();
+    void Done();
+
+    const_iterator begin() const { return m_Items.begin(); }
+    const_iterator end() const { return m_Items.end(); }
+
+   private:
+    std::map<int32_t, State> m_Items;
+  };
+
   CFX_PointF InToOut(const CFX_PointF& point) const;
   CFX_PointF OutToIn(const CFX_PointF& point) const;
   CFX_FloatRect InToOut(const CFX_FloatRect& rect) const;
@@ -160,7 +160,7 @@
   int32_t m_nSelItem = -1;
 
   // For multiple:
-  CPLST_Select m_aSelItems;
+  SelectState m_SelectState;
   int32_t m_nFootIndex = -1;
   int32_t m_nCaretIndex = -1;
   bool m_bCtrlSel = false;