diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-10 15:53:44 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-11 19:55:14 +0200 |
commit | 098e26eef7dc7e792eddd05c66354616fde81c72 (patch) | |
tree | 5d8c1d325c046ff381b02db2d96d5336d4f1304c /include | |
parent | 255d96a3e1f4e77ed6444a21c1c9c24b3dc9d194 (diff) |
use an aux modify handler instead of listening for VclEventId::EditModify
Change-Id: Ie35ad08a24b8b0c989806c4739bfe925fd9ab746
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98545
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/editbrowsebox.hxx | 41 | ||||
-rw-r--r-- | include/svtools/editimplementation.hxx | 6 |
2 files changed, 23 insertions, 24 deletions
diff --git a/include/svtools/editbrowsebox.hxx b/include/svtools/editbrowsebox.hxx index b32518b0c1d0..cbeb152c15d1 100644 --- a/include/svtools/editbrowsebox.hxx +++ b/include/svtools/editbrowsebox.hxx @@ -139,7 +139,6 @@ namespace svt virtual bool IsValueChangedFromSaved() const = 0; virtual void SaveValue() = 0; - virtual void SetModifyHdl( const Link<LinkParamNone*,void>& _rLink ) = 0; virtual bool CanUp() const = 0; virtual bool CanDown() const = 0; @@ -147,17 +146,36 @@ namespace svt virtual void Cut() = 0; virtual void Copy() = 0; virtual void Paste() = 0; - }; + // sets a link to call when the text is changed by the user + void SetModifyHdl(const Link<LinkParamNone*,void>& rLink) + { + m_aModify1Hdl = rLink; + } - //= GenericEditImplementation + // sets an additional link to call when the text is changed by the user + void SetAuxModifyHdl(const Link<LinkParamNone*,void>& rLink) + { + m_aModify2Hdl = rLink; + } + private: + Link<LinkParamNone*,void> m_aModify1Hdl; + Link<LinkParamNone*,void> m_aModify2Hdl; + + protected: + void CallModifyHdls() + { + m_aModify1Hdl.Call(nullptr); + m_aModify2Hdl.Call(nullptr); + } + }; + + //= GenericEditImplementation template <class EDIT> class GenericEditImplementation : public IEditImplementation { EDIT& m_rEdit; - protected: - Link<LinkParamNone*,void> m_aModifyHdl; public: GenericEditImplementation( EDIT& _rEdit ); @@ -182,7 +200,6 @@ namespace svt virtual bool IsValueChangedFromSaved() const override; virtual void SaveValue() override; - virtual void SetModifyHdl( const Link<LinkParamNone*,void>& _rLink ) override; virtual void Cut() override; virtual void Copy() override; @@ -250,7 +267,6 @@ namespace svt { EditControlBase& m_rEdit; int m_nMaxTextLen; - Link<LinkParamNone*,void> m_aModifyHdl; DECL_LINK(ModifyHdl, weld::Entry&, void); public: @@ -336,11 +352,6 @@ namespace svt m_rEdit.get_widget().save_value(); } - virtual void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) override - { - m_aModifyHdl = rLink; - } - virtual bool CanUp() const override { return false; @@ -422,7 +433,6 @@ namespace svt { MultiLineTextCell& m_rEdit; int m_nMaxTextLen; - Link<LinkParamNone*,void> m_aModifyHdl; DECL_LINK(ModifyHdl, weld::TextView&, void); public: @@ -497,11 +507,6 @@ namespace svt m_rEdit.get_widget().save_value(); } - virtual void SetModifyHdl( const Link<LinkParamNone*,void>& rLink ) override - { - m_aModifyHdl = rLink; - } - virtual bool CanUp() const override { return m_rEdit.get_widget().can_move_cursor_with_up(); diff --git a/include/svtools/editimplementation.hxx b/include/svtools/editimplementation.hxx index 04bc287ab06e..81728017af52 100644 --- a/include/svtools/editimplementation.hxx +++ b/include/svtools/editimplementation.hxx @@ -115,12 +115,6 @@ void GenericEditImplementation< EDIT >::SaveValue() } template <class EDIT> -void GenericEditImplementation< EDIT >::SetModifyHdl( const Link<LinkParamNone*,void>& _rLink ) -{ - m_aModifyHdl = _rLink; -} - -template <class EDIT> void GenericEditImplementation< EDIT >::Cut() { m_rEdit.Cut(); |