loplugin:referencecasting in linguistic

Change-Id: Iff53942bebb1481666ae4469e16089d54669954f
Reviewed-on: https://gerrit.libreoffice.org/75973
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2019-07-19 20:07:42 +02:00
parent 952b806c22
commit defdd8bebe
7 changed files with 20 additions and 41 deletions

View File

@ -257,8 +257,7 @@ void ConvDic::Save()
xSaxWriter->setOutputStream( xStream->getOutputStream() ); xSaxWriter->setOutputStream( xStream->getOutputStream() );
// prepare arguments (prepend doc handler to given arguments) // prepare arguments (prepend doc handler to given arguments)
uno::Reference< xml::sax::XDocumentHandler > xDocHandler( xSaxWriter, UNO_QUERY ); rtl::Reference<ConvDicXMLExport> pExport = new ConvDicXMLExport( *this, aMainURL, xSaxWriter );
rtl::Reference<ConvDicXMLExport> pExport = new ConvDicXMLExport( *this, aMainURL, xDocHandler );
bool bRet = pExport->Export(); // write entries to file bool bRet = pExport->Export(); // write entries to file
DBG_ASSERT( !pStream->GetError(), "I/O error while writing to stream" ); DBG_ASSERT( !pStream->GetError(), "I/O error while writing to stream" );
if (bRet) if (bRet)

View File

@ -391,10 +391,10 @@ ConvDicNameContainer & ConvDicList::GetNameContainer()
// since there is no UI to active/deactivate the dictionaries // since there is no UI to active/deactivate the dictionaries
// for chinese text conversion they should be activated by default // for chinese text conversion they should be activated by default
uno::Reference< XConversionDictionary > xS2TDic( uno::Reference< XConversionDictionary > xS2TDic =
mxNameContainer->GetByName( "ChineseS2T" ), UNO_QUERY ); mxNameContainer->GetByName( "ChineseS2T" );
uno::Reference< XConversionDictionary > xT2SDic( uno::Reference< XConversionDictionary > xT2SDic =
mxNameContainer->GetByName( "ChineseT2S" ), UNO_QUERY ); mxNameContainer->GetByName( "ChineseT2S" );
if (xS2TDic.is()) if (xS2TDic.is())
xS2TDic->setActive( true ); xS2TDic->setActive( true );
if (xT2SDic.is()) if (xT2SDic.is())

View File

