summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app
diff options
context:
space:
mode:
Diffstat (limited to 'xfa/fxfa/app')
-rw-r--r--xfa/fxfa/app/xfa_ffcheckbutton.cpp24
-rw-r--r--xfa/fxfa/app/xfa_ffchoicelist.cpp33
2 files changed, 26 insertions, 31 deletions
diff --git a/xfa/fxfa/app/xfa_ffcheckbutton.cpp b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
index 80a4e92bda..9e174a286e 100644
--- a/xfa/fxfa/app/xfa_ffcheckbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffcheckbutton.cpp
@@ -239,12 +239,9 @@ void CXFA_FFCheckButton::RenderWidget(CFX_Graphics* pGS,
FX_BOOL CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
FX_FLOAT fx,
FX_FLOAT fy) {
- if (!m_pNormalWidget) {
- return FALSE;
- }
- if (!IsButtonDown()) {
+ if (!m_pNormalWidget || !IsButtonDown())
return FALSE;
- }
+
SetButtonDown(FALSE);
CFWL_MsgMouse ms;
ms.m_dwCmd = FWL_MouseCommand::LeftButtonUp;
@@ -256,21 +253,22 @@ FX_BOOL CXFA_FFCheckButton::OnLButtonUp(uint32_t dwFlags,
TranslateFWLMessage(&ms);
return TRUE;
}
+
XFA_CHECKSTATE CXFA_FFCheckButton::FWLState2XFAState() {
- XFA_CHECKSTATE eCheckState = XFA_CHECKSTATE_Off;
uint32_t dwState = m_pNormalWidget->GetStates();
- if (dwState & FWL_STATE_CKB_Checked) {
- eCheckState = XFA_CHECKSTATE_On;
- } else if (dwState & FWL_STATE_CKB_Neutral) {
- eCheckState = XFA_CHECKSTATE_Neutral;
- }
- return eCheckState;
+ if (dwState & FWL_STATE_CKB_Checked)
+ return XFA_CHECKSTATE_On;
+ if (dwState & FWL_STATE_CKB_Neutral)
+ return XFA_CHECKSTATE_Neutral;
+ return XFA_CHECKSTATE_Off;
}
+
FX_BOOL CXFA_FFCheckButton::CommitData() {
XFA_CHECKSTATE eCheckState = FWLState2XFAState();
- m_pDataAcc->SetCheckState(eCheckState, TRUE);
+ m_pDataAcc->SetCheckState(eCheckState, true);
return TRUE;
}
+
FX_BOOL CXFA_FFCheckButton::IsDataChanged() {
XFA_CHECKSTATE eCheckState = FWLState2XFAState();
return m_pDataAcc->GetCheckState() != eCheckState;
diff --git a/xfa/fxfa/app/xfa_ffchoicelist.cpp b/xfa/fxfa/app/xfa_ffchoicelist.cpp
index 3f8ea29a49..21f96eeb79 100644
--- a/xfa/fxfa/app/xfa_ffchoicelist.cpp
+++ b/xfa/fxfa/app/xfa_ffchoicelist.cpp
@@ -62,44 +62,41 @@ FX_BOOL CXFA_FFListBox::LoadWidget() {
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
+
FX_BOOL CXFA_FFListBox::OnKillFocus(CXFA_FFWidget* pNewFocus) {
- FX_BOOL flag = ProcessCommittedData();
- if (!flag) {
+ if (!ProcessCommittedData())
UpdateFWLData();
- }
CXFA_FFField::OnKillFocus(pNewFocus);
return TRUE;
}
+
FX_BOOL CXFA_FFListBox::CommitData() {
CFWL_ListBox* pListBox = static_cast<CFWL_ListBox*>(m_pNormalWidget);
int32_t iSels = pListBox->CountSelItems();
CFX_Int32Array iSelArray;
- for (int32_t i = 0; i < iSels; i++) {
+ for (int32_t i = 0; i < iSels; ++i)
iSelArray.Add(pListBox->GetSelIndex(i));
- }
- m_pDataAcc->SetSelectedItems(iSelArray, TRUE);
+ m_pDataAcc->SetSelectedItems(iSelArray, true, FALSE, TRUE);
return TRUE;
}
+
FX_BOOL CXFA_FFListBox::IsDataChanged() {
CFX_Int32Array iSelArray;
m_pDataAcc->GetSelectedItems(iSelArray);
int32_t iOldSels = iSelArray.GetSize();
CFWL_ListBox* pListBox = (CFWL_ListBox*)m_pNormalWidget;
int32_t iSels = pListBox->CountSelItems();
- if (iOldSels == iSels) {
- int32_t iIndex = 0;
- for (; iIndex < iSels; iIndex++) {
- FWL_HLISTITEM hlistItem = pListBox->GetItem(iSelArray[iIndex]);
- if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected)) {
- break;
- }
- }
- if (iIndex == iSels) {
- return FALSE;
- }
+ if (iOldSels != iSels)
+ return TRUE;
+
+ for (int32_t i = 0; i < iSels; ++i) {
+ FWL_HLISTITEM hlistItem = pListBox->GetItem(iSelArray[i]);
+ if (!(pListBox->GetItemStates(hlistItem) && FWL_ITEMSTATE_LTB_Selected))
+ return TRUE;
}
- return TRUE;
+ return FALSE;
}
+
uint32_t CXFA_FFListBox::GetAlignment() {
uint32_t dwExtendedStyle = 0;
if (CXFA_Para para = m_pDataAcc->GetPara()) {