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 /xfa | |
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 'xfa')
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcheckbutton.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffcombobox.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimageedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffimageedit.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fflistbox.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fflistbox.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpushbutton.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffpushbutton.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffsignature.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffsignature.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_fftextedit.h | 1 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.cpp | 4 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffwidget.h | 3 |
16 files changed, 42 insertions, 0 deletions
diff --git a/xfa/fxfa/cxfa_ffcheckbutton.cpp b/xfa/fxfa/cxfa_ffcheckbutton.cpp index 699f3fe988..69b5d6f943 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.cpp +++ b/xfa/fxfa/cxfa_ffcheckbutton.cpp @@ -344,3 +344,7 @@ void CXFA_FFCheckButton::OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { m_pOldDelegate->OnDrawWidget(pGraphics, matrix); } + +FormFieldType CXFA_FFCheckButton::GetFormFieldType() { + return FormFieldType::kXFA_CheckBox; +} diff --git a/xfa/fxfa/cxfa_ffcheckbutton.h b/xfa/fxfa/cxfa_ffcheckbutton.h index 9b469bd7c3..f841d78ba4 100644 --- a/xfa/fxfa/cxfa_ffcheckbutton.h +++ b/xfa/fxfa/cxfa_ffcheckbutton.h @@ -29,6 +29,7 @@ class CXFA_FFCheckButton : public CXFA_FFField { void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; + FormFieldType GetFormFieldType() override; void SetFWLCheckState(XFA_CHECKSTATE eCheckState); diff --git a/xfa/fxfa/cxfa_ffcombobox.cpp b/xfa/fxfa/cxfa_ffcombobox.cpp index 5d0792b56d..4c024fbdef 100644 --- a/xfa/fxfa/cxfa_ffcombobox.cpp +++ b/xfa/fxfa/cxfa_ffcombobox.cpp @@ -266,6 +266,10 @@ void CXFA_FFComboBox::DeSelect() { ToComboBox(m_pNormalWidget.get())->EditDeSelect(); } +FormFieldType CXFA_FFComboBox::GetFormFieldType() { + return FormFieldType::kXFA_ComboBox; +} + void CXFA_FFComboBox::SetItemState(int32_t nIndex, bool bSelected) { ToComboBox(m_pNormalWidget.get())->SetCurSel(bSelected ? nIndex : -1); m_pNormalWidget->Update(); diff --git a/xfa/fxfa/cxfa_ffcombobox.h b/xfa/fxfa/cxfa_ffcombobox.h index c4bf6e9756..a20319e3b1 100644 --- a/xfa/fxfa/cxfa_ffcombobox.h +++ b/xfa/fxfa/cxfa_ffcombobox.h @@ -35,6 +35,7 @@ class CXFA_FFComboBox : public CXFA_FFField { void SelectAll() override; void Delete() override; void DeSelect() override; + FormFieldType GetFormFieldType() override; // IFWL_WidgetDelegate void OnProcessMessage(CFWL_Message* pMessage) override; diff --git a/xfa/fxfa/cxfa_ffimageedit.cpp b/xfa/fxfa/cxfa_ffimageedit.cpp index 681370edf5..0e97559e6a 100644 --- a/xfa/fxfa/cxfa_ffimageedit.cpp +++ b/xfa/fxfa/cxfa_ffimageedit.cpp @@ -147,3 +147,7 @@ void CXFA_FFImageEdit::OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { m_pOldDelegate->OnDrawWidget(pGraphics, matrix); } + +FormFieldType CXFA_FFImageEdit::GetFormFieldType() { + return FormFieldType::kXFA_ImageField; +} diff --git a/xfa/fxfa/cxfa_ffimageedit.h b/xfa/fxfa/cxfa_ffimageedit.h index 436435d55b..a7ef6a8c27 100644 --- a/xfa/fxfa/cxfa_ffimageedit.h +++ b/xfa/fxfa/cxfa_ffimageedit.h @@ -25,6 +25,7 @@ class CXFA_FFImageEdit : public CXFA_FFField { void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; + FormFieldType GetFormFieldType() override; private: void SetFWLRect() override; diff --git a/xfa/fxfa/cxfa_fflistbox.cpp b/xfa/fxfa/cxfa_fflistbox.cpp index 1a7b11bf64..ce9198a5d3 100644 --- a/xfa/fxfa/cxfa_fflistbox.cpp +++ b/xfa/fxfa/cxfa_fflistbox.cpp @@ -208,3 +208,7 @@ void CXFA_FFListBox::OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) { m_pOldDelegate->OnDrawWidget(pGraphics, matrix); } + +FormFieldType CXFA_FFListBox::GetFormFieldType() { + return FormFieldType::kXFA_ListBox; +} diff --git a/xfa/fxfa/cxfa_fflistbox.h b/xfa/fxfa/cxfa_fflistbox.h index 11c77612ce..27f1cdb8a4 100644 --- a/xfa/fxfa/cxfa_fflistbox.h +++ b/xfa/fxfa/cxfa_fflistbox.h @@ -21,6 +21,7 @@ class CXFA_FFListBox : public CXFA_FFField { void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; + FormFieldType GetFormFieldType() override; void OnSelectChanged(CFWL_Widget* pWidget); void SetItemState(int32_t nIndex, bool bSelected); diff --git a/xfa/fxfa/cxfa_ffpushbutton.cpp b/xfa/fxfa/cxfa_ffpushbutton.cpp index 97078a6f75..fdf7512d08 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.cpp +++ b/xfa/fxfa/cxfa_ffpushbutton.cpp @@ -239,3 +239,7 @@ void CXFA_FFPushButton::OnDrawWidget(CXFA_Graphics* pGraphics, } } } + +FormFieldType CXFA_FFPushButton::GetFormFieldType() { + return FormFieldType::kXFA_PushButton; +} diff --git a/xfa/fxfa/cxfa_ffpushbutton.h b/xfa/fxfa/cxfa_ffpushbutton.h index ba2d02318f..9b2a0ee4cc 100644 --- a/xfa/fxfa/cxfa_ffpushbutton.h +++ b/xfa/fxfa/cxfa_ffpushbutton.h @@ -34,6 +34,7 @@ class CXFA_FFPushButton : public CXFA_FFField { void OnProcessEvent(CFWL_Event* pEvent) override; void OnDrawWidget(CXFA_Graphics* pGraphics, const CFX_Matrix& matrix) override; + FormFieldType GetFormFieldType() override; private: void LoadHighlightCaption(); diff --git a/xfa/fxfa/cxfa_ffsignature.cpp b/xfa/fxfa/cxfa_ffsignature.cpp index 3b373a9e66..6e56b38ad1 100644 --- a/xfa/fxfa/cxfa_ffsignature.cpp +++ b/xfa/fxfa/cxfa_ffsignature.cpp @@ -110,3 +110,7 @@ FWL_WidgetHit CXFA_FFSignature::OnHitTest(const CFX_PointF& point) { bool CXFA_FFSignature::OnSetCursor(const CFX_PointF& point) { return false; } + +FormFieldType CXFA_FFSignature::GetFormFieldType() { + return FormFieldType::kXFA_Signature; +} diff --git a/xfa/fxfa/cxfa_ffsignature.h b/xfa/fxfa/cxfa_ffsignature.h index af26004c71..bd09576af4 100644 --- a/xfa/fxfa/cxfa_ffsignature.h +++ b/xfa/fxfa/cxfa_ffsignature.h @@ -37,6 +37,7 @@ class CXFA_FFSignature final : public CXFA_FFField { bool OnChar(uint32_t dwChar, uint32_t dwFlags) override; FWL_WidgetHit OnHitTest(const CFX_PointF& point) override; bool OnSetCursor(const CFX_PointF& point) override; + FormFieldType GetFormFieldType() override; }; #endif // XFA_FXFA_CXFA_FFSIGNATURE_H_ diff --git a/xfa/fxfa/cxfa_fftextedit.cpp b/xfa/fxfa/cxfa_fftextedit.cpp index 3429d97749..fad9a9b37a 100644 --- a/xfa/fxfa/cxfa_fftextedit.cpp +++ b/xfa/fxfa/cxfa_fftextedit.cpp @@ -423,3 +423,7 @@ void CXFA_FFTextEdit::Delete() { void CXFA_FFTextEdit::DeSelect() { ToEdit(m_pNormalWidget.get())->ClearSelection(); } + +FormFieldType CXFA_FFTextEdit::GetFormFieldType() { + return FormFieldType::kXFA_TextField; +} diff --git a/xfa/fxfa/cxfa_fftextedit.h b/xfa/fxfa/cxfa_fftextedit.h index d6bc131ffe..e8edb4691f 100644 --- a/xfa/fxfa/cxfa_fftextedit.h +++ b/xfa/fxfa/cxfa_fftextedit.h @@ -57,6 +57,7 @@ class CXFA_FFTextEdit : public CXFA_FFField { void SelectAll() override; void Delete() override; void DeSelect() override; + FormFieldType GetFormFieldType() override; protected: uint32_t GetAlignment(); diff --git a/xfa/fxfa/cxfa_ffwidget.cpp b/xfa/fxfa/cxfa_ffwidget.cpp index e28aa4314e..1024004158 100644 --- a/xfa/fxfa/cxfa_ffwidget.cpp +++ b/xfa/fxfa/cxfa_ffwidget.cpp @@ -1187,6 +1187,10 @@ void CXFA_FFWidget::Delete() {} void CXFA_FFWidget::DeSelect() {} +FormFieldType CXFA_FFWidget::GetFormFieldType() { + return FormFieldType::kXFA; +} + void CXFA_FFWidget::GetSuggestWords(CFX_PointF pointf, std::vector<ByteString>* pWords) { pWords->clear(); diff --git a/xfa/fxfa/cxfa_ffwidget.h b/xfa/fxfa/cxfa_ffwidget.h index 50b540635f..7c21903203 100644 --- a/xfa/fxfa/cxfa_ffwidget.h +++ b/xfa/fxfa/cxfa_ffwidget.h @@ -9,6 +9,7 @@ #include <vector> +#include "core/fpdfdoc/cpdf_formfield.h" #include "core/fxcodec/fx_codec_def.h" #include "core/fxge/cfx_graphstatedata.h" #include "xfa/fwl/cfwl_app.h" @@ -134,6 +135,8 @@ class CXFA_FFWidget : public CXFA_ContentLayoutItem { virtual void Delete(); virtual void DeSelect(); + virtual FormFieldType GetFormFieldType(); + // TODO(tsepez): Implement or remove. void GetSuggestWords(CFX_PointF pointf, std::vector<ByteString>* pWords); bool ReplaceSpellCheckWord(CFX_PointF pointf, |