summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 13:29:51 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-21 08:49:01 +0200
commit17db60eb46b31b6e4b7e664b01e6f7bb6a3016ab (patch)
treea2f64eca956aa2daf0e74de31bc2d419f769f2c0 /svtools
parent8a3912c8eb25d1acacbc0a18355f2ca75d418908 (diff)
loplugin:referencecasting in slideshow..svtools
Change-Id: Id0f0332d5d66c0bce309643bf42059b9bdc7d448 Reviewed-on: https://gerrit.libreoffice.org/75997 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/dialogs/ServerDetailsControls.cxx9
-rw-r--r--svtools/source/dialogs/addresstemplate.cxx2
-rw-r--r--svtools/source/misc/embedhlp.cxx38
-rw-r--r--svtools/source/uno/framestatuslistener.cxx11
-rw-r--r--svtools/source/uno/statusbarcontroller.cxx8
5 files changed, 29 insertions, 39 deletions
diff --git a/svtools/source/dialogs/ServerDetailsControls.cxx b/svtools/source/dialogs/ServerDetailsControls.cxx
index 9011f4784136..e63aeae088cc 100644
--- a/svtools/source/dialogs/ServerDetailsControls.cxx
+++ b/svtools/source/dialogs/ServerDetailsControls.cxx
@@ -285,8 +285,8 @@ CmisDetailsContainer::CmisDetailsContainer(PlaceEditDialog* pParentDialog, OUStr
m_xParentDialog(pParentDialog->getDialog()->GetXWindow())
{
Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext();
- Reference< XInteractionHandler > xGlobalInteractionHandler(
- InteractionHandler::createWithParent(xContext, m_xParentDialog), UNO_QUERY);
+ Reference< XInteractionHandler > xGlobalInteractionHandler =
+ InteractionHandler::createWithParent(xContext, m_xParentDialog);
m_xCmdEnv = new ucbhelper::CommandEnvironment( xGlobalInteractionHandler, Reference< XProgressHandler >() );
set_visible( false );
@@ -435,9 +435,8 @@ IMPL_LINK_NOARG( CmisDetailsContainer, RefreshReposHdl, weld::Button&, void )
{
if( !sUrl.isEmpty() && !m_sUsername.isEmpty() && !m_sPassword.isEmpty() )
{
- Reference< XInteractionHandler > xInteractionHandler(
- InteractionHandler::createWithParent(xContext, m_xParentDialog),
- UNO_QUERY );
+ Reference< XInteractionHandler > xInteractionHandler =
+ InteractionHandler::createWithParent(xContext, m_xParentDialog);
Sequence<OUString> aPasswd { m_sPassword };
diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx
index 84606e549750..8e5b6ea9b229 100644
--- a/svtools/source/dialogs/addresstemplate.cxx
+++ b/svtools/source/dialogs/addresstemplate.cxx
@@ -780,7 +780,7 @@ void AssignmentPersistentData::ImplCommit()
Reference< XTablesSupplier > xSupplTables(xConn, UNO_QUERY);
if (xSupplTables.is())
{
- m_xCurrentDatasourceTables.set(xSupplTables->getTables(), UNO_QUERY);
+ m_xCurrentDatasourceTables = xSupplTables->getTables();
if (m_xCurrentDatasourceTables.is())
aTableNames = m_xCurrentDatasourceTables->getElementNames();
}
diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx
index 0e7728156f7b..077ed200e48d 100644
--- a/svtools/source/misc/embedhlp.cxx
+++ b/svtools/source/misc/embedhlp.cxx
@@ -93,12 +93,12 @@ rtl::Reference<EmbedEventListener_Impl> EmbedEventListener_Impl::Create( Embedde
{
p->GetObject()->addStateChangeListener( pRet.get() );
- uno::Reference < util::XCloseable > xClose( p->GetObject(), uno::UNO_QUERY );
+ uno::Reference < util::XCloseable > xClose = p->GetObject();
DBG_ASSERT( xClose.is(), "Object does not support XCloseable!" );
if ( xClose.is() )
xClose->addCloseListener( pRet.get() );
- uno::Reference < document::XEventBroadcaster > xBrd( p->GetObject(), uno::UNO_QUERY );
+ uno::Reference < document::XEventBroadcaster > xBrd = p->GetObject();
if ( xBrd.is() )
xBrd->addEventListener( pRet.get() );
@@ -320,31 +320,23 @@ void EmbeddedObjectRef::Clear()
{
mpImpl->mxObj->removeStateChangeListener(mpImpl->mxListener.get());
- uno::Reference<util::XCloseable> xClose(mpImpl->mxObj, uno::UNO_QUERY);
- if ( xClose.is() )
- xClose->removeCloseListener( mpImpl->mxListener.get() );
-
- uno::Reference<document::XEventBroadcaster> xBrd(mpImpl->mxObj, uno::UNO_QUERY);
- if ( xBrd.is() )
- xBrd->removeEventListener( mpImpl->mxListener.get() );
+ mpImpl->mxObj->removeCloseListener( mpImpl->mxListener.get() );
+ mpImpl->mxObj->removeEventListener( mpImpl->mxListener.get() );
if ( mpImpl->bIsLocked )
{
- if ( xClose.is() )
+ try
{
- try
- {
- mpImpl->mxObj->changeState(embed::EmbedStates::LOADED);
- xClose->close( true );
- }
- catch (const util::CloseVetoException&)
- {
- // there's still someone who needs the object!
- }
- catch (const uno::Exception&)
- {
- TOOLS_WARN_EXCEPTION("svtools.misc", "Error on switching of the object to loaded state and closing");
- }
+ mpImpl->mxObj->changeState(embed::EmbedStates::LOADED);
+ mpImpl->mxObj->close( true );
+ }
+ catch (const util::CloseVetoException&)
+ {
+ // there's still someone who needs the object!
+ }
+ catch (const uno::Exception&)
+ {
+ TOOLS_WARN_EXCEPTION("svtools.misc", "Error on switching of the object to loaded state and closing");
}
}
}
diff --git a/svtools/source/uno/framestatuslistener.cxx b/svtools/source/uno/framestatuslistener.cxx
index 1e4cba141faa..ba158c2ddcf3 100644
--- a/svtools/source/uno/framestatuslistener.cxx
+++ b/svtools/source/uno/framestatuslistener.cxx
@@ -79,13 +79,12 @@ void SAL_CALL FrameStatusListener::release() throw ()
// XComponent
void SAL_CALL FrameStatusListener::dispose()
{
- Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
+ Reference< XComponent > xThis = this;
SolarMutexGuard aSolarMutexGuard;
if ( m_bDisposed )
throw DisposedException();
- Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
for (auto const& listener : m_aListenerMap)
{
try
@@ -96,8 +95,8 @@ void SAL_CALL FrameStatusListener::dispose()
aTargetURL.Complete = listener.first;
xURLTransformer->parseStrict( aTargetURL );
- if ( xDispatch.is() && xStatusListener.is() )
- xDispatch->removeStatusListener( xStatusListener, aTargetURL );
+ if ( xDispatch.is() )
+ xDispatch->removeStatusListener( this, aTargetURL );
}
catch (const Exception&)
{
@@ -165,7 +164,7 @@ void FrameStatusListener::addStatusListener( const OUString& aCommandURL )
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() )
{
@@ -210,7 +209,7 @@ void FrameStatusListener::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)
{
Reference< XURLTransformer > xURLTransformer( css::util::URLTransformer::create( m_xContext ) );
diff --git a/svtools/source/uno/statusbarcontroller.cxx b/svtools/source/uno/statusbarcontroller.cxx
index 88c07535dd16..d22dc8e69a98 100644
--- a/svtools/source/uno/statusbarcontroller.cxx
+++ b/svtools/source/uno/statusbarcontroller.cxx
@@ -184,7 +184,7 @@ void SAL_CALL StatusbarController::update()
// XComponent
void SAL_CALL StatusbarController::dispose()
{
- Reference< XComponent > xThis( static_cast< OWeakObject* >(this), UNO_QUERY );
+ Reference< XComponent > xThis = this;
{
SolarMutexGuard aSolarMutexGuard;
@@ -196,7 +196,7 @@ void SAL_CALL StatusbarController::dispose()
m_aListenerContainer.disposeAndClear( aEvent );
SolarMutexGuard aSolarMutexGuard;
- Reference< XStatusListener > xStatusListener( static_cast< OWeakObject* >( this ), UNO_QUERY );
+ Reference< XStatusListener > xStatusListener = this;
Reference< XURLTransformer > xURLTransformer = getURLTransformer();
css::util::URL aTargetURL;
for (auto const& listener : m_aListenerMap)
@@ -369,7 +369,7 @@ void StatusbarController::addStatusListener( const OUString& aCommandURL )
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() )
{
@@ -417,7 +417,7 @@ void StatusbarController::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)
{
Reference< XURLTransformer > xURLTransformer = getURLTransformer();