blob: acc61af0b1a8d9b65625fa89621c6b3cbb6ff00e [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"
Dan Sinclairedbb3192016-03-21 09:08:24 -040011#include "fpdfsdk/formfiller/cffl_formfiller.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
dsinclairdbc77162016-07-13 11:34:23 -070022class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler {
Nico Weber9d8ec5a2015-08-04 13:00:21 -070023 public:
dsinclair79db6092016-09-14 07:27:21 -070024 CFFL_ComboBox(CPDFSDK_Environment* pApp, CPDFSDK_Annot* pWidget);
Lei Zhang335e1182015-08-10 01:07:19 -070025 ~CFFL_ComboBox() override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070026
Lei Zhang335e1182015-08-10 01:07:19 -070027 // CFFL_FormFiller:
28 PWL_CREATEPARAM GetCreateParam() override;
29 CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
30 CPDFSDK_PageView* pPageView) override;
dsinclair72177da2016-09-15 12:07:23 -070031 FX_BOOL OnChar(CPDFSDK_Annot* pAnnot,
32 uint32_t nChar,
33 uint32_t nFlags) override;
Lei Zhang335e1182015-08-10 01:07:19 -070034 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-Malek3f3b45c2014-05-23 17:28:10 -070049
Lei Zhang335e1182015-08-10 01:07:19 -070050 // IPWL_FocusHandler:
51 void OnSetFocus(CPWL_Wnd* pWnd) override;
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070052
Tom Sepez51da0932015-11-25 16:05:49 -080053#ifdef PDF_ENABLE_XFA
Tom Sepez3343d142015-11-02 09:54:54 -080054 // CFFL_FormFiller:
55 FX_BOOL IsFieldFull(CPDFSDK_PageView* pPageView) override;
Tom Sepez40e9ff32015-11-30 12:39:54 -080056#endif // PDF_ENABLE_XFA
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070057
Nico Weber9d8ec5a2015-08-04 13:00:21 -070058 private:
59 CFX_WideString GetSelectExportText();
Lei Zhanga6d9f0e2015-06-13 00:48:38 -070060
Nico Weber9d8ec5a2015-08-04 13:00:21 -070061 CBA_FontMap* m_pFontMap;
62 FFL_ComboBoxState m_State;
John Abd-El-Malek3f3b45c2014-05-23 17:28:10 -070063};
64
Dan Sinclairedbb3192016-03-21 09:08:24 -040065#endif // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_