| 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/fxfa/app/xfa_ffchoicelist.h" | 7 #include "xfa/fxfa/app/xfa_ffchoicelist.h" |
| 8 | 8 |
| 9 #include "xfa/fwl/basewidget/ifwl_edit.h" | 9 #include "xfa/fwl/basewidget/ifwl_edit.h" |
| 10 #include "xfa/fwl/core/fwl_noteimp.h" | 10 #include "xfa/fwl/core/fwl_noteimp.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 CFX_Int32Array iSelArray; | 55 CFX_Int32Array iSelArray; |
| 56 m_pDataAcc->GetSelectedItems(iSelArray); | 56 m_pDataAcc->GetSelectedItems(iSelArray); |
| 57 int32_t iSelCount = iSelArray.GetSize(); | 57 int32_t iSelCount = iSelArray.GetSize(); |
| 58 for (int32_t j = 0; j < iSelCount; j++) { | 58 for (int32_t j = 0; j < iSelCount; j++) { |
| 59 FWL_HLISTITEM item = pListBox->GetItem(iSelArray[j]); | 59 FWL_HLISTITEM item = pListBox->GetItem(iSelArray[j]); |
| 60 pListBox->SetSelItem(item, TRUE); | 60 pListBox->SetSelItem(item, TRUE); |
| 61 } | 61 } |
| 62 m_pNormalWidget->UnlockUpdate(); | 62 m_pNormalWidget->UnlockUpdate(); |
| 63 return CXFA_FFField::LoadWidget(); | 63 return CXFA_FFField::LoadWidget(); |
| 64 } | 64 } |
| 65 |
| 65 FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { | 66 FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) { |
| 66 FX_BOOL flag = ProcessCommittedData(); | 67 if (!ProcessCommittedData()) |
| 67 if (!flag) { | |
| 68 UpdateFWLData(); | 68 UpdateFWLData(); |
| 69 } | |
| 70 CXFA_FFField::OnKillFocus(pNewFocus); | 69 CXFA_FFField::OnKillFocus(pNewFocus); |
| 71 return TRUE; | 70 return TRUE; |
| 72 } | 71 } |
| 72 |
| 73 FX_BOOL CXFA_FFListBox::CommitData() { | 73 FX_BOOL CXFA_FFListBox::CommitData() { |
| 74 CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget); | 74 CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget); |
| 75 int32_t iSels = pListBox->CountSelItems(); | 75 int32_t iSels = pListBox->CountSelItems(); |
| 76 CFX_Int32Array iSelArray; | 76 CFX_Int32Array iSelArray; |
| 77 for (int32_t i = 0; i < iSels; i++) { | 77 for (int32_t i = 0; i < iSels; ++i) |
| 78 iSelArray.Add(pListBox->GetSelIndex(i)); | 78 iSelArray.Add(pListBox->GetSelIndex(i)); |
| 79 } | 79 m_pDataAcc->SetSelectedItems(iSelArray, true, FALSE, TRUE); |
| 80 m_pDataAcc->SetSelectedItems(iSelArray, TRUE); | |
| 81 return TRUE; | 80 return TRUE; |
| 82 } | 81 } |
| 82 |
| 83 FX_BOOL CXFA_FFListBox::IsDataChanged() { | 83 FX_BOOL CXFA_FFListBox::IsDataChanged() { |
| 84 CFX_Int32Array iSelArray; | 84 CFX_Int32Array iSelArray; |
| 85 m_pDataAcc->GetSelectedItems(iSelArray); | 85 m_pDataAcc->GetSelectedItems(iSelArray); |
| 86 int32_t iOldSels = iSelArray.GetSize(); | 86 int32_t iOldSels = iSelArray.GetSize(); |
| 87 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; | 87 CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget; |
| 88 int32_t iSels = pListBox->CountSelItems(); | 88 int32_t iSels = pListBox->CountSelItems(); |
| 89 if (iOldSels == iSels) { | 89 if (iOldSels != iSels) |
| 90 int32_t iIndex = 0; | 90 return TRUE; |
| 91 for (; iIndex < iSels; iIndex++) { | 91 |
| 92 FWL_HLISTITEM hlistItem = pListBox->GetItem(iSelArray[iIndex]); | 92 for (int32_t i = 0; i < iSels; ++i) { |
| 93 if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected)) { | 93 FWL_HLISTITEM hlistItem = pListBox->GetItem(iSelArray[i]); |
| 94 break; | 94 if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected)) |
| 95 } | 95 return TRUE; |
| 96 } | |
| 97 if (iIndex == iSels) { | |
| 98 return FALSE; | |
| 99 } | |
| 100 } | 96 } |
| 101 return TRUE; | 97 return FALSE; |
| 102 } | 98 } |
| 99 |
| 103 uint32_t CXFA_FFListBox::GetAlignment() { | 100 uint32_t CXFA_FFListBox::GetAlignment() { |
| 104 uint32_t dwExtendedStyle = 0; | 101 uint32_t dwExtendedStyle = 0; |
| 105 if (CXFA_Para para = m_pDataAcc->GetPara()) { | 102 if (CXFA_Para para = m_pDataAcc->GetPara()) { |
| 106 int32_t iHorz = para.GetHorizontalAlign(); | 103 int32_t iHorz = para.GetHorizontalAlign(); |
| 107 switch (iHorz) { | 104 switch (iHorz) { |
| 108 case XFA_ATTRIBUTEENUM_Center: | 105 case XFA_ATTRIBUTEENUM_Center: |
| 109 dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign; | 106 dwExtendedStyle |= FWL_STYLEEXT_LTB_CenterAlign; |
| 110 break; | 107 break; |
| 111 case XFA_ATTRIBUTEENUM_Justify: | 108 case XFA_ATTRIBUTEENUM_Justify: |
| 112 break; | 109 break; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 default: | 523 default: |
| 527 break; | 524 break; |
| 528 } | 525 } |
| 529 m_pOldDelegate->OnProcessEvent(pEvent); | 526 m_pOldDelegate->OnProcessEvent(pEvent); |
| 530 } | 527 } |
| 531 | 528 |
| 532 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, | 529 void CXFA_FFComboBox::OnDrawWidget(CFX_Graphics* pGraphics, |
| 533 const CFX_Matrix* pMatrix) { | 530 const CFX_Matrix* pMatrix) { |
| 534 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); | 531 m_pOldDelegate->OnDrawWidget(pGraphics, pMatrix); |
| 535 } | 532 } |
| OLD | NEW |