summaryrefslogtreecommitdiff
path: root/sfx2/source
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
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')
-rw-r--r--sfx2/source/appl/appopen.cxx4
-rw-r--r--sfx2/source/appl/appserv.cxx4
-rw-r--r--sfx2/source/appl/newhelp.cxx4
-rw-r--r--sfx2/source/appl/shutdownicon.cxx8
-rw-r--r--sfx2/source/config/evntconf.cxx3
-rw-r--r--sfx2/source/control/dispatch.cxx13
-rw-r--r--sfx2/source/dialog/backingcomp.cxx14
-rw-r--r--sfx2/source/dialog/dockwin.cxx2
-rw-r--r--sfx2/source/dialog/filedlghelper.cxx54
-rw-r--r--sfx2/source/dialog/mailmodel.cxx3
-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
-rw-r--r--sfx2/source/inet/inettbc.cxx2
-rw-r--r--sfx2/source/notify/eventsupplier.cxx3
-rw-r--r--sfx2/source/sidebar/Panel.cxx2
-rw-r--r--sfx2/source/view/sfxbasecontroller.cxx4
-rw-r--r--sfx2/source/view/viewfrm.cxx29
-rw-r--r--sfx2/source/view/viewsh.cxx9
26 files changed, 89 insertions, 135 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 592fd4b28a16..067b009005dd 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -381,7 +381,7 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
xDoc->SetModified(false);
xDoc->ResetError();
- css::uno::Reference< css::frame::XModel > xModel ( xDoc->GetModel(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::frame::XModel > xModel = xDoc->GetModel();
if ( xModel.is() )
{
std::unique_ptr<SfxItemSet> pNew = xDoc->GetMedium()->GetItemSet()->Clone();
@@ -1010,7 +1010,7 @@ void SfxApplication::OpenDocExec_Impl( SfxRequest& rReq )
}
else
{
- xTargetFrame.set( Desktop::create(::comphelper::getProcessComponentContext()), UNO_QUERY );
+ xTargetFrame = Desktop::create(::comphelper::getProcessComponentContext());
}
}
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 90f584c3cf7e..fe24e15b8cc4 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -483,7 +483,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
{
Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
- Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
+ Reference< XIndexAccess > xTasks = xDesktop->getFrames();
if ( !xTasks.is() )
break;
@@ -1128,7 +1128,7 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
case SID_CLOSEDOCS:
{
Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() );
- Reference< XIndexAccess > xTasks( xDesktop->getFrames(), UNO_QUERY );
+ Reference< XIndexAccess > xTasks = xDesktop->getFrames();
if ( !xTasks.is() || !xTasks->getCount() )
rSet.DisableItem(nWhich);
break;
diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index fc60111090e1..6dbd7b82f6eb 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2233,7 +2233,7 @@ void SfxHelpTextWindow_Impl::FindHdl(sfx2::SearchDialog* pDlg)
else if ( pDlg->IsWrapAround() && !bWrapAround )
{
Reference < text::XTextViewCursorSupplier > xCrsrSupp( xController, uno::UNO_QUERY );
- Reference < text::XTextViewCursor > xTVCrsr( xCrsrSupp->getViewCursor(), uno::UNO_QUERY );
+ Reference < text::XTextViewCursor > xTVCrsr = xCrsrSupp->getViewCursor();
if ( xTVCrsr.is() )
{
Reference < text::XTextDocument > xDoc( xController->getModel(), uno::UNO_QUERY );
@@ -3026,7 +3026,7 @@ void SfxHelpWindow_Impl::DoAction( sal_uInt16 nActionId )
case TBI_COPY :
case TBI_SELECTIONMODE:
{
- Reference < XDispatchProvider > xProv( pTextWin->getFrame(), UNO_QUERY );
+ Reference < XDispatchProvider > xProv = pTextWin->getFrame();
if ( xProv.is() )
{
URL aURL;
diff --git a/sfx2/source/appl/shutdownicon.cxx b/sfx2/source/appl/shutdownicon.cxx
index 6693dd5235f0..6d828ed11343 100644
--- a/sfx2/source/appl/shutdownicon.cxx
+++ b/sfx2/source/appl/shutdownicon.cxx
@@ -200,7 +200,7 @@ void ShutdownIcon::OpenURL( const OUString& aURL, const OUString& rTarget, const
if ( !getInstance() || !getInstance()->m_xDesktop.is() )
return;
- css::uno::Reference < XDispatchProvider > xDispatchProvider( getInstance()->m_xDesktop, UNO_QUERY );
+ css::uno::Reference < XDispatchProvider > xDispatchProvider = getInstance()->m_xDesktop;
if ( !xDispatchProvider.is() )
return;
@@ -243,10 +243,10 @@ void ShutdownIcon::FromTemplate()
if ( !getInstance() || !getInstance()->m_xDesktop.is() )
return;
- css::uno::Reference < css::frame::XFramesSupplier > xDesktop ( getInstance()->m_xDesktop, UNO_QUERY);
+ css::uno::Reference < css::frame::XFramesSupplier > xDesktop = getInstance()->m_xDesktop;
css::uno::Reference < css::frame::XFrame > xFrame( xDesktop->getActiveFrame() );
if ( !xFrame.is() )
- xFrame.set( xDesktop, UNO_QUERY );
+ xFrame = xDesktop;
URL aTargetURL;
aTargetURL.Complete = ".uno:NewDoc";
@@ -474,7 +474,7 @@ void ShutdownIcon::terminateDesktop()
xDesktop->removeTerminateListener( pInst );
// terminate desktop only if no tasks exist
- css::uno::Reference< XIndexAccess > xTasks ( xDesktop->getFrames(), UNO_QUERY );
+ css::uno::Reference< XIndexAccess > xTasks = xDesktop->getFrames();
if( xTasks.is() && xTasks->getCount() < 1 )
Application::Quit();
diff --git a/sfx2/source/config/evntconf.cxx b/sfx2/source/config/evntconf.cxx
index 1365ead79d69..c21ba4dbbf7d 100644
--- a/sfx2/source/config/evntconf.cxx
+++ b/sfx2/source/config/evntconf.cxx
@@ -183,8 +183,7 @@ static void PropagateEvent_Impl( SfxObjectShell const *pDoc, const OUString& aEv
}
else
{
- xSupplier.set( frame::theGlobalEventBroadcaster::get(::comphelper::getProcessComponentContext()),
- uno::UNO_QUERY );
+ xSupplier = frame::theGlobalEventBroadcaster::get(::comphelper::getProcessComponentContext());
}
if ( !xSupplier.is() )
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index 319570787639..26c9b741ee19 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -321,9 +321,8 @@ void SfxDispatcher::Call_Impl(SfxShell& rShell, const SfxSlot &rSlot, SfxRequest
if ( GetFrame() )
{
// Recording may start
- css::uno::Reference< css::frame::XFrame > xFrame(
- GetFrame()->GetFrame().GetFrameInterface(),
- css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame =
+ GetFrame()->GetFrame().GetFrameInterface();
css::uno::Reference< css::beans::XPropertySet > xSet(
xFrame,
@@ -766,11 +765,11 @@ void SfxDispatcher::DoDeactivate_Impl(bool bMDI, SfxViewFrame const * pNew)
bool bHidePopups = bMDI && xImp->pFrame;
if ( pNew && xImp->pFrame )
{
- css::uno::Reference< css::frame::XFrame > xOldFrame(
- pNew->GetFrame().GetFrameInterface()->getCreator(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::frame::XFrame > xOldFrame =
+ pNew->GetFrame().GetFrameInterface()->getCreator();
- css::uno::Reference< css::frame::XFrame > xMyFrame(
- GetFrame()->GetFrame().GetFrameInterface(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::frame::XFrame > xMyFrame =
+ GetFrame()->GetFrame().GetFrameInterface();
if ( xOldFrame == xMyFrame )
bHidePopups = false;
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index ee47f60dcb1b..ccb5f05962f1 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -577,14 +577,8 @@ void SAL_CALL BackingComp::dispose()
// stop listening at the window
if (m_xWindow.is())
{
- css::uno::Reference< css::lang::XComponent > xBroadcaster(m_xWindow, css::uno::UNO_QUERY);
- if (xBroadcaster.is())
- {
- css::uno::Reference< css::lang::XEventListener > xEventThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- xBroadcaster->removeEventListener(xEventThis);
- }
- css::uno::Reference< css::awt::XKeyListener > xKeyThis(static_cast< ::cppu::OWeakObject* >(this), css::uno::UNO_QUERY);
- m_xWindow->removeKeyListener(xKeyThis);
+ m_xWindow->removeEventListener(this);
+ m_xWindow->removeKeyListener(this);
m_xWindow.clear();
}
@@ -678,9 +672,7 @@ void SAL_CALL BackingComp::initialize( /*IN*/ const css::uno::Sequence< css::uno
// start listening for window disposing
// It's set at our owner frame as component window later too. So it will may be disposed there ...
- css::uno::Reference< css::lang::XComponent > xBroadcaster(m_xWindow, css::uno::UNO_QUERY);
- if (xBroadcaster.is())
- xBroadcaster->addEventListener(static_cast< css::lang::XEventListener* >(this));
+ m_xWindow->addEventListener(static_cast< css::lang::XEventListener* >(this));
m_xWindow->setVisible(true);
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 4dc669dd6cf2..4dbce1831f91 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -139,7 +139,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
uno::Reference< lang::XSingleComponentFactory > xFactoryMgr = ui::theWindowContentFactoryManager::get(xContext);
SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
- uno::Reference< frame::XFrame > xFrame( pDispatcher->GetFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
+ uno::Reference< frame::XFrame > xFrame = pDispatcher->GetFrame()->GetFrame().GetFrameInterface();
// create a resource URL from the nId provided by the sfx2
OUString aResourceURL = aDockWindowResourceURL + OUString::number(nId);
uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 617ad549254d..73e0ae0cf821 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -325,9 +325,7 @@ void FileDialogHelper_Impl::dispose()
if ( mxFileDlg.is() )
{
// remove the event listener
- uno::Reference< XFilePickerNotifier > xNotifier( mxFileDlg, UNO_QUERY );
- if ( xNotifier.is() )
- xNotifier->removeFilePickerListener( this );
+ mxFileDlg->removeFilePickerListener( this );
::comphelper::disposeComponent( mxFileDlg );
mxFileDlg.clear();
@@ -337,11 +335,10 @@ void FileDialogHelper_Impl::dispose()
OUString FileDialogHelper_Impl::getCurrentFilterUIName() const
{
OUString aFilterName;
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
- if( xFltMgr.is() )
+ if( mxFileDlg.is() )
{
- aFilterName = xFltMgr->getCurrentFilter();
+ aFilterName = mxFileDlg->getCurrentFilter();
if ( !aFilterName.isEmpty() && isShowFilterExtensionEnabled() )
aFilterName = getFilterName( aFilterName );
@@ -936,10 +933,9 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
mxFileDlg.set(xFactory->createInstance( aService ), css::uno::UNO_QUERY);
mbSystemPicker = lcl_isSystemFilePicker( mxFileDlg );
- uno::Reference< XFilePickerNotifier > xNotifier( mxFileDlg, UNO_QUERY );
uno::Reference< XInitialization > xInit( mxFileDlg, UNO_QUERY );
- if ( ! mxFileDlg.is() || ! xNotifier.is() )
+ if ( ! mxFileDlg.is() )
{
return;
}
@@ -1154,7 +1150,7 @@ FileDialogHelper_Impl::FileDialogHelper_Impl(
}
// add the event listener
- xNotifier->addFilePickerListener( this );
+ mxFileDlg->addFilePickerListener( this );
}
FileDialogHelper_Impl::~FileDialogHelper_Impl()
@@ -1746,13 +1742,11 @@ void FileDialogHelper_Impl::setFilter( const OUString& rFilter )
maCurFilter = pFilter->GetUIName();
}
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
-
- if ( !maCurFilter.isEmpty() && xFltMgr.is() )
+ if ( !maCurFilter.isEmpty() && mxFileDlg.is() )
{
try
{
- xFltMgr->setCurrentFilter( maCurFilter );
+ mxFileDlg->setCurrentFilter( maCurFilter );
}
catch( const IllegalArgumentException& ){}
}
@@ -1771,9 +1765,7 @@ void FileDialogHelper_Impl::addFilters( const OUString& rFactory,
SfxFilterFlags nMust,
SfxFilterFlags nDont )
{
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
-
- if ( ! xFltMgr.is() )
+ if ( ! mxFileDlg.is() )
return;
if (mbDeleteMatcher)
@@ -1827,11 +1819,11 @@ void FileDialogHelper_Impl::addFilters( const OUString& rFactory,
// append the filters
OUString sFirstFilter;
if (OPEN == lcl_OpenOrSave(m_nDialogType))
- ::sfx2::appendFiltersForOpen( aIter, xFltMgr, sFirstFilter, *this );
+ ::sfx2::appendFiltersForOpen( aIter, mxFileDlg, sFirstFilter, *this );
else if ( mbExport )
- ::sfx2::appendExportFilters( aIter, xFltMgr, sFirstFilter, *this );
+ ::sfx2::appendExportFilters( aIter, mxFileDlg, sFirstFilter, *this );
else
- ::sfx2::appendFiltersForSave( aIter, xFltMgr, sFirstFilter, *this, rFactory );
+ ::sfx2::appendFiltersForSave( aIter, mxFileDlg, sFirstFilter, *this, rFactory );
// set our initial selected filter (if we do not already have one)
if ( maSelectFilter.isEmpty() )
@@ -1841,14 +1833,12 @@ void FileDialogHelper_Impl::addFilters( const OUString& rFactory,
void FileDialogHelper_Impl::addFilter( const OUString& rFilterName,
const OUString& rExtension )
{
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
-
- if ( ! xFltMgr.is() )
+ if ( ! mxFileDlg.is() )
return;
try
{
- xFltMgr->appendFilter( rFilterName, rExtension );
+ mxFileDlg->appendFilter( rFilterName, rExtension );
if ( maSelectFilter.isEmpty() )
maSelectFilter = rFilterName;
@@ -1861,9 +1851,7 @@ void FileDialogHelper_Impl::addFilter( const OUString& rFilterName,
void FileDialogHelper_Impl::addGraphicFilter()
{
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
-
- if ( ! xFltMgr.is() )
+ if ( ! mxFileDlg.is() )
return;
// create the list of filters
@@ -1903,14 +1891,14 @@ void FileDialogHelper_Impl::addGraphicFilter()
{
OUString aAllFilterName = SfxResId(STR_SFX_IMPORT_ALL_IMAGES);
aAllFilterName = ::sfx2::addExtension( aAllFilterName, aExtensions, bIsInOpenMode, *this );
- xFltMgr->appendFilter( aAllFilterName, aExtensions );
+ mxFileDlg->appendFilter( aAllFilterName, aExtensions );
maSelectFilter = aAllFilterName; // and make it the default
}
// rhbz#1715109 always include All files *.* or *
OUString aAllFilesName = SfxResId( STR_SFX_FILTERNAME_ALL );
aAllFilesName = ::sfx2::addExtension( aAllFilesName, FILEDIALOG_FILTER_ALL, bIsInOpenMode, *this );
- xFltMgr->appendFilter( aAllFilesName, FILEDIALOG_FILTER_ALL );
+ mxFileDlg->appendFilter( aAllFilesName, FILEDIALOG_FILTER_ALL );
// if the extension is "All files", make that the default
if (aExtensions == FILEDIALOG_FILTER_ALL)
@@ -1942,7 +1930,7 @@ void FileDialogHelper_Impl::addGraphicFilter()
aName = ::sfx2::addExtension( aName, aExt, bIsInOpenMode, *this );
try
{
- xFltMgr->appendFilter( aName, aExt );
+ mxFileDlg->appendFilter( aName, aExt );
}
catch( const IllegalArgumentException& )
{
@@ -2222,10 +2210,9 @@ void FileDialogHelper_Impl::setDefaultValues()
// when no filter is set, we set the currentFilter to <all>
if ( maCurFilter.isEmpty() && !maSelectFilter.isEmpty() )
{
- uno::Reference< XFilterManager > xFltMgr( mxFileDlg, UNO_QUERY );
try
{
- xFltMgr->setCurrentFilter( maSelectFilter );
+ mxFileDlg->setCurrentFilter( maSelectFilter );
}
catch( const IllegalArgumentException& )
{}
@@ -2485,10 +2472,9 @@ Sequence< OUString > FileDialogHelper::GetSelectedFiles() const
{
// a) the new way (optional!)
uno::Sequence< OUString > aResultSeq;
- uno::Reference< XFilePicker3 > xPickNew(mpImpl->mxFileDlg, UNO_QUERY);
- if (xPickNew.is())
+ if (mpImpl->mxFileDlg.is())
{
- aResultSeq = xPickNew->getSelectedFiles();
+ aResultSeq = mpImpl->mxFileDlg->getSelectedFiles();
}
// b) the olde way ... non optional.
else
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 85f08134fd5f..e7d6bc0299bd 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -183,8 +183,7 @@ SfxMailModel::SaveResult SfxMailModel::ShowFilterOptionsDialog(
}
if( xExporter.is() )
- xExporter->setSourceDocument(
- uno::Reference< lang::XComponent >( xModel, uno::UNO_QUERY ) );
+ xExporter->setSourceDocument( xModel );
if( xFilterDialog->execute() )
{
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();
}
}
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index a0eb228f5dfb..1afd5df14b5c 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -166,7 +166,7 @@ IMPL_LINK_NOARG(SfxURLToolBoxControl_Impl, OpenHdl, SvtURLBox*, void)
OpenURL( pURLBox->GetURL() );
Reference< XDesktop2 > xDesktop = Desktop::create( m_xContext );
- Reference< XFrame > xFrame( xDesktop->getActiveFrame(), UNO_QUERY );
+ Reference< XFrame > xFrame = xDesktop->getActiveFrame();
if ( xFrame.is() )
{
VclPtr<vcl::Window> pWin = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
diff --git a/sfx2/source/notify/eventsupplier.cxx b/sfx2/source/notify/eventsupplier.cxx
index 0be25c894451..2ea3e86fd89d 100644
--- a/sfx2/source/notify/eventsupplier.cxx
+++ b/sfx2/source/notify/eventsupplier.cxx
@@ -229,8 +229,7 @@ void SfxEvents_Impl::Execute( uno::Any const & aEventData, const document::Docum
}
else
{
- xProv.set( frame::Desktop::create( ::comphelper::getProcessComponentContext() ),
- uno::UNO_QUERY );
+ xProv = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
}
uno::Reference < frame::XDispatch > xDisp;
diff --git a/sfx2/source/sidebar/Panel.cxx b/sfx2/source/sidebar/Panel.cxx
index 9c7c3f3a2b79..6570c0615188 100644
--- a/sfx2/source/sidebar/Panel.cxx
+++ b/sfx2/source/sidebar/Panel.cxx
@@ -91,7 +91,7 @@ void Panel::dispose()
}
{
- Reference<lang::XComponent> xComponent (GetElementWindow(), UNO_QUERY);
+ Reference<lang::XComponent> xComponent = GetElementWindow();
if (xComponent.is())
xComponent->dispose();
}
diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx
index d143685d7c4b..7819b96488c1 100644
--- a/sfx2/source/view/sfxbasecontroller.cxx
+++ b/sfx2/source/view/sfxbasecontroller.cxx
@@ -721,7 +721,7 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
Reference< frame::XFrame > xParentFrame;
Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface();
if ( xOwnFrame.is() )
- xParentFrame.set( xOwnFrame->getCreator(), uno::UNO_QUERY );
+ xParentFrame = xOwnFrame->getCreator();
if ( xParentFrame.is() )
{
@@ -778,7 +778,7 @@ Reference< frame::XDispatch > SAL_CALL SfxBaseController::queryDispatch( const
Reference< frame::XFrame > xParentFrame;
Reference< frame::XFrame > xOwnFrame = pAct->GetFrame().GetFrameInterface();
if ( xOwnFrame.is() )
- xParentFrame.set( xOwnFrame->getCreator(), uno::UNO_QUERY );
+ xParentFrame = xOwnFrame->getCreator();
if ( xParentFrame.is() )
{
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 406e4ce22fff..7e70cb249c64 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -2597,9 +2597,8 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro )
//seen in tdf#122598, no parent for subsequent dialog
SfxAllItemSet aSet(rPool);
- css::uno::Reference< css::frame::XFrame > xFrame(
- GetFrame().GetFrameInterface(),
- css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame =
+ GetFrame().GetFrameInterface();
aSet.Put(SfxUnoFrameItem(SID_FILLFRAME, xFrame));
aReq.SetInternalArgs_Impl(aSet);
@@ -2685,21 +2684,18 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro )
// get LibraryContainer
css::uno::Any aTemp;
- css::uno::Reference< css::container::XNameAccess > xRoot(
- xLibCont,
- css::uno::UNO_QUERY);
css::uno::Reference< css::container::XNameAccess > xLib;
- if(xRoot->hasByName(aLibName))
+ if(xLibCont->hasByName(aLibName))
{
// library must be loaded
- aTemp = xRoot->getByName(aLibName);
+ aTemp = xLibCont->getByName(aLibName);
xLibCont->loadLibrary(aLibName);
aTemp >>= xLib;
}
else
{
- xLib.set( xLibCont->createLibrary(aLibName), css::uno::UNO_QUERY);
+ xLib = xLibCont->createLibrary(aLibName);
}
// pack the macro as direct usable "sub" routine
@@ -2780,9 +2776,8 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )
{
// try to find any active recorder on this frame
const OUString sProperty("DispatchRecorderSupplier");
- css::uno::Reference< css::frame::XFrame > xFrame(
- GetFrame().GetFrameInterface(),
- css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame =
+ GetFrame().GetFrameInterface();
css::uno::Reference< css::beans::XPropertySet > xSet(xFrame,css::uno::UNO_QUERY);
css::uno::Any aProp = xSet->getPropertyValue(sProperty);
@@ -2840,9 +2835,8 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )
case SID_TOGGLESTATUSBAR:
{
- css::uno::Reference< css::frame::XFrame > xFrame(
- GetFrame().GetFrameInterface(),
- css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame =
+ GetFrame().GetFrameInterface();
Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
Reference< css::frame::XLayoutManager > xLayoutManager;
@@ -2894,9 +2888,8 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq )
WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() );
if ( pWork )
{
- css::uno::Reference< css::frame::XFrame > xFrame(
- GetFrame().GetFrameInterface(),
- css::uno::UNO_QUERY);
+ css::uno::Reference< css::frame::XFrame > xFrame =
+ GetFrame().GetFrameInterface();
Reference< css::beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
Reference< css::frame::XLayoutManager > xLayoutManager;
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 986e16289ab8..abbb7b7b0ac5 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -151,7 +151,7 @@ private:
SfxClipboardChangeListener::SfxClipboardChangeListener( SfxViewShell* pView, const uno::Reference< datatransfer::clipboard::XClipboardNotifier >& xClpbrdNtfr )
: m_pViewShell( nullptr ), m_xClpbrdNtfr( xClpbrdNtfr )
{
- m_xCtrl.set( pView->GetController(), uno::UNO_QUERY );
+ m_xCtrl = pView->GetController();
if ( m_xCtrl.is() )
{
m_xCtrl->addEventListener( uno::Reference < lang::XEventListener > ( static_cast < lang::XEventListener* >( this ) ) );
@@ -392,9 +392,8 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
}
case SID_ACTIVATE_STYLE_APPLY:
{
- uno::Reference< frame::XFrame > xFrame(
- GetViewFrame()->GetFrame().GetFrameInterface(),
- uno::UNO_QUERY);
+ uno::Reference< frame::XFrame > xFrame =
+ GetViewFrame()->GetFrame().GetFrameInterface();
Reference< beans::XPropertySet > xPropSet( xFrame, UNO_QUERY );
Reference< frame::XLayoutManager > xLayoutManager;
@@ -762,7 +761,7 @@ void SfxViewShell::OutplaceActivated( bool bActive )
void SfxViewShell::UIActivating( SfxInPlaceClient* /*pClient*/ )
{
uno::Reference < frame::XFrame > xOwnFrame( pFrame->GetFrame().GetFrameInterface() );
- uno::Reference < frame::XFramesSupplier > xParentFrame( xOwnFrame->getCreator(), uno::UNO_QUERY );
+ uno::Reference < frame::XFramesSupplier > xParentFrame = xOwnFrame->getCreator();
if ( xParentFrame.is() )
xParentFrame->setActiveFrame( xOwnFrame );