1 // Copyright 2020 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_PERWINDOWDATA_H_ 8 #define FPDFSDK_FORMFILLER_CFFL_PERWINDOWDATA_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/observed_ptr.h" 13 #include "core/fxcrt/unowned_ptr.h" 14 #include "fpdfsdk/pwl/ipwl_fillernotify.h" 15 16 class CFFL_FormField; 17 class CPDFSDK_PageView; 18 class CPDFSDK_Widget; 19 20 class CFFL_PerWindowData final : public IPWL_FillerNotify::PerWindowData { 21 public: 22 CFFL_PerWindowData(CPDFSDK_Widget* pWidget, 23 const CPDFSDK_PageView* pPageView, 24 uint32_t nAppearanceAge, 25 uint32_t nValueAge); 26 CFFL_PerWindowData& operator=(const CFFL_PerWindowData& that) = delete; 27 ~CFFL_PerWindowData() override; 28 29 // IPWL_FillerNotify::PerWindowData: 30 std::unique_ptr<IPWL_FillerNotify::PerWindowData> Clone() const override; 31 GetWidget()32 CPDFSDK_Widget* GetWidget() const { return m_pWidget.Get(); } GetPageView()33 const CPDFSDK_PageView* GetPageView() const { return m_pPageView; } AppearanceAgeEquals(uint32_t age)34 bool AppearanceAgeEquals(uint32_t age) const { 35 return age == m_nAppearanceAge; 36 } GetValueAge()37 uint32_t GetValueAge() const { return m_nValueAge; } 38 SetFormField(CFFL_FormField * pFormField)39 void SetFormField(CFFL_FormField* pFormField) { m_pFormField = pFormField; } GetFormField()40 CFFL_FormField* GetFormField() { return m_pFormField; } 41 42 private: 43 CFFL_PerWindowData(const CFFL_PerWindowData& that); 44 45 ObservedPtr<CPDFSDK_Widget> m_pWidget; 46 UnownedPtr<const CPDFSDK_PageView> const m_pPageView; 47 UnownedPtr<CFFL_FormField> m_pFormField; 48 const uint32_t m_nAppearanceAge; 49 const uint32_t m_nValueAge; 50 }; 51 52 #endif // FPDFSDK_FORMFILLER_CFFL_PERWINDOWDATA_H_ 53