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_formfiller.h"
     12 
     13 class CBA_FontMap;
     14 
     15 struct FFL_ComboBoxState {
     16   int nIndex;
     17   int nStart;
     18   int nEnd;
     19   CFX_WideString sValue;
     20 };
     21 
     22 class CFFL_ComboBox : public CFFL_FormFiller, public IPWL_FocusHandler {
     23  public:
     24   CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp, CPDFSDK_Annot* pWidget);
     25   ~CFFL_ComboBox() override;
     26 
     27   // CFFL_FormFiller:
     28   PWL_CREATEPARAM GetCreateParam() override;
     29   CPWL_Wnd* NewPDFWindow(const PWL_CREATEPARAM& cp,
     30                          CPDFSDK_PageView* pPageView) 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   CPWL_Wnd* ResetPDFWindow(CPDFSDK_PageView* pPageView,
     46                            bool bRestoreValue) override;
     47 
     48   // IPWL_FocusHandler:
     49   void OnSetFocus(CPWL_Wnd* pWnd) override;
     50 
     51 #ifdef PDF_ENABLE_XFA
     52   // CFFL_FormFiller:
     53   bool IsFieldFull(CPDFSDK_PageView* pPageView) override;
     54 #endif  // PDF_ENABLE_XFA
     55 
     56  private:
     57   CFX_WideString GetSelectExportText();
     58 
     59   CBA_FontMap* m_pFontMap;
     60   FFL_ComboBoxState m_State;
     61 };
     62 
     63 #endif  // FPDFSDK_FORMFILLER_CFFL_COMBOBOX_H_
     64