void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_ComboBox* pWnd = static_cast<CPWL_ComboBox*>(GetPDFWindow(pPageView, false)); if (!pWnd) return; CFX_WideString swText = pWnd->GetText(); int32_t nCurSel = pWnd->GetSelect(); bool bSetValue = false; if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) bSetValue = (nCurSel < 0) || (swText != m_pWidget->GetOptionLabel(nCurSel)); if (bSetValue) { m_pWidget->SetValue(swText, false); } else { m_pWidget->GetSelectedIndex(0); m_pWidget->SetOptionSelection(nCurSel, true, false); } m_pWidget->ResetFieldAppearance(true); m_pWidget->UpdateField(); SetChangeMark(); m_pWidget->GetPDFPage(); }
void CFFL_CheckBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_CheckBox* pWnd = GetCheckBox(pPageView, false); if (!pWnd) return; bool bNewChecked = pWnd->IsChecked(); if (bNewChecked) { CPDF_FormField* pField = m_pWidget->GetFormField(); for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { if (pCtrl->IsChecked()) { break; } } } } CPDFSDK_Widget::ObservedPtr observed_widget(m_pWidget.Get()); CFFL_CheckBox::ObservedPtr observed_this(this); m_pWidget->SetCheck(bNewChecked, NotificationOption::kDoNotNotify); if (!observed_widget) return; m_pWidget->UpdateField(); if (!observed_widget || !observed_this) return; SetChangeMark(); }
void CFFL_RadioButton::SaveData(CPDFSDK_PageView* pPageView) { ASSERT(m_pWidget != NULL); if (CPWL_RadioButton* pWnd = (CPWL_RadioButton*)GetPDFWindow(pPageView, FALSE)) { FX_BOOL bNewChecked = pWnd->IsChecked(); if (bNewChecked) { CPDF_FormField* pField = m_pWidget->GetFormField(); ASSERT(pField != NULL); for (int32_t i = 0, sz = pField->CountControls(); i < sz; i++) { if (CPDF_FormControl* pCtrl = pField->GetControl(i)) { if (pCtrl->IsChecked()) { break; } } } } m_pWidget->SetCheck(bNewChecked, FALSE); m_pWidget->UpdateField(); SetChangeMark(); } }
void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, false)) { CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); m_pWidget->SetValue(sNewValue, false); m_pWidget->ResetFieldAppearance(true); m_pWidget->UpdateField(); SetChangeMark(); } }
void CFFL_ComboBox::SaveData(CPDFSDK_PageView* pPageView) { ASSERT(m_pWidget != NULL); if (CPWL_ComboBox* pWnd = (CPWL_ComboBox*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString swText = pWnd->GetText(); FX_INT32 nCurSel = pWnd->GetSelect(); //mantis:0004157 FX_BOOL bSetValue = TRUE; if (m_pWidget->GetFieldFlags() & FIELDFLAG_EDIT) { if (nCurSel >= 0) { if (swText != m_pWidget->GetOptionLabel(nCurSel)) bSetValue = TRUE; else bSetValue = FALSE; } else bSetValue = TRUE; } else bSetValue = FALSE; CFX_WideString sOldValue; if (bSetValue) { sOldValue = m_pWidget->GetValue(); m_pWidget->SetValue(swText, FALSE); } else { m_pWidget->GetSelectedIndex(0); m_pWidget->SetOptionSelection(nCurSel, TRUE, FALSE); } m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); m_pWidget->GetPDFPage(); } }
void CFFL_TextField::SaveData(CPDFSDK_PageView* pPageView) { ASSERT(m_pWidget != NULL); if (CPWL_Edit* pWnd = (CPWL_Edit*)GetPDFWindow(pPageView, FALSE)) { CFX_WideString sOldValue = m_pWidget->GetValue(); CFX_WideString sNewValue = pWnd->GetText(); m_pWidget->SetValue(sNewValue, FALSE); m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); } }
void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { ASSERT(m_pWidget != NULL); if (CPWL_ListBox* pListBox = (CPWL_ListBox*)GetPDFWindow(pPageView, FALSE)) { CFX_IntArray aOldSelect, aNewSelect; { for (int i=0,sz=m_pWidget->CountOptions(); i<sz; i++) { if (m_pWidget->IsOptionSelected(i)) { aOldSelect.Add(i); } } } int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); m_pWidget->ClearSelection(FALSE); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { for (int32_t i=0,sz=pListBox->GetCount(); i<sz; i++) { if (pListBox->IsItemSelected(i)) { m_pWidget->SetOptionSelection(i, TRUE, FALSE); aNewSelect.Add(i); } } } else { m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); aNewSelect.Add(pListBox->GetCurSel()); } m_pWidget->SetTopVisibleIndex(nNewTopIndex); m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); } }
void CFFL_ListBox::SaveData(CPDFSDK_PageView* pPageView) { CPWL_ListBox* pListBox = static_cast<CPWL_ListBox*>(GetPDFWindow(pPageView, FALSE)); if (!pListBox) return; int32_t nNewTopIndex = pListBox->GetTopVisibleIndex(); m_pWidget->ClearSelection(FALSE); if (m_pWidget->GetFieldFlags() & FIELDFLAG_MULTISELECT) { for (int32_t i = 0, sz = pListBox->GetCount(); i < sz; i++) { if (pListBox->IsItemSelected(i)) m_pWidget->SetOptionSelection(i, TRUE, FALSE); } } else { m_pWidget->SetOptionSelection(pListBox->GetCurSel(), TRUE, FALSE); } m_pWidget->SetTopVisibleIndex(nNewTopIndex); m_pWidget->ResetFieldAppearance(TRUE); m_pWidget->UpdateField(); SetChangeMark(); }