summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-10 15:53:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-11 19:55:14 +0200
commit098e26eef7dc7e792eddd05c66354616fde81c72 (patch)
tree5d8c1d325c046ff381b02db2d96d5336d4f1304c /svx
parent255d96a3e1f4e77ed6444a21c1c9c24b3dc9d194 (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 'svx')
-rw-r--r--svx/source/fmcomp/gridcell.cxx30
-rw-r--r--svx/source/inc/gridcell.hxx4
2 files changed, 6 insertions, 28 deletions
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;