diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2015-09-24 13:53:17 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2015-09-24 16:19:37 +0000 |
commit | e85b2333bce7b1dcae73861df6d90b48b9f4efe5 (patch) | |
tree | 21d066cecfbfda9ace96b26953ddcc3ae1764001 /dbaccess | |
parent | ff6462e6307e6924dc6c8178043ae9032f4b4152 (diff) |
convert Link<> to typed
Change-Id: I59d325c3b051690303a5841907317122fa1ec98b
Reviewed-on: https://gerrit.libreoffice.org/18825
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'dbaccess')
-rw-r--r-- | dbaccess/source/ui/control/FieldDescControl.cxx | 40 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/paramdialog.cxx | 25 | ||||
-rw-r--r-- | dbaccess/source/ui/dlg/queryfilter.cxx | 23 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/FieldDescControl.hxx | 4 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/paramdialog.hxx | 3 | ||||
-rw-r--r-- | dbaccess/source/ui/inc/queryfilter.hxx | 2 |
6 files changed, 47 insertions, 50 deletions
diff --git a/dbaccess/source/ui/control/FieldDescControl.cxx b/dbaccess/source/ui/control/FieldDescControl.cxx index 92a4dc55ea6a..fbe4ddc8d587 100644 --- a/dbaccess/source/ui/control/FieldDescControl.cxx +++ b/dbaccess/source/ui/control/FieldDescControl.cxx @@ -1439,81 +1439,77 @@ void OFieldDescControl::DisplayData(OFieldDescription* pFieldDescr ) SetReadOnly( bRead ); } -IMPL_LINK(OFieldDescControl, OnControlFocusGot, Control*, pControl ) +IMPL_LINK_TYPED(OFieldDescControl, OnControlFocusGot, Control&, rControl, void ) { OUString strHelpText; - OPropNumericEditCtrl* pNumeric = dynamic_cast< OPropNumericEditCtrl* >( pControl ); + OPropNumericEditCtrl* pNumeric = dynamic_cast< OPropNumericEditCtrl* >( &rControl ); if ( pNumeric ) { pNumeric->SaveValue(); strHelpText = pNumeric->GetHelp(); } - OPropColumnEditCtrl* pColumn = dynamic_cast< OPropColumnEditCtrl* >( pControl ); + OPropColumnEditCtrl* pColumn = dynamic_cast< OPropColumnEditCtrl* >( &rControl ); if ( pColumn ) { pColumn->SaveValue(); strHelpText = pColumn->GetHelp(); } - OPropEditCtrl* pEdit = dynamic_cast< OPropEditCtrl* >( pControl ); + OPropEditCtrl* pEdit = dynamic_cast< OPropEditCtrl* >( &rControl ); if ( pEdit ) { pEdit->SaveValue(); strHelpText = pEdit->GetHelp(); } - OPropListBoxCtrl* pListBox = dynamic_cast< OPropListBoxCtrl* >( pControl ); + OPropListBoxCtrl* pListBox = dynamic_cast< OPropListBoxCtrl* >( &rControl ); if ( pListBox ) { pListBox->SaveValue(); strHelpText = pListBox->GetHelp(); } - if (pControl == pFormat) + if (&rControl == pFormat) strHelpText = ModuleRes(STR_HELP_FORMAT_BUTTON); if (!strHelpText.isEmpty() && (pHelp != nullptr)) pHelp->SetHelpText(strHelpText); - m_pActFocusWindow = pControl; - - return 0L; + m_pActFocusWindow = &rControl; } -IMPL_LINK(OFieldDescControl, OnControlFocusLost, Control*, pControl ) +IMPL_LINK_TYPED(OFieldDescControl, OnControlFocusLost, Control&, rControl, void ) { - if ((pControl == pLength) || (pControl == pTextLen) || (pControl == pScale)) + if ((&rControl == pLength) || (&rControl == pTextLen) || (&rControl == pScale)) { - OPropNumericEditCtrl* pConverted = static_cast<OPropNumericEditCtrl*>(pControl); + OPropNumericEditCtrl* pConverted = static_cast<OPropNumericEditCtrl*>(&rControl); if (pConverted->IsModified()) CellModified(-1, pConverted->GetPos()); } - if(pControl == m_pColumnName) + if(&rControl == m_pColumnName) { - OPropColumnEditCtrl* pConverted = static_cast<OPropColumnEditCtrl*>(pControl); + OPropColumnEditCtrl* pConverted = static_cast<OPropColumnEditCtrl*>(&rControl); if (pConverted->IsModified()) CellModified(-1, pConverted->GetPos()); } - else if ((pControl == pDefault) || (pControl == pFormatSample) || (pControl == m_pAutoIncrementValue) ) + else if ((&rControl == pDefault) || (&rControl == pFormatSample) || (&rControl == m_pAutoIncrementValue) ) { - OPropEditCtrl* pConverted = static_cast<OPropEditCtrl*>(pControl); + OPropEditCtrl* pConverted = static_cast<OPropEditCtrl*>(&rControl); if (pConverted->IsModified()) CellModified(-1, pConverted->GetPos()); } - else if ((pControl == pRequired) || (pControl == pNumType) || (pControl == pAutoIncrement) || (pControl == pBoolDefault) || (pControl == m_pType)) + else if ((&rControl == pRequired) || (&rControl == pNumType) || (&rControl == pAutoIncrement) || (&rControl == pBoolDefault) || (&rControl == m_pType)) { - OPropListBoxCtrl* pConverted = static_cast<OPropListBoxCtrl*>(pControl); + OPropListBoxCtrl* pConverted = static_cast<OPropListBoxCtrl*>(&rControl); if (pConverted->IsModified()) CellModified(-1, pConverted->GetPos()); } - if (pControl == pDefault) + if (&rControl == pDefault) UpdateFormatSample(pActFieldDescr); - implFocusLost(pControl); - - return 0L; + implFocusLost(&rControl); } void OFieldDescControl::SaveData( OFieldDescription* pFieldDescr ) diff --git a/dbaccess/source/ui/dlg/paramdialog.cxx b/dbaccess/source/ui/dlg/paramdialog.cxx index 36766be76ca3..2a8fedd2607a 100644 --- a/dbaccess/source/ui/dlg/paramdialog.cxx +++ b/dbaccess/source/ui/dlg/paramdialog.cxx @@ -131,7 +131,7 @@ namespace dbaui void OParameterDialog::Construct() { m_pAllParams->SetSelectHdl(LINK(this, OParameterDialog, OnEntrySelected)); - m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); + m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocusHdl)); m_pParam->SetModifyHdl(LINK(this, OParameterDialog, OnValueModified)); m_pTravelNext->SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); m_pOKBtn->SetClickHdl(LINK(this, OParameterDialog, OnButtonClicked)); @@ -157,13 +157,18 @@ namespace dbaui m_pParam->GrabFocus(); } - IMPL_LINK(OParameterDialog, OnValueLoseFocus, Control*, /*pSource*/) + IMPL_LINK_NOARG_TYPED(OParameterDialog, OnValueLoseFocusHdl, Control&, void) + { + OnValueLoseFocus(); + } + + bool OParameterDialog::OnValueLoseFocus() { if (m_nCurrentlySelected != LISTBOX_ENTRY_NOTFOUND) { if ( ( m_aVisitedParams[ m_nCurrentlySelected ] & EF_DIRTY ) == 0 ) // nothing to do, the value isn't dirty - return 0L; + return false; } Reference< XPropertySet > xParamAsSet; @@ -184,7 +189,7 @@ namespace dbaui else { if (!m_bNeedErrorOnCurrent) - return 1L; + return true; OUString sName; try @@ -200,12 +205,12 @@ namespace dbaui sMessage = sMessage.replaceAll( "$name$", sName ); ScopedVclPtrInstance<MessageDialog>::Create(nullptr, sMessage)->Execute(); m_pParam->GrabFocus(); - return 1L; + return true; } } } - return 0L; + return false; } IMPL_LINK_TYPED(OParameterDialog, OnButtonClicked, Button*, pButton, void) @@ -213,7 +218,7 @@ namespace dbaui if (m_pCancelBtn == pButton) { // no interpreting of the given values anymore .... - m_pParam->SetLoseFocusHdl(Link<>()); // no direct call from the control anymore ... + m_pParam->SetLoseFocusHdl(Link<Control&,void>()); // no direct call from the control anymore ... m_bNeedErrorOnCurrent = false; // in case of any indirect calls -> no error message m_pCancelBtn->SetClickHdl(Link<Button*,void>()); m_pCancelBtn->Click(); @@ -291,7 +296,7 @@ namespace dbaui if (m_nCurrentlySelected != LISTBOX_ENTRY_NOTFOUND) { // do the transformation of the current text - if (LINK(this, OParameterDialog, OnValueLoseFocus).Call(m_pParam) != 0L) + if (OnValueLoseFocus()) { // there was an error interpreting the text m_pAllParams->SelectEntryPos(m_nCurrentlySelected); return 1L; @@ -347,7 +352,7 @@ namespace dbaui Selection aSel; if (pOldFocus == m_pParam) { - m_pParam->SetLoseFocusHdl(Link<>()); + m_pParam->SetLoseFocusHdl(Link<Control&,void>()); aSel = m_pParam->GetSelection(); } m_pTravelNext->GrabFocus(); @@ -357,7 +362,7 @@ namespace dbaui // restore the settings for the value edit if (pOldFocus == m_pParam) { - m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocus)); + m_pParam->SetLoseFocusHdl(LINK(this, OParameterDialog, OnValueLoseFocusHdl)); m_pParam->SetSelection(aSel); } } diff --git a/dbaccess/source/ui/dlg/queryfilter.cxx b/dbaccess/source/ui/dlg/queryfilter.cxx index 373b6d0fb568..764ce8ff2042 100644 --- a/dbaccess/source/ui/dlg/queryfilter.cxx +++ b/dbaccess/source/ui/dlg/queryfilter.cxx @@ -453,23 +453,18 @@ Reference< XPropertySet > DlgFilterCrit::getMatchingColumn( const Edit& _rValueI return getColumn( sField ); } -IMPL_LINK( DlgFilterCrit, PredicateLoseFocus, Edit*, _pField ) +IMPL_LINK_TYPED( DlgFilterCrit, PredicateLoseFocus, Control&, rControl, void ) { - OSL_ENSURE( _pField, "DlgFilterCrit::PredicateLoseFocus: invalid event source!" ); - if ( _pField ) + Edit* _pField = static_cast<Edit*>(&rControl); + // retrieve the field affected + Reference< XPropertySet> xColumn( getMatchingColumn( *_pField ) ); + // and normalize it's content + if ( xColumn.is() ) { - // retrieve the field affected - Reference< XPropertySet> xColumn( getMatchingColumn( *_pField ) ); - // and normalize it's content - if ( xColumn.is() ) - { - OUString sText( _pField->GetText() ); - m_aPredicateInput.normalizePredicateString( sText, xColumn ); - _pField->SetText( sText ); - } + OUString sText( _pField->GetText() ); + m_aPredicateInput.normalizePredicateString( sText, xColumn ); + _pField->SetText( sText ); } - - return 0L; } void DlgFilterCrit::SetLine( sal_uInt16 nIdx,const PropertyValue& _rItem,bool _bOr ) diff --git a/dbaccess/source/ui/inc/FieldDescControl.hxx b/dbaccess/source/ui/inc/FieldDescControl.hxx index 791bcb4f7f9b..f5fefbd3033a 100644 --- a/dbaccess/source/ui/inc/FieldDescControl.hxx +++ b/dbaccess/source/ui/inc/FieldDescControl.hxx @@ -120,8 +120,8 @@ namespace dbaui DECL_LINK( ChangeHdl, ListBox * ); // used by ActivatePropertyField - DECL_LINK( OnControlFocusLost, Control* ); - DECL_LINK( OnControlFocusGot, Control* ); + DECL_LINK_TYPED( OnControlFocusLost, Control&, void ); + DECL_LINK_TYPED( OnControlFocusGot, Control&, void ); void UpdateFormatSample(OFieldDescription* pFieldDescr); void ArrangeAggregates(); diff --git a/dbaccess/source/ui/inc/paramdialog.hxx b/dbaccess/source/ui/inc/paramdialog.hxx index 44d3316dd61d..58bb7c4113d7 100644 --- a/dbaccess/source/ui/inc/paramdialog.hxx +++ b/dbaccess/source/ui/inc/paramdialog.hxx @@ -99,7 +99,8 @@ namespace dbaui DECL_LINK(OnValueModified, Control*); DECL_LINK(OnEntrySelected, ListBox*); DECL_LINK_TYPED(OnButtonClicked, Button*, void); - DECL_LINK(OnValueLoseFocus, Control*); + DECL_LINK_TYPED(OnValueLoseFocusHdl, Control&, void); + bool OnValueLoseFocus(); }; } // namespace dbaui diff --git a/dbaccess/source/ui/inc/queryfilter.hxx b/dbaccess/source/ui/inc/queryfilter.hxx index 32fb47c0ed38..d09f69064bf3 100644 --- a/dbaccess/source/ui/inc/queryfilter.hxx +++ b/dbaccess/source/ui/inc/queryfilter.hxx @@ -118,7 +118,7 @@ namespace dbaui void BuildWherePart(); protected: - DECL_LINK( PredicateLoseFocus, Edit* ); + DECL_LINK_TYPED( PredicateLoseFocus, Control&, void ); }; } |