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>
This commit is contained in:
Noel Grandin
2019-07-19 11:47:47 +02:00
parent 6dfc659c5e
commit e6d23c144c
15 changed files with 43 additions and 67 deletions
@@ -36,8 +36,7 @@ namespace cppcanvas
namespace internal
{
ImplBitmapCanvas::ImplBitmapCanvas( const uno::Reference< rendering::XBitmapCanvas >& rCanvas ) :
ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
uno::UNO_QUERY) ),
ImplCanvas( rCanvas ),
mxBitmapCanvas( rCanvas ),
mxBitmap( rCanvas,
uno::UNO_QUERY )
@@ -34,8 +34,7 @@ namespace cppcanvas
const uno::Reference< rendering::XCustomSprite >& rSprite,
const ImplSpriteCanvas::TransformationArbiterSharedPtr& rTransformArbiter ) :
ImplSprite( rParentCanvas,
uno::Reference< rendering::XSprite >(rSprite,
uno::UNO_QUERY),
rSprite,
rTransformArbiter ),
mpLastCanvas(),
mxCustomSprite( rSprite )
@@ -45,8 +45,7 @@ namespace cppcanvas
ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
uno::UNO_QUERY) ),
ImplCanvas( rCanvas ),
mxSpriteCanvas( rCanvas ),
mpTransformArbiter( new TransformationArbiter() )
{
+1 -3
View File
@@ -55,9 +55,7 @@ namespace cppcanvas
{
return SpriteCanvasSharedPtr(
new internal::ImplSpriteCanvas(
uno::Reference< rendering::XSpriteCanvas >(
rVCLWindow.GetSpriteCanvas(),
uno::UNO_QUERY) ) );
rVCLWindow.GetSpriteCanvas() ) );
}
SpriteCanvasSharedPtr VCLFactory::createSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& xCanvas )
+1 -1
View File
@@ -235,7 +235,7 @@ css::uno::Sequence< css::uno::Type > OPropertySetHelper::getTypes()
void OPropertySetHelper::disposing()
{
// Create an event with this as sender
Reference < XPropertySet > rSource( static_cast< XPropertySet * >(this), UNO_QUERY );
Reference < XPropertySet > rSource = this;
EventObject aEvt;
aEvt.Source = rSource;
@@ -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())
{
+4 -9
View File
@@ -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&)
+10 -17
View File
@@ -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;
+1 -1
View File
@@ -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 );
+5 -5
View File
@@ -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 &&
+2 -3
View File
@@ -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& )
{
+3 -3
View File
@@ -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;
+1 -1
View File
@@ -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
+7 -11
View File
@@ -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() )
+4 -6
View File
@@ -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() )