From 42590fd2aa73c77c07b62ef1dcc823e17f6bb1e9 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 8 Jun 2015 16:27:56 +0200 Subject: loplugin:cstylecast: deal with remaining pointer casts Change-Id: Idc749cf79afe1f6612f5f44a9c44aae853f78275 --- sfx2/source/appl/appinit.cxx | 2 +- sfx2/source/appl/helpinterceptor.cxx | 4 ++-- sfx2/source/appl/linkmgr2.cxx | 2 +- sfx2/source/appl/workwin.cxx | 2 +- sfx2/source/bastyp/progress.cxx | 2 +- sfx2/source/control/bindings.cxx | 2 +- sfx2/source/control/shell.cxx | 4 ++-- sfx2/source/control/statcach.cxx | 6 +++--- sfx2/source/control/unoctitm.cxx | 24 ++++++++++++------------ sfx2/source/dialog/printopt.cxx | 8 ++++---- sfx2/source/dialog/splitwin.cxx | 2 +- sfx2/source/doc/sfxbasemodel.cxx | 10 +++++----- 12 files changed, 34 insertions(+), 34 deletions(-) (limited to 'sfx2') diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 28a709f707cd..d6315d286d45 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -242,7 +242,7 @@ bool SfxApplication::Initialize_Impl() SfxPickList::ensure(); DBG_ASSERT( !pAppData_Impl->pAppDispat, "AppDispatcher already exists" ); - pAppData_Impl->pAppDispat = new SfxDispatcher((SfxDispatcher*)0); + pAppData_Impl->pAppDispat = new SfxDispatcher(static_cast(nullptr)); pAppData_Impl->pSlotPool = new SfxSlotPool; pAppData_Impl->pTbxCtrlFac = new SfxTbxCtrlFactArr_Impl; pAppData_Impl->pStbCtrlFac = new SfxStbCtrlFactArr_Impl; diff --git a/sfx2/source/appl/helpinterceptor.cxx b/sfx2/source/appl/helpinterceptor.cxx index b71803252d08..c522046e656b 100644 --- a/sfx2/source/appl/helpinterceptor.cxx +++ b/sfx2/source/appl/helpinterceptor.cxx @@ -95,7 +95,7 @@ void HelpInterceptor_Impl::addURL( const OUString& rURL ) URL aURL; aURL.Complete = rURL; aEvent.FeatureURL = aURL; - aEvent.Source = (::com::sun::star::frame::XDispatch*)this; + aEvent.Source = static_cast(this); m_xListener->statusChanged( aEvent ); } @@ -109,7 +109,7 @@ void HelpInterceptor_Impl::setInterception( Reference< XFrame > xFrame ) m_xIntercepted = Reference< XDispatchProviderInterception>( xFrame, UNO_QUERY ); if ( m_xIntercepted.is() ) - m_xIntercepted->registerDispatchProviderInterceptor( (XDispatchProviderInterceptor*)this ); + m_xIntercepted->registerDispatchProviderInterceptor( static_cast(this) ); } diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index c3e25657c08e..c77ee19ec8ee 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -523,7 +523,7 @@ bool LinkManager::GetGraphicFromAny( const OUString& rMimeType, ::com::sun::star::uno::Sequence< sal_Int8 > aSeq; if( rValue.hasValue() && ( rValue >>= aSeq ) ) { - SvMemoryStream aMemStm( (void*)aSeq.getConstArray(), aSeq.getLength(), + SvMemoryStream aMemStm( const_cast(aSeq.getConstArray()), aSeq.getLength(), StreamMode::READ ); aMemStm.Seek( 0 ); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 2b360fa50974..1bf8e323a760 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -550,7 +550,7 @@ SfxWorkWindow::SfxWorkWindow( vcl::Window *pWin, SfxBindings& rB, SfxWorkWindow* // For the ObjectBars a integral place in the Childlist is reserved, // so that they always come in a defined order. - aChildren.insert( aChildren.begin(), SFX_OBJECTBAR_MAX, (SfxChild_Impl*)NULL ); + aChildren.insert( aChildren.begin(), SFX_OBJECTBAR_MAX, nullptr ); // create and initialize layout manager listener Reference< com::sun::star::frame::XFrame > xFrame = GetFrameInterface(); diff --git a/sfx2/source/bastyp/progress.cxx b/sfx2/source/bastyp/progress.cxx index 1593ef3992f0..6735a0c27544 100644 --- a/sfx2/source/bastyp/progress.cxx +++ b/sfx2/source/bastyp/progress.cxx @@ -75,7 +75,7 @@ struct SfxProgress_Impl void SfxProgress_Impl::Enable_Impl( bool bEnable ) { - SfxObjectShell* pDoc = bAllDocs ? NULL : (SfxObjectShell*) xObjSh; + SfxObjectShell* pDoc = bAllDocs ? NULL : static_cast(xObjSh); SfxViewFrame *pFrame= SfxViewFrame::GetFirst(pDoc); while ( pFrame ) { diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx index 76c4d4ff5d49..8c387037d62d 100644 --- a/sfx2/source/control/bindings.cxx +++ b/sfx2/source/control/bindings.cxx @@ -2071,7 +2071,7 @@ void SfxBindings::InvalidateUnoControllers_Impl() for ( sal_uInt16 n=nCount; n>0; n-- ) { SfxUnoControllerItem *pCtrl = (*pImp->pUnoCtrlArr)[n-1]; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef( (::cppu::OWeakObject*)pCtrl, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef( static_cast(pCtrl), ::com::sun::star::uno::UNO_QUERY ); pCtrl->ReleaseDispatch(); pCtrl->GetNewDispatch(); } diff --git a/sfx2/source/control/shell.cxx b/sfx2/source/control/shell.cxx index 520ba71c4fdf..8306dfe5f5a6 100644 --- a/sfx2/source/control/shell.cxx +++ b/sfx2/source/control/shell.cxx @@ -408,14 +408,14 @@ bool SfxShell::CanExecuteSlot_Impl( const SfxSlot &rSlot ) sal_IntPtr ShellCall_Impl( void* pObj, void* pArg ) { - static_cast(pObj)->ExecuteSlot( *static_cast(pArg), (SfxInterface*)0L ); + static_cast(pObj)->ExecuteSlot( *static_cast(pArg), nullptr ); return 0; } const SfxPoolItem* SfxShell::ExecuteSlot( SfxRequest& rReq, bool bAsync ) { if( !bAsync ) - return ExecuteSlot( rReq, (SfxInterface*)0L ); + return ExecuteSlot( rReq, nullptr ); else { if( !pImp->pExecuter ) diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 553cf4a1b645..b1b098d24eac 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -67,7 +67,7 @@ void SAL_CALL BindDispatch_Impl::disposing( const ::com::sun::star::lang::EventO { if ( xDisp.is() ) { - xDisp->removeStatusListener( (::com::sun::star::frame::XStatusListener*) this, aURL ); + xDisp->removeStatusListener( static_cast(this), aURL ); xDisp = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > (); } } @@ -78,7 +78,7 @@ void SAL_CALL BindDispatch_Impl::statusChanged( const ::com::sun::star::frame:: if ( !pCache ) return; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > xRef( static_cast(this), ::com::sun::star::uno::UNO_QUERY ); if ( aStatus.Requery ) pCache->Invalidate( true ); else @@ -153,7 +153,7 @@ void BindDispatch_Impl::Release() { if ( xDisp.is() ) { - xDisp->removeStatusListener( (::com::sun::star::frame::XStatusListener*) this, aURL ); + xDisp->removeStatusListener( static_cast(this), aURL ); xDisp = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > (); } diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx index 1ab2b53ca9d9..56a82072be2a 100644 --- a/sfx2/source/control/unoctitm.cxx +++ b/sfx2/source/control/unoctitm.cxx @@ -123,7 +123,7 @@ void SfxUnoControllerItem::UnBind() { // connection to SfxControllerItem is lost pCtrlItem = NULL; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( static_cast(this), ::com::sun::star::uno::UNO_QUERY ); ReleaseDispatch(); } @@ -137,7 +137,7 @@ void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame: // Error can only happen if the old Dispatch is implemented incorrectly // i.e. removeStatusListener did not work. But such things can happen... // So protect before ReleaseDispatch from release! - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( static_cast(this), ::com::sun::star::uno::UNO_QUERY ); ReleaseDispatch(); if ( pCtrlItem ) GetNewDispatch(); // asynchronous ?? @@ -186,7 +186,7 @@ void SAL_CALL SfxUnoControllerItem::statusChanged(const ::com::sun::star::frame: void SAL_CALL SfxUnoControllerItem::disposing( const ::com::sun::star::lang::EventObject& ) throw ( ::com::sun::star::uno::RuntimeException, std::exception ) { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( static_cast(this), ::com::sun::star::uno::UNO_QUERY ); ReleaseDispatch(); } @@ -194,7 +194,7 @@ void SfxUnoControllerItem::ReleaseDispatch() { if ( xDispatch.is() ) { - xDispatch->removeStatusListener( (::com::sun::star::frame::XStatusListener*) this, aCommand ); + xDispatch->removeStatusListener( static_cast(this), aCommand ); xDispatch = ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > (); } } @@ -231,7 +231,7 @@ void SfxUnoControllerItem::GetNewDispatch() } if ( xDispatch.is() ) - xDispatch->addStatusListener( (::com::sun::star::frame::XStatusListener*) this, aCommand ); + xDispatch->addStatusListener( static_cast(this), aCommand ); else if ( pCtrlItem ) pCtrlItem->StateChanged( pCtrlItem->GetId(), SfxItemState::DISABLED, NULL ); } @@ -250,7 +250,7 @@ void SfxUnoControllerItem::GetNewDispatch() void SfxUnoControllerItem::ReleaseBindings() { // connection to binding is lost; so forget the binding and the dispatch - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( (::cppu::OWeakObject*)this, ::com::sun::star::uno::UNO_QUERY ); + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > aRef( static_cast(this), ::com::sun::star::uno::UNO_QUERY ); ReleaseDispatch(); if ( pBindings ) pBindings->ReleaseUnoController_Impl( this ); @@ -260,7 +260,7 @@ void SfxUnoControllerItem::ReleaseBindings() void SfxStatusDispatcher::ReleaseAll() { ::com::sun::star::lang::EventObject aObject; - aObject.Source = (::cppu::OWeakObject*) this; + aObject.Source = static_cast(this); aListeners.disposeAndClear( aObject ); } @@ -287,7 +287,7 @@ void SAL_CALL SfxStatusDispatcher::addStatusListener(const ::com::sun::star::uno { ::com::sun::star::frame::FeatureStateEvent aEvent; aEvent.FeatureURL = aURL; - aEvent.Source = (::com::sun::star::frame::XDispatch*) this; + aEvent.Source = static_cast(this); aEvent.IsEnabled = sal_True; aEvent.Requery = sal_False; aListener->statusChanged( aEvent ); @@ -471,7 +471,7 @@ SfxDispatchController_Impl::~SfxDispatchController_Impl() // force all listeners to release the dispatch object ::com::sun::star::lang::EventObject aObject; - aObject.Source = (::cppu::OWeakObject*) pDispatch; + aObject.Source = static_cast(pDispatch); pDispatch->GetListeners().disposeAndClear( aObject ); } } @@ -881,7 +881,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util else aEvent.State = com::sun::star::frame::DispatchResultState::FAILURE; - aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch; + aEvent.Source = static_cast(pDispatch); if ( bSuccess && pItem && !pItem->ISA(SfxVoidItem) ) { sal_uInt16 nSubId( 0 ); @@ -924,7 +924,7 @@ void SAL_CALL SfxDispatchController_Impl::addStatusListener(const ::com::sun::st ::com::sun::star::frame::FeatureStateEvent aEvent; aEvent.FeatureURL = aURL; - aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch; + aEvent.Source = static_cast(pDispatch); aEvent.Requery = sal_False; if ( bVisible ) { @@ -1012,7 +1012,7 @@ void SfxDispatchController_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eSt ::com::sun::star::frame::FeatureStateEvent aEvent; aEvent.FeatureURL = aDispatchURL; - aEvent.Source = (::com::sun::star::frame::XDispatch*) pDispatch; + aEvent.Source = static_cast(pDispatch); aEvent.IsEnabled = eState != SfxItemState::DISABLED; aEvent.Requery = sal_False; aEvent.State = aState; diff --git a/sfx2/source/dialog/printopt.cxx b/sfx2/source/dialog/printopt.cxx index 851509941889..0953401cce1a 100644 --- a/sfx2/source/dialog/printopt.cxx +++ b/sfx2/source/dialog/printopt.cxx @@ -122,9 +122,9 @@ VclPtr SfxCommonPrintOptionsTabPage::Create( vcl::Window* pParent, c vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const vcl::Window* pWindow ) const { - if ( pWindow == (vcl::Window *)m_pReduceGradientsStepCountNF ) + if ( pWindow == static_cast(m_pReduceGradientsStepCountNF) ) return m_pReduceGradientsStripesRB; - else if ( pWindow == (vcl::Window *)m_pReduceBitmapsResolutionLB ) + else if ( pWindow == static_cast(m_pReduceBitmapsResolutionLB) ) return m_pReduceBitmapsResolutionRB; else return SfxTabPage::GetParentLabeledBy( pWindow ); @@ -132,9 +132,9 @@ vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabeledBy( const vcl::Window vcl::Window* SfxCommonPrintOptionsTabPage::GetParentLabelFor( const vcl::Window* pWindow ) const { - if ( pWindow == (vcl::Window *)m_pReduceGradientsStripesRB ) + if ( pWindow == static_cast(m_pReduceGradientsStripesRB) ) return m_pReduceGradientsStepCountNF; - else if ( pWindow == (vcl::Window *)m_pReduceBitmapsResolutionRB ) + else if ( pWindow == static_cast(m_pReduceBitmapsResolutionRB) ) return m_pReduceBitmapsResolutionLB; else return SfxTabPage::GetParentLabelFor( pWindow ); diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx index 805c8002ebe7..ca08f6f4d73a 100644 --- a/sfx2/source/dialog/splitwin.cxx +++ b/sfx2/source/dialog/splitwin.cxx @@ -1067,7 +1067,7 @@ bool SfxSplitWindow::CursorIsOverRect( bool bForceAdding ) const aRect = aRect.GetUnion( aVisRect ); } - if ( aRect.IsInside( OutputToScreenPixel( ((vcl::Window*)this)->GetPointerPosPixel() ) ) ) + if ( aRect.IsInside( OutputToScreenPixel( static_cast(const_cast(this))->GetPointerPosPixel() ) ) ) return true; return false; } diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 07d2805ed706..f28a43b75056 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -772,7 +772,7 @@ void SAL_CALL SfxBaseModel::dispose() throw(RuntimeException, std::exception) m_pData->m_pDocumentUndoManager = NULL; } - lang::EventObject aEvent( (frame::XModel *)this ); + lang::EventObject aEvent( static_cast(this) ); m_pData->m_aInterfaceContainer.disposeAndClear( aEvent ); m_pData->m_xDocumentProperties.clear(); @@ -2850,7 +2850,7 @@ void SfxBaseModel::NotifyModifyListeners_Impl() const ::cppu::OInterfaceContainerHelper* pIC = m_pData->m_aInterfaceContainer.getContainer( cppu::UnoType::get()); if ( pIC ) { - lang::EventObject aEvent( (frame::XModel *)this ); + lang::EventObject aEvent( static_cast(const_cast(this)) ); pIC->notifyEach( &util::XModifyListener::modified, aEvent ); } @@ -2876,7 +2876,7 @@ void SfxBaseModel::changing() SfxObjectShell* SfxBaseModel::GetObjectShell() const { - return m_pData ? (SfxObjectShell*) m_pData->m_pObjectShell : 0; + return m_pData ? static_cast(m_pData->m_pObjectShell) : 0; } @@ -3181,7 +3181,7 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame { SAL_INFO("sfx.doc", "SfxDocumentEvent: " + aName); - document::DocumentEvent aDocumentEvent( (frame::XModel*)this, aName, xController, Any() ); + document::DocumentEvent aDocumentEvent( static_cast(this), aName, xController, Any() ); pIC->forEach< document::XDocumentEventListener, NotifySingleListenerIgnoreRE< document::XDocumentEventListener, document::DocumentEvent > >( NotifySingleListenerIgnoreRE< document::XDocumentEventListener, document::DocumentEvent >( @@ -3194,7 +3194,7 @@ void SfxBaseModel::postEvent_Impl( const OUString& aName, const Reference< frame { SAL_INFO("sfx.doc", "SfxEvent: " + aName); - document::EventObject aEvent( (frame::XModel*)this, aName ); + document::EventObject aEvent( static_cast(this), aName ); pIC->forEach< document::XEventListener, NotifySingleListenerIgnoreRE< document::XEventListener, document::EventObject > >( NotifySingleListenerIgnoreRE< document::XEventListener, document::EventObject >( -- cgit