diff options
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index e19d47bb55..21a6d41c43 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -237,12 +237,11 @@ void CPDFSDK_InterForm::XfaSetValidationsEnabled(bool bEnabled) { m_bXfaValidationsEnabled = bEnabled; } -void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField, - bool bSynchronizeElse) { +void CPDFSDK_InterForm::SynchronizeField(CPDF_FormField* pFormField) { for (int i = 0, sz = pFormField->CountControls(); i < sz; i++) { CPDF_FormControl* pFormCtrl = pFormField->GetControl(i); if (CPDFSDK_Widget* pWidget = GetWidget(pFormCtrl)) - pWidget->Synchronize(bSynchronizeElse); + pWidget->Synchronize(false); } } #endif // PDF_ENABLE_XFA @@ -608,20 +607,17 @@ bool CPDFSDK_InterForm::DoAction_ResetForm(const CPDF_Action& action) { return m_pInterForm->ResetForm(fields, !(dwFlags & 0x01), true); } -bool CPDFSDK_InterForm::DoAction_ImportData(const CPDF_Action& action) { - return false; -} - std::vector<CPDF_FormField*> CPDFSDK_InterForm::GetFieldFromObjects( const std::vector<CPDF_Object*>& objects) const { std::vector<CPDF_FormField*> fields; for (CPDF_Object* pObject : objects) { - if (pObject && pObject->IsString()) { - WideString csName = pObject->GetUnicodeText(); - CPDF_FormField* pField = m_pInterForm->GetField(0, csName); - if (pField) - fields.push_back(pField); - } + if (!pObject || !pObject->IsString()) + continue; + + WideString csName = pObject->GetUnicodeText(); + CPDF_FormField* pField = m_pInterForm->GetField(0, csName); + if (pField) + fields.push_back(pField); } return fields; } @@ -631,41 +627,37 @@ int CPDFSDK_InterForm::BeforeValueChange(CPDF_FormField* pField, FormFieldType fieldType = pField->GetFieldType(); if (!IsFormFieldTypeComboOrText(fieldType)) return 0; - if (!OnKeyStrokeCommit(pField, csValue)) return -1; - if (!OnValidate(pField, csValue)) return -1; - return 1; } void CPDFSDK_InterForm::AfterValueChange(CPDF_FormField* pField) { #ifdef PDF_ENABLE_XFA - SynchronizeField(pField, false); + SynchronizeField(pField); #endif // PDF_ENABLE_XFA + FormFieldType fieldType = pField->GetFieldType(); - if (IsFormFieldTypeComboOrText(fieldType)) { - OnCalculate(pField); - bool bFormatted = false; - WideString sValue = OnFormat(pField, bFormatted); - ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true); - UpdateField(pField); - } + if (!IsFormFieldTypeComboOrText(fieldType)) + return; + + OnCalculate(pField); + bool bFormatted = false; + WideString sValue = OnFormat(pField, bFormatted); + ResetFieldAppearance(pField, bFormatted ? &sValue : nullptr, true); + UpdateField(pField); } int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField, const WideString& csValue) { if (pField->GetFieldType() != FormFieldType::kListBox) return 0; - if (!OnKeyStrokeCommit(pField, csValue)) return -1; - if (!OnValidate(pField, csValue)) return -1; - return 1; } |