diff options
author | Noel Grandin <noel@peralex.com> | 2015-09-17 12:39:30 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-09-17 14:41:57 +0200 |
commit | a86bc66f26cb85e132492d3e826ff396627769cc (patch) | |
tree | db68ece6021b1ccd5f2b6404e5633d13c451b380 /cui | |
parent | 9de789e3dd161580a56c989a87a4cbb53ab289b9 (diff) |
convert Link<> to typed
Change-Id: I3512f54657eb055fa306739d27d18012b46134ac
Diffstat (limited to 'cui')
-rw-r--r-- | cui/source/inc/autocdlg.hxx | 14 | ||||
-rw-r--r-- | cui/source/tabpages/autocdlg.cxx | 43 |
2 files changed, 34 insertions, 23 deletions
diff --git a/cui/source/inc/autocdlg.hxx b/cui/source/inc/autocdlg.hxx index 3c034fee1c04..eab62485f02a 100644 --- a/cui/source/inc/autocdlg.hxx +++ b/cui/source/inc/autocdlg.hxx @@ -183,7 +183,7 @@ public: class AutoCorrEdit : public Edit { - Link<> aActionLink; + Link<AutoCorrEdit&,bool> aActionLink; bool bSpaces; public: @@ -192,7 +192,7 @@ class AutoCorrEdit : public Edit AutoCorrEdit(vcl::Window* pParent) : Edit(pParent), bSpaces(false){} - void SetActionHdl( const Link<>& rLink ) + void SetActionHdl( const Link<AutoCorrEdit&,bool>& rLink ) { aActionLink = rLink;} void SetSpaces(bool bSet) @@ -253,9 +253,10 @@ private: bool bSWriter:1; DECL_LINK_TYPED(SelectHdl, SvTreeListBox*, void); - DECL_LINK_TYPED(NewDelHdl, Button*, void); - DECL_LINK(NewDelActionHdl, PushButton*); + DECL_LINK_TYPED(NewDelButtonHdl, Button*, void); + DECL_LINK_TYPED(NewDelActionHdl, AutoCorrEdit&, bool); DECL_LINK(ModifyHdl, Edit*); + bool NewDelHdl(void*); void RefillReplaceBox( bool bFromReset, LanguageType eOldLanguage, @@ -314,10 +315,11 @@ private: CollatorWrapper* pCompareClass; LanguageType eLang; - DECL_LINK_TYPED(NewDelHdl, Button*, void); - DECL_LINK(NewDelActionHdl, void*); + DECL_LINK_TYPED(NewDelButtonHdl, Button*, void); + DECL_LINK_TYPED(NewDelActionHdl, AutoCorrEdit&, bool); DECL_LINK(SelectHdl, ListBox*); DECL_LINK(ModifyHdl, Edit*); + bool NewDelHdl(void*); /// Box filled with new language void RefillReplaceBoxes(bool bFromReset, LanguageType eOldLanguage, diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index df4fbb1a402b..b4374e7808dd 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -898,8 +898,8 @@ OfaAutocorrReplacePage::OfaAutocorrReplacePage( vcl::Window* pParent, m_pReplaceTLB->SetStyle( m_pReplaceTLB->GetStyle()|WB_HSCROLL|WB_CLIPCHILDREN ); m_pReplaceTLB->SetSelectHdl( LINK(this, OfaAutocorrReplacePage, SelectHdl) ); - m_pNewReplacePB->SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl) ); - m_pDeleteReplacePB->SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelHdl) ); + m_pNewReplacePB->SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelButtonHdl) ); + m_pDeleteReplacePB->SetClickHdl( LINK(this, OfaAutocorrReplacePage, NewDelButtonHdl) ); m_pShortED->SetModifyHdl( LINK(this, OfaAutocorrReplacePage, ModifyHdl) ); m_pReplaceED->SetModifyHdl( LINK(this, OfaAutocorrReplacePage, ModifyHdl) ); m_pShortED->SetActionHdl( LINK(this, OfaAutocorrReplacePage, NewDelActionHdl) ); @@ -1238,12 +1238,16 @@ void OfaAutocorrReplacePage::DeleteEntry(const OUString& sShort, const OUString& rDeletedArray.push_back(aDeletedString); } -IMPL_LINK_TYPED(OfaAutocorrReplacePage, NewDelHdl, Button*, pBtn, void) +IMPL_LINK_TYPED(OfaAutocorrReplacePage, NewDelButtonHdl, Button*, pBtn, void) { - NewDelActionHdl(static_cast<PushButton*>(pBtn)); + NewDelHdl(pBtn); } -IMPL_LINK(OfaAutocorrReplacePage, NewDelActionHdl, PushButton*, pBtn) +IMPL_LINK_TYPED(OfaAutocorrReplacePage, NewDelActionHdl, AutoCorrEdit&, rEdit, bool) +{ + return NewDelHdl(&rEdit); +} +bool OfaAutocorrReplacePage::NewDelHdl(void* pBtn) { SvTreeListEntry* pEntry = m_pReplaceTLB->FirstSelected(); if( pBtn == m_pDeleteReplacePB ) @@ -1254,7 +1258,7 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelActionHdl, PushButton*, pBtn) DeleteEntry(SvTabListBox::GetEntryText(pEntry, 0), SvTabListBox::GetEntryText(pEntry, 1)); m_pReplaceTLB->GetModel()->Remove(pEntry); ModifyHdl(m_pShortED); - return 0; + return false; } } if(pBtn == m_pNewReplacePB || m_pNewReplacePB->IsEnabled()) @@ -1308,10 +1312,10 @@ IMPL_LINK(OfaAutocorrReplacePage, NewDelActionHdl, PushButton*, pBtn) { // this can only be an enter in one of the two edit fields // which means EndDialog() - has to be evaluated in KeyInput - return 0; + return false; } ModifyHdl(m_pShortED); - return 1; + return true; } IMPL_LINK(OfaAutocorrReplacePage, ModifyHdl, Edit*, pEdt) @@ -1439,10 +1443,10 @@ OfaAutocorrExceptPage::OfaAutocorrExceptPage(vcl::Window* pParent, const SfxItem pCompareClass = new CollatorWrapper( comphelper::getProcessComponentContext() ); pCompareClass->loadDefaultCollator( aLcl, 0 ); - m_pNewAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - m_pDelAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - m_pNewDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); - m_pDelDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelHdl)); + m_pNewAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_pDelAbbrevPB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_pNewDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); + m_pDelDoublePB->SetClickHdl(LINK(this, OfaAutocorrExceptPage, NewDelButtonHdl)); m_pAbbrevLB->SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); m_pDoubleCapsLB->SetSelectHdl(LINK(this, OfaAutocorrExceptPage, SelectHdl)); @@ -1687,12 +1691,17 @@ void OfaAutocorrExceptPage::Reset( const SfxItemSet* ) m_pAutoCapsCB->SaveValue(); } -IMPL_LINK_TYPED(OfaAutocorrExceptPage, NewDelHdl, Button*, pBtn, void) +IMPL_LINK_TYPED(OfaAutocorrExceptPage, NewDelButtonHdl, Button*, pBtn, void) { - NewDelActionHdl(pBtn); + NewDelHdl(pBtn); } -IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, void*, pBtn) +IMPL_LINK_TYPED(OfaAutocorrExceptPage, NewDelActionHdl, AutoCorrEdit&, rEdit, bool) +{ + return NewDelHdl(&rEdit); +} + +bool OfaAutocorrExceptPage::NewDelHdl(void* pBtn) { if((pBtn == m_pNewAbbrevPB || pBtn == m_pAbbrevED.get() ) && !m_pAbbrevED->GetText().isEmpty()) @@ -1716,7 +1725,7 @@ IMPL_LINK(OfaAutocorrExceptPage, NewDelActionHdl, void*, pBtn) m_pDoubleCapsLB->RemoveEntry(m_pDoubleCapsED->GetText()); ModifyHdl(m_pDoubleCapsED); } - return 0; + return false; } IMPL_LINK(OfaAutocorrExceptPage, SelectHdl, ListBox*, pBox) @@ -1770,7 +1779,7 @@ void AutoCorrEdit::KeyInput( const KeyEvent& rKEvt ) { // if there's nothing done on enter, call the // base class after all to close the dialog - if(!nModifier && !aActionLink.Call(this)) + if(!nModifier && !aActionLink.Call(*this)) Edit::KeyInput(rKEvt); } else if(bSpaces || aKeyCode.GetCode() != KEY_SPACE) |