diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-23 10:15:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-23 15:25:26 +0200 |
commit | 8a54339fc83fe9abaaace6f9f374697e6923d684 (patch) | |
tree | 516e82bb9eca2d586aa7acebbe369f67ff707a7f /framework | |
parent | d34f1df73806e9ca05fa0d07da619e2c0f01b6f7 (diff) |
loplugin:referencecasting look through more clang Types
Note that because of where the fix resides, loplugin:redundantcast
also notices a few more things.
Change-Id: I0b66047fadfff2c5ceafcbd3eab085de00d861a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120865
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'framework')
40 files changed, 147 insertions, 190 deletions
diff --git a/framework/source/dispatch/interceptionhelper.cxx b/framework/source/dispatch/interceptionhelper.cxx index 5287244b677a..3363805299f8 100644 --- a/framework/source/dispatch/interceptionhelper.cxx +++ b/framework/source/dispatch/interceptionhelper.cxx @@ -102,7 +102,7 @@ css::uno::Sequence< css::uno::Reference< css::frame::XDispatch > > SAL_CALL Inte void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) { // reject incorrect calls of this interface method - css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XDispatchProvider > xThis(this); if (!xInterceptor.is()) throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis); @@ -165,7 +165,7 @@ void SAL_CALL InterceptionHelper::registerDispatchProviderInterceptor(const css: void SAL_CALL InterceptionHelper::releaseDispatchProviderInterceptor(const css::uno::Reference< css::frame::XDispatchProviderInterceptor >& xInterceptor) { // reject wrong calling of this interface method - css::uno::Reference< css::frame::XDispatchProvider > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XDispatchProvider > xThis(this); if (!xInterceptor.is()) throw css::uno::RuntimeException("NULL references not allowed as in parameter", xThis); diff --git a/framework/source/dispatch/mailtodispatcher.cxx b/framework/source/dispatch/mailtodispatcher.cxx index 7dcdb073203d..330e395c4cfa 100644 --- a/framework/source/dispatch/mailtodispatcher.cxx +++ b/framework/source/dispatch/mailtodispatcher.cxx @@ -118,7 +118,7 @@ void SAL_CALL MailToDispatcher::dispatch( const css::util::URL& { // dispatch() is an [oneway] call ... and may our user release his reference to us immediately. // So we should hold us self alive till this call ends. - css::uno::Reference< css::frame::XNotifyingDispatch > xSelfHold(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XNotifyingDispatch > xSelfHold(this); implts_dispatch(aURL); // No notification for status listener! } @@ -142,7 +142,7 @@ void SAL_CALL MailToDispatcher::dispatchWithNotification( const css::util::URL& // This class was designed to die by reference. And if user release his reference to us immediately after calling this method // we can run into some problems. So we hold us self alive till this method ends. // Another reason: We can use this reference as source of sending event at the end too. - css::uno::Reference< css::frame::XNotifyingDispatch > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XNotifyingDispatch > xThis(this); bool bState = implts_dispatch(aURL); if (xListener.is()) diff --git a/framework/source/dispatch/popupmenudispatcher.cxx b/framework/source/dispatch/popupmenudispatcher.cxx index 1b845347454f..a35bd10599fd 100644 --- a/framework/source/dispatch/popupmenudispatcher.cxx +++ b/framework/source/dispatch/popupmenudispatcher.cxx @@ -86,8 +86,7 @@ void SAL_CALL PopupMenuDispatcher::initialize( const css::uno::Sequence< css::un m_xWeakFrame = xFrame; m_bActivateListener = true; - uno::Reference< css::frame::XFrameActionListener > xFrameActionListener( - static_cast<OWeakObject *>(this), css::uno::UNO_QUERY ); + uno::Reference< css::frame::XFrameActionListener > xFrameActionListener(this); xFrame->addFrameActionListener( xFrameActionListener ); } } @@ -212,7 +211,7 @@ void SAL_CALL PopupMenuDispatcher::disposing( const EventObject& ) uno::Reference< XFrame > xFrame( m_xWeakFrame.get(), UNO_QUERY ); if ( xFrame.is() ) { - xFrame->removeFrameActionListener( uno::Reference< XFrameActionListener >( static_cast<OWeakObject *>(this), UNO_QUERY )); + xFrame->removeFrameActionListener( uno::Reference< XFrameActionListener >(this) ); m_bActivateListener = false; } } diff --git a/framework/source/dispatch/servicehandler.cxx b/framework/source/dispatch/servicehandler.cxx index a4eac242aa11..a7a100bd19c1 100644 --- a/framework/source/dispatch/servicehandler.cxx +++ b/framework/source/dispatch/servicehandler.cxx @@ -119,7 +119,7 @@ void SAL_CALL ServiceHandler::dispatch( const css::util::URL& { // dispatch() is an [oneway] call ... and may our user release his reference to us immediately. // So we should hold us self alive till this call ends. - css::uno::Reference< css::frame::XNotifyingDispatch > xSelfHold(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XNotifyingDispatch > xSelfHold(this); implts_dispatch(aURL); // No notification for status listener! } @@ -143,7 +143,7 @@ void SAL_CALL ServiceHandler::dispatchWithNotification( const css::util::URL& // This class was designed to die by reference. And if user release his reference to us immediately after calling this method // we can run into some problems. So we hold us self alive till this method ends. // Another reason: We can use this reference as source of sending event at the end too. - css::uno::Reference< css::frame::XNotifyingDispatch > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XNotifyingDispatch > xThis(this); css::uno::Reference< css::uno::XInterface > xService = implts_dispatch(aURL); if (xListener.is()) diff --git a/framework/source/fwe/helper/actiontriggerhelper.cxx b/framework/source/fwe/helper/actiontriggerhelper.cxx index aca142bcee8e..ac9f9c41a3ff 100644 --- a/framework/source/fwe/helper/actiontriggerhelper.cxx +++ b/framework/source/fwe/helper/actiontriggerhelper.cxx @@ -269,7 +269,7 @@ static Reference< XPropertySet > CreateActionTrigger( sal_uInt16 nItemId, const if ( !!aImage ) { // We use our own optimized XBitmap implementation - Reference< XBitmap > xBitmap( static_cast< cppu::OWeakObject* >( new ImageWrapper( aImage )), UNO_QUERY ); + Reference< XBitmap > xBitmap = new ImageWrapper( aImage ); a <<= xBitmap; xPropSet->setPropertyValue("Image", a ); } diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx index e5a548640a58..fe6940d42348 100644 --- a/framework/source/fwe/xml/menuconfiguration.cxx +++ b/framework/source/fwe/xml/menuconfiguration.cxx @@ -62,7 +62,7 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML( aInputSource.aInputStream = rInputStream; // create menu bar - Reference< XIndexContainer > xItemContainer( static_cast< cppu::OWeakObject *>( new RootItemContainer()), UNO_QUERY ); + Reference< XIndexContainer > xItemContainer( new RootItemContainer() ); // create namespace filter and set menudocument handler inside to support xml namespaces diff --git a/framework/source/helper/uiconfigelementwrapperbase.cxx b/framework/source/helper/uiconfigelementwrapperbase.cxx index 399bf8bc9d8c..43c2eee5975c 100644 --- a/framework/source/helper/uiconfigelementwrapperbase.cxx +++ b/framework/source/helper/uiconfigelementwrapperbase.cxx @@ -264,7 +264,7 @@ void SAL_CALL UIConfigElementWrapperBase::setFastPropertyValue_NoBroadcast( sa Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY ); if ( xUIConfig.is() ) { - xUIConfig->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xUIConfig->removeConfigurationListener( Reference< XUIConfigurationListener >(this) ); m_bConfigListening = false; } } @@ -282,7 +282,7 @@ void SAL_CALL UIConfigElementWrapperBase::setFastPropertyValue_NoBroadcast( sa Reference< XUIConfiguration > xUIConfig( m_xConfigSource, UNO_QUERY ); if ( xUIConfig.is() ) { - xUIConfig->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xUIConfig->addConfigurationListener( Reference< XUIConfigurationListener >(this) ); m_bConfigListening = true; } } @@ -419,7 +419,7 @@ void SAL_CALL UIConfigElementWrapperBase::setSettings( const Reference< XIndexAc // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( xSettings, UNO_QUERY ); if ( xReplace.is() ) - m_xConfigData.set( static_cast< OWeakObject * >( new ConstItemContainer( xSettings ) ), UNO_QUERY ); + m_xConfigData = new ConstItemContainer( xSettings ); else m_xConfigData = xSettings; @@ -452,7 +452,7 @@ Reference< XIndexAccess > SAL_CALL UIConfigElementWrapperBase::getSettings( sal_ SolarMutexGuard g; if ( bWriteable ) - return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( m_xConfigData ) ), UNO_QUERY ); + return Reference< XIndexAccess >( new RootItemContainer( m_xConfigData ) ); return m_xConfigData; } diff --git a/framework/source/jobs/job.cxx b/framework/source/jobs/job.cxx index 4cb9c5bb0ce1..81203f3afcfc 100644 --- a/framework/source/jobs/job.cxx +++ b/framework/source/jobs/job.cxx @@ -175,7 +175,7 @@ void Job::execute( /*IN*/ const css::uno::Sequence< css::beans::NamedValue >& lD // It's necessary to hold us self alive! // Otherwise we might die by ref count ... - css::uno::Reference< css::task::XJobListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::task::XJobListener > xThis(this); try { @@ -495,7 +495,7 @@ void Job::impl_startListening() try { m_xDesktop = css::frame::Desktop::create( m_xContext ); - css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XTerminateListener > xThis(this); m_xDesktop->addTerminateListener(xThis); m_bListenOnDesktop = true; } @@ -511,7 +511,7 @@ void Job::impl_startListening() try { css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xFrame , css::uno::UNO_QUERY); - css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XCloseListener > xThis(this); if (xCloseable.is()) { xCloseable->addCloseListener(xThis); @@ -531,7 +531,7 @@ void Job::impl_startListening() try { css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY); - css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XCloseListener > xThis(this); if (xCloseable.is()) { xCloseable->addCloseListener(xThis); @@ -557,7 +557,7 @@ void Job::impl_stopListening() { try { - css::uno::Reference< css::frame::XTerminateListener > xThis(static_cast< ::cppu::OWeakObject* >(this) , css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XTerminateListener > xThis(this); m_xDesktop->removeTerminateListener(xThis); m_xDesktop.clear(); m_bListenOnDesktop = false; @@ -573,7 +573,7 @@ void Job::impl_stopListening() try { css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xFrame , css::uno::UNO_QUERY); - css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XCloseListener > xThis(this); if (xCloseable.is()) { xCloseable->removeCloseListener(xThis); @@ -592,7 +592,7 @@ void Job::impl_stopListening() try { css::uno::Reference< css::util::XCloseBroadcaster > xCloseable(m_xModel , css::uno::UNO_QUERY); - css::uno::Reference< css::util::XCloseListener > xThis (static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XCloseListener > xThis(this); if (xCloseable.is()) { xCloseable->removeCloseListener(xThis); diff --git a/framework/source/jobs/jobdispatch.cxx b/framework/source/jobs/jobdispatch.cxx index 964f128e9110..c07727d017e7 100644 --- a/framework/source/jobs/jobdispatch.cxx +++ b/framework/source/jobs/jobdispatch.cxx @@ -204,7 +204,7 @@ css::uno::Reference< css::frame::XDispatch > SAL_CALL JobDispatch::queryDispatch JobURL aAnalyzedURL(aURL.Complete); if (aAnalyzedURL.isValid()) - xDispatch.set( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); + xDispatch = this; return xDispatch; } diff --git a/framework/source/layoutmanager/layoutmanager.cxx b/framework/source/layoutmanager/layoutmanager.cxx index 2d76f8eaf378..973ec6bbaf92 100644 --- a/framework/source/layoutmanager/layoutmanager.cxx +++ b/framework/source/layoutmanager/layoutmanager.cxx @@ -311,7 +311,7 @@ void LayoutManager::implts_reset( bool bAttached ) try { // Remove listener to old module ui configuration manager - xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xModuleCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -323,7 +323,7 @@ void LayoutManager::implts_reset( bool bAttached ) // Add listener to new module ui configuration manager xModuleCfgMgr.set( xModuleCfgSupplier->getUIConfigurationManager( aModuleIdentifier ), UNO_QUERY ); if ( xModuleCfgMgr.is() ) - xModuleCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xModuleCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -354,7 +354,7 @@ void LayoutManager::implts_reset( bool bAttached ) try { // Remove listener to old ui configuration manager - xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xDocCfgMgr->removeConfigurationListener( Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -365,7 +365,7 @@ void LayoutManager::implts_reset( bool bAttached ) { xDocCfgMgr.set( xUIConfigurationManagerSupplier->getUIConfigurationManager(), UNO_QUERY ); if ( xDocCfgMgr.is() ) - xDocCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + xDocCfgMgr->addConfigurationListener( Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -381,7 +381,7 @@ void LayoutManager::implts_reset( bool bAttached ) try { xModuleCfgMgr->removeConfigurationListener( - Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -393,7 +393,7 @@ void LayoutManager::implts_reset( bool bAttached ) try { xDocCfgMgr->removeConfigurationListener( - Reference< XUIConfigurationListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -1281,7 +1281,7 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki { Reference< awt::XWindow > xWindow( m_xDockingAreaAcceptor->getContainerWindow() ); if ( xWindow.is() && ( m_xFrame->getContainerWindow() != m_xContainerWindow || !xDockingAreaAcceptor.is() ) ) - xWindow->removeWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), UNO_QUERY )); + xWindow->removeWindowListener( Reference< awt::XWindowListener >(this) ); m_aDockingArea = awt::Rectangle(); if ( pToolbarManager ) @@ -1298,11 +1298,11 @@ void SAL_CALL LayoutManager::setDockingAreaAcceptor( const Reference< ui::XDocki m_aDockingArea = awt::Rectangle(); m_xContainerWindow = m_xDockingAreaAcceptor->getContainerWindow(); m_xContainerTopWindow.set( m_xContainerWindow, UNO_QUERY ); - m_xContainerWindow->addWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xContainerWindow->addWindowListener( Reference< awt::XWindowListener >(this) ); // we always must keep a connection to the window of our frame for resize events if ( m_xContainerWindow != m_xFrame->getContainerWindow() ) - m_xFrame->getContainerWindow()->addWindowListener( Reference< awt::XWindowListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xFrame->getContainerWindow()->addWindowListener( Reference< awt::XWindowListener >(this) ); // #i37884# set initial visibility state - in the plugin case the container window is already shown // and we get no notification anymore @@ -2762,8 +2762,7 @@ void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent ) try { Reference<XUIConfiguration> xModuleCfgMgr(m_xModuleCfgMgr, UNO_QUERY); - xModuleCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>( - static_cast<OWeakObject*>(this), UNO_QUERY)); + xModuleCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>(this)); } catch (const Exception&) { @@ -2775,8 +2774,7 @@ void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent ) try { Reference<XUIConfiguration> xDocCfgMgr(m_xDocCfgMgr, UNO_QUERY); - xDocCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>( - static_cast<OWeakObject*>(this), UNO_QUERY)); + xDocCfgMgr->removeConfigurationListener(Reference<XUIConfigurationListener>(this)); } catch (const Exception&) { @@ -2823,7 +2821,7 @@ void SAL_CALL LayoutManager::disposing( const lang::EventObject& rEvent ) if ( bDisposeAndClear ) { // Send message to all listener and forget her references. - uno::Reference< frame::XLayoutManager > xThis( static_cast< ::cppu::OWeakObject* >(this), uno::UNO_QUERY ); + uno::Reference< frame::XLayoutManager > xThis(this); lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); } diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index f0dc6025649f..4e901dd282bd 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -482,10 +482,8 @@ bool ToolbarLayoutManager::createToolbar( const OUString& rResourceURL ) { try { - xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); - xWindow->addWindowListener( uno::Reference< awt::XWindowListener >( - static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(this) ); + xWindow->addWindowListener( uno::Reference< awt::XWindowListener >(this) ); xDockWindow->enableDocking( true ); } catch (const uno::Exception&) @@ -596,8 +594,7 @@ bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL ) try { if ( xWindow.is() ) - xWindow->removeWindowListener( uno::Reference< awt::XWindowListener >( - static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xWindow->removeWindowListener( uno::Reference< awt::XWindowListener >(this) ); } catch (const uno::Exception&) { @@ -606,8 +603,7 @@ bool ToolbarLayoutManager::destroyToolbar( const OUString& rResourceURL ) try { if ( xDockWindow.is() ) - xDockWindow->removeDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xDockWindow->removeDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(this) ); } catch (const uno::Exception&) { @@ -1111,11 +1107,11 @@ void ToolbarLayoutManager::implts_createAddonsToolBars() { try { - xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xDockWindow->addDockableWindowListener( uno::Reference< awt::XDockableWindowListener >(this) ); xDockWindow->enableDocking( true ); uno::Reference< awt::XWindow > xWindow( xDockWindow, uno::UNO_QUERY ); if ( xWindow.is() ) - xWindow->addWindowListener( uno::Reference< awt::XWindowListener >( static_cast< OWeakObject * >( this ), uno::UNO_QUERY )); + xWindow->addWindowListener( uno::Reference< awt::XWindowListener >(this) ); } catch (const uno::Exception&) { diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx index 43869f7bdc44..4455f810a938 100644 --- a/framework/source/services/autorecovery.cxx +++ b/framework/source/services/autorecovery.cxx @@ -2185,7 +2185,7 @@ void AutoRecovery::implts_startModifyListeningOnDoc(AutoRecovery::TDocumentInfo& css::uno::Reference< css::util::XModifyBroadcaster > xBroadcaster(rInfo.Document, css::uno::UNO_QUERY); if (xBroadcaster.is()) { - css::uno::Reference< css::util::XModifyListener > xThis(static_cast< css::frame::XDispatch* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XModifyListener > xThis(this); xBroadcaster->addModifyListener(xThis); rInfo.ListenForModify = true; } @@ -2199,7 +2199,7 @@ void AutoRecovery::implts_stopModifyListeningOnDoc(AutoRecovery::TDocumentInfo& css::uno::Reference< css::util::XModifyBroadcaster > xBroadcaster(rInfo.Document, css::uno::UNO_QUERY); if (xBroadcaster.is()) { - css::uno::Reference< css::util::XModifyListener > xThis(static_cast< css::frame::XDispatch* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XModifyListener > xThis(this); xBroadcaster->removeModifyListener(xThis); rInfo.ListenForModify = false; } diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index e431c4dd520d..55af0d9c109a 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -583,7 +583,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL Desktop::loadComponentFrom TransactionGuard aTransaction( m_aTransactionManager, E_HARDEXCEPTIONS ); SAL_INFO( "fwk.desktop", "loadComponentFromURL" ); - css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XComponentLoader > xThis(this); utl::MediaDescriptor aDescriptor(lArguments); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false); diff --git a/framework/source/services/frame.cxx b/framework/source/services/frame.cxx index 6603ceaaecc3..56a1a7b1e623 100644 --- a/framework/source/services/frame.cxx +++ b/framework/source/services/frame.cxx @@ -580,7 +580,7 @@ css::uno::Reference< css::lang::XComponent > SAL_CALL XFrameImpl::loadComponentF { checkDisposed(); - css::uno::Reference< css::frame::XComponentLoader > xThis(static_cast< css::frame::XComponentLoader* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::frame::XComponentLoader > xThis(this); utl::MediaDescriptor aDescriptor(lArguments); bool bOnMainThread = aDescriptor.getUnpackedValueOrDefault("OnMainThread", false); @@ -1242,7 +1242,7 @@ void SAL_CALL XFrameImpl::activate() // he is threadsafe himself and live if we live. css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive(); css::uno::Reference< css::frame::XFramesSupplier > xParent = m_xParent; - css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XFrame > xThis(this); EActiveState eState = m_eActiveState; aWriteLock.clear(); @@ -1320,7 +1320,7 @@ void SAL_CALL XFrameImpl::deactivate() // Copy necessary member and free the lock. css::uno::Reference< css::frame::XFrame > xActiveChild = m_aChildFrameContainer.getActive(); css::uno::Reference< css::frame::XFramesSupplier > xParent = m_xParent; - css::uno::Reference< css::frame::XFrame > xThis ( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XFrame > xThis(this); EActiveState eState = m_eActiveState; aWriteLock.clear(); @@ -2082,7 +2082,7 @@ void SAL_CALL XFrameImpl::disposing() // We should hold a reference to ourself ... // because our owner dispose us and release our reference ... // May be we will die before we could finish this method ... - css::uno::Reference< css::frame::XFrame > xThis( static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XFrame > xThis(this); SAL_INFO("fwk.frame", "[Frame] " << m_sName << " send dispose event to listener"); @@ -3108,12 +3108,9 @@ void XFrameImpl::implts_startWindowListening() SolarMutexClearableGuard aReadLock; css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; - css::uno::Reference< css::awt::XWindowListener > xWindowListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XFocusListener > xFocusListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); + css::uno::Reference< css::awt::XWindowListener > xWindowListener(this); + css::uno::Reference< css::awt::XFocusListener > xFocusListener(this); + css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(this); aReadLock.clear(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ @@ -3147,12 +3144,9 @@ void XFrameImpl::implts_stopWindowListening() SolarMutexClearableGuard aReadLock; css::uno::Reference< css::awt::XWindow > xContainerWindow = m_xContainerWindow; css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > xDragDropListener = m_xDropTargetListener; - css::uno::Reference< css::awt::XWindowListener > xWindowListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XFocusListener > xFocusListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); - css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener( static_cast< ::cppu::OWeakObject* >(this), - css::uno::UNO_QUERY ); + css::uno::Reference< css::awt::XWindowListener > xWindowListener(this); + css::uno::Reference< css::awt::XFocusListener > xFocusListener(this); + css::uno::Reference< css::awt::XTopWindowListener > xTopWindowListener(this); aReadLock.clear(); /* UNSAFE AREA --------------------------------------------------------------------------------------------- */ diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index 5efaa204274b..f880e7354fd2 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -206,9 +206,7 @@ void GlobalSettings_Access::impl_initConfigAccess() css::uno::Reference< css::lang::XComponent >( xConfigProvider, css::uno::UNO_QUERY_THROW )->addEventListener( - css::uno::Reference< css::lang::XEventListener >( - static_cast< cppu::OWeakObject* >( this ), - css::uno::UNO_QUERY )); + css::uno::Reference< css::lang::XEventListener >(this)); } } catch ( const css::lang::WrappedTargetException& ) diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx index 02954c18dfd6..889b90cae936 100644 --- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx @@ -426,9 +426,9 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xContainer ); if ( pRootItemContainer ) - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); else - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( xContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -441,10 +441,10 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement { try { - Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + Reference< XIndexContainer > xIndexContainer( new RootItemContainer() ); ToolBoxConfiguration::LoadToolBox( m_xContext, xInputStream, xIndexContainer ); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer ); - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -458,10 +458,10 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement { try { - Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + Reference< XIndexContainer > xIndexContainer( new RootItemContainer() ); StatusBarConfiguration::LoadStatusBar( m_xContext, xInputStream, xIndexContainer ); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer ); - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -493,7 +493,7 @@ void ModuleUIConfigurationManager::impl_requestUIElementData( sal_Int16 nElement } // At least we provide an empty settings container! - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer() ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer(); } ModuleUIConfigurationManager::UIElementData* ModuleUIConfigurationManager::impl_findUIElementData( const OUString& aResourceURL, sal_Int16 nElementType, bool bLoad ) @@ -623,7 +623,7 @@ void ModuleUIConfigurationManager::impl_resetElementTypeData( { UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; @@ -685,7 +685,7 @@ void ModuleUIConfigurationManager::impl_reloadElementTypeData( { UIElementDataHashMap& rHashMap = rUserElementType.aElementsHashMap; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rUserElementType.nElementType; @@ -893,7 +893,7 @@ ModuleUIConfigurationManager::ModuleUIConfigurationManager( // XComponent void SAL_CALL ModuleUIConfigurationManager::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); @@ -1093,7 +1093,7 @@ Reference< XIndexContainer > SAL_CALL ModuleUIConfigurationManager::createSettin throw DisposedException(); // Creates an empty item container which can be filled from outside - return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + return Reference< XIndexContainer >( new RootItemContainer() ); } sal_Bool SAL_CALL ModuleUIConfigurationManager::hasSettings( const OUString& ResourceURL ) @@ -1134,7 +1134,7 @@ Reference< XIndexAccess > SAL_CALL ModuleUIConfigurationManager::getSettings( co { // Create a copy of our data if someone wants to change the data. if ( bWriteable ) - return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY ); + return Reference< XIndexAccess >( new RootItemContainer( pDataSettings->xSettings ) ); else return pDataSettings->xSettings; } @@ -1169,7 +1169,7 @@ void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const OUString& Res // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); if ( xReplace.is() ) - pDataSettings->xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + pDataSettings->xSettings = new ConstItemContainer( aNewData ); else pDataSettings->xSettings = aNewData; pDataSettings->bDefault = false; @@ -1180,7 +1180,7 @@ void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const OUString& Res UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; rElementType.bModified = true; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings @@ -1207,7 +1207,7 @@ void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const OUString& Res // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); if ( xReplace.is() ) - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( aNewData ); else aUIElementData.xSettings = aNewData; aUIElementData.aName = RetrieveNameFromResourceURL( ResourceURL ) + m_aXMLPostfix; @@ -1228,7 +1228,7 @@ void SAL_CALL ModuleUIConfigurationManager::replaceSettings( const OUString& Res else rElements.emplace( ResourceURL, aUIElementData ); - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings @@ -1290,7 +1290,7 @@ void SAL_CALL ModuleUIConfigurationManager::removeSettings( const OUString& Reso UIElementType& rElementType = m_aUIElements[LAYER_USERDEFINED][nElementType]; rElementType.bModified = true; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Check if we have settings in the default layer which replaces the user-defined one! @@ -1356,7 +1356,7 @@ void SAL_CALL ModuleUIConfigurationManager::insertSettings( const OUString& NewR // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); if ( xReplace.is() ) - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( aNewData ); else aUIElementData.xSettings = aNewData; aUIElementData.aName = RetrieveNameFromResourceURL( NewResourceURL ) + m_aXMLPostfix; @@ -1370,7 +1370,7 @@ void SAL_CALL ModuleUIConfigurationManager::insertSettings( const OUString& NewR rElements.emplace( NewResourceURL, aUIElementData ); Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); // Create event to notify listener about removed element settings ui::ConfigurationEvent aEvent; diff --git a/framework/source/uiconfiguration/uiconfigurationmanager.cxx b/framework/source/uiconfiguration/uiconfigurationmanager.cxx index 038c0585ae53..b1dd9b24f37b 100644 --- a/framework/source/uiconfiguration/uiconfigurationmanager.cxx +++ b/framework/source/uiconfiguration/uiconfigurationmanager.cxx @@ -349,9 +349,9 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, Reference< XIndexAccess > xContainer( aMenuCfg.CreateMenuBarConfigurationFromXML( xInputStream )); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xContainer ); if ( pRootItemContainer ) - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); else - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( xContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( xContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -364,10 +364,10 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, { try { - Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + Reference< XIndexContainer > xIndexContainer( new RootItemContainer() ); ToolBoxConfiguration::LoadToolBox( m_xContext, xInputStream, xIndexContainer ); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer ); - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -381,10 +381,10 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, { try { - Reference< XIndexContainer > xIndexContainer( static_cast< OWeakObject * >( new RootItemContainer() ), UNO_QUERY ); + Reference< XIndexContainer > xIndexContainer( new RootItemContainer() ); StatusBarConfiguration::LoadStatusBar( m_xContext, xInputStream, xIndexContainer ); auto pRootItemContainer = comphelper::getUnoTunnelImplementation<RootItemContainer>( xIndexContainer ); - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( pRootItemContainer, true ) ), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer( pRootItemContainer, true ); return; } catch ( const css::lang::WrappedTargetException& ) @@ -416,7 +416,7 @@ void UIConfigurationManager::impl_requestUIElementData( sal_Int16 nElementType, } // At least we provide an empty settings container! - aUIElementData.xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer()), UNO_QUERY ); + aUIElementData.xSettings = new ConstItemContainer(); } UIConfigurationManager::UIElementData* UIConfigurationManager::impl_findUIElementData( const OUString& aResourceURL, sal_Int16 nElementType, bool bLoad ) @@ -534,7 +534,7 @@ void UIConfigurationManager::impl_resetElementTypeData( { UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Make copies of the event structures to be thread-safe. We have to unlock our mutex before calling @@ -573,7 +573,7 @@ void UIConfigurationManager::impl_reloadElementTypeData( UIElementDataHashMap& rHashMap = rDocElementType.aElementsHashMap; Reference< XStorage > xElementStorage( rDocElementType.xStorage ); - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); sal_Int16 nType = rDocElementType.nElementType; @@ -683,7 +683,7 @@ UIConfigurationManager::UIConfigurationManager( const css::uno::Reference< css:: // XComponent void SAL_CALL UIConfigurationManager::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); @@ -874,7 +874,7 @@ Reference< XIndexContainer > SAL_CALL UIConfigurationManager::createSettings() throw DisposedException(); // Creates an empty item container which can be filled from outside - return Reference< XIndexContainer >( static_cast< OWeakObject * >( new RootItemContainer()), UNO_QUERY ); + return Reference< XIndexContainer >( new RootItemContainer() ); } sal_Bool SAL_CALL UIConfigurationManager::hasSettings( const OUString& ResourceURL ) @@ -909,7 +909,7 @@ Reference< XIndexAccess > SAL_CALL UIConfigurationManager::getSettings( const OU { // Create a copy of our data if someone wants to change the data. if ( bWriteable ) - return Reference< XIndexAccess >( static_cast< OWeakObject * >( new RootItemContainer( pDataSettings->xSettings ) ), UNO_QUERY ); + return Reference< XIndexAccess >( new RootItemContainer( pDataSettings->xSettings ) ); else return pDataSettings->xSettings; } @@ -942,7 +942,7 @@ void SAL_CALL UIConfigurationManager::replaceSettings( const OUString& ResourceU // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); if ( xReplace.is() ) - pDataSettings->xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + pDataSettings->xSettings = new ConstItemContainer( aNewData ); else pDataSettings->xSettings = aNewData; @@ -954,7 +954,7 @@ void SAL_CALL UIConfigurationManager::replaceSettings( const OUString& ResourceU UIElementType& rElementType = m_aUIElements[nElementType]; rElementType.bModified = true; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about replaced element settings @@ -1014,7 +1014,7 @@ void SAL_CALL UIConfigurationManager::removeSettings( const OUString& ResourceUR UIElementType& rElementType = m_aUIElements[nElementType]; rElementType.bModified = true; - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings @@ -1068,7 +1068,7 @@ void SAL_CALL UIConfigurationManager::insertSettings( const OUString& NewResourc // Create a copy of the data if the container is not const Reference< XIndexReplace > xReplace( aNewData, UNO_QUERY ); if ( xReplace.is() ) - pDataSettings->xSettings.set( static_cast< OWeakObject * >( new ConstItemContainer( aNewData ) ), UNO_QUERY ); + pDataSettings->xSettings = new ConstItemContainer( aNewData ); else pDataSettings->xSettings = aNewData; @@ -1087,7 +1087,7 @@ void SAL_CALL UIConfigurationManager::insertSettings( const OUString& NewResourc } Reference< XIndexAccess > xInsertSettings( aUIElementData.xSettings ); - Reference< XUIConfigurationManager > xThis( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XUIConfigurationManager > xThis(this); Reference< XInterface > xIfac( xThis, UNO_QUERY ); // Create event to notify listener about removed element settings diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx index bc9b5937d3b0..6547d1c6bcde 100644 --- a/framework/source/uielement/addonstoolbarwrapper.cxx +++ b/framework/source/uielement/addonstoolbarwrapper.cxx @@ -53,7 +53,7 @@ AddonsToolBarWrapper::~AddonsToolBarWrapper() // XComponent void SAL_CALL AddonsToolBarWrapper::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); diff --git a/framework/source/uielement/controlmenucontroller.cxx b/framework/source/uielement/controlmenucontroller.cxx index 14c372a55688..6d8e1c5f3b10 100644 --- a/framework/source/uielement/controlmenucontroller.cxx +++ b/framework/source/uielement/controlmenucontroller.cxx @@ -227,14 +227,14 @@ void ControlMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > con // XEventListener void SAL_CALL ControlMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/fontmenucontroller.cxx b/framework/source/uielement/fontmenucontroller.cxx index b0fbd9797368..0e3466992ab7 100644 --- a/framework/source/uielement/fontmenucontroller.cxx +++ b/framework/source/uielement/fontmenucontroller.cxx @@ -124,7 +124,7 @@ void FontMenuController::fillPopupMenu( const Sequence< OUString >& rFontNameSeq // XEventListener void SAL_CALL FontMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); @@ -132,7 +132,7 @@ void SAL_CALL FontMenuController::disposing( const EventObject& ) m_xFontListDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/fontsizemenucontroller.cxx b/framework/source/uielement/fontsizemenucontroller.cxx index edc17b084069..684128d8008f 100644 --- a/framework/source/uielement/fontsizemenucontroller.cxx +++ b/framework/source/uielement/fontsizemenucontroller.cxx @@ -243,14 +243,14 @@ void FontSizeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co // XEventListener void SAL_CALL FontSizeMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); m_xCurrentFontDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/headermenucontroller.cxx b/framework/source/uielement/headermenucontroller.cxx index 213aa2a94566..f0c443b299c2 100644 --- a/framework/source/uielement/headermenucontroller.cxx +++ b/framework/source/uielement/headermenucontroller.cxx @@ -190,14 +190,14 @@ void HeaderMenuController::fillPopupMenu( const Reference< css::frame::XModel >& // XEventListener void SAL_CALL HeaderMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/langselectionmenucontroller.cxx b/framework/source/uielement/langselectionmenucontroller.cxx index fe340caf3fc8..d9458a895788 100644 --- a/framework/source/uielement/langselectionmenucontroller.cxx +++ b/framework/source/uielement/langselectionmenucontroller.cxx @@ -86,7 +86,7 @@ LanguageSelectionMenuController::~LanguageSelectionMenuController() // XEventListener void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); @@ -94,7 +94,7 @@ void SAL_CALL LanguageSelectionMenuController::disposing( const EventObject& ) m_xLanguageDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/macrosmenucontroller.cxx b/framework/source/uielement/macrosmenucontroller.cxx index 856e3985b1cb..89f3b32a86ac 100644 --- a/framework/source/uielement/macrosmenucontroller.cxx +++ b/framework/source/uielement/macrosmenucontroller.cxx @@ -100,7 +100,7 @@ void MacrosMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > cons // XEventListener void SAL_CALL MacrosMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); @@ -109,7 +109,7 @@ void SAL_CALL MacrosMenuController::disposing( const EventObject& ) if ( m_xPopupMenu.is() ) { - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); } m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/menubarmanager.cxx b/framework/source/uielement/menubarmanager.cxx index 1b57b7430da6..42168962f21e 100644 --- a/framework/source/uielement/menubarmanager.cxx +++ b/framework/source/uielement/menubarmanager.cxx @@ -160,7 +160,7 @@ void MenuBarManager::Destroy() // XComponent void SAL_CALL MenuBarManager::disposing() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis( this ); SolarMutexGuard g; Destroy(); @@ -170,8 +170,7 @@ void SAL_CALL MenuBarManager::disposing() try { m_xDocImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch ( const Exception& ) { @@ -182,8 +181,7 @@ void SAL_CALL MenuBarManager::disposing() try { m_xModuleImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch ( const Exception& ) { @@ -457,8 +455,7 @@ void MenuBarManager::RemoveListener() try { if ( m_xFrame.is() ) - m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >(this) ); } catch ( const Exception& ) { @@ -1225,8 +1222,7 @@ void MenuBarManager::RetrieveImageManagers() Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager(); m_xDocImageManager.set( xDocUICfgMgr->getImageManager(), UNO_QUERY ); m_xDocImageManager->addConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } } } @@ -1238,8 +1234,7 @@ void MenuBarManager::RetrieveImageManagers() theModuleUIConfigurationManagerSupplier::get( m_xContext ); Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); m_xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY ); - m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >(this) ); } } @@ -1474,7 +1469,7 @@ void MenuBarManager::SetItemContainer( const Reference< XIndexAccess >& rItemCon FillMenuManager( m_pVCLMenu, xFrame, xDispatchProvider, m_aModuleIdentifier, false ); // add itself as frame action listener - m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xFrame->addFrameActionListener( Reference< XFrameActionListener >(this) ); } } @@ -1521,7 +1516,7 @@ void MenuBarManager::GetPopupController( PopupControllerCache& rPopupController void MenuBarManager::AddMenu(MenuBarManager* pSubMenuManager,const OUString& _sItemCommand,sal_uInt16 _nItemId) { - Reference< XStatusListener > xSubMenuManager( static_cast< OWeakObject *>( pSubMenuManager ), UNO_QUERY ); + Reference< XStatusListener > xSubMenuManager( pSubMenuManager ); m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( xSubMenuManager, UNO_QUERY )); Reference< XDispatch > xDispatch; diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx index a8bf9a845f6c..6f67deef0392 100644 --- a/framework/source/uielement/menubarwrapper.cxx +++ b/framework/source/uielement/menubarwrapper.cxx @@ -121,7 +121,7 @@ MenuBarWrapper::~MenuBarWrapper() void SAL_CALL MenuBarWrapper::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); diff --git a/framework/source/uielement/newmenucontroller.cxx b/framework/source/uielement/newmenucontroller.cxx index e8abbe0ceb0f..b6636330899b 100644 --- a/framework/source/uielement/newmenucontroller.cxx +++ b/framework/source/uielement/newmenucontroller.cxx @@ -356,7 +356,7 @@ void NewMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > const & // XEventListener void SAL_CALL NewMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); @@ -364,7 +364,7 @@ void SAL_CALL NewMenuController::disposing( const EventObject& ) m_xContext.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/objectmenucontroller.cxx b/framework/source/uielement/objectmenucontroller.cxx index 00b0692f1eae..74c3b2436602 100644 --- a/framework/source/uielement/objectmenucontroller.cxx +++ b/framework/source/uielement/objectmenucontroller.cxx @@ -111,14 +111,14 @@ void ObjectMenuController::fillPopupMenu( const Sequence< css::embed::VerbDescri // XEventListener void SAL_CALL ObjectMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } diff --git a/framework/source/uielement/progressbarwrapper.cxx b/framework/source/uielement/progressbarwrapper.cxx index d0a2068c2649..ad147111ff50 100644 --- a/framework/source/uielement/progressbarwrapper.cxx +++ b/framework/source/uielement/progressbarwrapper.cxx @@ -251,9 +251,7 @@ void SAL_CALL ProgressBarWrapper::update() // XComponent void SAL_CALL ProgressBarWrapper::dispose() { - uno::Reference< lang::XComponent > xThis( - static_cast< cppu::OWeakObject* >(this), - uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xThis(this); { SolarMutexGuard g; @@ -297,10 +295,7 @@ uno::Reference< uno::XInterface > SAL_CALL ProgressBarWrapper::getRealInterface( if ( !xComp.is() ) { rtl::Reference<StatusIndicatorInterfaceWrapper> pWrapper = - new StatusIndicatorInterfaceWrapper( - uno::Reference< lang::XComponent >( - static_cast< cppu::OWeakObject* >( this ), - uno::UNO_QUERY )); + new StatusIndicatorInterfaceWrapper( uno::Reference< lang::XComponent >(this) ); xComp.set(static_cast< cppu::OWeakObject* >( pWrapper.get() ), uno::UNO_QUERY ); m_xProgressBarIfacWrapper = xComp; diff --git a/framework/source/uielement/recentfilesmenucontroller.cxx b/framework/source/uielement/recentfilesmenucontroller.cxx index ef6b3f00e922..9bf31b03c16c 100644 --- a/framework/source/uielement/recentfilesmenucontroller.cxx +++ b/framework/source/uielement/recentfilesmenucontroller.cxx @@ -263,14 +263,14 @@ void RecentFilesMenuController::executeEntry( sal_Int32 nIndex ) // XEventListener void SAL_CALL RecentFilesMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } @@ -340,7 +340,7 @@ Reference< XDispatch > SAL_CALL RecentFilesMenuController::queryDispatch( throwIfDisposed(); if ( aURL.Complete.startsWith( m_aBaseURL ) ) - return Reference< XDispatch >( static_cast< OWeakObject* >( this ), UNO_QUERY ); + return Reference< XDispatch >( this ); else return Reference< XDispatch >(); } diff --git a/framework/source/uielement/statusbarmanager.cxx b/framework/source/uielement/statusbarmanager.cxx index 6754cb85a002..7c6de5518b98 100644 --- a/framework/source/uielement/statusbarmanager.cxx +++ b/framework/source/uielement/statusbarmanager.cxx @@ -175,8 +175,7 @@ void SAL_CALL StatusBarManager::disposing( const lang::EventObject& Source ) // XComponent void SAL_CALL StatusBarManager::dispose() { - uno::Reference< lang::XComponent > xThis( - static_cast< OWeakObject* >(this), uno::UNO_QUERY ); + uno::Reference< lang::XComponent > xThis(this ); lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); @@ -202,9 +201,7 @@ void SAL_CALL StatusBarManager::dispose() { try { - m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >( - static_cast< ::cppu::OWeakObject *>( this ), - uno::UNO_QUERY )); + m_xFrame->removeFrameActionListener( uno::Reference< frame::XFrameActionListener >(this) ); } catch ( const uno::Exception& ) { @@ -296,9 +293,7 @@ void StatusBarManager::CreateControllers() bool bInit( true ); uno::Reference< frame::XStatusbarController > xController; AddonStatusbarItemData *pItemData = static_cast< AddonStatusbarItemData *>( m_pStatusBar->GetItemData( nId ) ); - uno::Reference< ui::XStatusbarItem > xStatusbarItem( - static_cast< cppu::OWeakObject *>( new StatusbarItem( m_pStatusBar, nId, aCommandURL ) ), - uno::UNO_QUERY ); + uno::Reference< ui::XStatusbarItem > xStatusbarItem = new StatusbarItem( m_pStatusBar, nId, aCommandURL ); beans::PropertyValue aPropValue; std::vector< uno::Any > aPropVector; @@ -378,8 +373,7 @@ void StatusBarManager::CreateControllers() if ( !m_bFrameActionRegistered && m_xFrame.is() ) { m_bFrameActionRegistered = true; - m_xFrame->addFrameActionListener( uno::Reference< frame::XFrameActionListener >( - static_cast< ::cppu::OWeakObject *>( this ), uno::UNO_QUERY )); + m_xFrame->addFrameActionListener( uno::Reference< frame::XFrameActionListener >(this) ); } } diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx index bf5f08a6384c..957fd4401480 100644 --- a/framework/source/uielement/statusbarwrapper.cxx +++ b/framework/source/uielement/statusbarwrapper.cxx @@ -53,7 +53,7 @@ StatusBarWrapper::~StatusBarWrapper() void SAL_CALL StatusBarWrapper::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); css::lang::EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index b5d6dde2363a..bed772499951 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -317,8 +317,7 @@ VclPtr<vcl::Window> SubToolBarController::createVclPopupWindow(vcl::Window* /*pP if ( xSubToolBar.is() ) { css::uno::Reference< css::awt::XDockableWindow > xDockWindow( xSubToolBar, css::uno::UNO_QUERY ); - xDockWindow->addDockableWindowListener( css::uno::Reference< css::awt::XDockableWindowListener >( - static_cast< OWeakObject * >( this ), css::uno::UNO_QUERY ) ); + xDockWindow->addDockableWindowListener( css::uno::Reference< css::awt::XDockableWindowListener >(this) ); xDockWindow->enableDocking( true ); // keep reference to UIElement to avoid its destruction diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx index c7e6d8c79ec8..774216a251bf 100644 --- a/framework/source/uielement/toolbarmanager.cxx +++ b/framework/source/uielement/toolbarmanager.cxx @@ -810,8 +810,7 @@ void SAL_CALL ToolBarManager::disposing( const EventObject& Source ) try { m_xDocImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -823,8 +822,7 @@ void SAL_CALL ToolBarManager::disposing( const EventObject& Source ) try { m_xModuleImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -843,7 +841,7 @@ void SAL_CALL ToolBarManager::disposing( const EventObject& Source ) // XComponent void SAL_CALL ToolBarManager::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); EventObject aEvent( xThis ); m_aListenerContainer.disposeAndClear( aEvent ); @@ -863,8 +861,7 @@ void SAL_CALL ToolBarManager::dispose() try { m_xDocImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -876,8 +873,7 @@ void SAL_CALL ToolBarManager::dispose() try { m_xModuleImageManager->removeConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } catch (const Exception&) { @@ -899,8 +895,7 @@ void SAL_CALL ToolBarManager::dispose() { try { - m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >( - static_cast< ::cppu::OWeakObject *>( this ), UNO_QUERY )); + m_xFrame->removeFrameActionListener( Reference< XFrameActionListener >(this) ); } catch (const Exception&) { @@ -1284,8 +1279,7 @@ void ToolBarManager::AddFrameActionListener() if ( !m_bFrameActionRegistered && m_xFrame.is() ) { m_bFrameActionRegistered = true; - m_xFrame->addFrameActionListener( Reference< XFrameActionListener >( - static_cast< ::cppu::OWeakObject *>( this ), UNO_QUERY )); + m_xFrame->addFrameActionListener( Reference< XFrameActionListener >(this) ); } } @@ -1326,8 +1320,7 @@ void ToolBarManager::InitImageManager() Reference< XUIConfigurationManager > xDocUICfgMgr = xSupplier->getUIConfigurationManager(); m_xDocImageManager.set( xDocUICfgMgr->getImageManager(), UNO_QUERY ); m_xDocImageManager->addConfigurationListener( - Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + Reference< XUIConfigurationListener >(this) ); } } } @@ -1346,8 +1339,7 @@ void ToolBarManager::InitImageManager() theModuleUIConfigurationManagerSupplier::get( m_xContext ); Reference< XUIConfigurationManager > xUICfgMgr = xModuleCfgMgrSupplier->getUIConfigurationManager( m_aModuleIdentifier ); m_xModuleImageManager.set( xUICfgMgr->getImageManager(), UNO_QUERY ); - m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + m_xModuleImageManager->addConfigurationListener( Reference< XUIConfigurationListener >(this) ); } } @@ -2325,7 +2317,7 @@ IMPL_LINK_NOARG(ToolBarManager, AsyncUpdateControllersHdl, Timer *, void) { // The guard must be in its own context as the we can get destroyed when our // own xInterface reference get destroyed! - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); SolarMutexGuard g; diff --git a/framework/source/uielement/toolbarmodemenucontroller.cxx b/framework/source/uielement/toolbarmodemenucontroller.cxx index dfe2e4ff4378..296db7c1bf20 100644 --- a/framework/source/uielement/toolbarmodemenucontroller.cxx +++ b/framework/source/uielement/toolbarmodemenucontroller.cxx @@ -158,14 +158,14 @@ void ToolbarModeMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > // XEventListener void SAL_CALL ToolbarModeMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); m_xDispatch.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } @@ -287,7 +287,7 @@ void SAL_CALL ToolbarModeMenuController::setPopupMenu( const Reference< css::awt SolarMutexGuard aSolarMutexGuard; m_xPopupMenu = xPopupMenu; - m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( static_cast<OWeakObject*>(this), UNO_QUERY )); + m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >(this) ); fillPopupMenu( m_xPopupMenu ); } } diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index c67dab5f2856..33f896781696 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -470,7 +470,7 @@ void ToolbarsMenuController::fillPopupMenu( Reference< css::awt::XPopupMenu > co // XEventListener void SAL_CALL ToolbarsMenuController::disposing( const EventObject& ) { - Reference< css::awt::XMenuListener > xHolder(static_cast<OWeakObject *>(this), UNO_QUERY ); + Reference< css::awt::XMenuListener > xHolder(this); osl::MutexGuard aLock( m_aMutex ); m_xFrame.clear(); @@ -480,7 +480,7 @@ void SAL_CALL ToolbarsMenuController::disposing( const EventObject& ) m_xContext.clear(); if ( m_xPopupMenu.is() ) - m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(static_cast<OWeakObject *>(this), UNO_QUERY )); + m_xPopupMenu->removeMenuListener( Reference< css::awt::XMenuListener >(this) ); m_xPopupMenu.clear(); } @@ -748,7 +748,7 @@ void SAL_CALL ToolbarsMenuController::setPopupMenu( const Reference< css::awt::X SolarMutexGuard aSolarMutexGuard; m_xPopupMenu = xPopupMenu; - m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >( static_cast<OWeakObject*>(this), UNO_QUERY )); + m_xPopupMenu->addMenuListener( Reference< css::awt::XMenuListener >(this) ); fillPopupMenu( m_xPopupMenu ); } } diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx index 0928c5a4702a..05e39fc9ccc2 100644 --- a/framework/source/uielement/toolbarwrapper.cxx +++ b/framework/source/uielement/toolbarwrapper.cxx @@ -81,7 +81,7 @@ uno::Any SAL_CALL ToolBarWrapper::queryInterface( const uno::Type & rType ) // XComponent void SAL_CALL ToolBarWrapper::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); { SolarMutexGuard g; diff --git a/framework/source/uifactory/menubarfactory.cxx b/framework/source/uifactory/menubarfactory.cxx index 5c6e60425400..56f84c15de34 100644 --- a/framework/source/uifactory/menubarfactory.cxx +++ b/framework/source/uifactory/menubarfactory.cxx @@ -55,8 +55,7 @@ Reference< XUIElement > SAL_CALL MenuBarFactory::createUIElement( const OUString& ResourceURL, const Sequence< PropertyValue >& Args ) { - Reference< css::ui::XUIElement > xMenuBar( - static_cast<OWeakObject *>(new MenuBarWrapper(m_xContext)), UNO_QUERY); + Reference< css::ui::XUIElement > xMenuBar = new MenuBarWrapper(m_xContext); CreateUIElement(ResourceURL, Args, u"private:resource/menubar/", xMenuBar, m_xContext); return xMenuBar; } diff --git a/framework/source/uifactory/statusbarfactory.cxx b/framework/source/uifactory/statusbarfactory.cxx index 0c59adea073b..2914dc4cc430 100644 --- a/framework/source/uifactory/statusbarfactory.cxx +++ b/framework/source/uifactory/statusbarfactory.cxx @@ -66,8 +66,7 @@ Reference< XUIElement > SAL_CALL StatusBarFactory::createUIElement( const OUString& ResourceURL, const Sequence< PropertyValue >& Args ) { - Reference< css::ui::XUIElement > xStatusBar( - static_cast<OWeakObject *>(new StatusBarWrapper(m_xContext)), UNO_QUERY); + Reference< css::ui::XUIElement > xStatusBar = new StatusBarWrapper(m_xContext); MenuBarFactory::CreateUIElement(ResourceURL, Args, u"private:resource/statusbar/", xStatusBar, m_xContext); return xStatusBar; } diff --git a/framework/source/uifactory/toolbarfactory.cxx b/framework/source/uifactory/toolbarfactory.cxx index 8af020cde45b..1f9bb6114281 100644 --- a/framework/source/uifactory/toolbarfactory.cxx +++ b/framework/source/uifactory/toolbarfactory.cxx @@ -66,8 +66,7 @@ Reference< XUIElement > SAL_CALL ToolBarFactory::createUIElement( const OUString& ResourceURL, const Sequence< PropertyValue >& Args ) { - Reference< css::ui::XUIElement > xToolBar( - static_cast<OWeakObject *>(new ToolBarWrapper(m_xContext)), UNO_QUERY); + Reference< css::ui::XUIElement > xToolBar = new ToolBarWrapper(m_xContext); CreateUIElement(ResourceURL, Args, u"private:resource/toolbar/", xToolBar, m_xContext); return xToolBar; } |