Home | History | Annotate | Download | only in formfiller
      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.
      4 
      5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
      6 
      7 #ifndef FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
      8 #define FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
      9 
     10 #include "core/fxcrt/fx_string.h"
     11 #include "fpdfsdk/formfiller/cffl_textobject.h"
     12 
     13 class CBA_FontMap;
     14 
     15 struct FFL_ComboBoxState {
     16   int nIndex;
     17   int nStart;
     18   int nEnd;
     19   WideString sValue;
     20 };
     21 
     22 class CFFL_ComboBox : public CFFL_TextObject,
     23                       public CPWL_Wnd::FocusHandlerIface {
     24  public:
     25   CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Widget* pWidget);
     26   ~CFFL_ComboBox() override;
     27 
     28   // CFFL_TextObject:
     29   CPWL_Wnd::CreateParams GetCreateParam() override;
     30   CPWL_Wnd* NewPDFWindow(const CPWL_Wnd::CreateParams& cp) override;
     31   bool OnChar(CPDFSDK_Annot* pAnnot, uint32_t nChar, uint32_t nFlags) override;
     32   bool IsDataChanged(CPDFSDK_PageView* pPageView) override;
     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;
     40   bool IsActionDataChanged(CPDF_AAction::AActionType type,
     41                            const PDFSDK_FieldAction& faOld,
     42                            const PDFSDK_FieldAction& faNew) override;
     43   void SaveState(CPDFSDK_PageView* pPageView) override;
     44   void RestoreState(CPDFSDK_PageView* pPageView) override;
     45 #ifdef PDF_ENABLE_XFA
     46   bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
     47 #endif
     48 
     49   // CPWL_Wnd::FocusHandlerIface:
     50   void OnSetFocus(CPWL_Edit* pEdit) override;
     51 
     52  private:
     53   WideString GetSelectExportText();
     54 
     55   FFL_ComboBoxState m_State;
     56 };
     57 
     58 #endif  // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
     59