summaryrefslogtreecommitdiff
path: root/sfx2/source/doc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 20:11:22 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-20 17:58:43 +0200
commit476a652361de507303c7298a40cc96fa4bda22a3 (patch)
tree573ec85eeb6e2604c5cb2f078ea02f848686d443 /sfx2/source/doc
parent254dfda42e2e7bd8be77ccdc702ed7b09a226e57 (diff)
loplugin:referencecasting in sfx2
Change-Id: I97cd8821aa9a6f462f9b271940483738655ee9cf Reviewed-on: https://gerrit.libreoffice.org/75979 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/doc')
-rw-r--r--sfx2/source/doc/DocumentSigner.cxx3
-rw-r--r--sfx2/source/doc/SfxRedactionHelper.cxx8
-rw-r--r--sfx2/source/doc/docfile.cxx8
-rw-r--r--sfx2/source/doc/exoticfileloadexception.cxx6
-rw-r--r--sfx2/source/doc/guisaveas.cxx3
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/objserv.cxx19
-rw-r--r--sfx2/source/doc/objstor.cxx2
-rw-r--r--sfx2/source/doc/objxtor.cxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx11
10 files changed, 27 insertions, 39 deletions
diff --git a/sfx2/source/doc/DocumentSigner.cxx b/sfx2/source/doc/DocumentSigner.cxx
index ceef0a1b0a9d..d7b05d6acdbd 100644
--- a/sfx2/source/doc/DocumentSigner.cxx
+++ b/sfx2/source/doc/DocumentSigner.cxx
@@ -57,8 +57,7 @@ bool DocumentSigner::signDocument(uno::Reference<security::XCertificate> const&
try
{
uno::Reference<embed::XStorage> xMetaInf;
- uno::Reference<container::XNameAccess> xNameAccess(xWriteableZipStore, uno::UNO_QUERY);
- if (xNameAccess.is() && xNameAccess->hasByName("META-INF"))
+ if (xWriteableZipStore.is() && xWriteableZipStore->hasByName("META-INF"))
{
xMetaInf = xWriteableZipStore->openStorageElement("META-INF",
embed::ElementModes::READWRITE);
diff --git a/sfx2/source/doc/SfxRedactionHelper.cxx b/sfx2/source/doc/SfxRedactionHelper.cxx
index ff81bdf39292..3a43faed3ac5 100644
--- a/sfx2/source/doc/SfxRedactionHelper.cxx
+++ b/sfx2/source/doc/SfxRedactionHelper.cxx
@@ -330,8 +330,8 @@ SfxRedactionHelper::getPageMarginsForWriter(css::uno::Reference<css::frame::XMod
SAL_WARN("sfx.doc", "Ref to xStyleFamiliesSupplier is null in setPageMargins().");
return aPageMargins;
}
- uno::Reference<container::XNameAccess> xStyleFamilies(
- xStyleFamiliesSupplier->getStyleFamilies(), UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies
+ = xStyleFamiliesSupplier->getStyleFamilies();
if (!xStyleFamilies.is())
return aPageMargins;
@@ -387,8 +387,8 @@ SfxRedactionHelper::getPageMarginsForCalc(css::uno::Reference<css::frame::XModel
SAL_WARN("sfx.doc", "Ref to xStyleFamiliesSupplier is null in getPageMarginsForCalc().");
return aPageMargins;
}
- uno::Reference<container::XNameAccess> xStyleFamilies(
- xStyleFamiliesSupplier->getStyleFamilies(), UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies
+ = xStyleFamiliesSupplier->getStyleFamilies();
if (!xStyleFamilies.is())
return aPageMargins;
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 8570d9921d56..316d7057a1be 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1755,7 +1755,7 @@ void SfxMedium::CloseStorage()
{
if ( pImpl->xStorage.is() )
{
- uno::Reference < lang::XComponent > xComp( pImpl->xStorage, uno::UNO_QUERY );
+ uno::Reference < lang::XComponent > xComp = pImpl->xStorage;
// in the salvage mode the medium does not own the storage
if ( pImpl->bDisposeStorage && !pImpl->m_bSalvageMode )
{
@@ -3829,8 +3829,7 @@ bool SfxMedium::SignDocumentContentUsingCertificate(bool bHasValidDocumentSignat
throw uno::RuntimeException();
uno::Reference< embed::XStorage > xMetaInf;
- uno::Reference<container::XNameAccess> xNameAccess(xWriteableZipStor, uno::UNO_QUERY);
- if (xNameAccess.is() && xNameAccess->hasByName("META-INF"))
+ if (xWriteableZipStor.is() && xWriteableZipStor->hasByName("META-INF"))
{
xMetaInf = xWriteableZipStor->openStorageElement(
"META-INF",
@@ -3956,8 +3955,7 @@ bool SfxMedium::SignContents_Impl(weld::Window* pDialogParent,
throw uno::RuntimeException();
uno::Reference< embed::XStorage > xMetaInf;
- uno::Reference<container::XNameAccess> xNameAccess(xWriteableZipStor, uno::UNO_QUERY);
- if (xNameAccess.is() && xNameAccess->hasByName("META-INF"))
+ if (xWriteableZipStor.is() && xWriteableZipStor->hasByName("META-INF"))
{
xMetaInf = xWriteableZipStor->openStorageElement(
"META-INF",
diff --git a/sfx2/source/doc/exoticfileloadexception.cxx b/sfx2/source/doc/exoticfileloadexception.cxx
index 46b3c63edd65..56a697f43bf6 100644
--- a/sfx2/source/doc/exoticfileloadexception.cxx
+++ b/sfx2/source/doc/exoticfileloadexception.cxx
@@ -23,10 +23,8 @@ ExoticFileLoadException::ExoticFileLoadException(const OUString& rURL,
m_aRequest <<= aReq;
- m_xAbort.set(uno::Reference<task::XInteractionAbort>(new comphelper::OInteractionAbort),
- uno::UNO_QUERY);
- m_xApprove.set(uno::Reference<task::XInteractionApprove>(new comphelper::OInteractionApprove),
- uno::UNO_QUERY);
+ m_xAbort = new comphelper::OInteractionAbort;
+ m_xApprove = new comphelper::OInteractionApprove;
m_lContinuations.realloc(2);
m_lContinuations[0] = m_xApprove;
m_lContinuations[1] = m_xAbort;
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index bc464e4b0694..dedb5a83d72f 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -592,8 +592,7 @@ bool ModelData_Impl::ExecuteFilterDialog_Impl( const OUString& aFilterName )
uno::Reference< document::XExporter > xExporter( xFilterDialog, uno::UNO_QUERY );
if( xExporter.is() )
- xExporter->setSourceDocument(
- uno::Reference< lang::XComponent >( GetModel(), uno::UNO_QUERY ) );
+ xExporter->setSourceDocument( GetModel() );
uno::Sequence< beans::PropertyValue > aPropsForDialog;
GetMediaDescr() >> aPropsForDialog;
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index d44b55e6b753..4462547bf349 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1029,7 +1029,7 @@ void SfxObjectShell::InitOwnModel_Impl()
}
pMedium->GetItemSet()->ClearItem( SID_REFERER );
- uno::Reference< frame::XModel > xModel ( GetModel(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xModel = GetModel();
if ( xModel.is() )
{
SfxItemSet *pSet = GetMedium()->GetItemSet();
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 74edeb4d57da..195e0d0ba534 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -592,8 +592,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
// Create an empty Draw component.
uno::Reference<frame::XDesktop2> xDesktop = css::frame::Desktop::create(comphelper::getProcessComponentContext());
- uno::Reference<frame::XComponentLoader> xComponentLoader(xDesktop, uno::UNO_QUERY);
- uno::Reference<lang::XComponent> xComponent = xComponentLoader->loadComponentFromURL("private:factory/sdraw", "_default", 0, {});
+ uno::Reference<lang::XComponent> xComponent = xDesktop->loadComponentFromURL("private:factory/sdraw", "_default", 0, {});
// Add the doc pages to the new draw document
SfxRedactionHelper::addPagesToDraw(xComponent, nPages, aMetaFiles, aPageSizes, aPageMargins, aRedactionTargets, bIsAutoRedact);
@@ -1555,23 +1554,21 @@ SignatureState SfxObjectShell::ImplCheckSignaturesInformation( const uno::Sequen
/// Does this ZIP storage have a signature stream?
static bool HasSignatureStream(const uno::Reference<embed::XStorage>& xStorage)
{
- uno::Reference<container::XNameAccess> xNameAccess(xStorage, uno::UNO_QUERY);
- if (!xNameAccess.is())
+ if (!xStorage.is())
return false;
- if (xNameAccess->hasByName("META-INF"))
+ if (xStorage->hasByName("META-INF"))
{
// ODF case.
try
{
uno::Reference<embed::XStorage> xMetaInf
= xStorage->openStorageElement("META-INF", embed::ElementModes::READ);
- uno::Reference<container::XNameAccess> xMetaInfNames(xMetaInf, uno::UNO_QUERY);
- if (xMetaInfNames.is())
+ if (xMetaInf.is())
{
- return xMetaInfNames->hasByName("documentsignatures.xml")
- || xMetaInfNames->hasByName("macrosignatures.xml")
- || xMetaInfNames->hasByName("packagesignatures.xml");
+ return xMetaInf->hasByName("documentsignatures.xml")
+ || xMetaInf->hasByName("macrosignatures.xml")
+ || xMetaInf->hasByName("packagesignatures.xml");
}
}
catch (const css::io::IOException& rException)
@@ -1581,7 +1578,7 @@ static bool HasSignatureStream(const uno::Reference<embed::XStorage>& xStorage)
}
// OOXML case.
- return xNameAccess->hasByName("_xmlsignatures");
+ return xStorage->hasByName("_xmlsignatures");
}
uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::GetDocumentSignatureInformation( bool bScriptingContent, const uno::Reference< security::XDocumentDigitalSignatures >& xSigner )
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 009f48b27ba5..86ca3b03375f 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -485,7 +485,7 @@ bool SfxObjectShell::DoInitNew( SfxMedium* pMed )
if ( SfxObjectCreateMode::EMBEDDED == eCreateMode )
SetTitle(SfxResId(STR_NONAME));
- uno::Reference< frame::XModel > xModel ( GetModel(), uno::UNO_QUERY );
+ uno::Reference< frame::XModel > xModel = GetModel();
if ( xModel.is() )
{
SfxItemSet *pSet = GetMedium()->GetItemSet();
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index f0bb29b70441..c60af88c7f75 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1042,8 +1042,8 @@ Reference<lang::XComponent> SfxObjectShell::CreateAndLoadComponent( const SfxIte
if ( pTargetItem )
aTarget = pTargetItem->GetValue();
- uno::Reference < frame::XComponentLoader > xLoader;
- xLoader.set( frame::Desktop::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY );
+ uno::Reference < frame::XComponentLoader > xLoader =
+ frame::Desktop::create(comphelper::getProcessComponentContext());
Reference <lang::XComponent> xComp;
try
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 4d1833e31d11..db831f784dbb 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -3179,8 +3179,7 @@ Reference < container::XIndexAccess > SAL_CALL SfxBaseModel::getViewData()
// currently no frame for this document at all or View is under construction
return Reference < container::XIndexAccess >();
- m_pData->m_contViewData.set( document::IndexedPropertyValues::create( ::comphelper::getProcessComponentContext() ),
- UNO_QUERY );
+ m_pData->m_contViewData = document::IndexedPropertyValues::create( ::comphelper::getProcessComponentContext() );
if ( !m_pData->m_contViewData.is() )
{
@@ -3331,10 +3330,9 @@ Sequence< OUString > SAL_CALL SfxBaseModel::getDocumentSubStoragesNames()
if ( m_pData->m_pObjectShell.is() )
{
Reference < embed::XStorage > xStorage = m_pData->m_pObjectShell->GetStorage();
- Reference < container::XNameAccess > xAccess( xStorage, UNO_QUERY );
- if ( xAccess.is() )
+ if ( xStorage.is() )
{
- Sequence< OUString > aTemp = xAccess->getElementNames();
+ Sequence< OUString > aTemp = xStorage->getElementNames();
sal_Int32 nResultSize = 0;
for ( sal_Int32 n = 0; n < aTemp.getLength(); n++ )
{
@@ -3538,8 +3536,7 @@ Reference< ui::XUIConfigurationManager2 > SfxBaseModel::getUIConfigurationManage
}
}
- Reference< container::XIndexAccess > xToolbarData( xToolbar, UNO_QUERY );
- xNewUIConfMan->insertSettings( aCustomTbxName, xToolbarData );
+ xNewUIConfMan->insertSettings( aCustomTbxName, xToolbar );
xNewUIConfMan->store();
}
}