summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/formfiller/FFL_ListBox.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
committerLei Zhang <thestig@chromium.org>2015-06-19 18:11:07 -0700
commit606346f584700bdae0741066f2e6d2481744032c (patch)
tree8f6afe79644cc515795af83dc8a06b207afb1bd6 /fpdfsdk/src/formfiller/FFL_ListBox.cpp
parent6d8b1c2c7b1cbada20109f70ae971a4192330bb5 (diff)
downloadpdfium-606346f584700bdae0741066f2e6d2481744032c.tar.xz
Merge to XFA: Replace some CFX_MapPtrTemplates with std::map.
There are more CFX_MapPtrTemplate usage on the XFA branch, so it is not removed. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1181593003. (cherry picked from commit e8d3691c82d1be805ffdce3329d00313af7ce0ab) Review URL: https://codereview.chromium.org/1198663004.
Diffstat (limited to 'fpdfsdk/src/formfiller/FFL_ListBox.cpp')
-rw-r--r--fpdfsdk/src/formfiller/FFL_ListBox.cpp52
1 files changed, 21 insertions, 31 deletions
diff --git a/fpdfsdk/src/formfiller/FFL_ListBox.cpp b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
index 4622d4fcef..28dcf340ad 100644
--- a/fpdfsdk/src/formfiller/FFL_ListBox.cpp
+++ b/fpdfsdk/src/formfiller/FFL_ListBox.cpp
@@ -75,7 +75,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView
if (pWnd->HasFlag(PLBS_MULTIPLESEL))
{
- m_OriginSelections.RemoveAll();
+ m_OriginSelections.clear();
FX_BOOL bSetCaret = FALSE;
for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++)
@@ -88,7 +88,7 @@ CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView
bSetCaret = TRUE;
}
pWnd->Select(i);
- m_OriginSelections.SetAt(i, NULL);
+ m_OriginSelections.insert(i);
}
}
}
@@ -115,36 +115,26 @@ FX_BOOL CFFL_ListBox::OnChar(CPDFSDK_Annot* pAnnot, FX_UINT nChar, FX_UINT nFlag
return CFFL_FormFiller::OnChar(pAnnot, nChar, nFlags);
}
-FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView)
+FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView)
{
- ASSERT(m_pWidget != NULL);
-
- if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE))
- {
- if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT)
- {
- int nSelCount = 0;
- for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++)
- {
- if (pListBox->IsItemSelected(i))
- {
- void* p = NULL;
- if (!m_OriginSelections.Lookup(i, p))
- return TRUE;
-
- nSelCount++;
- }
- }
-
- return nSelCount != m_OriginSelections.GetCount();
- }
- else
- {
- return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
- }
- }
-
- return FALSE;
+ CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE);
+ if (!pListBox)
+ return FALSE;
+
+ if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) {
+ int nSelCount = 0;
+ for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; ++i) {
+ if (pListBox->IsItemSelected(i)) {
+ if (m_OriginSelections.count(i) == 0)
+ return TRUE;
+
+ nSelCount++;
+ }
+ }
+
+ return nSelCount != m_OriginSelections.size();
+ }
+ return pListBox->GetCurSel() != m_pWidget->GetSelectedIndex(0);
}
void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView)