blob: 7d5a38ef56bb6686d070af63c8601a49018335a1 [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;
19 CFX_WideString sValue;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070020};
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070021
Lei Zhangb4fee4d2017-08-01 18:34:43 -070022class CFFL_ComboBox : public CFFL_TextObject, public IPWL_FocusHandler {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023 public:
Lei Zhang4f34c642017-06-02 00:45:14 -070024 CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget);
Lei Zhang335e1182015-08-10 01:07:19 -070025 ~CFFL_ComboBox() override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070026
Lei Zhangb4fee4d2017-08-01 18:34:43 -070027 // CFFL_TextObject:
Tom Sepezbf157302017-09-15 13:26:32 -070028 CPWL_Wnd::CreateParams GetCreateParam() override;
29 CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override;
tsepez4cf55152016-11-02 14:37:54 -070030 bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
31 bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
Lei Zhang335e1182015-08-10 01:07:19 -070032 void SaveData(CPDFSDK_PageView* pPageView) override;
33 void GetActionData(CPDFSDK_PageView* pPageView,
34 CPDF_AAction::AActionType type,
35 PDFSDK_FieldAction& fa) override;
36 void SetActionData(CPDFSDK_PageView* pPageView,
37 CPDF_AAction::AActionType type,
38 const PDFSDK_FieldAction& fa) override;
tsepez4cf55152016-11-02 14:37:54 -070039 bool IsActionDataChanged(CPDF_AAction::AActionType type,
40 const PDFSDK_FieldAction& faOld,
41 const PDFSDK_FieldAction& faNew) override;
Lei Zhang335e1182015-08-10 01:07:19 -070042 void SaveState(CPDFSDK_PageView* pPageView) override;
43 void RestoreState(CPDFSDK_PageView* pPageView) override;
Lei Zhangb4fee4d2017-08-01 18:34:43 -070044#ifdef PDF_ENABLE_XFA
45 bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
46#endif
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070047
Lei Zhang335e1182015-08-10 01:07:19 -070048 // IPWL_FocusHandler:
Lei Zhang4183f202017-07-07 16:10:06 -070049 void OnSetFocus(CPWL_Edit* pEdit) override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070050
Nico Weber9d8ec5a2015-08-04 13:00:21 -070051 private:
52 CFX_WideString GetSelectExportText();
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070053
Nico Weber9d8ec5a2015-08-04 13:00:21 -070054 FFL_ComboBoxState m_State;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070055};
56
Dan Sinclairedbb3192016-03-21 09:08:24 -040057#endif // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_