summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 13:28:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 17:59:06 +0200
commitb1ef3c043d66e7cd529fc4fb13a3d2e8fdb4f2ee (patch)
treeac5ef4b1c0a3b191f97b3b2aa022a3062c77fdb3 /scripting
parent476a652361de507303c7298a40cc96fa4bda22a3 (diff)
loplugin:referencecasting in scripting
Change-Id: I056ae11c6cda0a1550a8fe363b069359feafcd59 Reviewed-on: https://gerrit.libreoffice.org/75996 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basprov.cxx9
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx4
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx12
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx8
-rw-r--r--scripting/source/provider/MasterScriptProvider.cxx3
-rw-r--r--scripting/source/stringresource/stringresource.cxx5
6 files changed, 18 insertions, 23 deletions
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 796b7ba391bd..692f198cc960 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -119,7 +119,7 @@ namespace basprov
Reference< uri::XUriReferenceFactory > xUriFac( uri::UriReferenceFactory::create( m_xContext ) );
OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) );
- Reference< uri::XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY );
+ Reference< uri::XUriReference > xUriRef = xUriFac->parse( aLinkURL );
if ( xUriRef.is() )
{
@@ -246,7 +246,7 @@ namespace basprov
if ( xDocumentScripts.is() )
{
m_pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( xModel );
- m_xLibContainerDoc.set( xDocumentScripts->getBasicLibraries(), UNO_QUERY );
+ m_xLibContainerDoc = xDocumentScripts->getBasicLibraries();
OSL_ENSURE( m_pDocBasicManager && m_xLibContainerDoc.is(),
"BasicProviderImpl::initialize: invalid BasicManager, or invalid script container!" );
}
@@ -278,7 +278,7 @@ namespace basprov
}
if ( !m_xLibContainerApp.is() )
- m_xLibContainerApp.set( SfxGetpApp()->GetBasicContainer(), UNO_QUERY );
+ m_xLibContainerApp = SfxGetpApp()->GetBasicContainer();
}
@@ -294,8 +294,7 @@ namespace basprov
Reference< provider::XScript > xScript;
Reference< uri::XUriReferenceFactory > xFac ( uri::UriReferenceFactory::create( m_xContext ) );
- Reference< uri::XUriReference > uriRef(
- xFac->parse( scriptURI ), UNO_QUERY );
+ Reference< uri::XUriReference > uriRef = xFac->parse( scriptURI );
Reference < uri::XVndSunStarScriptUrl > sfUri( uriRef, UNO_QUERY );
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 1f99c6f5d879..2bdcf0d2cfba 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -203,7 +203,7 @@ namespace dlgprov
{
Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext("ooo.vba.VBAToOOEventDesc", m_xContext ), UNO_QUERY );
if ( xVBAToOOEvtDesc.is() )
- xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
+ xEventsSupplier = xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName );
}
return xEventsSupplier;
@@ -473,7 +473,7 @@ namespace dlgprov
Any aCtx;
aCtx <<= OUString("user");
- xScriptProvider.set( xFactory->createScriptProvider( aCtx ), UNO_QUERY );
+ xScriptProvider = xFactory->createScriptProvider( aCtx );
}
}
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 64f12bfb9350..3c71bcf6102d 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -262,7 +262,7 @@ namespace dlgprov
Reference< uri::XUriReference > uriRef;
for (;;)
{
- uriRef.set( xFac->parse( aURL ), UNO_QUERY );
+ uriRef = xFac->parse( aURL );
if ( !uriRef.is() )
{
OUString errorMsg = "DialogProviderImpl::getDialogModel: failed to parse URI: " + aURL;
@@ -310,14 +310,14 @@ namespace dlgprov
if ( sLocation == "application" )
{
- xLibContainer.set( SfxGetpApp()->GetDialogContainer(), UNO_QUERY );
+ xLibContainer = SfxGetpApp()->GetDialogContainer();
}
else if ( sLocation == "document" )
{
Reference< XEmbeddedScripts > xDocumentScripts( m_xModel, UNO_QUERY );
if ( xDocumentScripts.is() )
{
- xLibContainer.set( xDocumentScripts->getDialogLibraries(), UNO_QUERY );
+ xLibContainer = xDocumentScripts->getDialogLibraries();
OSL_ENSURE( xLibContainer.is(),
"DialogProviderImpl::createDialogModel: invalid dialog container!" );
}
@@ -346,7 +346,7 @@ namespace dlgprov
if ( !xDocumentScripts.is() )
continue;
- xLibContainer.set( xDocumentScripts->getDialogLibraries(), UNO_QUERY );
+ xLibContainer = xDocumentScripts->getDialogLibraries();
OSL_ENSURE( xLibContainer.is(),
"DialogProviderImpl::createDialogModel: invalid dialog container!" );
}
@@ -451,10 +451,10 @@ namespace dlgprov
}
else if ( m_xModel.is() )
{
- Reference< frame::XController > xController( m_xModel->getCurrentController(), UNO_QUERY );
+ Reference< frame::XController > xController = m_xModel->getCurrentController();
if ( xController.is() )
{
- Reference< frame::XFrame > xFrame( xController->getFrame(), UNO_QUERY );
+ Reference< frame::XFrame > xFrame = xController->getFrame();
if ( xFrame.is() )
xPeer.set( xFrame->getContainerWindow(), UNO_QUERY );
}
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index dff0f3513e4b..c4b7a519beb6 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -93,8 +93,7 @@ Reference< XDispatch > SAL_CALL ScriptProtocolHandler::queryDispatch(
// get scheme of url
Reference< uri::XUriReferenceFactory > xFac = uri::UriReferenceFactory::create( m_xContext );
- Reference< uri::XUriReference > uriRef(
- xFac->parse( aURL.Complete ), UNO_QUERY );
+ Reference< uri::XUriReference > uriRef = xFac->parse( aURL.Complete );
if ( uriRef.is() )
{
if ( uriRef->getScheme() == "vnd.sun.star.script" )
@@ -324,13 +323,12 @@ ScriptProtocolHandler::getScriptInvocation()
}
else
{
- Reference< XFrame > xFrame( m_xFrame.get(), UNO_QUERY );
- if ( xFrame.is() )
+ if ( m_xFrame.is() )
{
SfxFrame* pFrame = nullptr;
for ( pFrame = SfxFrame::GetFirst(); pFrame; pFrame = SfxFrame::GetNext( *pFrame ) )
{
- if ( pFrame->GetFrameInterface() == xFrame )
+ if ( pFrame->GetFrameInterface() == m_xFrame )
break;
}
SfxObjectShell* pDocShell = pFrame ? pFrame->GetCurrentDocument() : SfxObjectShell::Current();
diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx
index 1e933df231f7..7b4ed3b9ab87 100644
--- a/scripting/source/provider/MasterScriptProvider.cxx
+++ b/scripting/source/provider/MasterScriptProvider.cxx
@@ -232,8 +232,7 @@ MasterScriptProvider::getScript( const OUString& scriptURI )
Reference< uri::XUriReferenceFactory > xFac ( uri::UriReferenceFactory::create( m_xContext ) );
- Reference< uri::XUriReference > uriRef(
- xFac->parse( scriptURI ), UNO_QUERY );
+ Reference< uri::XUriReference > uriRef = xFac->parse( scriptURI );
Reference < uri::XVndSunStarScriptUrl > sfUri( uriRef, UNO_QUERY );
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 4814f7ef57a7..a50076ffc762 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -2304,10 +2304,9 @@ void StringResourceWithStorageImpl::setStorage( const Reference< XStorage >& Sto
// Scan locale properties files
void StringResourceWithStorageImpl::implScanLocales()
{
- Reference< container::XNameAccess > xNameAccess( m_xStorage, UNO_QUERY );
- if( xNameAccess.is() )
+ if( m_xStorage.is() )
{
- Sequence< OUString > aContentSeq = xNameAccess->getElementNames();
+ Sequence< OUString > aContentSeq = m_xStorage->getElementNames();
implScanLocaleNames( aContentSeq );
}