diff options
98 files changed, 297 insertions, 361 deletions
diff --git a/avmedia/source/viewer/mediawindow_impl.cxx b/avmedia/source/viewer/mediawindow_impl.cxx index affc0ff63611..2637eedf8147 100644 --- a/avmedia/source/viewer/mediawindow_impl.cxx +++ b/avmedia/source/viewer/mediawindow_impl.cxx @@ -144,10 +144,9 @@ void MediaWindowImpl::dispose() if (mxPlayerWindow.is()) { - auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get()); - mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) ); - mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) ); - mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) ); + mxPlayerWindow->removeKeyListener( uno::Reference< awt::XKeyListener >( mxEvents ) ); + mxPlayerWindow->removeMouseListener( uno::Reference< awt::XMouseListener >( mxEvents ) ); + mxPlayerWindow->removeMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEvents ) ); mxPlayerWindow->dispose(); mxPlayerWindow.clear(); } @@ -443,11 +442,10 @@ void MediaWindowImpl::onURLChanged() if( xPlayerWindow.is() ) { - auto pEventsIf = static_cast<cppu::OWeakObject*>(mxEvents.get()); - xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( pEventsIf, uno::UNO_QUERY ) ); - xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( pEventsIf, uno::UNO_QUERY ) ); - xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( pEventsIf, uno::UNO_QUERY ) ); - xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( pEventsIf, uno::UNO_QUERY ) ); + xPlayerWindow->addKeyListener( uno::Reference< awt::XKeyListener >( mxEvents ) ); + xPlayerWindow->addMouseListener( uno::Reference< awt::XMouseListener >( mxEvents ) ); + xPlayerWindow->addMouseMotionListener( uno::Reference< awt::XMouseMotionListener >( mxEvents ) ); + xPlayerWindow->addFocusListener( uno::Reference< awt::XFocusListener >( mxEvents ) ); } } else diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 449910274c7c..cf087c863d98 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -962,7 +962,7 @@ void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAdd if( xInit.is() ) { uno::Any aParam; - uno::Reference< XChartDocument > xDoc( static_cast<XChartDocument*>(this), uno::UNO_QUERY ); + uno::Reference< XChartDocument > xDoc(this); aParam <<= xDoc; uno::Sequence< uno::Any > aSeq( &aParam, 1 ); xInit->initialize( aSeq ); diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index 57919f3cbada..e4782c95b28d 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -179,7 +179,7 @@ void ExplicitCategoriesProvider::convertCategoryAnysToText( uno::Sequence< OUStr { Reference< chart2::XAxis > xAxis( xCooSysModel->getAxisByDimension(0,0) ); nAxisNumberFormat = AxisHelper::getExplicitNumberFormatKeyForAxis( - xAxis, xCooSysModel, uno::Reference<chart2::XChartDocument>(static_cast< ::cppu::OWeakObject* >(&rModel), uno::UNO_QUERY), false ); + xAxis, xCooSysModel, uno::Reference<chart2::XChartDocument>(&rModel), false ); } Color nLabelColor; diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx index 99b1ce5ee99c..7a02ba66b5d8 100644 --- a/chart2/source/view/main/ChartView.cxx +++ b/chart2/source/view/main/ChartView.cxx @@ -425,7 +425,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter( if( !xDiagram.is()) return; - uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( static_cast< ::cppu::OWeakObject* >( &rChartModel ), uno::UNO_QUERY ); + uno::Reference< util::XNumberFormatsSupplier > xNumberFormatsSupplier( &rChartModel ); if( rChartModel.hasInternalDataProvider() && DiagramHelper::isSupportingDateAxis( xDiagram ) ) m_nDefaultDateNumberFormat=DiagramHelper::getDateNumberFormat( xNumberFormatsSupplier ); diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx index c68eceb67c32..6f7c464aa161 100644 --- a/compilerplugins/clang/plugin.cxx +++ b/compilerplugins/clang/plugin.cxx @@ -11,6 +11,7 @@ #include "plugin.hxx" +#include <iostream> #include <cassert> #include <cstddef> #include <string> @@ -736,8 +737,19 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) { static const CXXRecordDecl* stripTypeSugar(QualType qt) { const clang::Type* t = qt.getTypePtr(); - while (auto elaboratedType = dyn_cast<ElaboratedType>(t)) - t = elaboratedType->desugar().getTypePtr(); + do + { + if (auto elaboratedType = dyn_cast<ElaboratedType>(t)) + t = elaboratedType->desugar().getTypePtr(); + else if (auto tsType = dyn_cast<TemplateSpecializationType>(t)) + t = tsType->desugar().getTypePtr(); + else if (auto sttpType = dyn_cast<SubstTemplateTypeParmType>(t)) + t = sttpType->desugar().getTypePtr(); + else if (auto tdType = dyn_cast<TypedefType>(t)) + t = tdType->desugar().getTypePtr(); + else + break; + } while(true); auto recordType = dyn_cast<RecordType>(t); if (!recordType) return nullptr; diff --git a/compilerplugins/clang/test/referencecasting.cxx b/compilerplugins/clang/test/referencecasting.cxx index a6850ed660ea..1b1e75f90cea 100644 --- a/compilerplugins/clang/test/referencecasting.cxx +++ b/compilerplugins/clang/test/referencecasting.cxx @@ -13,8 +13,10 @@ #include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/io/XStreamListener.hpp" +#include "com/sun/star/io/XInputStream.hpp" #include "com/sun/star/lang/XTypeProvider.hpp" #include "com/sun/star/lang/XComponent.hpp" +#include "cppuhelper/implbase.hxx" #include "cppuhelper/weak.hxx" #include "rtl/ref.hxx" @@ -192,4 +194,24 @@ void test14(css::uno::Sequence<css::uno::Reference<css::io::XStreamListener>> se } } +namespace test15 +{ +class Foo : public cppu::WeakImplHelper<css::lang::XComponent, css::io::XInputStream> +{ + virtual ~Foo(); + css::uno::Reference<css::lang::XTypeProvider> bar() + { + // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}} + return css::uno::Reference<css::lang::XTypeProvider>( + static_cast<css::lang::XTypeProvider*>(this), css::uno::UNO_QUERY); + } + css::uno::Reference<css::io::XInputStream> bar2() + { + // expected-error@+1 {{the source reference is already a subtype of the destination reference, just use = [loplugin:referencecasting]}} + return css::uno::Reference<css::io::XInputStream>(static_cast<css::io::XInputStream*>(this), + css::uno::UNO_QUERY); + } +}; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */ diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 5a1f2f9767ea..f9871eaee981 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1096,7 +1096,7 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos) try { OUString sCellText; - Reference< XGridFieldDataSupplier > xFieldData(static_cast< XGridPeer* >(GetPeer()), UNO_QUERY); + Reference< XGridFieldDataSupplier > xFieldData(GetPeer()); Sequence<sal_Bool> aSupportingText = xFieldData->queryFieldDataType(cppu::UnoType<decltype(sCellText)>::get()); if (aSupportingText.getConstArray()[nColumnPos]) { @@ -1197,7 +1197,7 @@ sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) try { // assume that text can be dropped into a field if the column has a css::awt::XTextComponent interface - Reference< XIndexAccess > xColumnControls(static_cast<css::form::XGridPeer*>(GetPeer()), UNO_QUERY); + Reference< XIndexAccess > xColumnControls(GetPeer()); if (xColumnControls.is()) { Reference< css::awt::XTextComponent > xColControl( diff --git a/dbaccess/source/ui/misc/TokenWriter.cxx b/dbaccess/source/ui/misc/TokenWriter.cxx index 619b10095e4a..005ee1d03a70 100644 --- a/dbaccess/source/ui/misc/TokenWriter.cxx +++ b/dbaccess/source/ui/misc/TokenWriter.cxx @@ -120,7 +120,7 @@ void ODatabaseImportExport::dispose() Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); if (xComponent.is()) { - Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY); + Reference< XEventListener> xEvt(this); xComponent->removeEventListener(xEvt); } m_xConnection.clear(); @@ -163,7 +163,7 @@ void ODatabaseImportExport::impl_initFromDescriptor( const ODataAccessDescriptor { Reference< XConnection > xPureConn( _aDataDescriptor[DataAccessDescriptorProperty::Connection], UNO_QUERY ); m_xConnection.reset( xPureConn, SharedConnection::NoTakeOwnership ); - Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY); + Reference< XEventListener> xEvt(this); Reference< XComponent > xComponent(m_xConnection, UNO_QUERY); if (xComponent.is() && xEvt.is()) xComponent->addEventListener(xEvt); @@ -212,7 +212,7 @@ void ODatabaseImportExport::initialize() { // we need a connection OSL_ENSURE(!m_sDataSourceName.isEmpty(),"There must be a datsource name!"); Reference<XNameAccess> xDatabaseContext( DatabaseContext::create(m_xContext), UNO_QUERY_THROW); - Reference< XEventListener> xEvt(static_cast<cppu::OWeakObject*>(this),UNO_QUERY); + Reference< XEventListener> xEvt(this); Reference< XConnection > xConnection; SQLExceptionInfo aInfo = ::dbaui::createConnection( m_sDataSourceName, xDatabaseContext, m_xContext, xEvt, xConnection ); diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 57bbfa0ab35f..6ed978ab3957 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -389,7 +389,7 @@ void BackendImpl::implProcessHelp( { OUString aErrStr = DpResId( RID_STR_HELPPROCESSING_GENERAL_ERROR ) + "No help folder"; - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + OWeakObject* oWeakThis = this; throw deployment::DeploymentException( OUString(), oWeakThis, makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } @@ -536,7 +536,7 @@ void BackendImpl::implProcessHelp( } } - OWeakObject* oWeakThis = static_cast<OWeakObject *>(this); + OWeakObject* oWeakThis = this; throw deployment::DeploymentException( OUString(), oWeakThis, makeAny( uno::Exception( aErrStr, oWeakThis ) ) ); } diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 75a41d0a1ac9..68843ec16cf2 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -112,8 +112,7 @@ bool OwnView_Impl::CreateModelFromURL( const OUString& aFileURL ) aArgs[1].Value <<= true; aArgs[2].Name = "InteractionHandler"; - aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( - static_cast< ::cppu::OWeakObject* >( new DummyHandler_Impl() ), uno::UNO_QUERY ); + aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >( new DummyHandler_Impl() ); aArgs[3].Name = "DontEdit"; aArgs[3].Value <<= true; @@ -135,16 +134,12 @@ bool OwnView_Impl::CreateModelFromURL( const OUString& aFileURL ) { uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); if ( xBroadCaster.is() ) - xBroadCaster->addEventListener( uno::Reference< document::XEventListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xBroadCaster->addEventListener( uno::Reference< document::XEventListener >(this) ); uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); if ( xCloseable.is() ) { - xCloseable->addCloseListener( uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xCloseable->addCloseListener( uno::Reference< util::XCloseListener >(this) ); ::osl::MutexGuard aGuard( m_aMutex ); m_xModel = xModel; @@ -544,16 +539,12 @@ void OwnView_Impl::Close() try { uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); if ( xBroadCaster.is() ) - xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( this ) ); uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); if ( xCloseable.is() ) { - xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( this ) ); xCloseable->close( true ); } } @@ -585,15 +576,11 @@ void SAL_CALL OwnView_Impl::notifyEvent( const document::EventObject& aEvent ) try { uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY ); if ( xBroadCaster.is() ) - xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >( this ) ); uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY ); if ( xCloseable.is() ) - xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( - static_cast< ::cppu::OWeakObject* >( this ), - uno::UNO_QUERY ) ); + xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >( this ) ); } catch( uno::Exception& ) {} diff --git a/filter/source/config/cache/cacheupdatelistener.cxx b/filter/source/config/cache/cacheupdatelistener.cxx index 4a20d29dcb14..6de64e00c46a 100644 --- a/filter/source/config/cache/cacheupdatelistener.cxx +++ b/filter/source/config/cache/cacheupdatelistener.cxx @@ -71,7 +71,7 @@ void CacheUpdateListener::stopListening() if (!xNotifier.is()) return; - css::uno::Reference< css::util::XChangesListener > xThis(static_cast< css::util::XChangesListener* >(this), css::uno::UNO_QUERY); + css::uno::Reference< css::util::XChangesListener > xThis(this); xNotifier->removeChangesListener(xThis); } diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index e2a6a582ed31..c71c02c1c34f 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1719,8 +1719,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co } // Check if we and the given model have a common ancestor (up to the forms collection) - Reference<XChild> xCont( - static_cast<XWeak*>(this), css::uno::UNO_QUERY); + Reference<XChild> xCont(this); Reference< XInterface > xMyTopLevel = xCont->getParent(); while (xMyTopLevel.is()) { diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index bb4eb3b27228..00388525a63b 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -477,9 +477,7 @@ Reference< XNumberFormatsSupplier > OFormattedModel::calcFormatsSupplier() const Reference<XNumberFormatsSupplier> OFormattedModel::calcFormFormatsSupplier() const { - Reference<XChild> xMe( - static_cast<XWeak*>(const_cast<OFormattedModel*>(this)), - css::uno::UNO_QUERY); + Reference<XChild> xMe(const_cast<OFormattedModel*>(this)); // By this we make sure that we get the right object even when aggregating DBG_ASSERT(xMe.is(), "OFormattedModel::calcFormFormatsSupplier : I should have a content interface !"); // Iterate through until we reach a StartForm (starting with an own Parent) 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; } diff --git a/package/source/xstor/ocompinstream.cxx b/package/source/xstor/ocompinstream.cxx index 17092d9a54cd..783b426a9af7 100644 --- a/package/source/xstor/ocompinstream.cxx +++ b/package/source/xstor/ocompinstream.cxx @@ -165,7 +165,7 @@ uno::Reference< io::XInputStream > SAL_CALL OInputCompStream::getInputStream() throw lang::DisposedException(); } - return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY ); + return this; } uno::Reference< io::XOutputStream > SAL_CALL OInputCompStream::getOutputStream() diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 470ec4468130..58524e525e85 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -2031,8 +2031,7 @@ void OStorage::MakeLinkToSubComponent_Impl( const uno::Reference< lang::XCompone m_pData->m_pSubElDispListener = new OChildDispListener_Impl( *this ); } - xComponent->addEventListener( uno::Reference< lang::XEventListener >( - static_cast< ::cppu::OWeakObject* >(m_pData->m_pSubElDispListener.get()), uno::UNO_QUERY)); + xComponent->addEventListener( m_pData->m_pSubElDispListener ); m_pData->m_aOpenSubComponentsVector.emplace_back(xComponent ); } diff --git a/package/source/zippackage/ZipPackageFolder.cxx b/package/source/zippackage/ZipPackageFolder.cxx index f3099c5b31f3..838bed728069 100644 --- a/package/source/zippackage/ZipPackageFolder.cxx +++ b/package/source/zippackage/ZipPackageFolder.cxx @@ -170,12 +170,12 @@ void SAL_CALL ZipPackageFolder::insertByName( const OUString& aName, const uno:: if ( ( nTest = xRef->getSomething ( ZipPackageFolder::getUnoTunnelId() ) ) != 0 ) { ZipPackageFolder *pFolder = reinterpret_cast < ZipPackageFolder * > ( nTest ); - pEntry = static_cast < ZipPackageEntry * > ( pFolder ); + pEntry = pFolder; } else if ( ( nTest = xRef->getSomething ( ZipPackageStream::getUnoTunnelId() ) ) != 0 ) { ZipPackageStream *pStream = reinterpret_cast < ZipPackageStream * > ( nTest ); - pEntry = static_cast < ZipPackageEntry * > ( pStream ); + pEntry = pStream; } else throw IllegalArgumentException(THROW_WHERE, uno::Reference< uno::XInterface >(), 0 ); diff --git a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx index 4dfad09947a0..7e7862d78e49 100644 --- a/sd/source/ui/slidesorter/controller/SlideSorterController.cxx +++ b/sd/source/ui/slidesorter/controller/SlideSorterController.cxx @@ -151,8 +151,7 @@ SlideSorterController::~SlideSorterController() { try { - uno::Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpListener.get()), uno::UNO_QUERY); + uno::Reference<lang::XComponent> xComponent = mpListener; if (xComponent.is()) xComponent->dispose(); } diff --git a/sd/source/ui/slidesorter/controller/SlsListener.cxx b/sd/source/ui/slidesorter/controller/SlsListener.cxx index 8f6b0268842f..7e956734ed2a 100644 --- a/sd/source/ui/slidesorter/controller/SlsListener.cxx +++ b/sd/source/ui/slidesorter/controller/SlsListener.cxx @@ -102,9 +102,7 @@ Listener::Listener ( mxFrameWeak = xFrame; if (xFrame.is()) { - xFrame->addFrameActionListener ( - Reference<frame::XFrameActionListener>( - static_cast<XWeak*>(this), UNO_QUERY)); + xFrame->addFrameActionListener(Reference<frame::XFrameActionListener>(this)); mbListeningToFrame = true; } @@ -166,9 +164,7 @@ void Listener::ReleaseListeners() Reference<frame::XFrame> xFrame (mxFrameWeak); if (xFrame.is()) { - xFrame->removeFrameActionListener ( - Reference<frame::XFrameActionListener>( - static_cast<XWeak*>(this), UNO_QUERY)); + xFrame->removeFrameActionListener(Reference<frame::XFrameActionListener>(this)); mbListeningToFrame = false; } } diff --git a/sd/source/ui/tools/EventMultiplexer.cxx b/sd/source/ui/tools/EventMultiplexer.cxx index 1c86d4c644c0..59fa6e115ab8 100644 --- a/sd/source/ui/tools/EventMultiplexer.cxx +++ b/sd/source/ui/tools/EventMultiplexer.cxx @@ -204,9 +204,7 @@ EventMultiplexer::Implementation::Implementation (ViewShellBase& rBase) mxFrameWeak = xFrame; if (xFrame.is()) { - xFrame->addFrameActionListener ( - Reference<frame::XFrameActionListener>( - static_cast<XWeak*>(this), UNO_QUERY)); + xFrame->addFrameActionListener ( Reference<frame::XFrameActionListener>(this) ); mbListeningToFrame = true; } @@ -265,8 +263,7 @@ void EventMultiplexer::Implementation::ReleaseListeners() if (xFrame.is()) { xFrame->removeFrameActionListener ( - Reference<frame::XFrameActionListener>( - static_cast<XWeak*>(this), UNO_QUERY)); + Reference<frame::XFrameActionListener>(this) ); } } diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 30acb21ca00f..8cd3dd04f7e1 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -325,8 +325,7 @@ void DrawViewShell::Construct(DrawDocShell* pDocSh, PageKind eInitialPageKind) { mxScannerManager = scanner::ScannerManager::create( xContext ); - mxScannerListener.set( static_cast< ::cppu::OWeakObject* >( new ScannerEventListener( this ) ), - uno::UNO_QUERY ); + mxScannerListener = new ScannerEventListener( this ); } catch (Exception const &) { diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index c57cf61c946c..677cdfdc4037 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -1727,7 +1727,7 @@ void AccessibleNotes::SetTextView ( // manager). for (const auto& rxChild : aChildren) { - Reference<lang::XComponent> xComponent (static_cast<XWeak*>(rxChild.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = rxChild; if (xComponent.is()) xComponent->dispose(); } diff --git a/sdext/source/presenter/PresenterController.cxx b/sdext/source/presenter/PresenterController.cxx index 86b57ca73794..9aa5af7b2201 100644 --- a/sdext/source/presenter/PresenterController.cxx +++ b/sdext/source/presenter/PresenterController.cxx @@ -212,8 +212,7 @@ void PresenterController::disposing() mxController = nullptr; } - Reference<XComponent> xWindowManagerComponent ( - static_cast<XWeak*>(mpWindowManager.get()), UNO_QUERY); + Reference<XComponent> xWindowManagerComponent = mpWindowManager; mpWindowManager = nullptr; if (xWindowManagerComponent.is()) xWindowManagerComponent->dispose(); @@ -228,8 +227,7 @@ void PresenterController::disposing() mxNextSlide = nullptr; mpTheme.reset(); { - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpPaneBorderPainter.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = mpPaneBorderPainter; mpPaneBorderPainter = nullptr; if (xComponent.is()) xComponent->dispose(); diff --git a/sdext/source/presenter/PresenterHelpView.cxx b/sdext/source/presenter/PresenterHelpView.cxx index d6b625e53183..e5bec81efc92 100644 --- a/sdext/source/presenter/PresenterHelpView.cxx +++ b/sdext/source/presenter/PresenterHelpView.cxx @@ -192,8 +192,7 @@ void SAL_CALL PresenterHelpView::disposing() if (mpCloseButton.is()) { - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = mpCloseButton; mpCloseButton = nullptr; if (xComponent.is()) xComponent->dispose(); diff --git a/sdext/source/presenter/PresenterNotesView.cxx b/sdext/source/presenter/PresenterNotesView.cxx index ad43f035b041..787f6624eb60 100644 --- a/sdext/source/presenter/PresenterNotesView.cxx +++ b/sdext/source/presenter/PresenterNotesView.cxx @@ -145,7 +145,7 @@ void SAL_CALL PresenterNotesView::disposing() // Dispose tool bar. { - Reference<XComponent> xComponent (static_cast<XWeak*>(mpToolBar.get()), UNO_QUERY); + Reference<XComponent> xComponent = mpToolBar; mpToolBar = nullptr; if (xComponent.is()) xComponent->dispose(); @@ -165,7 +165,7 @@ void SAL_CALL PresenterNotesView::disposing() // Dispose close button { - Reference<XComponent> xComponent (static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY); + Reference<XComponent> xComponent = mpCloseButton; mpCloseButton = nullptr; if (xComponent.is()) xComponent->dispose(); diff --git a/sdext/source/presenter/PresenterPaneFactory.cxx b/sdext/source/presenter/PresenterPaneFactory.cxx index a9c5bb907f25..dd4eb2fa9b8e 100644 --- a/sdext/source/presenter/PresenterPaneFactory.cxx +++ b/sdext/source/presenter/PresenterPaneFactory.cxx @@ -43,8 +43,7 @@ Reference<drawing::framework::XResourceFactory> PresenterPaneFactory::Create ( rtl::Reference<PresenterPaneFactory> pFactory ( new PresenterPaneFactory(rxContext,rpPresenterController)); pFactory->Register(rxController); - return Reference<drawing::framework::XResourceFactory>( - static_cast<XWeak*>(pFactory.get()), UNO_QUERY); + return Reference<drawing::framework::XResourceFactory>(pFactory); } PresenterPaneFactory::PresenterPaneFactory ( @@ -250,8 +249,7 @@ Reference<XResource> PresenterPaneFactory::CreatePane ( aArguments[2] <<= rxParentPane->getCanvas(); aArguments[3] <<= OUString(); aArguments[4] <<= Reference<drawing::framework::XPaneBorderPainter>( - static_cast<XWeak*>(mpPresenterController->GetPaneBorderPainter().get()), - UNO_QUERY); + mpPresenterController->GetPaneBorderPainter()); aArguments[5] <<= !bIsSpritePane; xPane->initialize(aArguments); diff --git a/sdext/source/presenter/PresenterScreen.cxx b/sdext/source/presenter/PresenterScreen.cxx index c624adcdf614..594e6ce17287 100644 --- a/sdext/source/presenter/PresenterScreen.cxx +++ b/sdext/source/presenter/PresenterScreen.cxx @@ -175,8 +175,7 @@ PresenterScreenListener::PresenterScreenListener ( void PresenterScreenListener::Initialize() { - Reference< document::XEventListener > xDocListener( - static_cast< document::XEventListener* >(this), UNO_QUERY); + Reference< document::XEventListener > xDocListener(this); Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY ); if( xDocBroadcaster.is() ) xDocBroadcaster->addEventListener(xDocListener); @@ -187,8 +186,7 @@ void SAL_CALL PresenterScreenListener::disposing() Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY ); if( xDocBroadcaster.is() ) xDocBroadcaster->removeEventListener( - Reference<document::XEventListener>( - static_cast<document::XEventListener*>(this), UNO_QUERY)); + Reference<document::XEventListener>(this) ); if (mpPresenterScreen.is()) { diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx index c06c0dfd79ec..dcb00b60bdda 100644 --- a/sdext/source/presenter/PresenterSlideSorter.cxx +++ b/sdext/source/presenter/PresenterSlideSorter.cxx @@ -362,16 +362,14 @@ void SAL_CALL PresenterSlideSorter::disposing() if (mpVerticalScrollBar.is()) { - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpVerticalScrollBar.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = mpVerticalScrollBar; mpVerticalScrollBar = nullptr; if (xComponent.is()) xComponent->dispose(); } if (mpCloseButton.is()) { - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(mpCloseButton.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = mpCloseButton; mpCloseButton = nullptr; if (xComponent.is()) xComponent->dispose(); diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx index c3236235c5b0..1a06c70db16c 100644 --- a/sdext/source/presenter/PresenterToolBar.cxx +++ b/sdext/source/presenter/PresenterToolBar.cxx @@ -424,8 +424,7 @@ void SAL_CALL PresenterToolBar::disposing() { if (pElement) { - Reference<lang::XComponent> xComponent ( - static_cast<XWeak*>(pElement.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = pElement; if (xComponent.is()) xComponent->dispose(); } @@ -1063,7 +1062,7 @@ PresenterToolBarView::~PresenterToolBarView() void SAL_CALL PresenterToolBarView::disposing() { - Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpToolBar.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent = mpToolBar; mpToolBar = nullptr; if (xComponent.is()) xComponent->dispose(); @@ -1121,7 +1120,7 @@ sal_Bool SAL_CALL PresenterToolBarView::isAnchorOnly() void SAL_CALL PresenterToolBarView::setCurrentPage (const Reference<drawing::XDrawPage>& rxSlide) { - Reference<drawing::XDrawView> xToolBar (static_cast<XWeak*>(mpToolBar.get()), UNO_QUERY); + Reference<drawing::XDrawView> xToolBar = mpToolBar; if (xToolBar.is()) xToolBar->setCurrentPage(rxSlide); } diff --git a/sdext/source/presenter/PresenterViewFactory.cxx b/sdext/source/presenter/PresenterViewFactory.cxx index 01b40d6e2ab8..87759f7fe9b3 100644 --- a/sdext/source/presenter/PresenterViewFactory.cxx +++ b/sdext/source/presenter/PresenterViewFactory.cxx @@ -112,8 +112,7 @@ Reference<drawing::framework::XResourceFactory> PresenterViewFactory::Create ( rtl::Reference<PresenterViewFactory> pFactory ( new PresenterViewFactory(rxContext,rxController,rpPresenterController)); pFactory->Register(rxController); - return Reference<drawing::framework::XResourceFactory>( - static_cast<XWeak*>(pFactory.get()), UNO_QUERY); + return Reference<drawing::framework::XResourceFactory>(pFactory); } void PresenterViewFactory::Register (const Reference<frame::XController>& rxController) diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 387c6d9aeeac..46e485f89062 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -165,8 +165,7 @@ void LayoutManagerListener::setFrame( const css::uno::Reference< css::frame::XFr if ( xLayoutManager.is() ) xLayoutManager->addLayoutManagerEventListener( - css::uno::Reference< css::frame::XLayoutManagerListener >( - static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); + css::uno::Reference< css::frame::XLayoutManagerListener >(this) ); xPropSet.set( xLayoutManager, UNO_QUERY ); if ( xPropSet.is() ) @@ -229,8 +228,7 @@ void SAL_CALL LayoutManagerListener::dispose() // remove as listener from layout manager if ( xLayoutManager.is() ) xLayoutManager->removeLayoutManagerEventListener( - css::uno::Reference< css::frame::XLayoutManagerListener >( - static_cast< OWeakObject* >( this ), css::uno::UNO_QUERY )); + css::uno::Reference< css::frame::XLayoutManagerListener >(this) ); } catch ( css::lang::DisposedException& ) { diff --git a/sfx2/source/control/sfxstatuslistener.cxx b/sfx2/source/control/sfxstatuslistener.cxx index ff436cbd52a0..38e26b055059 100644 --- a/sfx2/source/control/sfxstatuslistener.cxx +++ b/sfx2/source/control/sfxstatuslistener.cxx @@ -71,7 +71,7 @@ void SfxStatusListener::UnBind() { if ( m_xDispatch.is() ) { - Reference< XStatusListener > aStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > aStatusListener(this); m_xDispatch->removeStatusListener( aStatusListener, m_aCommand ); m_xDispatch.clear(); } @@ -79,7 +79,7 @@ void SfxStatusListener::UnBind() void SfxStatusListener::ReBind() { - Reference< XStatusListener > aStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > aStatusListener(this); if ( m_xDispatch.is() ) m_xDispatch->removeStatusListener( aStatusListener, m_aCommand ); if ( m_xDispatchProvider.is() ) @@ -103,7 +103,7 @@ void SAL_CALL SfxStatusListener::dispose() { try { - Reference< XStatusListener > aStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > aStatusListener(this); m_xDispatch->removeStatusListener( aStatusListener, m_aCommand ); } catch ( Exception& ) diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx index 9ba91ff0ade0..5bf5a27f3d88 100644 --- a/sfx2/source/control/statcach.cxx +++ b/sfx2/source/control/statcach.cxx @@ -72,7 +72,7 @@ void SAL_CALL BindDispatch_Impl::statusChanged( const css::frame::FeatureStateE if ( !pCache ) return; - css::uno::Reference< css::frame::XStatusListener > xKeepAlive( static_cast<cppu::OWeakObject*>(this), css::uno::UNO_QUERY ); + css::uno::Reference< css::frame::XStatusListener > xKeepAlive(this); if ( aStatus.Requery ) pCache->Invalidate( true ); else diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 6d501fb4107b..8f4eab0b2b17 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -3879,7 +3879,7 @@ void SfxBaseModel::impl_getPrintHelper() return; m_pData->m_xPrintable = new SfxPrintHelper(); Reference < lang::XInitialization > xInit( m_pData->m_xPrintable, UNO_QUERY ); - xInit->initialize( { Any(Reference < frame::XModel > (static_cast< frame::XModel* >(this), UNO_QUERY )) } ); + xInit->initialize( { Any(Reference < frame::XModel > (this)) } ); Reference < view::XPrintJobBroadcaster > xBrd( m_pData->m_xPrintable, UNO_QUERY ); xBrd->addPrintJobListener( new SfxPrintHelperListener_Impl( m_pData.get() ) ); } diff --git a/sfx2/source/sidebar/ControllerFactory.cxx b/sfx2/source/sidebar/ControllerFactory.cxx index 5aefd0668681..1a4fcd51a9b5 100644 --- a/sfx2/source/sidebar/ControllerFactory.cxx +++ b/sfx2/source/sidebar/ControllerFactory.cxx @@ -67,14 +67,12 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( } if ( ! xController.is()) { - xController.set( - static_cast<XWeak*>(new framework::GenericToolbarController( + xController = new framework::GenericToolbarController( ::comphelper::getProcessComponentContext(), rxFrame, pToolBox, nItemId, - rsCommandName)), - UNO_QUERY); + rsCommandName); } // Initialize the controller with eg a service factory. @@ -155,13 +153,11 @@ Reference<frame::XToolbarController> ControllerFactory::CreateToolBoxController( if (!xController.is()) { - xController.set( - static_cast<XWeak*>(new framework::GenericToolbarController( + xController = new framework::GenericToolbarController( ::comphelper::getProcessComponentContext(), rxFrame, rToolbar, - rsCommandName)), - UNO_QUERY); + rsCommandName); } if (xController.is()) diff --git a/sfx2/source/sidebar/SidebarDockingWindow.cxx b/sfx2/source/sidebar/SidebarDockingWindow.cxx index 48ef151b9d61..b9fcdc43b62b 100644 --- a/sfx2/source/sidebar/SidebarDockingWindow.cxx +++ b/sfx2/source/sidebar/SidebarDockingWindow.cxx @@ -67,7 +67,7 @@ SidebarDockingWindow::~SidebarDockingWindow() void SidebarDockingWindow::dispose() { - Reference<lang::XComponent> xComponent (static_cast<XWeak*>(mpSidebarController.get()), UNO_QUERY); + Reference<lang::XComponent> xComponent(mpSidebarController); mpSidebarController.clear(); if (xComponent.is()) xComponent->dispose(); diff --git a/sfx2/source/sidebar/Theme.cxx b/sfx2/source/sidebar/Theme.cxx index 6d6fe7bc517f..e918a992376c 100644 --- a/sfx2/source/sidebar/Theme.cxx +++ b/sfx2/source/sidebar/Theme.cxx @@ -179,7 +179,7 @@ void SAL_CALL Theme::disposing() Reference<beans::XPropertySet> Theme::GetPropertySet() { if (SfxGetpApp()) - return Reference<beans::XPropertySet>(static_cast<XWeak*>(&GetCurrentTheme()), UNO_QUERY); + return Reference<beans::XPropertySet>(&GetCurrentTheme()); else return Reference<beans::XPropertySet>(); } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 60252a3b71cb..49653b4546cf 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -178,8 +178,7 @@ public: , _nStartTime(0) { osl_atomic_increment(&m_refCount); - Reference< lang::XComponent > xComponent( - static_cast< ::cppu::OWeakObject* >(pController), uno::UNO_QUERY ); + Reference< lang::XComponent > xComponent = pController; if (xComponent.is()) xComponent->addEventListener(this); osl_atomic_decrement(&m_refCount); diff --git a/svl/source/fsstor/oinputstreamcontainer.cxx b/svl/source/fsstor/oinputstreamcontainer.cxx index bb2ec91f8542..d473911a1419 100644 --- a/svl/source/fsstor/oinputstreamcontainer.cxx +++ b/svl/source/fsstor/oinputstreamcontainer.cxx @@ -165,7 +165,7 @@ uno::Reference< io::XInputStream > SAL_CALL OFSInputStreamContainer::getInputStr if ( !m_xInputStream.is() ) return uno::Reference< io::XInputStream >(); - return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY ); + return this; } uno::Reference< io::XOutputStream > SAL_CALL OFSInputStreamContainer::getOutputStream() diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index d9cffe188c4c..b5d69c88713a 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -178,7 +178,7 @@ void SAL_CALL PopupMenuControllerBase::updatePopupMenu() void PopupMenuControllerBase::updateCommand( const OUString& rCommandURL ) { osl::ClearableMutexGuard aLock( m_aMutex ); - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > xStatusListener(this); Reference< XDispatch > xDispatch( m_xDispatch ); URL aTargetURL; aTargetURL.Complete = rCommandURL; @@ -342,7 +342,7 @@ void SAL_CALL PopupMenuControllerBase::setPopupMenu( const Reference< awt::XPopu SolarMutexGuard aSolarMutexGuard; m_xPopupMenu = xPopupMenu; - m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >( static_cast<OWeakObject*>(this), UNO_QUERY )); + m_xPopupMenu->addMenuListener( Reference< awt::XMenuListener >(this) ); Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); diff --git a/svtools/source/uno/toolboxcontroller.cxx b/svtools/source/uno/toolboxcontroller.cxx index fa881b64ad4b..c18e4c9abae7 100644 --- a/svtools/source/uno/toolboxcontroller.cxx +++ b/svtools/source/uno/toolboxcontroller.cxx @@ -242,7 +242,7 @@ void SAL_CALL ToolboxController::update() // XComponent void SAL_CALL ToolboxController::dispose() { - Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY ); + Reference< XComponent > xThis(this); { SolarMutexGuard aSolarMutexGuard; @@ -254,7 +254,7 @@ void SAL_CALL ToolboxController::dispose() m_aListenerContainer.disposeAndClear( aEvent ); SolarMutexGuard aSolarMutexGuard; - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > xStatusListener(this); for (auto const& listener : m_aListenerMap) { try @@ -413,7 +413,7 @@ void ToolboxController::addStatusListener( const OUString& aCommandURL ) m_xUrlTransformer->parseStrict( aTargetURL ); xDispatch = xDispatchProvider->queryDispatch( aTargetURL, OUString(), 0 ); - xStatusListener.set( static_cast< OWeakObject* >( this ), UNO_QUERY ); + xStatusListener = this; URLToDispatchMap::iterator aIter = m_aListenerMap.find( aCommandURL ); if ( aIter != m_aListenerMap.end() ) { @@ -455,7 +455,7 @@ void ToolboxController::removeStatusListener( const OUString& aCommandURL ) return; Reference< XDispatch > xDispatch( pIter->second ); - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > xStatusListener(this); m_aListenerMap.erase( pIter ); try @@ -488,7 +488,7 @@ void ToolboxController::bindListener() Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); if ( m_xContext.is() && xDispatchProvider.is() ) { - xStatusListener.set( static_cast< OWeakObject* >( this ), UNO_QUERY ); + xStatusListener = this; for (auto & listener : m_aListenerMap) { css::util::URL aTargetURL; @@ -575,7 +575,7 @@ void ToolboxController::unbindListener() if ( !(m_xContext.is() && xDispatchProvider.is()) ) return; - Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY ); + Reference< XStatusListener > xStatusListener(this); for (auto & listener : m_aListenerMap) { css::util::URL aTargetURL; @@ -619,7 +619,7 @@ void ToolboxController::updateStatus( const OUString& aCommandURL ) // Try to find a dispatch object for the requested command URL Reference< XDispatchProvider > xDispatchProvider( m_xFrame, UNO_QUERY ); - xStatusListener.set( static_cast< OWeakObject* >( this ), UNO_QUERY ); + xStatusListener = this; if ( m_xContext.is() && xDispatchProvider.is() ) { aTargetURL.Complete = aCommandURL; diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 573427c4714e..c4b75024c9fc 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -165,9 +165,7 @@ uno::Reference<XAccessible> ShapeTypeHandler::Instance().CreateAccessibleObject ( aShapeInfo, maShapeTreeInfo)); - rChildDescriptor.mxAccessibleShape.set( - static_cast<uno::XWeak*>(pShape.get()), - uno::UNO_QUERY); + rChildDescriptor.mxAccessibleShape = pShape; if ( pShape.is() ) { pShape->Init(); diff --git a/svx/source/form/datanavi.cxx b/svx/source/form/datanavi.cxx index 93ecd07b9d60..27cfb9f1ad4a 100644 --- a/svx/source/form/datanavi.cxx +++ b/svx/source/form/datanavi.cxx @@ -1297,8 +1297,7 @@ namespace svxform m_xFrame = pBindings->GetDispatcher()->GetFrame()->GetFrame().GetFrameInterface(); DBG_ASSERT( m_xFrame.is(), "DataNavigatorWindow::LoadModels(): no frame" ); // add frameaction listener - Reference< XFrameActionListener > xListener( - static_cast< XFrameActionListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XFrameActionListener > xListener = m_xDataListener; m_xFrame->addFrameActionListener( xListener ); // load xforms models of the current document @@ -1307,8 +1306,7 @@ namespace svxform DataNavigatorWindow::~DataNavigatorWindow() { - Reference< XFrameActionListener > xListener( - static_cast< XFrameActionListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XFrameActionListener > xListener = m_xDataListener; m_xFrame->removeFrameActionListener( xListener ); SvtViewOptions aViewOpt( EViewType::TabDialog, CFGNAME_DATANAVIGATOR ); @@ -1951,8 +1949,7 @@ namespace svxform void DataNavigatorWindow::AddContainerBroadcaster( const css::uno::Reference< css::container::XContainer >& xContainer ) { - Reference< XContainerListener > xListener( - static_cast< XContainerListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XContainerListener > xListener = m_xDataListener; xContainer->addContainerListener( xListener ); m_aContainerList.push_back( xContainer ); } @@ -1960,8 +1957,7 @@ namespace svxform void DataNavigatorWindow::AddEventBroadcaster( const css::uno::Reference< css::xml::dom::events::XEventTarget >& xTarget ) { - Reference< XEventListener > xListener( - static_cast< XEventListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XEventListener > xListener = m_xDataListener; xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, true ); xTarget->addEventListener( EVENTTYPE_CHARDATA, xListener, false ); xTarget->addEventListener( EVENTTYPE_ATTR, xListener, true ); @@ -1971,13 +1967,11 @@ namespace svxform void DataNavigatorWindow::RemoveBroadcaster() { - Reference< XContainerListener > xContainerListener( - static_cast< XContainerListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XContainerListener > xContainerListener = m_xDataListener; sal_Int32 i, nCount = m_aContainerList.size(); for ( i = 0; i < nCount; ++i ) m_aContainerList[i]->removeContainerListener( xContainerListener ); - Reference< XEventListener > xEventListener( - static_cast< XEventListener* >( m_xDataListener.get() ), UNO_QUERY ); + Reference< XEventListener > xEventListener = m_xDataListener; nCount = m_aEventTargetList.size(); for ( i = 0; i < nCount; ++i ) { diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index ecaaab2cd5d1..786c95698c05 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -633,7 +633,7 @@ void SAL_CALL FindTextToolbarController::initialize( const css::uno::Sequence< c m_nFindAllId = pToolBox->GetItemId(COMMAND_FINDALL); } - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } css::uno::Reference< css::awt::XWindow > SAL_CALL FindTextToolbarController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) @@ -787,7 +787,7 @@ void SAL_CALL UpDownSearchToolboxController::dispose() void SAL_CALL UpDownSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } // XToolbarController @@ -906,7 +906,7 @@ void SAL_CALL MatchCaseToolboxController::initialize( const css::uno::Sequence< { svt::ToolboxController::initialize(aArguments); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) @@ -1022,7 +1022,7 @@ void SAL_CALL SearchFormattedToolboxController::initialize( const css::uno::Sequ { svt::ToolboxController::initialize(aArguments); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxController::createItemWindow( const css::uno::Reference< css::awt::XWindow >& xParent ) @@ -1132,7 +1132,7 @@ void SAL_CALL FindAllToolboxController::dispose() void SAL_CALL FindAllToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } // XToolbarController @@ -1239,7 +1239,7 @@ void SAL_CALL ExitSearchToolboxController::dispose() void SAL_CALL ExitSearchToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } // XToolbarController @@ -1361,7 +1361,7 @@ void SAL_CALL SearchLabelToolboxController::dispose() void SAL_CALL SearchLabelToolboxController::initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) { svt::ToolboxController::initialize( aArguments ); - SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY), m_aCommandURL); + SearchToolbarControllersManager::createControllersManager().registryController(m_xFrame, css::uno::Reference< css::frame::XStatusListener >(this), m_aCommandURL); } // XStatusListener diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index c05d7323e43c..a6ba615358ed 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -633,7 +633,7 @@ void SvxShape::ObtainSettingsFromPropertySet(const SvxItemPropertySet& rPropSet) if(HasSdrObject() && rPropSet.AreThereOwnUsrAnys()) { SfxItemSet aSet( GetSdrObject()->getSdrModelFromSdrObject().GetItemPool(), svl::Items<SDRATTR_START, SDRATTR_END>); - Reference< beans::XPropertySet > xShape( static_cast<OWeakObject*>(this), UNO_QUERY ); + Reference< beans::XPropertySet > xShape(this); SvxItemPropertySet_ObtainSettingsFromPropertySet(rPropSet, aSet, xShape, &mpPropSet->getPropertyMap() ); GetSdrObject()->SetMergedItemSetAndBroadcast(aSet); diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx index 1bc01a2b3d14..82554572b09d 100644 --- a/sw/source/core/crsr/viscrs.cxx +++ b/sw/source/core/crsr/viscrs.cxx @@ -511,7 +511,7 @@ void SwSelPaintRects::HighlightInputField() pCursorForInputTextField->GetMark()->nContent.Assign( pTextNode, *(pCurTextInputFieldAtCursor->End()) ); pCursorForInputTextField->FillRects(); - SwRects* pRects = static_cast<SwRects*>(pCursorForInputTextField.get()); + SwRects* pRects = pCursorForInputTextField.get(); for (const SwRect & rNextRect : *pRects) { const tools::Rectangle aPntRect(rNextRect.SVRect()); diff --git a/sw/source/core/docnode/finalthreadmanager.cxx b/sw/source/core/docnode/finalthreadmanager.cxx index 4bfc84132e61..4eb94f38f0cc 100644 --- a/sw/source/core/docnode/finalthreadmanager.cxx +++ b/sw/source/core/docnode/finalthreadmanager.cxx @@ -239,7 +239,7 @@ FinalThreadManager::FinalThreadManager(css::uno::Reference< css::uno::XComponent void FinalThreadManager::registerAsListenerAtDesktop() { css::uno::Reference< css::frame::XDesktop2 > xDesktop = css::frame::Desktop::create(m_xContext); - xDesktop->addTerminateListener( css::uno::Reference< css::frame::XTerminateListener >( static_cast< cppu::OWeakObject* >( this ), css::uno::UNO_QUERY ) ); + xDesktop->addTerminateListener( css::uno::Reference< css::frame::XTerminateListener >( this ) ); } FinalThreadManager::~FinalThreadManager() diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx index fc7b5414dc20..4446c63c1080 100644 --- a/sw/source/core/unocore/unochart.cxx +++ b/sw/source/core/unocore/unochart.cxx @@ -1792,7 +1792,7 @@ SwChartDataSequence::SwChartDataSequence( const SwTable* pTable = SwTable::FindTable( &rTableFormat ); if (pTable) { - uno::Reference< chart2::data::XDataSequence > xRef( static_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY ); + uno::Reference< chart2::data::XDataSequence > xRef(this); m_xDataProvider->AddDataSequence( *pTable, xRef ); m_xDataProvider->addEventListener( static_cast< lang::XEventListener * >(this) ); } @@ -1841,7 +1841,7 @@ SwChartDataSequence::SwChartDataSequence( const SwChartDataSequence &rObj ) : const SwTable* pTable = SwTable::FindTable( GetFrameFormat() ); if (pTable) { - uno::Reference< chart2::data::XDataSequence > xRef( static_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY ); + uno::Reference< chart2::data::XDataSequence > xRef(this); m_xDataProvider->AddDataSequence( *pTable, xRef ); m_xDataProvider->addEventListener( static_cast< lang::XEventListener * >(this) ); } @@ -2241,7 +2241,7 @@ void SAL_CALL SwChartDataSequence::dispose( ) const SwTable* pTable = SwTable::FindTable( GetFrameFormat() ); if (pTable) { - uno::Reference< chart2::data::XDataSequence > xRef( static_cast< chart2::data::XDataSequence * >(this), uno::UNO_QUERY ); + uno::Reference< chart2::data::XDataSequence > xRef(this); m_xDataProvider->RemoveDataSequence( *pTable, xRef ); } else { @@ -2534,8 +2534,8 @@ void SwChartLabeledDataSequence::SetDataSequence( uno::Reference< chart2::data::XDataSequence >& rxDest, const uno::Reference< chart2::data::XDataSequence >& rxSource) { - uno::Reference< util::XModifyListener > xML( static_cast< util::XModifyListener* >(this), uno::UNO_QUERY ); - uno::Reference< lang::XEventListener > xEL( static_cast< lang::XEventListener* >(this), uno::UNO_QUERY ); + uno::Reference< util::XModifyListener > xML(this); + uno::Reference< lang::XEventListener > xEL(this); // stop listening to old data-sequence uno::Reference< util::XModifyBroadcaster > xMB( rxDest, uno::UNO_QUERY ); diff --git a/sw/source/uibase/uno/unomodule.cxx b/sw/source/uibase/uno/unomodule.cxx index 0d595e773333..a64f1951e0f5 100644 --- a/sw/source/uibase/uno/unomodule.cxx +++ b/sw/source/uibase/uno/unomodule.cxx @@ -125,7 +125,7 @@ uno::Reference< frame::XDispatch > SAL_CALL SwUnoModule::queryDispatch( SwGlobals::ensure(); const SfxSlot* pSlot = SW_MOD()->GetInterface()->GetSlot( aURL.Complete ); if ( pSlot ) - xReturn.set(static_cast< frame::XDispatch* >(this), uno::UNO_QUERY); + xReturn = this; return xReturn; } diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 6ec5ec882c4c..e991de6df09c 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -2079,7 +2079,7 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName) case WID_DOC_FORBIDDEN_CHARS: { GetPropertyHelper(); - Reference<XForbiddenCharacters> xRet(static_cast<cppu::OWeakObject*>(mxPropertyHelper.get()), UNO_QUERY); + Reference<XForbiddenCharacters> xRet = mxPropertyHelper; aAny <<= xRet; } break; diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 9dcacd958c5e..62453331474b 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -1263,8 +1263,7 @@ ControlContainerBase::ControlContainerBase( const Reference< XComponentContext > { maComponentInfos.nWidth = 280; maComponentInfos.nHeight = 400; - mxListener = new ResourceListener( Reference< util::XModifyListener >( - static_cast< OWeakObject* >( this ), UNO_QUERY )); + mxListener = new ResourceListener( Reference< util::XModifyListener >(this) ); } ControlContainerBase::~ControlContainerBase() @@ -1589,7 +1588,7 @@ void ControlContainerBase::ImplModelPropertiesChanged( const Sequence< PropertyC if ( !mbPosModified && !mbSizeModified ) { // Don't set new pos/size if we get new values from window listener - Reference< XControl > xThis( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); + Reference< XControl > xThis(this); ImplSetPosSize( xThis ); } } diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index fcfa50b4e4ea..5c5df64850f8 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -364,7 +364,7 @@ void UnoDialogControl::createPeer( const Reference< XToolkit > & rxToolkit, cons if ( !mbWindowListener ) { - Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY ); + Reference< XWindowListener > xWL(this); addWindowListener( xWL ); mbWindowListener = true; } diff --git a/toolkit/source/controls/roadmapcontrol.cxx b/toolkit/source/controls/roadmapcontrol.cxx index 4bf888811ee2..64c1e25dc9d8 100644 --- a/toolkit/source/controls/roadmapcontrol.cxx +++ b/toolkit/source/controls/roadmapcontrol.cxx @@ -276,7 +276,7 @@ static void lcl_throwIndexOutOfBoundsException( ) maRoadmapItems.insert( maRoadmapItems.begin() + Index, xRoadmapItem); ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem); maContainerListeners.elementInserted( aEvent ); - Reference< XPropertySet > xPropertySet( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); + Reference< XPropertySet > xPropertySet( this ); sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet ); if ( Index <= n_CurrentItemID ) { @@ -294,7 +294,7 @@ static void lcl_throwIndexOutOfBoundsException( ) maRoadmapItems.erase( maRoadmapItems.begin() + Index ); ContainerEvent aEvent = GetContainerEvent(Index, xRoadmapItem); maContainerListeners.elementRemoved( aEvent ); - Reference< XPropertySet > xPropertySet( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); + Reference< XPropertySet > xPropertySet( this ); sal_Int16 n_CurrentItemID = GetCurrentItemID( xPropertySet ); Any aAny; if ( Index > n_CurrentItemID ) diff --git a/toolkit/source/controls/tabpagemodel.cxx b/toolkit/source/controls/tabpagemodel.cxx index aa0f1badef0c..ccf320dad8aa 100644 --- a/toolkit/source/controls/tabpagemodel.cxx +++ b/toolkit/source/controls/tabpagemodel.cxx @@ -212,7 +212,7 @@ void UnoControlTabPage::createPeer( const Reference< XToolkit > & rxToolkit, con { if ( !m_bWindowListener ) { - Reference< XWindowListener > xWL( static_cast< cppu::OWeakObject*>( this ), UNO_QUERY ); + Reference< XWindowListener > xWL(this); addWindowListener( xWL ); m_bWindowListener = true; } diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index e669e7e9889e..841c9e869773 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -569,7 +569,7 @@ void UnoControl::ImplModelPropertiesChanged( const Sequence< PropertyChangeEvent } Reference< XWindow > xParent = getParentPeer(); - Reference< XControl > xThis( static_cast<XAggregation*>(static_cast<cppu::OWeakAggObject*>(this)), UNO_QUERY ); + Reference< XControl > xThis(this); // call createPeer via an interface got from queryInterface, so the aggregating class can intercept it DBG_ASSERT( !bNeedNewPeer || xParent.is(), "Need new peer, but don't have a parent!" ); diff --git a/unoxml/source/dom/elementlist.cxx b/unoxml/source/dom/elementlist.cxx index c0ffb0f87929..c8fc604377de 100644 --- a/unoxml/source/dom/elementlist.cxx +++ b/unoxml/source/dom/elementlist.cxx @@ -93,7 +93,7 @@ namespace DOM { if (m_xEventListener.is() && m_pElement.is()) { - Reference< XEventTarget > xTarget(static_cast<XElement*>(m_pElement.get()), UNO_QUERY); + Reference< XEventTarget > xTarget = m_pElement; assert(xTarget.is()); if (!xTarget.is()) return; diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index 8ae170995d19..7e8902b56f2d 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.cxx @@ -268,7 +268,7 @@ bool XSecController::chainOn() */ m_xSAXEventKeeper->setNextHandler( nullptr ); - css::uno::Reference< css::xml::sax::XDocumentHandler > xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), css::uno::UNO_QUERY); + css::uno::Reference< css::xml::sax::XDocumentHandler > xSEKHandler(m_xSAXEventKeeper); /* * connects the previous document handler on the SAX chain diff --git a/xmlsecurity/source/helper/xsecsign.cxx b/xmlsecurity/source/helper/xsecsign.cxx index 3d9cac6dc485..862375febc90 100644 --- a/xmlsecurity/source/helper/xsecsign.cxx +++ b/xmlsecurity/source/helper/xsecsign.cxx @@ -69,7 +69,7 @@ css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecCon css::uno::Sequence<css::uno::Any> args(5); args[0] <<= OUString::number(nSecurityId); - args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY); + args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper); args[2] <<= OUString::number(nIdOfSignatureElementCollector); //for nss, the internal module is used for signing, which needs to be improved later @@ -377,7 +377,7 @@ bool XSecController::WriteSignature( /* * export the signature template */ - css::uno::Reference<css::xml::sax::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()),css::uno::UNO_QUERY); + css::uno::Reference<css::xml::sax::XDocumentHandler> xSEKHandler(m_xSAXEventKeeper); int i; int sigNum = m_vInternalSignatureInformations.size(); @@ -426,7 +426,7 @@ bool XSecController::WriteOOXMLSignature(const uno::Reference<embed::XStorage>& try { // Export the signature template. - css::uno::Reference<xml::sax::XDocumentHandler> xSEKHandler(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY); + css::uno::Reference<xml::sax::XDocumentHandler> xSEKHandler(m_xSAXEventKeeper); for (InternalSignatureInformation & rInformation : m_vInternalSignatureInformations) { diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index b5b4af76b1cf..82efa17eb807 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -74,7 +74,7 @@ css::uno::Reference< css::xml::crypto::sax::XReferenceResolvedListener > XSecCon css::uno::Sequence<css::uno::Any> args(5); args[0] <<= OUString::number(nSecurityId); - args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(static_cast<cppu::OWeakObject*>(m_xSAXEventKeeper.get()), uno::UNO_QUERY); + args[1] <<= uno::Reference<xml::crypto::sax::XSecuritySAXEventKeeper>(m_xSAXEventKeeper); args[2] <<= OUString::number(nIdOfSignatureElementCollector); args[3] <<= m_xSecurityContext; args[4] <<= m_xXMLSignature; |