| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "../../include/formfiller/FormFiller.h" | 7 #include "../../include/formfiller/FormFiller.h" |
| 8 #include "../../include/formfiller/FFL_FormFiller.h" | 8 #include "../../include/formfiller/FFL_FormFiller.h" |
| 9 #include "../../include/formfiller/FFL_ListBox.h" | 9 #include "../../include/formfiller/FFL_ListBox.h" |
| 10 //#include "../../include/formfiller/FFL_Module.h" | 10 //#include "../../include/formfiller/FFL_Module.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView
* pPageView) | 69 CPWL_Wnd* CFFL_ListBox::NewPDFWindow(const PWL_CREATEPARAM& cp, CPDFSDK_PageView
* pPageView) |
| 70 { | 70 { |
| 71 CPWL_ListBox* pWnd = new CPWL_ListBox(); | 71 CPWL_ListBox* pWnd = new CPWL_ListBox(); |
| 72 pWnd->AttachFFLData(this); | 72 pWnd->AttachFFLData(this); |
| 73 pWnd->Create(cp); | 73 pWnd->Create(cp); |
| 74 | 74 |
| 75 ASSERT(m_pApp != NULL); | 75 ASSERT(m_pApp != NULL); |
| 76 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); | 76 CFFL_IFormFiller* pIFormFiller = m_pApp->GetIFormFiller(); |
| 77 pWnd->SetFillerNotify(pIFormFiller); | 77 pWnd->SetFillerNotify(pIFormFiller); |
| 78 | 78 |
| 79 » for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) | 79 » for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) |
| 80 pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); | 80 pWnd->AddString(m_pWidget->GetOptionLabel(i).c_str()); |
| 81 | 81 |
| 82 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) | 82 if (pWnd->HasFlag(PLBS_MULTIPLESEL)) |
| 83 { | 83 { |
| 84 m_OriginSelections.RemoveAll(); | 84 m_OriginSelections.RemoveAll(); |
| 85 | 85 |
| 86 FX_BOOL bSetCaret = FALSE; | 86 FX_BOOL bSetCaret = FALSE; |
| 87 » » for (FX_INT32 i=0,sz=m_pWidget->CountOptions(); i<sz; i++) | 87 » » for (int32_t i=0,sz=m_pWidget->CountOptions(); i<sz; i++) |
| 88 { | 88 { |
| 89 if (m_pWidget->IsOptionSelected(i)) | 89 if (m_pWidget->IsOptionSelected(i)) |
| 90 { | 90 { |
| 91 if (!bSetCaret) | 91 if (!bSetCaret) |
| 92 { | 92 { |
| 93 pWnd->SetCaret(i); | 93 pWnd->SetCaret(i); |
| 94 bSetCaret = TRUE; | 94 bSetCaret = TRUE; |
| 95 } | 95 } |
| 96 pWnd->Select(i); | 96 pWnd->Select(i); |
| 97 m_OriginSelections.SetAt(i, NULL); | 97 m_OriginSelections.SetAt(i, NULL); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 123 | 123 |
| 124 FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) | 124 FX_BOOL CFFL_ListBox::IsDataChanged(CPDFSDK_PageView* pPageView) |
| 125 { | 125 { |
| 126 ASSERT(m_pWidget != NULL); | 126 ASSERT(m_pWidget != NULL); |
| 127 | 127 |
| 128 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALS
E)) | 128 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALS
E)) |
| 129 { | 129 { |
| 130 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) | 130 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) |
| 131 { | 131 { |
| 132 int nSelCount = 0; | 132 int nSelCount = 0; |
| 133 » » » for (FX_INT32 i=0,sz=pListBox->GetCount(); i<sz; i++) | 133 » » » for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++) |
| 134 { | 134 { |
| 135 if (pListBox->IsItemSelected(i)) | 135 if (pListBox->IsItemSelected(i)) |
| 136 { | 136 { |
| 137 void* p = NULL; | 137 void* p = NULL; |
| 138 if (!m_OriginSelections.Lookup(i, p)) | 138 if (!m_OriginSelections.Lookup(i, p)) |
| 139 return TRUE; | 139 return TRUE; |
| 140 | 140 |
| 141 nSelCount++; | 141 nSelCount++; |
| 142 } | 142 } |
| 143 } | 143 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 165 for (int i=0,sz=m_pWidget->CountOptions(); i<sz; i++) | 165 for (int i=0,sz=m_pWidget->CountOptions(); i<sz; i++) |
| 166 { | 166 { |
| 167 if (m_pWidget->IsOptionSelected(i)) | 167 if (m_pWidget->IsOptionSelected(i)) |
| 168 { | 168 { |
| 169 aOldSelect.Add(i); | 169 aOldSelect.Add(i); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 } | 172 } |
| 173 | 173 |
| 174 | 174 |
| 175 » » FX_INT32 nNewTopIndex = pListBox->GetTopVisibleIndex(); | 175 » » int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); |
| 176 | 176 |
| 177 m_pWidget->ClearSelection(FALSE); | 177 m_pWidget->ClearSelection(FALSE); |
| 178 | 178 |
| 179 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) | 179 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) |
| 180 { | 180 { |
| 181 » » » for (FX_INT32 i=0,sz=pListBox->GetCount(); i<sz; i++) | 181 » » » for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++) |
| 182 { | 182 { |
| 183 if (pListBox->IsItemSelected(i)) | 183 if (pListBox->IsItemSelected(i)) |
| 184 { | 184 { |
| 185 m_pWidget->SetOptionSelection(i, TRUE, F
ALSE); | 185 m_pWidget->SetOptionSelection(i, TRUE, F
ALSE); |
| 186 aNewSelect.Add(i); | 186 aNewSelect.Add(i); |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 } | 189 } |
| 190 else | 190 else |
| 191 { | 191 { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 208 case CPDF_AAction::Validate: | 208 case CPDF_AAction::Validate: |
| 209 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) | 209 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) |
| 210 { | 210 { |
| 211 fa.sValue = L""; | 211 fa.sValue = L""; |
| 212 } | 212 } |
| 213 else | 213 else |
| 214 { | 214 { |
| 215 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow
(pPageView, FALSE)) | 215 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow
(pPageView, FALSE)) |
| 216 { | 216 { |
| 217 ASSERT(m_pWidget != NULL); | 217 ASSERT(m_pWidget != NULL); |
| 218 » » » » FX_INT32 nCurSel = pListBox->GetCurSel(); | 218 » » » » int32_t nCurSel = pListBox->GetCurSel(); |
| 219 if (nCurSel >= 0) | 219 if (nCurSel >= 0) |
| 220 fa.sValue = m_pWidget->GetOptionLabel(nC
urSel); | 220 fa.sValue = m_pWidget->GetOptionLabel(nC
urSel); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 break; | 223 break; |
| 224 case CPDF_AAction::LoseFocus: | 224 case CPDF_AAction::LoseFocus: |
| 225 case CPDF_AAction::GetFocus: | 225 case CPDF_AAction::GetFocus: |
| 226 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) | 226 if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) |
| 227 { | 227 { |
| 228 fa.sValue = L""; | 228 fa.sValue = L""; |
| 229 } | 229 } |
| 230 else | 230 else |
| 231 { | 231 { |
| 232 ASSERT(m_pWidget != NULL); | 232 ASSERT(m_pWidget != NULL); |
| 233 » » » FX_INT32 nCurSel = m_pWidget->GetSelectedIndex(0); | 233 » » » int32_t nCurSel = m_pWidget->GetSelectedIndex(0); |
| 234 if (nCurSel >= 0) | 234 if (nCurSel >= 0) |
| 235 fa.sValue = m_pWidget->GetOptionLabel(nCurSel); | 235 fa.sValue = m_pWidget->GetOptionLabel(nCurSel); |
| 236 } | 236 } |
| 237 break; | 237 break; |
| 238 default: | 238 default: |
| 239 break; | 239 break; |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 | 243 |
| 244 void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct
ionType type, | 244 void CFFL_ListBox::SetActionData(CPDFSDK_PageView* pPageView, CPDF_AAction::AAct
ionType type, |
| 245 const PDFSDK_Fie
ldAction& fa) | 245 const PDFSDK_Fie
ldAction& fa) |
| 246 { | 246 { |
| 247 } | 247 } |
| 248 | 248 |
| 249 void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) | 249 void CFFL_ListBox::SaveState(CPDFSDK_PageView* pPageView) |
| 250 { | 250 { |
| 251 ASSERT(pPageView != NULL); | 251 ASSERT(pPageView != NULL); |
| 252 | 252 |
| 253 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALS
E)) | 253 if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALS
E)) |
| 254 { | 254 { |
| 255 » » for (FX_INT32 i=0,sz=pListBox->GetCount(); i<sz; i++) | 255 » » for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++) |
| 256 { | 256 { |
| 257 if (pListBox->IsItemSelected(i)) | 257 if (pListBox->IsItemSelected(i)) |
| 258 { | 258 { |
| 259 m_State.Add(i); | 259 m_State.Add(i); |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) | 265 void CFFL_ListBox::RestoreState(CPDFSDK_PageView* pPageView) |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 | 308 |
| 309 if (CommitData(pPageView, nFlag)) | 309 if (CommitData(pPageView, nFlag)) |
| 310 { | 310 { |
| 311 DestroyPDFWindow(pPageView); | 311 DestroyPDFWindow(pPageView); |
| 312 m_bValid = FALSE; | 312 m_bValid = FALSE; |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| OLD | NEW |