John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 1 | // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 4 | |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 5 | // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | |
Dan Sinclair | edbb319 | 2016-03-21 09:08:24 -0400 | [diff] [blame] | 7 | #ifndef FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_ |
| 8 | #define FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_ |
Tom Sepez | 245c80e | 2015-04-08 16:19:33 -0700 | [diff] [blame] | 9 | |
dsinclair | a52ab74 | 2016-09-29 13:59:29 -0700 | [diff] [blame] | 10 | #include "core/fxcrt/fx_string.h" |
Lei Zhang | b4fee4d | 2017-08-01 18:34:43 -0700 | [diff] [blame] | 11 | #include "fpdfsdk/formfiller/cffl_textobject.h" |
Tom Sepez | 245c80e | 2015-04-08 16:19:33 -0700 | [diff] [blame] | 12 | |
| 13 | class CBA_FontMap; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 14 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 15 | struct FFL_ComboBoxState { |
| 16 | int nIndex; |
| 17 | int nStart; |
| 18 | int nEnd; |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 19 | WideString sValue; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 20 | }; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 21 | |
Tom Sepez | 134ac91 | 2017-09-15 15:32:01 -0700 | [diff] [blame] | 22 | class CFFL_ComboBox : public CFFL_TextObject, |
| 23 | public CPWL_Wnd::FocusHandlerIface { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 24 | public: |
Lei Zhang | 4f34c64 | 2017-06-02 00:45:14 -0700 | [diff] [blame] | 25 | CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget); |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 26 | ~CFFL_ComboBox() override; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 27 | |
Lei Zhang | b4fee4d | 2017-08-01 18:34:43 -0700 | [diff] [blame] | 28 | // CFFL_TextObject: |
Tom Sepez | bf15730 | 2017-09-15 13:26:32 -0700 | [diff] [blame] | 29 | CPWL_Wnd::CreateParams GetCreateParam() override; |
| 30 | CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 31 | bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override; |
| 32 | bool IsDataChanged(CPDFSDK_PageView* pPageView) override; |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 33 | void SaveData(CPDFSDK_PageView* pPageView) override; |
| 34 | void GetActionData(CPDFSDK_PageView* pPageView, |
| 35 | CPDF_AAction::AActionType type, |
| 36 | PDFSDK_FieldAction& fa) override; |
| 37 | void SetActionData(CPDFSDK_PageView* pPageView, |
| 38 | CPDF_AAction::AActionType type, |
| 39 | const PDFSDK_FieldAction& fa) override; |
tsepez | 4cf5515 | 2016-11-02 14:37:54 -0700 | [diff] [blame] | 40 | bool IsActionDataChanged(CPDF_AAction::AActionType type, |
| 41 | const PDFSDK_FieldAction& faOld, |
| 42 | const PDFSDK_FieldAction& faNew) override; |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 43 | void SaveState(CPDFSDK_PageView* pPageView) override; |
| 44 | void RestoreState(CPDFSDK_PageView* pPageView) override; |
Lei Zhang | b4fee4d | 2017-08-01 18:34:43 -0700 | [diff] [blame] | 45 | #ifdef PDF_ENABLE_XFA |
| 46 | bool IsFieldFull(CPDFSDK_PageView* pPageView) override; |
| 47 | #endif |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 48 | |
Tom Sepez | 134ac91 | 2017-09-15 15:32:01 -0700 | [diff] [blame] | 49 | // CPWL_Wnd::FocusHandlerIface: |
Lei Zhang | 4183f20 | 2017-07-07 16:10:06 -0700 | [diff] [blame] | 50 | void OnSetFocus(CPWL_Edit* pEdit) override; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 51 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 52 | private: |
Ryan Harrison | 275e260 | 2017-09-18 14:23:18 -0400 | [diff] [blame] | 53 | WideString GetSelectExportText(); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 54 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 55 | FFL_ComboBoxState m_State; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 56 | }; |
| 57 | |
Dan Sinclair | edbb319 | 2016-03-21 09:08:24 -0400 | [diff] [blame] | 58 | #endif // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_ |