From bd8b93fdff93ff7b2b7e493a7bcef6a59f299dae Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 27 Aug 2015 13:08:02 +0200 Subject: make PostUserEvent Link<> typed Change-Id: I13f10bda985d55d419a5bff481130a456ae2db8a --- sfx2/inc/inettbc.hxx | 2 +- sfx2/source/appl/fileobj.cxx | 4 ++-- sfx2/source/appl/fileobj.hxx | 2 +- sfx2/source/control/recentdocsview.cxx | 4 ++-- sfx2/source/dialog/backingwindow.cxx | 6 ++---- sfx2/source/dialog/filedlghelper.cxx | 8 ++------ sfx2/source/dialog/filedlgimpl.hxx | 4 ++-- sfx2/source/dialog/taskpane.cxx | 5 ++--- sfx2/source/dialog/templdlg.cxx | 21 +++++++++------------ sfx2/source/dialog/tplcitem.cxx | 4 +--- sfx2/source/inc/templdgi.hxx | 3 ++- sfx2/source/inc/tplcitem.hxx | 2 +- sfx2/source/inet/inettbc.cxx | 4 ++-- sfx2/source/notify/hintpost.cxx | 5 ++--- sfx2/source/sidebar/AsynchronousCall.cxx | 6 ++---- sfx2/source/view/viewsh.cxx | 7 +++---- 16 files changed, 36 insertions(+), 51 deletions(-) (limited to 'sfx2') diff --git a/sfx2/inc/inettbc.hxx b/sfx2/inc/inettbc.hxx index dcc6b1120076..8562b7f43b19 100644 --- a/sfx2/inc/inettbc.hxx +++ b/sfx2/inc/inettbc.hxx @@ -44,7 +44,7 @@ private: ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > aArgs; }; - DECL_STATIC_LINK( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo* ); + DECL_STATIC_LINK_TYPED( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, void*, void ); public: diff --git a/sfx2/source/appl/fileobj.cxx b/sfx2/source/appl/fileobj.cxx index d1e3032d577a..a70005105749 100644 --- a/sfx2/source/appl/fileobj.cxx +++ b/sfx2/source/appl/fileobj.cxx @@ -497,13 +497,13 @@ IMPL_LINK_NOARG( SvFileObject, LoadGrfReady_Impl ) return 0; } -IMPL_LINK( SvFileObject, DelMedium_Impl, SfxMediumRef*, deleteMedium ) +IMPL_LINK_TYPED( SvFileObject, DelMedium_Impl, void*, p, void ) { + SfxMediumRef* deleteMedium = static_cast(p); nPostUserEventId = 0; assert(pDelMed == deleteMedium); pDelMed = NULL; delete deleteMedium; - return 0; } IMPL_LINK_TYPED( SvFileObject, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg, void ) diff --git a/sfx2/source/appl/fileobj.hxx b/sfx2/source/appl/fileobj.hxx index 8e24f0ff1363..6bdc7a15a526 100644 --- a/sfx2/source/appl/fileobj.hxx +++ b/sfx2/source/appl/fileobj.hxx @@ -54,7 +54,7 @@ class SvFileObject : public sfx2::SvLinkSource bool LoadFile_Impl(); void SendStateChg_Impl( sfx2::LinkManager::LinkState nState ); - DECL_LINK( DelMedium_Impl, SfxMediumRef* ); + DECL_LINK_TYPED( DelMedium_Impl, void*, void ); DECL_LINK( LoadGrfReady_Impl, void* ); DECL_LINK_TYPED( DialogClosedHdl, sfx2::FileDialogHelper*, void ); diff --git a/sfx2/source/control/recentdocsview.cxx b/sfx2/source/control/recentdocsview.cxx index 7a76ea369ee9..e4f59320ba33 100644 --- a/sfx2/source/control/recentdocsview.cxx +++ b/sfx2/source/control/recentdocsview.cxx @@ -312,8 +312,9 @@ void RecentDocsView::Clear() ThumbnailView::Clear(); } -IMPL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentFile ) +IMPL_STATIC_LINK_TYPED( RecentDocsView, ExecuteHdl_Impl, void*, p, void ) { + LoadRecentFile* pLoadRecentFile = static_cast< LoadRecentFile*>(p); try { // Asynchronous execution as this can lead to our own destruction! @@ -326,7 +327,6 @@ IMPL_STATIC_LINK( RecentDocsView, ExecuteHdl_Impl, LoadRecentFile*, pLoadRecentF } delete pLoadRecentFile; - return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index ec76c0565041..a0d3c1c01ef5 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -698,7 +698,7 @@ struct ImplDelayedDispatch ~ImplDelayedDispatch() {} }; -static sal_IntPtr implDispatchDelayed( void*, void* pArg ) +static void implDispatchDelayed( void*, void* pArg ) { struct ImplDelayedDispatch* pDispatch = static_cast(pArg); try @@ -711,8 +711,6 @@ static sal_IntPtr implDispatchDelayed( void*, void* pArg ) // clean up delete pDispatch; - - return 0; } void BackingWindow::dispatchURL( const OUString& i_rURL, @@ -745,7 +743,7 @@ void BackingWindow::dispatchURL( const OUString& i_rURL, if ( xDispatch.is() ) { ImplDelayedDispatch* pDisp = new ImplDelayedDispatch( xDispatch, aDispatchURL, i_rArgs ); - if( Application::PostUserEvent( Link<>( NULL, implDispatchDelayed ), pDisp ) == 0 ) + if( Application::PostUserEvent( Link( NULL, implDispatchDelayed ), pDisp ) == 0 ) delete pDisp; // event could not be posted for unknown reason, at least don't leak } } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index fd1f6799a277..fdca859cd80c 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1158,14 +1158,12 @@ void FileDialogHelper_Impl::setControlHelpIds( const sal_Int16* _pControlId, con } } -IMPL_LINK_NOARG( FileDialogHelper_Impl, InitControls ) +IMPL_LINK_NOARG_TYPED( FileDialogHelper_Impl, InitControls, void*, void ) { mnPostUserEventId = 0; enablePasswordBox( true ); updateFilterOptionsBox( ); updateSelectionBox( ); - - return 0L; } void FileDialogHelper_Impl::preExecute() @@ -2301,13 +2299,11 @@ void FileDialogHelper::SetContext( Context _eNewContext ) mpImp->SetContext( _eNewContext ); } -IMPL_LINK_NOARG(FileDialogHelper, ExecuteSystemFilePicker) +IMPL_LINK_NOARG_TYPED(FileDialogHelper, ExecuteSystemFilePicker, void*, void) { m_nError = mpImp->execute(); if ( m_aDialogClosedLink.IsSet() ) m_aDialogClosedLink.Call( this ); - - return 0L; } // rDirPath has to be a directory diff --git a/sfx2/source/dialog/filedlgimpl.hxx b/sfx2/source/dialog/filedlgimpl.hxx index 9103318581d0..e0122ff2f01f 100644 --- a/sfx2/source/dialog/filedlgimpl.hxx +++ b/sfx2/source/dialog/filedlgimpl.hxx @@ -147,8 +147,8 @@ namespace sfx2 std::vector& rpURLList, const SfxFilter* pFilter ); - DECL_LINK_TYPED(TimeOutHdl_Impl, Idle *, void); - DECL_LINK( InitControls, void* ); + DECL_LINK_TYPED( TimeOutHdl_Impl, Idle *, void); + DECL_LINK_TYPED( InitControls, void*, void ); public: // XFilePickerListener methods diff --git a/sfx2/source/dialog/taskpane.cxx b/sfx2/source/dialog/taskpane.cxx index 814df2accdd5..ff90fc97dad1 100644 --- a/sfx2/source/dialog/taskpane.cxx +++ b/sfx2/source/dialog/taskpane.cxx @@ -549,7 +549,7 @@ namespace sfx2 static bool impl_isToolPanelResource( const OUString& i_rResourceURL ); - DECL_LINK( OnActivatePanel, void* ); + DECL_LINK_TYPED( OnActivatePanel, void*, void ); private: ModuleTaskPane& m_rAntiImpl; @@ -571,10 +571,9 @@ namespace sfx2 } - IMPL_LINK( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg ) + IMPL_LINK_TYPED( ModuleTaskPane_Impl, OnActivatePanel, void*, i_pArg, void ) { m_aPanelDeck->ActivatePanel( reinterpret_cast< size_t >( i_pArg ) ); - return 1L; } diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index ba176f00cce7..f9a313df50a5 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -284,10 +284,9 @@ sal_Int8 DropListBox_Impl::ExecuteDrop( const ExecuteDropEvent& rEvt ) return nRet; } -IMPL_LINK_NOARG(DropListBox_Impl, OnAsyncExecuteDrop) +IMPL_LINK_NOARG_TYPED(DropListBox_Impl, OnAsyncExecuteDrop, void*, void) { pDialog->ActionSelect( SID_STYLE_NEW_BY_EXAMPLE ); - return 0; } bool DropListBox_Impl::Notify( NotifyEvent& rNEvt ) @@ -2151,25 +2150,23 @@ IMPL_LINK( SfxCommonTemplateDialog_Impl, FmtSelectHdl, SvTreeListBox *, pListBox return 0; } -IMPL_LINK( SfxCommonTemplateDialog_Impl, MenuSelectHdl, Menu *, pMenu ) +IMPL_LINK( SfxCommonTemplateDialog_Impl, MenuSelectHdl, Menu*, pMenu ) { - if( pMenu ) - { - nLastItemId = pMenu->GetCurItemId(); - Application::PostUserEvent( - LINK( this, SfxCommonTemplateDialog_Impl, MenuSelectHdl ), 0 ); - return sal_IntPtr(true); - } + nLastItemId = pMenu->GetCurItemId(); + Application::PostUserEvent( + LINK( this, SfxCommonTemplateDialog_Impl, MenuSelectAsyncHdl ), 0 ); + return sal_IntPtr(true); +} +IMPL_LINK_NOARG_TYPED( SfxCommonTemplateDialog_Impl, MenuSelectAsyncHdl, void*, void ) +{ switch(nLastItemId) { case ID_NEW: NewHdl(0); break; case ID_EDIT: EditHdl(0); break; case ID_DELETE: DeleteHdl(0); break; case ID_HIDE: HideHdl(0); break; case ID_SHOW: ShowHdl(0); break; - default: return sal_IntPtr(false); } - return sal_IntPtr(true); } SfxStyleFamily SfxCommonTemplateDialog_Impl::GetActualFamily() const diff --git a/sfx2/source/dialog/tplcitem.cxx b/sfx2/source/dialog/tplcitem.cxx index 612166cfcf7b..6cc5b08be270 100644 --- a/sfx2/source/dialog/tplcitem.cxx +++ b/sfx2/source/dialog/tplcitem.cxx @@ -154,8 +154,7 @@ void SfxTemplateControllerItem::StateChanged( sal_uInt16 nSID, SfxItemState eSta } } -IMPL_LINK(SfxTemplateControllerItem, SetWaterCanStateHdl_Impl, - SfxTemplateControllerItem*,) +IMPL_LINK_NOARG_TYPED(SfxTemplateControllerItem, SetWaterCanStateHdl_Impl, void*, void) { nUserEventId = 0; SfxBoolItem* pState = 0; @@ -168,7 +167,6 @@ IMPL_LINK(SfxTemplateControllerItem, SetWaterCanStateHdl_Impl, } rTemplateDlg.SetWaterCanState(pState); delete pState; - return 0; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/inc/templdgi.hxx b/sfx2/source/inc/templdgi.hxx index 28e8d2419a64..8a79c49f5e91 100644 --- a/sfx2/source/inc/templdgi.hxx +++ b/sfx2/source/inc/templdgi.hxx @@ -53,7 +53,7 @@ namespace com { namespace sun { namespace star { namespace frame { class DropListBox_Impl : public SvTreeListBox { private: - DECL_LINK(OnAsyncExecuteDrop, void *); + DECL_LINK_TYPED(OnAsyncExecuteDrop, void *, void); protected: SfxCommonTemplateDialog_Impl* pDialog; @@ -292,6 +292,7 @@ public: virtual ~SfxCommonTemplateDialog_Impl(); DECL_LINK( MenuSelectHdl, Menu * ); + DECL_LINK_TYPED( MenuSelectAsyncHdl, void*, void ); virtual void EnableEdit( bool b = true ) { diff --git a/sfx2/source/inc/tplcitem.hxx b/sfx2/source/inc/tplcitem.hxx index 57270b480b57..35a490a1e215 100644 --- a/sfx2/source/inc/tplcitem.hxx +++ b/sfx2/source/inc/tplcitem.hxx @@ -29,7 +29,7 @@ class SfxTemplateControllerItem : public SfxControllerItem { sal_uInt8 nWaterCanState; ImplSVEvent* nUserEventId; - DECL_LINK(SetWaterCanStateHdl_Impl, SfxTemplateControllerItem*); + DECL_LINK_TYPED(SetWaterCanStateHdl_Impl, void*, void); protected: virtual void StateChanged(sal_uInt16, SfxItemState, const SfxPoolItem* pState) SAL_OVERRIDE; diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index fc85b0055cff..8ba12b55e3ca 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -133,8 +133,9 @@ void SfxURLToolBoxControl_Impl::OpenURL( const OUString& rName, bool /*bNew*/ ) -IMPL_STATIC_LINK( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo*, pExecuteInfo ) +IMPL_STATIC_LINK_TYPED( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, void*, p, void ) { + ExecuteInfo* pExecuteInfo = static_cast(p); try { // Asynchronous execution as this can lead to our own destruction! @@ -147,7 +148,6 @@ IMPL_STATIC_LINK( SfxURLToolBoxControl_Impl, ExecuteHdl_Impl, ExecuteInfo*, pExe } delete pExecuteInfo; - return 0; } diff --git a/sfx2/source/notify/hintpost.cxx b/sfx2/source/notify/hintpost.cxx index f952b6b5971a..81c68d50e11a 100644 --- a/sfx2/source/notify/hintpost.cxx +++ b/sfx2/source/notify/hintpost.cxx @@ -39,11 +39,10 @@ void SfxHintPoster::Post( SfxRequest* pHintToPost ) AddFirstRef(); } -IMPL_LINK( SfxHintPoster, DoEvent_Impl, SfxRequest *, pPostedHint ) +IMPL_LINK_TYPED( SfxHintPoster, DoEvent_Impl, void *, pPostedHint, void ) { - m_Link.Call( pPostedHint ); + m_Link.Call( static_cast(pPostedHint) ); ReleaseRef(); - return 0; } void SfxHintPoster::SetEventHdl(const Link& rLink) diff --git a/sfx2/source/sidebar/AsynchronousCall.cxx b/sfx2/source/sidebar/AsynchronousCall.cxx index f9ebe18624a9..13aff881c322 100644 --- a/sfx2/source/sidebar/AsynchronousCall.cxx +++ b/sfx2/source/sidebar/AsynchronousCall.cxx @@ -43,7 +43,7 @@ void AsynchronousCall::RequestCall() { if (mnCallId == 0) { - Link<> aLink (LINK(this, AsynchronousCall, HandleUserCall)); + Link aLink (LINK(this, AsynchronousCall, HandleUserCall)); mnCallId = Application::PostUserEvent(aLink); } } @@ -57,13 +57,11 @@ void AsynchronousCall::CancelRequest() } } -IMPL_LINK_NOARG(AsynchronousCall, HandleUserCall ) +IMPL_LINK_NOARG_TYPED(AsynchronousCall, HandleUserCall, void*, void ) { mnCallId = 0; if (maAction) maAction(); - - return sal_IntPtr(true); } } } // end of namespace sfx2::sidebar diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index dc6f439905e5..4a0c3f743a99 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -135,7 +135,7 @@ private: uno::Reference< datatransfer::clipboard::XClipboardNotifier > m_xClpbrdNtfr; uno::Reference< lang::XComponent > m_xCtrl; - DECL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, AsyncExecuteInfo* ); + DECL_STATIC_LINK_TYPED( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void*, void ); }; SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, const uno::Reference< datatransfer::clipboard::XClipboardNotifier >& xClpbrdNtfr ) @@ -170,8 +170,9 @@ void SfxClipboardChangeListener::ChangedContents() } } -IMPL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, AsyncExecuteInfo*, pAsyncExecuteInfo ) +IMPL_STATIC_LINK_TYPED( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, void*, p, void ) { + AsyncExecuteInfo* pAsyncExecuteInfo = static_cast(p); if ( pAsyncExecuteInfo ) { uno::Reference< datatransfer::clipboard::XClipboardListener > xThis( pAsyncExecuteInfo->m_xThis ); @@ -184,8 +185,6 @@ IMPL_STATIC_LINK( SfxClipboardChangeListener, AsyncExecuteHdl_Impl, AsyncExecute } } delete pAsyncExecuteInfo; - - return 0; } void SAL_CALL SfxClipboardChangeListener::disposing( const lang::EventObject& /*rEventObject*/ ) -- cgit