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" |
Dan Sinclair | edbb319 | 2016-03-21 09:08:24 -0400 | [diff] [blame] | 11 | #include "fpdfsdk/formfiller/cffl_formfiller.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; |
| 19 | CFX_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 | |
dsinclair | dbc7716 | 2016-07-13 11:34:23 -0700 | [diff] [blame] | 22 | class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler { |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 23 | public: |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 24 | CFFL_ComboBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget); |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 25 | ~CFFL_ComboBox() override; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 26 | |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 27 | // CFFL_FormFiller: |
| 28 | PWL_CREATEPARAM GetCreateParam() override; |
| 29 | CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp, |
| 30 | CPDFSDK_PageView* pPageView) override; |
dsinclair | 72177da | 2016-09-15 12:07:23 -0700 | [diff] [blame] | 31 | FX_BOOL OnChar(CPDFSDK_Annot* pAnnot, |
| 32 | uint32_t nChar, |
| 33 | uint32_t nFlags) override; |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 34 | FX_BOOL IsDataChanged(CPDFSDK_PageView* pPageView) override; |
| 35 | void SaveData(CPDFSDK_PageView* pPageView) override; |
| 36 | void GetActionData(CPDFSDK_PageView* pPageView, |
| 37 | CPDF_AAction::AActionType type, |
| 38 | PDFSDK_FieldAction& fa) override; |
| 39 | void SetActionData(CPDFSDK_PageView* pPageView, |
| 40 | CPDF_AAction::AActionType type, |
| 41 | const PDFSDK_FieldAction& fa) override; |
| 42 | FX_BOOL IsActionDataChanged(CPDF_AAction::AActionType type, |
| 43 | const PDFSDK_FieldAction& faOld, |
| 44 | const PDFSDK_FieldAction& faNew) override; |
| 45 | void SaveState(CPDFSDK_PageView* pPageView) override; |
| 46 | void RestoreState(CPDFSDK_PageView* pPageView) override; |
| 47 | CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView, |
| 48 | FX_BOOL bRestoreValue) override; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 49 | |
Lei Zhang | 335e118 | 2015-08-10 01:07:19 -0700 | [diff] [blame] | 50 | // IPWL_FocusHandler: |
| 51 | void OnSetFocus(CPWL_Wnd* pWnd) override; |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 52 | |
Tom Sepez | 51da093 | 2015-11-25 16:05:49 -0800 | [diff] [blame] | 53 | #ifdef PDF_ENABLE_XFA |
Tom Sepez | 3343d14 | 2015-11-02 09:54:54 -0800 | [diff] [blame] | 54 | // CFFL_FormFiller: |
| 55 | FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override; |
Tom Sepez | 40e9ff3 | 2015-11-30 12:39:54 -0800 | [diff] [blame] | 56 | #endif // PDF_ENABLE_XFA |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 57 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 58 | private: |
| 59 | CFX_WideString GetSelectExportText(); |
Lei Zhang | a6d9f0e | 2015-06-13 00:48:38 -0700 | [diff] [blame] | 60 | |
Nico Weber | 9d8ec5a | 2015-08-04 13:00:21 -0700 | [diff] [blame] | 61 | CBA_FontMap* m_pFontMap; |
| 62 | FFL_ComboBoxState m_State; |
John Abd-El-Malek | 3f3b45c | 2014-05-23 17:28:10 -0700 | [diff] [blame] | 63 | }; |
| 64 | |
Dan Sinclair | edbb319 | 2016-03-21 09:08:24 -0400 | [diff] [blame] | 65 | #endif // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_ |