summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 14:03:53 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 14:52:24 +0200
commit2ec1c7a69917ce39850addc49ea3eb8618869aac (patch)
treea61d4a597f6293245e4b85b22552f408c0086091 /desktop
parent0a4e138d3ac3609f2e1465c8a949d07eb89bccf0 (diff)
loplugin:referencecasting in desktop
Change-Id: I9ba4243bc3d6b14e66694728deb270ed74a70d01 Reviewed-on: https://gerrit.libreoffice.org/75949 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/qa/desktop_lib/test_desktop_lib.cxx2
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/dispatchwatcher.cxx4
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx5
-rw-r--r--desktop/source/lib/init.cxx17
-rw-r--r--desktop/source/migration/migration.cxx14
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.cxx3
7 files changed, 19 insertions, 28 deletions
diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx
index a3db0fd57b1f..e590b0a7f974 100644
--- a/desktop/qa/desktop_lib/test_desktop_lib.cxx
+++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx
@@ -878,7 +878,7 @@ void DesktopLOKTest::testWriterComments()
LibLODocument_Impl* pDocument = loadDoc("blank_text.odt");
pDocument->pClass->registerCallback(pDocument, &DesktopLOKTest::callback, this);
- uno::Reference<awt::XReschedule> xToolkit(com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext()), uno::UNO_QUERY);
+ uno::Reference<awt::XReschedule> xToolkit = com::sun::star::awt::Toolkit::create(comphelper::getProcessComponentContext());
// Insert a comment at the beginning of the document and wait till the main
// loop grabs the focus, so characters end up in the annotation window.
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index 0867f6b5e82d..4feef4a7c27b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -2291,7 +2291,7 @@ void Desktop::HandleAppEvent( const ApplicationEvent& rAppEvent )
if ( !xTask.is() )
{
// get any task if there is no active one
- Reference< css::container::XIndexAccess > xList( xDesktop->getFrames(), css::uno::UNO_QUERY );
+ Reference< css::container::XIndexAccess > xList = xDesktop->getFrames();
if ( xList->getCount() > 0 )
xList->getByIndex(0) >>= xTask;
}
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 96f0a7f69168..af0a6d9ffd93 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -771,7 +771,7 @@ bool DispatchWatcher::executeDispatchRequests( const std::vector<DispatchRequest
if ( bEmpty && !bNoTerminate /*m_aRequestContainer.empty()*/ )
{
// We have to check if we have an open task otherwise we have to shutdown the office.
- Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ Reference< XElementAccess > xList = xDesktop->getFrames();
if ( !xList->hasElements() )
{
@@ -799,7 +799,7 @@ void SAL_CALL DispatchWatcher::dispatchFinished( const DispatchResultEvent& )
{
// We have to check if we have an open task otherwise we have to shutdown the office.
Reference< XDesktop2 > xDesktop = css::frame::Desktop::create( ::comphelper::getProcessComponentContext() );
- Reference< XElementAccess > xList( xDesktop->getFrames(), UNO_QUERY );
+ Reference< XElementAccess > xList = xDesktop->getFrames();
if ( !xList->hasElements() )
{
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 3cff34b814ce..e55a7ea717eb 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -228,9 +228,8 @@ UpdateDialog::Thread::Thread(
{
if( m_context.is() )
{
- m_xInteractionHdl.set(
- task::InteractionHandler::createWithParent(m_context, dialog.getDialog()->GetXWindow()),
- uno::UNO_QUERY );
+ m_xInteractionHdl =
+ task::InteractionHandler::createWithParent(m_context, dialog.getDialog()->GetXWindow());
m_updateInformation->setInteractionHandler( m_xInteractionHdl );
}
}
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index f48f9846d063..1a18e296a092 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3484,11 +3484,9 @@ static char* getLanguages(const char* pCommand)
css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
if (xLangSrv.is())
{
- css::uno::Reference<css::linguistic2::XSpellChecker> xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY);
- css::uno::Reference<css::linguistic2::XSupportedLocales> xLocales(xSpell, css::uno::UNO_QUERY);
-
- if (xLocales.is())
- aLocales = xLocales->getLocales();
+ css::uno::Reference<css::linguistic2::XSpellChecker> xSpell = xLangSrv->getSpellChecker();
+ if (xSpell.is())
+ aLocales = xSpell->getLocales();
}
}
@@ -3615,7 +3613,7 @@ static char* getStyles(LibreOfficeKitDocument* pThis, const char* pCommand)
boost::property_tree::ptree aTree;
aTree.put("commandName", pCommand);
uno::Reference<css::style::XStyleFamiliesSupplier> xStyleFamiliesSupplier(pDocument->mxComponent, uno::UNO_QUERY);
- uno::Reference<container::XNameAccess> xStyleFamilies(xStyleFamiliesSupplier->getStyleFamilies(), uno::UNO_QUERY);
+ uno::Reference<container::XNameAccess> xStyleFamilies = xStyleFamiliesSupplier->getStyleFamilies();
uno::Sequence<OUString> aStyleFamilies = xStyleFamilies->getElementNames();
static const std::vector<OUString> aWriterStyles =
@@ -4838,10 +4836,9 @@ static void preloadData()
css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
if (xLangSrv.is())
{
- css::uno::Reference<css::linguistic2::XSpellChecker> xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY);
- css::uno::Reference<css::linguistic2::XSupportedLocales> xLocales(xSpell, css::uno::UNO_QUERY);
- if (xLocales.is())
- aLocales = xLocales->getLocales();
+ css::uno::Reference<css::linguistic2::XSpellChecker> xSpell = xLangSrv->getSpellChecker();
+ if (xSpell.is())
+ aLocales = xSpell->getLocales();
}
for (const auto& aLocale : aLocales)
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 6f481014dda9..5d9f68e8e467 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -862,8 +862,7 @@ std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules(
if (!xModules.is())
return vModulesInfo;
- uno::Reference< container::XNameAccess > xAccess(xModules, uno::UNO_QUERY);
- uno::Sequence< OUString > lNames = xAccess->getElementNames();
+ uno::Sequence< OUString > lNames = xModules->getElementNames();
sal_Int32 nLength = lNames.getLength();
for (sal_Int32 i=0; i<nLength; ++i) {
OUString sModuleShortName = lNames[i];
@@ -873,8 +872,7 @@ std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules(
uno::Reference< embed::XStorage > xMenubar = xModule->openStorageElement(MENUBAR, embed::ElementModes::READ);
if (xMenubar.is()) {
- uno::Reference< container::XNameAccess > xNameAccess(xMenubar, uno::UNO_QUERY);
- if (xNameAccess->getElementNames().hasElements()) {
+ if (xMenubar->getElementNames().hasElements()) {
aModuleInfo.sModuleShortName = sModuleShortName;
aModuleInfo.bHasMenubar = true;
}
@@ -885,8 +883,7 @@ std::vector< MigrationModuleInfo > MigrationImpl::dectectUIChangesForAllModules(
const OUString RESOURCEURL_CUSTOM_ELEMENT("custom_");
sal_Int32 nCustomLen = 7;
- uno::Reference< container::XNameAccess > xNameAccess(xToolbar, uno::UNO_QUERY);
- ::uno::Sequence< OUString > lToolbars = xNameAccess->getElementNames();
+ ::uno::Sequence< OUString > lToolbars = xToolbar->getElementNames();
for (sal_Int32 j=0; j<lToolbars.getLength(); ++j) {
OUString sToolbarName = lToolbars[j];
if (sToolbarName.getLength()>=nCustomLen &&
@@ -1060,9 +1057,8 @@ void MigrationImpl::mergeOldToNewVersion(const uno::Reference< ui::XUIConfigurat
}
}
- uno::Reference< container::XIndexAccess > xIndexAccess(xIndexContainer, uno::UNO_QUERY);
- if (xIndexAccess.is())
- xCfgManager->replaceSettings(sResourceURL, xIndexAccess);
+ if (xIndexContainer.is())
+ xCfgManager->replaceSettings(sResourceURL, xIndexContainer);
uno::Reference< ui::XUIConfigurationPersistence > xUIConfigurationPersistence(xCfgManager, uno::UNO_QUERY);
if (xUIConfigurationPersistence.is())
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index b04b7d2e108a..a001462afd62 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -195,10 +195,9 @@ bool OO3ExtensionMigration::scanDescriptionXml( const OUString& sDescriptionXmlU
try
{
- uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY );
uno::Reference< xml::dom::XNode > xNode(
xPath->selectSingleNode(
- xRootNode, "desc:identifier/@value" ));
+ xRoot, "desc:identifier/@value" ));
if ( xNode.is() )
aExtIdentifier = xNode->getNodeValue();
}