[Libreoffice-commits] core.git: avmedia/source chart2/source compilerplugins/clang dbaccess/source desktop/source embeddedobj/source filter/source forms/source framework/source package/source sdext/source sd/source sfx2/source svl/source svtools/source svx/source sw/source toolkit/source unoxml/source xmlsecurity/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Mon Aug 23 13:26:11 UTC 2021
avmedia/source/viewer/mediawindow_impl.cxx | 16 +---
chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx | 2
chart2/source/tools/ExplicitCategoriesProvider.cxx | 2
chart2/source/view/main/ChartView.cxx | 2
compilerplugins/clang/plugin.cxx | 16 +++-
compilerplugins/clang/test/referencecasting.cxx | 22 +++++
dbaccess/source/ui/browser/sbagrid.cxx | 4 -
dbaccess/source/ui/misc/TokenWriter.cxx | 6 -
desktop/source/deployment/registry/help/dp_help.cxx | 4 -
embeddedobj/source/msole/ownview.cxx | 27 +------
filter/source/config/cache/cacheupdatelistener.cxx | 2
forms/source/component/FormComponent.cxx | 3
forms/source/component/FormattedField.cxx | 4 -
framework/source/dispatch/interceptionhelper.cxx | 4 -
framework/source/dispatch/mailtodispatcher.cxx | 4 -
framework/source/dispatch/popupmenudispatcher.cxx | 5 -
framework/source/dispatch/servicehandler.cxx | 4 -
framework/source/fwe/helper/actiontriggerhelper.cxx | 2
framework/source/fwe/xml/menuconfiguration.cxx | 2
framework/source/helper/uiconfigelementwrapperbase.cxx | 8 +-
framework/source/jobs/job.cxx | 14 +--
framework/source/jobs/jobdispatch.cxx | 2
framework/source/layoutmanager/layoutmanager.cxx | 26 +++---
framework/source/layoutmanager/toolbarlayoutmanager.cxx | 16 +---
framework/source/services/autorecovery.cxx | 4 -
framework/source/services/desktop.cxx | 2
framework/source/services/frame.cxx | 26 ++----
framework/source/uiconfiguration/globalsettings.cxx | 4 -
framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx | 38 +++++-----
framework/source/uiconfiguration/uiconfigurationmanager.cxx | 34 ++++----
framework/source/uielement/addonstoolbarwrapper.cxx | 2
framework/source/uielement/controlmenucontroller.cxx | 4 -
framework/source/uielement/fontmenucontroller.cxx | 4 -
framework/source/uielement/fontsizemenucontroller.cxx | 4 -
framework/source/uielement/headermenucontroller.cxx | 4 -
framework/source/uielement/langselectionmenucontroller.cxx | 4 -
framework/source/uielement/macrosmenucontroller.cxx | 4 -
framework/source/uielement/menubarmanager.cxx | 21 ++---
framework/source/uielement/menubarwrapper.cxx | 2
framework/source/uielement/newmenucontroller.cxx | 4 -
framework/source/uielement/objectmenucontroller.cxx | 4 -
framework/source/uielement/progressbarwrapper.cxx | 9 --
framework/source/uielement/recentfilesmenucontroller.cxx | 6 -
framework/source/uielement/statusbarmanager.cxx | 14 +--
framework/source/uielement/statusbarwrapper.cxx | 2
framework/source/uielement/subtoolbarcontroller.cxx | 3
framework/source/uielement/toolbarmanager.cxx | 28 ++-----
framework/source/uielement/toolbarmodemenucontroller.cxx | 6 -
framework/source/uielement/toolbarsmenucontroller.cxx | 6 -
framework/source/uielement/toolbarwrapper.cxx | 2
framework/source/uifactory/menubarfactory.cxx | 3
framework/source/uifactory/statusbarfactory.cxx | 3
framework/source/uifactory/toolbarfactory.cxx | 3
package/source/xstor/ocompinstream.cxx | 2
package/source/xstor/xstorage.cxx | 3
package/source/zippackage/ZipPackageFolder.cxx | 4 -
sd/source/ui/slidesorter/controller/SlideSorterController.cxx | 3
sd/source/ui/slidesorter/controller/SlsListener.cxx | 8 --
sd/source/ui/tools/EventMultiplexer.cxx | 7 -
sd/source/ui/view/drviewsa.cxx | 3
sdext/source/presenter/PresenterAccessibility.cxx | 2
sdext/source/presenter/PresenterController.cxx | 6 -
sdext/source/presenter/PresenterHelpView.cxx | 3
sdext/source/presenter/PresenterNotesView.cxx | 4 -
sdext/source/presenter/PresenterPaneFactory.cxx | 6 -
sdext/source/presenter/PresenterScreen.cxx | 6 -
sdext/source/presenter/PresenterSlideSorter.cxx | 6 -
sdext/source/presenter/PresenterToolBar.cxx | 7 -
sdext/source/presenter/PresenterViewFactory.cxx | 3
sfx2/source/appl/workwin.cxx | 6 -
sfx2/source/control/sfxstatuslistener.cxx | 6 -
sfx2/source/control/statcach.cxx | 2
sfx2/source/doc/sfxbasemodel.cxx | 2
sfx2/source/sidebar/ControllerFactory.cxx | 12 +--
sfx2/source/sidebar/SidebarDockingWindow.cxx | 2
sfx2/source/sidebar/Theme.cxx | 2
sfx2/source/view/sfxbasecontroller.cxx | 3
svl/source/fsstor/oinputstreamcontainer.cxx | 2
svtools/source/uno/popupmenucontrollerbase.cxx | 4 -
svtools/source/uno/toolboxcontroller.cxx | 14 +--
svx/source/accessibility/ChildrenManagerImpl.cxx | 4 -
svx/source/form/datanavi.cxx | 18 +---
svx/source/tbxctrls/tbunosearchcontrollers.cxx | 14 +--
svx/source/unodraw/unoshape.cxx | 2
sw/source/core/crsr/viscrs.cxx | 2
sw/source/core/docnode/finalthreadmanager.cxx | 2
sw/source/core/unocore/unochart.cxx | 10 +-
sw/source/uibase/uno/unomodule.cxx | 2
sw/source/uibase/uno/unotxdoc.cxx | 2
toolkit/source/controls/controlmodelcontainerbase.cxx | 5 -
toolkit/source/controls/dialogcontrol.cxx | 2
toolkit/source/controls/roadmapcontrol.cxx | 4 -
toolkit/source/controls/tabpagemodel.cxx | 2
toolkit/source/controls/unocontrol.cxx | 2
unoxml/source/dom/elementlist.cxx | 2
xmlsecurity/source/helper/xsecctl.cxx | 2
xmlsecurity/source/helper/xsecsign.cxx | 6 -
xmlsecurity/source/helper/xsecverify.cxx | 2
98 files changed, 297 insertions(+), 361 deletions(-)
New commits:
commit 8a54339fc83fe9abaaace6f9f374697e6923d684
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 23 10:15:01 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 23 15:25:26 2021 +0200
loplugin:referencecasting look through more clang Types
Note that because of where the fix resides, loplugin:redundantcast
also notices a few more things.
Change-Id: I0b66047fadfff2c5ceafcbd3eab085de00d861a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120865
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
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 at +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 at +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
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list