summaryrefslogtreecommitdiff
path: root/fpdfsdk/cpdfsdk_interform.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-30 18:15:02 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-30 18:15:02 +0000
commitce047a637b5abfc5abbea90958f276946b7efdd4 (patch)
tree6b78b2d0dbc826e61bcca91f138d8afd138623ac /fpdfsdk/cpdfsdk_interform.cpp
parentbb1ee53577418429d2e30180bd941f16eea8b340 (diff)
downloadpdfium-ce047a637b5abfc5abbea90958f276946b7efdd4.tar.xz
Cleanup some SDK code
This CL cleans up nits in some SDK code. Change-Id: Id8dc5face65230e607119a65c821fcde01483ad2 Reviewed-on: https://pdfium-review.googlesource.com/24610 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r--fpdfsdk/cpdfsdk_interform.cpp46
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;
}