diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-01-16 16:06:45 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-16 16:06:45 +0000 |
commit | 2056fac754e679baea695390854fe7b0ce7acb28 (patch) | |
tree | b0f2b982ac2ea9d4206ecd9703eb439ad524cb32 /fpdfsdk/cpdfsdk_interform.cpp | |
parent | d3427164e7869ee9c22fcb843ab619b247cbed72 (diff) | |
download | pdfium-2056fac754e679baea695390854fe7b0ce7acb28.tar.xz |
Add support for XFA specific FormField types
This adds to form field types specific types for XFA form fields to be
used instead of the generic XFA value when possible.
BUG=pdfium:952,chromium:763129,chromium:592758
Change-Id: I8d1cff6a280d71db348b7c31a251cbe2e398ec79
Reviewed-on: https://pdfium-review.googlesource.com/22677
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'fpdfsdk/cpdfsdk_interform.cpp')
-rw-r--r-- | fpdfsdk/cpdfsdk_interform.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/fpdfsdk/cpdfsdk_interform.cpp b/fpdfsdk/cpdfsdk_interform.cpp index 04ccc35d56..1aa1174b9f 100644 --- a/fpdfsdk/cpdfsdk_interform.cpp +++ b/fpdfsdk/cpdfsdk_interform.cpp @@ -57,6 +57,24 @@ bool IsFormFieldTypeComboOrText(FormFieldType fieldType) { } } +#ifdef PDF_ENABLE_XFA +bool IsFormFieldTypeXFA(FormFieldType fieldType) { + switch (fieldType) { + case FormFieldType::kXFA: + case FormFieldType::kXFA_CheckBox: + case FormFieldType::kXFA_ComboBox: + case FormFieldType::kXFA_ImageField: + case FormFieldType::kXFA_ListBox: + case FormFieldType::kXFA_PushButton: + case FormFieldType::kXFA_Signature: + case FormFieldType::kXFA_TextField: + return true; + default: + return false; + } +} +#endif // PDF_ENABLE_XFA + } // namespace CPDFSDK_InterForm::CPDFSDK_InterForm(CPDFSDK_FormFillEnvironment* pFormFillEnv) @@ -691,6 +709,14 @@ bool CPDFSDK_InterForm::IsNeedHighLight(FormFieldType fieldType) { if (fieldType == FormFieldType::kUnknown) return false; +#ifdef PDF_ENABLE_XFA + // For the XFA fields, we need to return if the specific field type has + // highlight enabled or if the general XFA field type has it enabled. + if (IsFormFieldTypeXFA(fieldType)) { + if (!m_NeedsHighlight[static_cast<size_t>(fieldType)]) + return m_NeedsHighlight[static_cast<size_t>(FormFieldType::kXFA)]; + } +#endif // PDF_ENABLE_XFA return m_NeedsHighlight[static_cast<size_t>(fieldType)]; } @@ -720,5 +746,15 @@ FX_COLORREF CPDFSDK_InterForm::GetHighlightColor(FormFieldType fieldType) { if (fieldType == FormFieldType::kUnknown) return FXSYS_RGB(255, 255, 255); +#ifdef PDF_ENABLE_XFA + // For the XFA fields, we need to return the specific field type highlight + // colour or the general XFA field type colour if present. + if (IsFormFieldTypeXFA(fieldType)) { + if (!m_NeedsHighlight[static_cast<size_t>(fieldType)] && + m_NeedsHighlight[static_cast<size_t>(FormFieldType::kXFA)]) { + return m_HighlightColor[static_cast<size_t>(FormFieldType::kXFA)]; + } + } +#endif // PDF_ENABLE_XFA return m_HighlightColor[static_cast<size_t>(fieldType)]; } |