blob: bdc0934862bdf12833194823299b439ada2b2c1e [file] [log] [blame]
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07001// 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 Zhanga6d9f0e2015-06-13 00:48:38 -07004
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -07005// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
Dan Sinclairedbb3192016-03-21 09:08:24 -04007#ifndef FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
8#define FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
Tom Sepez245c80e2015-04-08 16:19:33 -07009
dsinclaira52ab742016-09-29 13:59:29 -070010#include "core/fxcrt/fx_string.h"
Lei Zhangb4fee4d2017-08-01 18:34:43 -070011#include "fpdfsdk/formfiller/cffl_textobject.h"
Tom Sepez245c80e2015-04-08 16:19:33 -070012
13class CBA_FontMap;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070014
Nico Weber9d8ec5a2015-08-04 13:00:21 -070015struct FFL_ComboBoxState {
16 int nIndex;
17 int nStart;
18 int nEnd;
Ryan Harrison275e2602017-09-18 14:23:18 -040019 WideString sValue;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070021
Tom Sepez134ac912017-09-15 15:32:01 -070022class CFFL_ComboBox : public CFFL_TextObject,
23 public CPWL_Wnd::FocusHandlerIface {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070024 public:
Lei Zhang4f34c642017-06-02 00:45:14 -070025 CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget);
Lei Zhang335e1182015-08-10 01:07:19 -070026 ~CFFL_ComboBox() override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070027
Lei Zhangb4fee4d2017-08-01 18:34:43 -070028 // CFFL_TextObject:
Tom Sepezbf157302017-09-15 13:26:32 -070029 CPWL_Wnd::CreateParams GetCreateParam() override;
30 CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override;
tsepez4cf55152016-11-02 14:37:54 -070031 bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
32 bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
Lei Zhang335e1182015-08-10 01:07:19 -070033 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;
tsepez4cf55152016-11-02 14:37:54 -070040 bool IsActionDataChanged(CPDF_AAction::AActionType type,
41 const PDFSDK_FieldAction& faOld,
42 const PDFSDK_FieldAction& faNew) override;
Lei Zhang335e1182015-08-10 01:07:19 -070043 void SaveState(CPDFSDK_PageView* pPageView) override;
44 void RestoreState(CPDFSDK_PageView* pPageView) override;
Lei Zhangb4fee4d2017-08-01 18:34:43 -070045#ifdef PDF_ENABLE_XFA
46 bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
47#endif
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070048
Tom Sepez134ac912017-09-15 15:32:01 -070049 // CPWL_Wnd::FocusHandlerIface:
Lei Zhang4183f202017-07-07 16:10:06 -070050 void OnSetFocus(CPWL_Edit* pEdit) override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070051
Nico Weber9d8ec5a2015-08-04 13:00:21 -070052 private:
Ryan Harrison275e2602017-09-18 14:23:18 -040053 WideString GetSelectExportText();
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070054
Nico Weber9d8ec5a2015-08-04 13:00:21 -070055 FFL_ComboBoxState m_State;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070056};
57
Dan Sinclairedbb3192016-03-21 09:08:24 -040058#endif // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_