From 6db6df7735febef44a8b82ed2bd3ff038d4b8698 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 30 Jan 2017 11:00:19 -0800 Subject: Remove CFX_ArrayTemplate from CFFL_ListBox Change-Id: Id7eac9163582d05bce3115408a66e63953d7093b Reviewed-on: https://pdfium-review.googlesource.com/2453 Commit-Queue: dsinclair Reviewed-by: dsinclair --- fpdfsdk/formfiller/cffl_listbox.cpp | 25 +++++++++++++++---------- fpdfsdk/formfiller/cffl_listbox.h | 3 ++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp index bc3bb6c4ab..556e0e17d7 100644 --- a/fpdfsdk/formfiller/cffl_listbox.cpp +++ b/fpdfsdk/formfiller/cffl_listbox.cpp @@ -167,20 +167,25 @@ void CFFL_ListBox::GetActionData(CPDFSDK_PageView* pPageView, void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) { ASSERT(pPageView); - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { - for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { - if (pListBox->IsItemSelected(i)) { - m_State.Add(i); - } - } + CPWL_ListBox* pListBox = + static_cast(GetPDFWindow(pPageView, false)); + if (!pListBox) + return; + + for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { + if (pListBox->IsItemSelected(i)) + m_State.push_back(i); } } void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) { - if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, false)) { - for (int i = 0, sz = m_State.GetSize(); i < sz; i++) - pListBox->Select(m_State[i]); - } + CPWL_ListBox* pListBox = + static_cast(GetPDFWindow(pPageView, false)); + if (!pListBox) + return; + + for (const auto& item : m_State) + pListBox->Select(item); } CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/formfiller/cffl_listbox.h b/fpdfsdk/formfiller/cffl_listbox.h index e97ede0deb..609f2c4809 100644 --- a/fpdfsdk/formfiller/cffl_listbox.h +++ b/fpdfsdk/formfiller/cffl_listbox.h @@ -9,6 +9,7 @@ #include #include +#include #include "fpdfsdk/formfiller/cffl_formfiller.h" @@ -37,7 +38,7 @@ class CFFL_ListBox : public CFFL_FormFiller { private: std::unique_ptr m_pFontMap; std::set m_OriginSelections; - CFX_ArrayTemplate m_State; + std::vector m_State; }; #endif // FPDFSDK_FORMFILLER_CFFL_LISTBOX_H_ -- cgit v1.2.3