diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 09:51:02 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-07-19 13:28:41 +0200 |
commit | 242e1c42d975b2d8729cd150cf104b177033760a (patch) | |
tree | a44512de3ad3cb5a59cf3b658752dfe154ba5aa0 /comphelper | |
parent | ee2bb231036b1d9d954dec369855948e6ea1f53a (diff) |
loplugin:referencecasting in comphelper..connectivity
Change-Id: I21896885c29e9ab58ebab17b59f1480c6a06fb38
Reviewed-on: https://gerrit.libreoffice.org/75936
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/container/embeddedobjectcontainer.cxx | 8 | ||||
-rw-r--r-- | comphelper/source/misc/backupfilehelper.cxx | 16 | ||||
-rw-r--r-- | comphelper/source/misc/dispatchcommand.cxx | 2 | ||||
-rw-r--r-- | comphelper/source/misc/proxyaggregation.cxx | 8 |
4 files changed, 15 insertions, 19 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx index ba71089dc402..aa818d78ce5e 100644 --- a/comphelper/source/container/embeddedobjectcontainer.cxx +++ b/comphelper/source/container/embeddedobjectcontainer.cxx @@ -238,10 +238,9 @@ bool EmbeddedObjectContainer::HasEmbeddedObject( const OUString& rName ) auto aIt = pImpl->maNameToObjectMap.find( rName ); if (aIt != pImpl->maNameToObjectMap.end()) return true; - uno::Reference <container::XNameAccess> xAccess(pImpl->mxStorage, uno::UNO_QUERY); - if (!xAccess.is()) + if (!pImpl->mxStorage.is()) return false; - return xAccess->hasByName(rName); + return pImpl->mxStorage->hasByName(rName); } bool EmbeddedObjectContainer::HasEmbeddedObject( const uno::Reference < embed::XEmbeddedObject >& xObj ) const @@ -999,10 +998,9 @@ void EmbeddedObjectContainer::CloseEmbeddedObject( const uno::Reference < embed: pImpl->maObjectToNameMap.erase( aIter->second ); pImpl->maNameToObjectMap.erase( aIter ); - uno::Reference < ::util::XCloseable > xClose( xObj, uno::UNO_QUERY ); try { - xClose->close( true ); + xObj->close( true ); } catch (const uno::Exception&) { diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx index aa81039ad89c..c60f9fa6e75e 100644 --- a/comphelper/source/misc/backupfilehelper.cxx +++ b/comphelper/source/misc/backupfilehelper.cxx @@ -819,12 +819,12 @@ namespace { // create a SAXWriter uno::Reference< xml::sax::XWriter > const xSaxWriter = xml::sax::Writer::create(xContext); - uno::Reference< io::XStream > xTempFile(io::TempFile::create(xContext), uno::UNO_QUERY); - uno::Reference< io::XOutputStream > xOutStrm(xTempFile->getOutputStream(), uno::UNO_QUERY); + uno::Reference< io::XStream > xTempFile = io::TempFile::create(xContext); + uno::Reference< io::XOutputStream > xOutStrm = xTempFile->getOutputStream(); // set output stream and do the serialization - xSaxWriter->setOutputStream(uno::Reference< css::io::XOutputStream >(xOutStrm, uno::UNO_QUERY)); - xSerializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(xSaxWriter, uno::UNO_QUERY), uno::Sequence< beans::StringPair >()); + xSaxWriter->setOutputStream(xOutStrm); + xSerializer->serialize(xSaxWriter, uno::Sequence< beans::StringPair >()); // get URL from temp file uno::Reference < beans::XPropertySet > xTempFileProps(xTempFile, uno::UNO_QUERY); @@ -2115,12 +2115,12 @@ namespace comphelper // create a SAXWriter uno::Reference< xml::sax::XWriter > const xSaxWriter = xml::sax::Writer::create(xContext); - uno::Reference< io::XStream > xTempFile(io::TempFile::create(xContext), uno::UNO_QUERY); - uno::Reference< io::XOutputStream > xOutStrm(xTempFile->getOutputStream(), uno::UNO_QUERY); + uno::Reference< io::XStream > xTempFile = io::TempFile::create(xContext); + uno::Reference< io::XOutputStream > xOutStrm = xTempFile->getOutputStream(); // set output stream and do the serialization - xSaxWriter->setOutputStream(uno::Reference< css::io::XOutputStream >(xOutStrm, uno::UNO_QUERY)); - xSerializer->serialize(uno::Reference< xml::sax::XDocumentHandler >(xSaxWriter, uno::UNO_QUERY), uno::Sequence< beans::StringPair >()); + xSaxWriter->setOutputStream(xOutStrm); + xSerializer->serialize(xSaxWriter, uno::Sequence< beans::StringPair >()); // get URL from temp file uno::Reference < beans::XPropertySet > xTempFileProps(xTempFile, uno::UNO_QUERY); diff --git a/comphelper/source/misc/dispatchcommand.cxx b/comphelper/source/misc/dispatchcommand.cxx index 069a9d835032..d7b723c72574 100644 --- a/comphelper/source/misc/dispatchcommand.cxx +++ b/comphelper/source/misc/dispatchcommand.cxx @@ -71,7 +71,7 @@ bool dispatchCommand(const OUString& rCommand, const css::uno::Sequence<css::bea uno::Reference<frame::XFrame> xFrame(xDesktop->getActiveFrame()); if (!xFrame.is()) - xFrame.set(xDesktop, uno::UNO_QUERY); + xFrame = xDesktop; return dispatchCommand(rCommand, xFrame, rArguments, rListener); } diff --git a/comphelper/source/misc/proxyaggregation.cxx b/comphelper/source/misc/proxyaggregation.cxx index 3ace74436dfc..13d59edfe679 100644 --- a/comphelper/source/misc/proxyaggregation.cxx +++ b/comphelper/source/misc/proxyaggregation.cxx @@ -168,12 +168,10 @@ namespace comphelper // dispose our inner context // before we do this, remove ourself as listener - else in disposing( EventObject ), we // would dispose ourself a second time - Reference< XComponent > xComp( m_xInner, UNO_QUERY ); - if ( xComp.is() ) + if ( m_xInner.is() ) { - xComp->removeEventListener( this ); - xComp->dispose(); - xComp.clear(); + m_xInner->removeEventListener( this ); + m_xInner->dispose(); } } |