loplugin:referencecasting in editeng

Change-Id: I584266ba58e55e6435e76180227c0a5756aa0c23
Reviewed-on: https://gerrit.libreoffice.org/75950
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2019-07-19 14:04:30 +02:00
parent 9987bb6ee0
commit 0a4e138d3a
6 changed files with 16 additions and 22 deletions

View File

@@ -975,7 +975,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength()); sal_uInt16 nDicCount = static_cast<sal_uInt16>(aDics.getLength());
for (sal_uInt16 i = 0; i < nDicCount; i++) for (sal_uInt16 i = 0; i < nDicCount; i++)
{ {
uno::Reference< linguistic2::XDictionary > xDicTmp( pDic[i], uno::UNO_QUERY ); uno::Reference< linguistic2::XDictionary > xDicTmp = pDic[i];
if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp) if (!xDicTmp.is() || LinguMgr::GetIgnoreAllList() == xDicTmp)
continue; continue;

View File

@@ -1438,7 +1438,7 @@ OUString ImpEditView::SpellIgnoreWord()
if ( !aWord.isEmpty() ) if ( !aWord.isEmpty() )
{ {
Reference< XDictionary > xDic( LinguMgr::GetIgnoreAllList(), UNO_QUERY ); Reference< XDictionary > xDic = LinguMgr::GetIgnoreAllList();
if (xDic.is()) if (xDic.is())
xDic->add( aWord, false, OUString() ); xDic->add( aWord, false, OUString() );
EditDoc& rDoc = pEditEngine->GetEditDoc(); EditDoc& rDoc = pEditEngine->GetEditDoc();
@@ -2325,8 +2325,7 @@ void ImpEditView::RemoveDragAndDropListeners()
if ( mxDnDListener.is() ) if ( mxDnDListener.is() )
{ {
uno::Reference< lang::XEventListener> xEL( mxDnDListener, uno::UNO_QUERY ); mxDnDListener->disposing( lang::EventObject() ); // #95154# Empty Source means it's the Client
xEL->disposing( lang::EventObject() ); // #95154# Empty Source means it's the Client
mxDnDListener.clear(); mxDnDListener.clear();
} }

View File

@@ -749,12 +749,11 @@ namespace editeng
// exactly which characters are really changed in order to keep as much // exactly which characters are really changed in order to keep as much
// from attributation for the text as possible. // from attributation for the text as possible.
Sequence< sal_Int32 > aOffsets; Sequence< sal_Int32 > aOffsets;
Reference< XExtendedTextConversion > xExtConverter( m_xConverter, UNO_QUERY ); if (m_eConvType == HHC::eConvSimplifiedTraditional && m_xConverter.is())
if (m_eConvType == HHC::eConvSimplifiedTraditional && xExtConverter.is())
{ {
try try
{ {
xExtConverter->getConversionWithOffset( m_xConverter->getConversionWithOffset(
m_sCurrentPortion, m_sCurrentPortion,
m_nCurrentStartIndex, m_nCurrentStartIndex,
m_nCurrentEndIndex - m_nCurrentStartIndex, m_nCurrentEndIndex - m_nCurrentStartIndex,

View File

@@ -401,7 +401,7 @@ Reference< XDictionary > SvxSpellWrapper::GetAllRightDic()
sal_Int32 i = 0; sal_Int32 i = 0;
while (!xDic.is() && i < nCount) while (!xDic.is() && i < nCount)
{ {
Reference< XDictionary > xTmp( pDic[i], UNO_QUERY ); Reference< XDictionary > xTmp = pDic[i];
if (xTmp.is()) if (xTmp.is())
{ {
if ( xTmp->isActive() && if ( xTmp->isActive() &&
@@ -457,8 +457,8 @@ bool SvxSpellWrapper::FindSpellError()
else else
{ {
// look up in ChangeAllList for misspelled word // look up in ChangeAllList for misspelled word
Reference< XDictionary > xChangeAllList( Reference< XDictionary > xChangeAllList =
LinguMgr::GetChangeAllList(), UNO_QUERY ); LinguMgr::GetChangeAllList();
Reference< XDictionaryEntry > xEntry; Reference< XDictionaryEntry > xEntry;
if (xChangeAllList.is()) if (xChangeAllList.is())
xEntry = xChangeAllList->getEntry( xAlt->getWord() ); xEntry = xChangeAllList->getEntry( xAlt->getWord() );

View File

@@ -2444,8 +2444,7 @@ bool SvxAutoCorrectLanguageLists::MakeBlocklist_Imp( SotStorage& rStg )
uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *refList ); uno::Reference < io::XOutputStream> xOut = new utl::OOutputStreamWrapper( *refList );
xWriter->setOutputStream(xOut); xWriter->setOutputStream(xOut);
uno::Reference<xml::sax::XDocumentHandler> xHandler(xWriter, uno::UNO_QUERY); rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List.get(), pXMLImplAutocorr_ListStr, xWriter ) );
rtl::Reference< SvXMLAutoCorrectExport > xExp( new SvXMLAutoCorrectExport( xContext, pAutocorr_List.get(), pXMLImplAutocorr_ListStr, xHandler ) );
xExp->exportDoc( XML_BLOCK_LIST ); xExp->exportDoc( XML_BLOCK_LIST );

View File

@@ -600,9 +600,8 @@ uno::Reference< XDictionary > LinguMgr::GetIgnoreAll()
if (xTmpDicList.is()) if (xTmpDicList.is())
{ {
std::locale loc(Translate::Create("svt")); std::locale loc(Translate::Create("svt"));
xIgnoreAll.set( xTmpDicList->getDictionaryByName( xIgnoreAll = xTmpDicList->getDictionaryByName(
Translate::get(STR_DESCRIPTION_IGNOREALLLIST, loc) ), Translate::get(STR_DESCRIPTION_IGNOREALLLIST, loc) );
UNO_QUERY );
} }
return xIgnoreAll; return xIgnoreAll;
} }
@@ -615,14 +614,13 @@ uno::Reference< XDictionary > LinguMgr::GetChangeAll()
if (!pExitLstnr) if (!pExitLstnr)
pExitLstnr = new LinguMgrExitLstnr; pExitLstnr = new LinguMgrExitLstnr;
uno::Reference< XSearchableDictionaryList > _xDicList( GetDictionaryList() , UNO_QUERY ); uno::Reference< XSearchableDictionaryList > _xDicList = GetDictionaryList();
if (_xDicList.is()) if (_xDicList.is())
{ {
xChangeAll.set( _xDicList->createDictionary( xChangeAll = _xDicList->createDictionary(
"ChangeAllList", "ChangeAllList",
LanguageTag::convertToLocale( LANGUAGE_NONE ), LanguageTag::convertToLocale( LANGUAGE_NONE ),
DictionaryType_NEGATIVE, OUString() ), DictionaryType_NEGATIVE, OUString() );
UNO_QUERY );
} }
return xChangeAll; return xChangeAll;
} }
@@ -640,8 +638,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard()
return nullptr; return nullptr;
const OUString aDicName( "standard.dic" ); const OUString aDicName( "standard.dic" );
uno::Reference< XDictionary > xDic( xTmpDicList->getDictionaryByName( aDicName ), uno::Reference< XDictionary > xDic = xTmpDicList->getDictionaryByName( aDicName );
UNO_QUERY );
if (!xDic.is()) if (!xDic.is())
{ {
// try to create standard dictionary // try to create standard dictionary
@@ -663,7 +660,7 @@ uno::Reference< XDictionary > LinguMgr::GetStandard()
xTmpDicList->addDictionary( xTmp ); xTmpDicList->addDictionary( xTmp );
xTmp->setActive( true ); xTmp->setActive( true );
} }
xDic.set( xTmp, UNO_QUERY ); xDic = xTmp;
} }
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
uno::Reference< XStorable > xStor( xDic, UNO_QUERY ); uno::Reference< XStorable > xStor( xDic, UNO_QUERY );