summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.cpp25
-rw-r--r--fpdfsdk/formfiller/cffl_listbox.h3
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<CPWL_ListBox*>(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<CPWL_ListBox*>(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 <memory>
#include <set>
+#include <vector>
#include "fpdfsdk/formfiller/cffl_formfiller.h"
@@ -37,7 +38,7 @@ class CFFL_ListBox : public CFFL_FormFiller {
private:
std::unique_ptr<CBA_FontMap> m_pFontMap;
std::set<int> m_OriginSelections;
- CFX_ArrayTemplate<int> m_State;
+ std::vector<int> m_State;
};
#endif // FPDFSDK_FORMFILLER_CFFL_LISTBOX_H_