@ -156,10 +156,9 @@ void SAL_CALL DicEvtListenerHelper::processDictionaryEvent(
// assert that there is a corresponding dictionary entry if one was // assert that there is a corresponding dictionary entry if one was
// added or deleted // added or deleted
uno::Reference< XDictionaryEntry > xDicEntry( rDicEvent.xDictionaryEntry, UNO_QUERY );
DBG_ASSERT( !(rDicEvent.nEvent & DBG_ASSERT( !(rDicEvent.nEvent &
(DictionaryEventFlags::ADD_ENTRY | DictionaryEventFlags::DEL_ENTRY)) (DictionaryEventFlags::ADD_ENTRY | DictionaryEventFlags::DEL_ENTRY))
|| xDicEntry.is(), || rDicEvent.xDictionaryEntry.is(),
"lng : missing dictionary entry" ); "lng : missing dictionary entry" );
// evaluate DictionaryEvents and update data for next DictionaryListEvent // evaluate DictionaryEvents and update data for next DictionaryListEvent
@ -167,11 +166,11 @@ void SAL_CALL DicEvtListenerHelper::processDictionaryEvent(
DBG_ASSERT(eDicType != DictionaryType_MIXED, DBG_ASSERT(eDicType != DictionaryType_MIXED,
"lng : unexpected dictionary type"); "lng : unexpected dictionary type");
if ((rDicEvent.nEvent & DictionaryEventFlags::ADD_ENTRY) && xDic->isActive()) if ((rDicEvent.nEvent & DictionaryEventFlags::ADD_ENTRY) && xDic->isActive())
nCondensedEvt |= xDicEntry->isNegative() ? nCondensedEvt |= rDicEvent.xDictionaryEntry->isNegative() ?
DictionaryListEventFlags::ADD_NEG_ENTRY : DictionaryListEventFlags::ADD_NEG_ENTRY :
DictionaryListEventFlags::ADD_POS_ENTRY; DictionaryListEventFlags::ADD_POS_ENTRY;
if ((rDicEvent.nEvent & DictionaryEventFlags::DEL_ENTRY) && xDic->isActive()) if ((rDicEvent.nEvent & DictionaryEventFlags::DEL_ENTRY) && xDic->isActive())
nCondensedEvt |= xDicEntry->isNegative() ? nCondensedEvt |= rDicEvent.xDictionaryEntry->isNegative() ?
DictionaryListEventFlags::DEL_NEG_ENTRY : DictionaryListEventFlags::DEL_NEG_ENTRY :
DictionaryListEventFlags::DEL_POS_ENTRY; DictionaryListEventFlags::DEL_POS_ENTRY;
if ((rDicEvent.nEvent & DictionaryEventFlags::ENTRIES_CLEARED) && xDic->isActive()) if ((rDicEvent.nEvent & DictionaryEventFlags::ENTRIES_CLEARED) && xDic->isActive())

View File

@ -624,8 +624,8 @@ void GrammarCheckingIterator::DequeueAndCheck()
|| nSuggestedEnd > nStartPos, || nSuggestedEnd > nStartPos,
"nSuggestedEndOfSentencePos calculation failed?"); "nSuggestedEndOfSentencePos calculation failed?");
uno::Reference<linguistic2::XProofreader> xGC( uno::Reference<linguistic2::XProofreader> xGC =
GetGrammarChecker(aCurLocale), uno::UNO_QUERY); GetGrammarChecker(aCurLocale);
if (xGC.is()) if (xGC.is())
{ {
aGuard.clear(); aGuard.clear();

View File

@ -1014,12 +1014,8 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
if (xInfo.is()) if (xInfo.is())
aImplName = xInfo->getImplementationName(); aImplName = xInfo->getImplementationName();
SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" ); SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY ); uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
SAL_WARN_IF( !xSuppLoc.is(), "linguistic", "interfaces not supported" );
if (xSuppLoc.is()) {
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangVec( aLocaleSequence ); aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailSpellSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) ); pAvailSpellSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
} }
@ -1076,13 +1072,8 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
if (xInfo.is()) if (xInfo.is())
aImplName = xInfo->getImplementationName(); aImplName = xInfo->getImplementationName();
SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" ); SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY ); uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
SAL_WARN_IF( !xSuppLoc.is(), "linguistic", "interfaces not supported" );
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangVec( aLocaleSequence ); aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailGrammarSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) ); pAvailGrammarSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
} }
@ -1137,13 +1128,8 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
if (xInfo.is()) if (xInfo.is())
aImplName = xInfo->getImplementationName(); aImplName = xInfo->getImplementationName();
SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" ); SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY ); uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
SAL_WARN_IF( !xSuppLoc.is(), "linguistic", "interfaces not supported" );
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangVec( aLocaleSequence ); aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailHyphSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) ); pAvailHyphSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
} }
} }
@ -1198,13 +1184,8 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
if (xInfo.is()) if (xInfo.is())
aImplName = xInfo->getImplementationName(); aImplName = xInfo->getImplementationName();
SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" ); SAL_WARN_IF( aImplName.isEmpty(), "linguistic", "empty implementation name" );
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY ); uno::Sequence<lang::Locale> aLocaleSequence(xSvc->getLocales());
SAL_WARN_IF( !xSuppLoc.is(), "linguistic", "interfaces not supported" );
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangVec( aLocaleSequence ); aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailThesSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) ); pAvailThesSvcs->push_back( std::make_unique<SvcInfo>( aImplName, aLanguages ) );
} }

View File

@ -282,7 +282,7 @@ uno::Reference< XDictionaryEntry > SearchDicList(
sal_Int32 i; sal_Int32 i;
for (i = 0; i < nDics; i++) for (i = 0; i < nDics; i++)
{ {
uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY ); uno::Reference< XDictionary > axDic = pDic[i];
DictionaryType eType = axDic->getDictionaryType(); DictionaryType eType = axDic->getDictionaryType();
LanguageType nLang = LinguLocaleToLanguage( axDic->getLocale() ); LanguageType nLang = LinguLocaleToLanguage( axDic->getLocale() );

View File

@ -74,7 +74,7 @@ void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
for (sal_Int32 i = 0; i < nDics; i++) for (sal_Int32 i = 0; i < nDics; i++)
{ {
Reference< XDictionary > xDic( pDic[i], UNO_QUERY ); Reference< XDictionary > xDic = pDic[i];
LanguageType nLang = LinguLocaleToLanguage( xDic->getLocale() ); LanguageType nLang = LinguLocaleToLanguage( xDic->getLocale() );