diff options
-rw-r--r-- | include/svtools/editbrowsebox.hxx | 41 | ||||
-rw-r--r-- | include/svtools/editimplementation.hxx | 6 | ||||
-rw-r--r-- | svtools/source/brwbox/ebbcontrols.cxx | 6 | ||||
-rw-r--r-- | svx/source/fmcomp/gridcell.cxx | 30 | ||||
-rw-r--r-- | svx/source/inc/gridcell.hxx | 4 |
5 files changed, 32 insertions, 55 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(); diff --git a/svtools/source/brwbox/ebbcontrols.cxx b/svtools/source/brwbox/ebbcontrols.cxx index febac63d4eb5..f26c7e013ad0 100644 --- a/svtools/source/brwbox/ebbcontrols.cxx +++ b/svtools/source/brwbox/ebbcontrols.cxx @@ -318,12 +318,12 @@ namespace svt IMPL_LINK_NOARG(MultiLineEditImplementation, ModifyHdl, weld::TextView&, void) { - m_aModifyHdl.Call(nullptr); + CallModifyHdls(); } IMPL_LINK_NOARG(EditImplementation, ModifyHdl, Edit&, void) { - m_aModifyHdl.Call(nullptr); + CallModifyHdls(); } //= EditCellController @@ -345,7 +345,7 @@ namespace svt IMPL_LINK_NOARG(EntryImplementation, ModifyHdl, weld::Entry&, void) { - m_aModifyHdl.Call(nullptr); + CallModifyHdls(); } ControlBase::ControlBase(BrowserDataWin* pParent, const OUString& rUIXMLDescription, const OString& rID) diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 6ae6bae43b93..f9e02176e525 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -3560,6 +3560,7 @@ FmXEditCell::FmXEditCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> m_pEditImplementation = new EntryImplementation(static_cast<EditControlBase&>(m_pCellControl->GetWindow())); m_bOwnEditImplementation = true; } + m_pEditImplementation->SetAuxModifyHdl(LINK(this, FmXEditCell, ModifyHdl)); } FmXEditCell::~FmXEditCell() @@ -3581,7 +3582,6 @@ void FmXEditCell::disposing() m_aTextListeners.disposeAndClear(aEvt); m_aChangeListeners.disposeAndClear(aEvt); - m_pEditImplementation->SetModifyHdl( Link<LinkParamNone*,void>() ); if ( m_bOwnEditImplementation ) delete m_pEditImplementation; m_pEditImplementation = nullptr; @@ -3625,7 +3625,6 @@ void SAL_CALL FmXEditCell::removeTextListener(const Reference< css::awt::XTextLi m_aTextListeners.removeInterface( l ); } - void SAL_CALL FmXEditCell::setText( const OUString& aText ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3640,7 +3639,6 @@ void SAL_CALL FmXEditCell::setText( const OUString& aText ) } } - void SAL_CALL FmXEditCell::insertText(const css::awt::Selection& rSel, const OUString& aText) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3676,7 +3674,6 @@ OUString SAL_CALL FmXEditCell::getText() return aText; } - OUString SAL_CALL FmXEditCell::getSelectedText() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3690,7 +3687,6 @@ OUString SAL_CALL FmXEditCell::getSelectedText() return aText; } - void SAL_CALL FmXEditCell::setSelection( const css::awt::Selection& aSelection ) { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3699,7 +3695,6 @@ void SAL_CALL FmXEditCell::setSelection( const css::awt::Selection& aSelection ) m_pEditImplementation->SetSelection( Selection( aSelection.Min, aSelection.Max ) ); } - css::awt::Selection SAL_CALL FmXEditCell::getSelection() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3711,7 +3706,6 @@ css::awt::Selection SAL_CALL FmXEditCell::getSelection() return css::awt::Selection(aSel.Min(), aSel.Max()); } - sal_Bool SAL_CALL FmXEditCell::isEditable() { ::osl::MutexGuard aGuard( m_aMutex ); @@ -3765,14 +3759,12 @@ void FmXEditCell::onTextChanged() m_aTextListeners.notifyEach( &awt::XTextListener::textChanged, aEvent ); } - void FmXEditCell::onFocusGained( const awt::FocusEvent& _rEvent ) { FmXTextCell::onFocusGained( _rEvent ); m_sValueOnEnter = getText(); } - void FmXEditCell::onFocusLost( const awt::FocusEvent& _rEvent ) { FmXTextCell::onFocusLost( _rEvent ); @@ -3784,21 +3776,10 @@ void FmXEditCell::onFocusLost( const awt::FocusEvent& _rEvent ) } } - -void FmXEditCell::onWindowEvent( const VclEventId _nEventId, const vcl::Window& _rWindow, const void* _pEventData ) +IMPL_LINK_NOARG(FmXEditCell, ModifyHdl, LinkParamNone*, void) { - switch ( _nEventId ) - { - case VclEventId::EditModify: - { - if ( m_pEditImplementation && m_aTextListeners.getLength() ) - onTextChanged(); - return; - } - default: break; - } - - FmXTextCell::onWindowEvent( _nEventId, _rWindow, _pEventData ); + if (m_aTextListeners.getLength()) + onTextChanged(); } FmXCheckBoxCell::FmXCheckBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellControl> pControl ) @@ -3809,7 +3790,6 @@ FmXCheckBoxCell::FmXCheckBoxCell( DbGridColumn* pColumn, std::unique_ptr<DbCellC { } - FmXCheckBoxCell::~FmXCheckBoxCell() { if (!OComponentHelper::rBHelper.bDisposed) @@ -3817,11 +3797,9 @@ FmXCheckBoxCell::~FmXCheckBoxCell() acquire(); dispose(); } - } // OComponentHelper - void FmXCheckBoxCell::disposing() { css::lang::EventObject aEvt(*this); diff --git a/svx/source/inc/gridcell.hxx b/svx/source/inc/gridcell.hxx index 1b93fe550469..d4fb36b9bfb3 100644 --- a/svx/source/inc/gridcell.hxx +++ b/svx/source/inc/gridcell.hxx @@ -892,11 +892,11 @@ public: private: virtual ~FmXEditCell() override; - virtual void onWindowEvent( const VclEventId _nEventId, const vcl::Window& _rWindow, const void* _pEventData ) override; - virtual void onFocusGained( const css::awt::FocusEvent& _rEvent ) override; virtual void onFocusLost( const css::awt::FocusEvent& _rEvent ) override; + DECL_LINK(ModifyHdl, LinkParamNone*, void); + void onTextChanged(); OUString m_sValueOnEnter; |