summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 09:52:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-07-19 11:47:47 +0200
commite6d23c144ccadbd962b5dfb953bf29e49a7f64a3 (patch)
treee0b0176fc3f4c08049cd72ef1ea4d24da02f0766 /cui
parent6dfc659c5e468ad969291ad39085b9c3ec53bcac (diff)
loplugin:referencecasting in cppcanvas..cui
Change-Id: Ib8a513d88575cef9c1479b91adff98170c9323e8 Reviewed-on: https://gerrit.libreoffice.org/75937 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'cui')
-rw-r--r--cui/source/customize/CommandCategoryListBox.cxx2
-rw-r--r--cui/source/customize/acccfg.cxx13
-rw-r--r--cui/source/customize/cfg.cxx27
-rw-r--r--cui/source/customize/cfgutil.cxx2
-rw-r--r--cui/source/dialogs/SpellDialog.cxx10
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx5
-rw-r--r--cui/source/options/optdict.cxx6
-rw-r--r--cui/source/options/optlingu.cxx2
-rw-r--r--cui/source/options/treeopt.cxx18
-rw-r--r--cui/source/options/webconninfo.cxx10
10 files changed, 38 insertions, 57 deletions
diff --git a/cui/source/customize/CommandCategoryListBox.cxx b/cui/source/customize/CommandCategoryListBox.cxx
index 382852a56b9e..937916ec3ea6 100644
--- a/cui/source/customize/CommandCategoryListBox.cxx
+++ b/cui/source/customize/CommandCategoryListBox.cxx
@@ -528,7 +528,7 @@ void CommandCategoryListBox::addChildren(
OUString uri, description;
- css::uno::Reference < css::beans::XPropertySet >xPropSet( child.get(), css::uno::UNO_QUERY );
+ css::uno::Reference < css::beans::XPropertySet >xPropSet( child, css::uno::UNO_QUERY );
if (!xPropSet.is())
{
diff --git a/cui/source/customize/acccfg.cxx b/cui/source/customize/acccfg.cxx
index d12c2a97bad5..c71d0d3911ed 100644
--- a/cui/source/customize/acccfg.cxx
+++ b/cui/source/customize/acccfg.cxx
@@ -1354,9 +1354,7 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, LoadHdl, sfx2::FileDialogHelper*, void
xComponent.set(xCfgMgr, uno::UNO_QUERY);
if (xComponent.is())
xComponent->dispose();
- xComponent.set(xRootStorage, uno::UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
+ xRootStorage->dispose();
}
}
catch(const uno::RuntimeException&)
@@ -1430,12 +1428,9 @@ IMPL_LINK_NOARG(SfxAcceleratorConfigPage, SaveHdl, sfx2::FileDialogHelper*, void
if (xRootStorage.is())
{
- uno::Reference<lang::XComponent> xComponent(xCfgMgr, uno::UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
- xComponent.set(xRootStorage, uno::UNO_QUERY);
- if (xComponent.is())
- xComponent->dispose();
+ if (xCfgMgr.is())
+ xCfgMgr->dispose();
+ xRootStorage->dispose();
}
}
catch(const uno::RuntimeException&)
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index b6d9bb2a5c61..4d3c1e28ad1d 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -568,7 +568,7 @@ bool MenuSaveInData::Apply()
if ( IsModified() )
{
// Apply new menu bar structure to our settings container
- m_xMenuSettings.set( GetConfigManager()->createSettings(), uno::UNO_QUERY );
+ m_xMenuSettings = GetConfigManager()->createSettings();
uno::Reference< container::XIndexContainer > xIndexContainer (
m_xMenuSettings, uno::UNO_QUERY );
@@ -871,7 +871,7 @@ bool ContextMenuSaveInData::Apply()
{
if ( pEntry->IsModified() || SvxConfigPageHelper::SvxConfigEntryModified( pEntry ) )
{
- css::uno::Reference< css::container::XIndexContainer > xIndexContainer( GetConfigManager()->createSettings(), css::uno::UNO_QUERY );
+ css::uno::Reference< css::container::XIndexContainer > xIndexContainer = GetConfigManager()->createSettings();
css::uno::Reference< css::lang::XSingleComponentFactory > xFactory( xIndexContainer, css::uno::UNO_QUERY );
ApplyMenu( xIndexContainer, xFactory, pEntry );
@@ -2400,8 +2400,8 @@ void ToolbarSaveInData::ApplyToolbar(
void ToolbarSaveInData::ApplyToolbar( SvxConfigEntry* pToolbar )
{
// Apply new toolbar structure to our settings container
- uno::Reference< container::XIndexAccess > xSettings(
- GetConfigManager()->createSettings(), uno::UNO_QUERY );
+ uno::Reference< container::XIndexAccess > xSettings =
+ GetConfigManager()->createSettings();
uno::Reference< container::XIndexContainer > xIndexContainer (
xSettings, uno::UNO_QUERY );
@@ -2449,7 +2449,7 @@ void ToolbarSaveInData::CreateToolbar( SvxConfigEntry* pToolbar )
{
// show the new toolbar in the UI also
uno::Reference< container::XIndexAccess >
- xSettings( GetConfigManager()->createSettings(), uno::UNO_QUERY );
+ xSettings = GetConfigManager()->createSettings();
uno::Reference< beans::XPropertySet >
xPropertySet( xSettings, uno::UNO_QUERY );
@@ -2892,11 +2892,9 @@ IMPL_LINK_NOARG(SvxIconSelectorDialog, DeleteHdl, weld::Button&, void)
uno::Sequence< OUString > URLs { aSelImageText };
m_xTbSymbol->RemoveItem(nId);
m_xImportedImageManager->removeImages( SvxConfigPageHelper::GetImageType(), URLs );
- uno::Reference< css::ui::XUIConfigurationPersistence >
- xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
- if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
+ if ( m_xImportedImageManager->isModified() )
{
- xConfigPersistence->store();
+ m_xImportedImageManager->store();
}
}
}
@@ -2906,8 +2904,6 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
{
uno::Sequence< OUString > URLs(1);
uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
- uno::Reference< css::ui::XUIConfigurationPersistence >
- xConfigPer( m_xImportedImageManager, uno::UNO_QUERY );
uno::Reference< graphic::XGraphic > xGraphic;
uno::Sequence< beans::PropertyValue > aMediaProps( 1 );
@@ -2964,7 +2960,7 @@ bool SvxIconSelectorDialog::ReplaceGraphicItem(
URLs[0] = aURL;
aImportGraph[ 0 ] = xGraphic;
m_xImportedImageManager->replaceImages( SvxConfigPageHelper::GetImageType(), URLs, aImportGraph );
- xConfigPer->store();
+ m_xImportedImageManager->store();
bResult = true;
break;
@@ -3157,12 +3153,9 @@ bool SvxIconSelectorDialog::ImportGraphic( const OUString& aURL )
uno::Sequence< uno::Reference<graphic::XGraphic > > aImportGraph( 1 );
aImportGraph[ 0 ] = xGraphic;
m_xImportedImageManager->insertImages( SvxConfigPageHelper::GetImageType(), aImportURL, aImportGraph );
- uno::Reference< css::ui::XUIConfigurationPersistence >
- xConfigPersistence( m_xImportedImageManager, uno::UNO_QUERY );
-
- if ( xConfigPersistence.is() && xConfigPersistence->isModified() )
+ if ( m_xImportedImageManager->isModified() )
{
- xConfigPersistence->store();
+ m_xImportedImageManager->store();
}
result = true;
diff --git a/cui/source/customize/cfgutil.cxx b/cui/source/customize/cfgutil.cxx
index 7a58aa96ab77..2c0c1e6ac506 100644
--- a/cui/source/customize/cfgutil.cxx
+++ b/cui/source/customize/cfgutil.cxx
@@ -376,7 +376,7 @@ namespace
{
Reference< XScriptInvocationContext > xContext( _rxComponent, UNO_QUERY );
if ( xContext.is() )
- xScripts.set( xContext->getScriptContainer(), UNO_QUERY );
+ xScripts = xContext->getScriptContainer();
}
return Reference< XModel >( xScripts, UNO_QUERY );
diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx
index 52671b110586..9c6e90b74c25 100644
--- a/cui/source/dialogs/SpellDialog.cxx
+++ b/cui/source/dialogs/SpellDialog.cxx
@@ -545,7 +545,7 @@ IMPL_LINK_NOARG(SpellDialog, ChangeAllHdl, weld::Button&, void)
// add new word to ChangeAll list
OUString aOldWord( m_xSentenceED->GetErrorText() );
SvxPrepareAutoCorrect( aOldWord, aString );
- Reference<XDictionary> aXDictionary( LinguMgr::GetChangeAllList(), UNO_QUERY );
+ Reference<XDictionary> aXDictionary = LinguMgr::GetChangeAllList();
DictionaryError nAdded = AddEntryToDic( aXDictionary,
aOldWord, true,
aString );
@@ -568,7 +568,7 @@ IMPL_LINK( SpellDialog, IgnoreAllHdl, weld::Button&, rButton, void )
{
m_xSentenceED->UndoActionStart( SPELLUNDO_CHANGE_GROUP );
// add word to IgnoreAll list
- Reference< XDictionary > aXDictionary( LinguMgr::GetIgnoreAllList(), UNO_QUERY );
+ Reference< XDictionary > aXDictionary = LinguMgr::GetIgnoreAllList();
//in case the error has been changed manually it has to be restored
m_xSentenceED->RestoreCurrentError();
if (&rButton == m_xIgnoreRulePB.get())
@@ -780,7 +780,7 @@ int SpellDialog::InitUserDicts()
sal_uInt16 nItemId = 1; // menu items should be enumerated from 1 and not 0
for (sal_Int32 i = 0; i < nSize; ++i)
{
- uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY );
+ uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i];
if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
continue;
@@ -1082,7 +1082,7 @@ bool SpellDialog::ApplyChangeAllList_Impl(SpellPortions& rSentence, bool &bHasRe
{
bHasReplaced = false;
bool bRet = true;
- Reference<XDictionary> xChangeAll( LinguMgr::GetChangeAllList(), UNO_QUERY );
+ Reference<XDictionary> xChangeAll = LinguMgr::GetChangeAllList();
if(!xChangeAll->getCount())
return bRet;
bRet = false;
@@ -1585,7 +1585,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css
nCursor = nMinPos;
// maybe the error found here is already in the ChangeAllList and has to be replaced
- Reference<XDictionary> xChangeAll( LinguMgr::GetChangeAllList(), UNO_QUERY );
+ Reference<XDictionary> xChangeAll = LinguMgr::GetChangeAllList();
Reference<XDictionaryEntry> xEntry;
if (xChangeAll->getCount() && pSpellErrorDescription &&
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index 1f097367a1d5..50df1eff94c0 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -233,15 +233,14 @@ bool SvxHlinkDlgMarkWnd::RefreshFromDoc(const OUString& aURL)
if( !aURL.isEmpty() )
{
// load from url
- uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY );
- if( xLoader.is() )
+ if( xDesktop.is() )
{
try
{
uno::Sequence< beans::PropertyValue > aArg(1);
aArg.getArray()[0].Name = "Hidden";
aArg.getArray()[0].Value <<= true;
- xComp = xLoader->loadComponentFromURL( aURL, "_blank", 0, aArg );
+ xComp = xDesktop->loadComponentFromURL( aURL, "_blank", 0, aArg );
}
catch( const io::IOException& )
{
diff --git a/cui/source/options/optdict.cxx b/cui/source/options/optdict.cxx
index ab4711eb1a2f..adbb6489f551 100644
--- a/cui/source/options/optdict.cxx
+++ b/cui/source/options/optdict.cxx
@@ -154,7 +154,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
{
lang::Locale aLocale( LanguageTag::convertToLocale(nLang) );
OUString aURL( linguistic::GetWritableDictionaryURL( sDict ) );
- m_xNewDic.set(xDicList->createDictionary(sDict, aLocale, eType, aURL) , UNO_QUERY);
+ m_xNewDic = xDicList->createDictionary(sDict, aLocale, eType, aURL);
m_xNewDic->setActive(true);
}
DBG_ASSERT(m_xNewDic.is(), "NULL pointer");
@@ -172,7 +172,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, weld::Button&, void)
if (xDicList.is() && m_xNewDic.is())
{
- xDicList->addDictionary(Reference<XDictionary>(m_xNewDic, UNO_QUERY));
+ xDicList->addDictionary(m_xNewDic);
// refresh list of dictionaries
//! dictionaries may have been added/removed elsewhere too.
@@ -253,7 +253,7 @@ SvxEditDictionaryDialog::SvxEditDictionaryDialog(weld::Window* pParent, const OU
OUString aLookUpEntry;
for ( sal_Int32 i = 0; i < nCount; ++i )
{
- Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
+ Reference< XDictionary > xDic = pDic[i];
if (xDic.is())
{
bool bNegative = xDic->getDictionaryType() == DictionaryType_NEGATIVE;
diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx
index 3280514c63d7..c915ec25ad69 100644
--- a/cui/source/options/optlingu.cxx
+++ b/cui/source/options/optlingu.cxx
@@ -1374,7 +1374,7 @@ IMPL_LINK(SvxLinguTabPage, ClickHdl_Impl, weld::Button&, rBtn, void)
ScopedVclPtr<AbstractSvxNewDictionaryDialog> aDlg(pFact->CreateSvxNewDictionaryDialog(GetDialogFrameWeld()));
uno::Reference< XDictionary > xNewDic;
if ( aDlg->Execute() == RET_OK )
- xNewDic.set( aDlg->GetNewDictionary(), UNO_QUERY );
+ xNewDic = aDlg->GetNewDictionary();
if ( xNewDic.is() )
{
// add new dics to the end
diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx
index 83f3a37855dc..701f159487c8 100644
--- a/cui/source/options/treeopt.cxx
+++ b/cui/source/options/treeopt.cxx
@@ -2069,16 +2069,12 @@ void ExtensionsTabPage::dispose()
if ( m_xPage.is() )
{
- Reference< XComponent > xComponent( m_xPage, UNO_QUERY );
- if ( xComponent.is() )
+ try
+ {
+ m_xPage->dispose();
+ }
+ catch ( const Exception & )
{
- try
- {
- xComponent->dispose();
- }
- catch ( const Exception & )
- {
- }
}
m_xPage.clear();
}
@@ -2101,9 +2097,9 @@ void ExtensionsTabPage::CreateDialogWithHandler()
{
SetStyle( GetStyle() | WB_DIALOGCONTROL | WB_CHILDDLGCTRL );
Reference< awt::XWindowPeer > xParent( VCLUnoHelper::GetInterface( this ), UNO_QUERY );
- m_xPage.set(
+ m_xPage =
m_xWinProvider->createContainerWindow(
- m_sPageURL, OUString(), xParent, m_xEventHdl ), UNO_QUERY );
+ m_sPageURL, OUString(), xParent, m_xEventHdl );
Reference< awt::XControl > xPageControl( m_xPage, UNO_QUERY );
if ( xPageControl.is() )
diff --git a/cui/source/options/webconninfo.cxx b/cui/source/options/webconninfo.cxx
index 3798fc77eb9e..641367713225 100644
--- a/cui/source/options/webconninfo.cxx
+++ b/cui/source/options/webconninfo.cxx
@@ -85,9 +85,8 @@ void WebConnectionInfoDialog::FillPasswordList()
if ( xMasterPasswd->isPersistentStoringAllowed() )
{
- uno::Reference< task::XInteractionHandler > xInteractionHandler(
- task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr),
- uno::UNO_QUERY);
+ uno::Reference< task::XInteractionHandler > xInteractionHandler =
+ task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), nullptr);
uno::Sequence< task::UrlRecord > aURLEntries = xMasterPasswd->getAllPersistent( xInteractionHandler );
sal_Int32 nCount = 0;
@@ -185,9 +184,8 @@ IMPL_LINK_NOARG(WebConnectionInfoDialog, ChangePasswordHdl, weld::Button&, void)
= new ::comphelper::SimplePasswordRequest;
uno::Reference< task::XInteractionRequest > rRequest( pPasswordRequest );
- uno::Reference< task::XInteractionHandler > xInteractionHandler(
- task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), m_xDialog->GetXWindow()),
- uno::UNO_QUERY );
+ uno::Reference< task::XInteractionHandler > xInteractionHandler =
+ task::InteractionHandler::createWithParent(comphelper::getProcessComponentContext(), m_xDialog->GetXWindow());
xInteractionHandler->handle( rRequest );
if ( pPasswordRequest->isPassword() )