xref: /aosp_15_r20/external/pdfium/fpdfsdk/formfiller/cffl_listbox.h (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1 // Copyright 2014 The PDFium Authors
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_LISTBOX_H_
8 #define FPDFSDK_FORMFILLER_CFFL_LISTBOX_H_
9 
10 #include <memory>
11 #include <set>
12 #include <vector>
13 
14 #include "fpdfsdk/formfiller/cffl_textobject.h"
15 
16 class CPWL_ListBox;
17 
18 class CFFL_ListBox final : public CFFL_TextObject {
19  public:
20   CFFL_ListBox(CFFL_InteractiveFormFiller* pFormFiller,
21                CPDFSDK_Widget* pWidget);
22   ~CFFL_ListBox() override;
23 
24   // CFFL_TextObject:
25   CPWL_Wnd::CreateParams GetCreateParam() override;
26   std::unique_ptr<CPWL_Wnd> NewPWLWindow(
27       const CPWL_Wnd::CreateParams& cp,
28       std::unique_ptr<IPWL_FillerNotify::PerWindowData> pAttachedData) override;
29   bool OnChar(CPDFSDK_Widget* pWidget,
30               uint32_t nChar,
31               Mask<FWL_EVENTFLAG> nFlags) override;
32   bool IsDataChanged(const CPDFSDK_PageView* pPageView) override;
33   void SaveData(const CPDFSDK_PageView* pPageView) override;
34   void GetActionData(const CPDFSDK_PageView* pPageView,
35                      CPDF_AAction::AActionType type,
36                      CFFL_FieldAction& fa) override;
37   void SavePWLWindowState(const CPDFSDK_PageView* pPageView) override;
38   void RecreatePWLWindowFromSavedState(
39       const CPDFSDK_PageView* pPageView) override;
40   bool SetIndexSelected(int index, bool selected) override;
41   bool IsIndexSelected(int index) override;
42 
43  private:
44   CPWL_ListBox* GetPWLListBox(const CPDFSDK_PageView* pPageView) const;
45   CPWL_ListBox* CreateOrUpdatePWLListBox(const CPDFSDK_PageView* pPageView);
46 
47   std::set<int> m_OriginSelections;
48   std::vector<int> m_State;
49 };
50 
51 #endif  // FPDFSDK_FORMFILLER_CFFL_LISTBOX_H_
52