| 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 "xfa/fwl/core/ifwl_combobox.h" | 7 #include "xfa/fwl/core/ifwl_combobox.h" |
| 8 | 8 |
| 9 #include "third_party/base/ptr_util.h" | 9 #include "third_party/base/ptr_util.h" |
| 10 #include "xfa/fde/cfde_txtedtengine.h" | 10 #include "xfa/fde/cfde_txtedtengine.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 int32_t IFWL_ComboBox::GetEditTextLength() const { | 279 int32_t IFWL_ComboBox::GetEditTextLength() const { |
| 280 if (!m_pEdit) | 280 if (!m_pEdit) |
| 281 return -1; | 281 return -1; |
| 282 return m_pEdit->GetTextLength(); | 282 return m_pEdit->GetTextLength(); |
| 283 } | 283 } |
| 284 | 284 |
| 285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, | 285 FWL_Error IFWL_ComboBox::GetEditText(CFX_WideString& wsText, |
| 286 int32_t nStart, | 286 int32_t nStart, |
| 287 int32_t nCount) const { | 287 int32_t nCount) const { |
| 288 if (m_pEdit) { | 288 if (m_pEdit) { |
| 289 return m_pEdit->GetText(wsText, nStart, nCount); | 289 m_pEdit->GetText(wsText, nStart, nCount); |
| 290 } else if (m_pListBox) { | 290 return FWL_Error::Succeeded; |
| 291 } |
| 292 if (m_pListBox) { |
| 291 IFWL_ComboBoxDP* pData = | 293 IFWL_ComboBoxDP* pData = |
| 292 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); | 294 static_cast<IFWL_ComboBoxDP*>(m_pProperties->m_pDataProvider); |
| 293 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); | 295 CFWL_ListItem* hItem = pData->GetItem(this, m_iCurSel); |
| 294 m_pListBox->GetItemText(hItem, wsText); | 296 m_pListBox->GetItemText(hItem, wsText); |
| 295 return FWL_Error::Succeeded; | 297 return FWL_Error::Succeeded; |
| 296 } | 298 } |
| 297 return FWL_Error::Indefinite; | 299 return FWL_Error::Indefinite; |
| 298 } | 300 } |
| 299 | 301 |
| 300 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { | 302 FWL_Error IFWL_ComboBox::SetEditSelRange(int32_t nStart, int32_t nCount) { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 313 | 315 |
| 314 int32_t IFWL_ComboBox::GetEditLimit() { | 316 int32_t IFWL_ComboBox::GetEditLimit() { |
| 315 if (!m_pEdit) | 317 if (!m_pEdit) |
| 316 return -1; | 318 return -1; |
| 317 return m_pEdit->GetLimit(); | 319 return m_pEdit->GetLimit(); |
| 318 } | 320 } |
| 319 | 321 |
| 320 FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { | 322 FWL_Error IFWL_ComboBox::SetEditLimit(int32_t nLimit) { |
| 321 if (!m_pEdit) | 323 if (!m_pEdit) |
| 322 return FWL_Error::Indefinite; | 324 return FWL_Error::Indefinite; |
| 323 return m_pEdit->SetLimit(nLimit); | 325 m_pEdit->SetLimit(nLimit); |
| 324 } | 326 return FWL_Error::Succeeded; |
| 325 | |
| 326 FWL_Error IFWL_ComboBox::EditDoClipboard(int32_t iCmd) { | |
| 327 if (!m_pEdit) | |
| 328 return FWL_Error::Indefinite; | |
| 329 return m_pEdit->DoClipboard(iCmd); | |
| 330 } | 327 } |
| 331 | 328 |
| 332 bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { | 329 bool IFWL_ComboBox::EditRedo(const IFDE_TxtEdtDoRecord* pRecord) { |
| 333 return m_pEdit && m_pEdit->Redo(pRecord); | 330 return m_pEdit && m_pEdit->Redo(pRecord); |
| 334 } | 331 } |
| 335 | 332 |
| 336 bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { | 333 bool IFWL_ComboBox::EditUndo(const IFDE_TxtEdtDoRecord* pRecord) { |
| 337 return m_pEdit && m_pEdit->Undo(pRecord); | 334 return m_pEdit && m_pEdit->Undo(pRecord); |
| 338 } | 335 } |
| 339 | 336 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 | 392 |
| 396 bool IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { | 393 bool IFWL_ComboBox::EditCut(CFX_WideString& wsCut) { |
| 397 return m_pEdit->Cut(wsCut); | 394 return m_pEdit->Cut(wsCut); |
| 398 } | 395 } |
| 399 | 396 |
| 400 bool IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { | 397 bool IFWL_ComboBox::EditPaste(const CFX_WideString& wsPaste) { |
| 401 return m_pEdit->Paste(wsPaste); | 398 return m_pEdit->Paste(wsPaste); |
| 402 } | 399 } |
| 403 | 400 |
| 404 bool IFWL_ComboBox::EditSelectAll() { | 401 bool IFWL_ComboBox::EditSelectAll() { |
| 405 return m_pEdit->AddSelRange(0) == FWL_Error::Succeeded; | 402 m_pEdit->AddSelRange(0); |
| 403 return true; |
| 406 } | 404 } |
| 407 | 405 |
| 408 bool IFWL_ComboBox::EditDelete() { | 406 bool IFWL_ComboBox::EditDelete() { |
| 409 return m_pEdit->ClearText() == FWL_Error::Succeeded; | 407 m_pEdit->ClearText(); |
| 408 return true; |
| 410 } | 409 } |
| 411 | 410 |
| 412 bool IFWL_ComboBox::EditDeSelect() { | 411 bool IFWL_ComboBox::EditDeSelect() { |
| 413 return m_pEdit->ClearSelections() == FWL_Error::Succeeded; | 412 m_pEdit->ClearSelections(); |
| 413 return true; |
| 414 } | 414 } |
| 415 | 415 |
| 416 FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { | 416 FWL_Error IFWL_ComboBox::GetBBox(CFX_RectF& rect) { |
| 417 if (m_pWidgetMgr->IsFormDisabled()) { | 417 if (m_pWidgetMgr->IsFormDisabled()) { |
| 418 return DisForm_GetBBox(rect); | 418 return DisForm_GetBBox(rect); |
| 419 } | 419 } |
| 420 rect = m_pProperties->m_rtWidget; | 420 rect = m_pProperties->m_rtWidget; |
| 421 if (m_pListBox && IsDropListShowed()) { | 421 if (m_pListBox && IsDropListShowed()) { |
| 422 CFX_RectF rtList; | 422 CFX_RectF rtList; |
| 423 m_pListBox->GetWidgetRect(rtList); | 423 m_pListBox->GetWidgetRect(rtList); |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 else | 1252 else |
| 1253 iCurSel++; | 1253 iCurSel++; |
| 1254 } | 1254 } |
| 1255 m_iCurSel = iCurSel; | 1255 m_iCurSel = iCurSel; |
| 1256 SynchrEditText(m_iCurSel); | 1256 SynchrEditText(m_iCurSel); |
| 1257 return; | 1257 return; |
| 1258 } | 1258 } |
| 1259 if (m_pEdit) | 1259 if (m_pEdit) |
| 1260 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); | 1260 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); |
| 1261 } | 1261 } |
| OLD | NEW |