Fix for fdo43460 Part XXIII getLength() to isEmpty()
Part XXIII Modules linguistic
This commit is contained in:
committed by
Jan Holesovsky
parent
a17fb88256
commit
c3fc5c9c9b
@@ -230,7 +230,7 @@ DictionaryNeo::DictionaryNeo(const OUString &rName,
|
||||
bIsModified = bIsActive = sal_False;
|
||||
bIsReadonly = !bWriteable;
|
||||
|
||||
if( rMainURL.getLength() > 0 )
|
||||
if( !rMainURL.isEmpty())
|
||||
{
|
||||
sal_Bool bExists = FileExists( rMainURL );
|
||||
if( !bExists )
|
||||
@@ -271,7 +271,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
|
||||
// function should only be called once in order to load entries from file
|
||||
bNeedEntries = sal_False;
|
||||
|
||||
if (rMainURL.getLength() == 0)
|
||||
if (rMainURL.isEmpty())
|
||||
return 0;
|
||||
|
||||
uno::Reference< lang::XMultiServiceFactory > xServiceFactory( comphelper::getProcessServiceFactory() );
|
||||
@@ -411,7 +411,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
|
||||
if (rURL.getLength() == 0)
|
||||
if (rURL.isEmpty())
|
||||
return 0;
|
||||
DBG_ASSERT(!INetURLObject( rURL ).HasError(), "lng : invalid URL");
|
||||
|
||||
@@ -999,7 +999,7 @@ sal_Bool SAL_CALL DictionaryNeo::hasLocation()
|
||||
throw(RuntimeException)
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
return aMainURL.getLength() > 0;
|
||||
return !aMainURL.isEmpty();
|
||||
}
|
||||
|
||||
OUString SAL_CALL DictionaryNeo::getLocation()
|
||||
@@ -1075,7 +1075,7 @@ void SAL_CALL DictionaryNeo::storeToURL(
|
||||
DicEntry::DicEntry(const OUString &rDicFileWord,
|
||||
sal_Bool bIsNegativWord)
|
||||
{
|
||||
if (rDicFileWord.getLength())
|
||||
if (!rDicFileWord.isEmpty())
|
||||
splitDicFileWord( rDicFileWord, aDicWord, aReplacement );
|
||||
bIsNegativ = bIsNegativWord;
|
||||
}
|
||||
|
@@ -698,7 +698,7 @@ void DicList::_CreateDicList()
|
||||
sal_Int32 nLen = aActiveDics.getLength();
|
||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
||||
{
|
||||
if (pActiveDic[i].getLength())
|
||||
if (!pActiveDic[i].isEmpty())
|
||||
{
|
||||
uno::Reference< XDictionary > xDic( getDictionaryByName( pActiveDic[i] ) );
|
||||
if (xDic.is())
|
||||
|
@@ -552,7 +552,7 @@ void GrammarCheckingIterator::DequeueAndCheck()
|
||||
|
||||
sal_Int32 nStartPos = aFPEntryItem.m_nStartIndex;
|
||||
sal_Int32 nSuggestedEnd = GetSuggestedEndOfSentence( aCurTxt, nStartPos, aCurLocale );
|
||||
DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.getLength() == 0) || nSuggestedEnd > nStartPos,
|
||||
DBG_ASSERT( (nSuggestedEnd == 0 && aCurTxt.isEmpty()) || nSuggestedEnd > nStartPos,
|
||||
"nSuggestedEndOfSentencePos calculation failed?" );
|
||||
|
||||
linguistic2::ProofreadingResult aRes;
|
||||
@@ -824,7 +824,7 @@ throw (uno::RuntimeException)
|
||||
{
|
||||
// check in document is checked automatically in the background...
|
||||
OUString aDocId = aIt->second;
|
||||
if (m_aCurCheckedDocId.getLength() > 0 && m_aCurCheckedDocId == aDocId)
|
||||
if (!m_aCurCheckedDocId.isEmpty() && m_aCurCheckedDocId == aDocId)
|
||||
{
|
||||
// an entry for that document was dequed and is currently being checked.
|
||||
bRes = sal_True;
|
||||
@@ -1099,7 +1099,7 @@ void GrammarCheckingIterator::SetServiceList(
|
||||
|
||||
if (nLanguage != LANGUAGE_NONE && nLanguage != LANGUAGE_DONTKNOW)
|
||||
{
|
||||
if (aImplName.getLength() > 0)
|
||||
if (!aImplName.isEmpty())
|
||||
m_aGCImplNamesByLang[ nLanguage ] = aImplName;
|
||||
else
|
||||
m_aGCImplNamesByLang.erase( nLanguage );
|
||||
@@ -1120,7 +1120,7 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
|
||||
if (aIt != m_aGCImplNamesByLang.end())
|
||||
aImplName = aIt->second;
|
||||
|
||||
if (aImplName.getLength() > 0)
|
||||
if (!aImplName.isEmpty())
|
||||
aRes[0] = aImplName;
|
||||
else
|
||||
aRes.realloc(0);
|
||||
|
@@ -541,7 +541,7 @@ Reference< XPossibleHyphens > SAL_CALL
|
||||
Reference< XPossibleHyphens > xRes;
|
||||
|
||||
sal_Int16 nLanguage = LocaleToLanguage( rLocale );
|
||||
if (nLanguage == LANGUAGE_NONE || !rWord.getLength())
|
||||
if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
|
||||
return xRes;
|
||||
|
||||
// search for entry with that language
|
||||
|
@@ -262,7 +262,7 @@ void PropertyChgHelper::AddAsPropListener()
|
||||
const OUString *pPropName = aPropNames.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
||||
{
|
||||
if (pPropName[i].getLength())
|
||||
if (!pPropName[i].isEmpty())
|
||||
xPropSet->addPropertyChangeListener( pPropName[i], this );
|
||||
}
|
||||
}
|
||||
@@ -276,7 +276,7 @@ void PropertyChgHelper::RemoveAsPropListener()
|
||||
const OUString *pPropName = aPropNames.getConstArray();
|
||||
for (sal_Int32 i = 0; i < nLen; ++i)
|
||||
{
|
||||
if (pPropName[i].getLength())
|
||||
if (!pPropName[i].isEmpty())
|
||||
xPropSet->removePropertyChangeListener( pPropName[i], this );
|
||||
}
|
||||
}
|
||||
|
@@ -67,7 +67,7 @@ static sal_Bool lcl_SeqHasString( const uno::Sequence< OUString > &rSeq, const O
|
||||
sal_Bool bRes = sal_False;
|
||||
|
||||
sal_Int32 nLen = rSeq.getLength();
|
||||
if (nLen == 0 || rText.getLength() == 0)
|
||||
if (nLen == 0 || rText.isEmpty())
|
||||
return bRes;
|
||||
|
||||
const OUString *pSeq = rSeq.getConstArray();
|
||||
@@ -528,7 +528,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
||||
OUString aKeyText;
|
||||
if (nKeyStart != -1)
|
||||
aKeyText = rName.copy( nKeyStart + 1 );
|
||||
DBG_ASSERT( aKeyText.getLength() != 0, "unexpected key (lang::Locale) string" );
|
||||
DBG_ASSERT( !aKeyText.isEmpty(), "unexpected key (lang::Locale) string" );
|
||||
if (0 == rName.compareTo( aSpellCheckerList, aSpellCheckerList.getLength() ))
|
||||
{
|
||||
// delete old cached data, needs to be acquired new on demand
|
||||
@@ -547,7 +547,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
||||
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
|
||||
|
||||
LanguageType nLang = LANGUAGE_NONE;
|
||||
if (0 != aKeyText.getLength())
|
||||
if (!aKeyText.isEmpty())
|
||||
nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
|
||||
|
||||
GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
|
||||
@@ -572,7 +572,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
||||
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
|
||||
|
||||
LanguageType nLang = LANGUAGE_NONE;
|
||||
if (0 != aKeyText.getLength())
|
||||
if (!aKeyText.isEmpty())
|
||||
nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
|
||||
|
||||
if (SvtLinguConfig().HasGrammarChecker())
|
||||
@@ -600,7 +600,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
||||
aSvcImplNames = GetLangSvc( aValues.getConstArray()[0] );
|
||||
|
||||
LanguageType nLang = LANGUAGE_NONE;
|
||||
if (0 != aKeyText.getLength())
|
||||
if (!aKeyText.isEmpty())
|
||||
nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
|
||||
|
||||
GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below
|
||||
@@ -625,7 +625,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
|
||||
aSvcImplNames = GetLangSvcList( aValues.getConstArray()[0] );
|
||||
|
||||
LanguageType nLang = LANGUAGE_NONE;
|
||||
if (0 != aKeyText.getLength())
|
||||
if (!aKeyText.isEmpty())
|
||||
nLang = MsLangId::convertIsoStringToLanguage( aKeyText );
|
||||
|
||||
GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below
|
||||
@@ -772,7 +772,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
|
||||
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
|
||||
if (xInfo.is())
|
||||
aImplName = xInfo->getImplementationName();
|
||||
DBG_ASSERT( aImplName.getLength(),
|
||||
DBG_ASSERT( !aImplName.isEmpty(),
|
||||
"empty implementation name" );
|
||||
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
|
||||
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
|
||||
@@ -837,7 +837,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
|
||||
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
|
||||
if (xInfo.is())
|
||||
aImplName = xInfo->getImplementationName();
|
||||
DBG_ASSERT( aImplName.getLength(),
|
||||
DBG_ASSERT( !aImplName.isEmpty(),
|
||||
"empty implementation name" );
|
||||
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
|
||||
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
|
||||
@@ -901,7 +901,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
|
||||
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
|
||||
if (xInfo.is())
|
||||
aImplName = xInfo->getImplementationName();
|
||||
DBG_ASSERT( aImplName.getLength(),
|
||||
DBG_ASSERT( !aImplName.isEmpty(),
|
||||
"empty implementation name" );
|
||||
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
|
||||
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
|
||||
@@ -967,7 +967,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
|
||||
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
|
||||
if (xInfo.is())
|
||||
aImplName = xInfo->getImplementationName();
|
||||
DBG_ASSERT( aImplName.getLength(),
|
||||
DBG_ASSERT( !aImplName.isEmpty(),
|
||||
"empty implementation name" );
|
||||
uno::Reference< linguistic2::XSupportedLocales > xSuppLoc( xSvc, uno::UNO_QUERY );
|
||||
DBG_ASSERT( xSuppLoc.is(), "interfaces not supported" );
|
||||
@@ -1570,7 +1570,7 @@ static uno::Sequence< OUString > GetLangSvcList( const uno::Any &rVal )
|
||||
for (sal_Int32 j = 0; j < nSvcs; ++j)
|
||||
{
|
||||
OUString aImplName( pSvcName[j] );
|
||||
DBG_ASSERT( aImplName.getLength(), "service impl-name missing" );
|
||||
DBG_ASSERT( !aImplName.isEmpty(), "service impl-name missing" );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -1599,7 +1599,7 @@ static uno::Sequence< OUString > GetLangSvc( const uno::Any &rVal )
|
||||
else
|
||||
{
|
||||
OUString aImplName;
|
||||
if ((rVal >>= aImplName) && aImplName.getLength() != 0)
|
||||
if ((rVal >>= aImplName) && !aImplName.isEmpty())
|
||||
{
|
||||
aRes.realloc(1);
|
||||
aRes.getArray()[0] = aImplName;
|
||||
|
@@ -381,7 +381,7 @@ sal_uInt8 AddEntryToDic(
|
||||
LanguageType LocaleToLanguage( const Locale& rLocale )
|
||||
{
|
||||
// empty Locale -> LANGUAGE_NONE
|
||||
if ( rLocale.Language.getLength() == 0 )
|
||||
if ( rLocale.Language.isEmpty() )
|
||||
return LANGUAGE_NONE;
|
||||
|
||||
return MsLangId::convertLocaleToLanguage( rLocale );
|
||||
@@ -546,7 +546,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
|
||||
uno::Reference< XHyphenatedWord > &rxHyphWord )
|
||||
{
|
||||
uno::Reference< XHyphenatedWord > xRes;
|
||||
if (rOrigWord.getLength() && rxHyphWord.is())
|
||||
if (!rOrigWord.isEmpty() && rxHyphWord.is())
|
||||
{
|
||||
sal_Int16 nChgPos = 0,
|
||||
nChgLen = 0;
|
||||
|
@@ -109,12 +109,12 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
|
||||
// 2. all user pathes
|
||||
// 3. all internal pathes
|
||||
sal_Int32 nMaxEntries = aInternalPaths.getLength() + aUserPaths.getLength();
|
||||
if (aWritablePath.getLength() > 0)
|
||||
if (!aWritablePath.isEmpty())
|
||||
++nMaxEntries;
|
||||
aRes.realloc( nMaxEntries );
|
||||
rtl::OUString *pRes = aRes.getArray();
|
||||
sal_Int32 nCount = 0; // number of actually added entries
|
||||
if ((nPathFlags & PATH_FLAG_WRITABLE) && aWritablePath.getLength() != 0)
|
||||
if ((nPathFlags & PATH_FLAG_WRITABLE) && !aWritablePath.isEmpty())
|
||||
pRes[ nCount++ ] = aWritablePath;
|
||||
for (int i = 0; i < 2; ++i)
|
||||
{
|
||||
@@ -124,7 +124,7 @@ static uno::Sequence< rtl::OUString > GetMultiPaths_Impl(
|
||||
{
|
||||
const bool bAddUser = &rPathSeq == &aUserPaths && (nPathFlags & PATH_FLAG_USER);
|
||||
const bool bAddInternal = &rPathSeq == &aInternalPaths && (nPathFlags & PATH_FLAG_INTERNAL);
|
||||
if ((bAddUser || bAddInternal) && pPathSeq[k].getLength() > 0)
|
||||
if ((bAddUser || bAddInternal) && !pPathSeq[k].isEmpty())
|
||||
pRes[ nCount++ ] = pPathSeq[k];
|
||||
}
|
||||
}
|
||||
|
@@ -141,7 +141,7 @@ size_t ProposalList::Count() const
|
||||
size_t nLen = aVec.size();
|
||||
for (size_t i = 0; i < nLen; ++i)
|
||||
{
|
||||
if (aVec[i].getLength() != 0)
|
||||
if (!aVec[i].isEmpty())
|
||||
++nRes;
|
||||
}
|
||||
return nRes;
|
||||
@@ -158,7 +158,7 @@ Sequence< OUString > ProposalList::GetSequence() const
|
||||
{
|
||||
const OUString &rText = aVec[i];
|
||||
DBG_ASSERT( nIdx < nCount, "index our of range" );
|
||||
if (nIdx < nCount && rText.getLength() > 0)
|
||||
if (nIdx < nCount && !rText.isEmpty())
|
||||
pRes[ nIdx++ ] = rText;
|
||||
}
|
||||
return aRes;
|
||||
@@ -191,7 +191,7 @@ sal_Bool SvcListHasLanguage(
|
||||
{
|
||||
if (pRef[k].is())
|
||||
{
|
||||
if (0 == aTmpLocale.Language.getLength())
|
||||
if (aTmpLocale.Language.isEmpty())
|
||||
aTmpLocale = CreateLocale( nLanguage );
|
||||
bHasLanguage = pRef[k]->hasLocale( aTmpLocale );
|
||||
}
|
||||
@@ -312,7 +312,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl(
|
||||
|
||||
sal_Bool bRes = sal_True;
|
||||
|
||||
if (nLanguage == LANGUAGE_NONE || !rWord.getLength())
|
||||
if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
|
||||
return bRes;
|
||||
|
||||
// search for entry with that language
|
||||
@@ -478,7 +478,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
||||
|
||||
Reference< XSpellAlternatives > xRes;
|
||||
|
||||
if (nLanguage == LANGUAGE_NONE || !rWord.getLength())
|
||||
if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
|
||||
return xRes;
|
||||
|
||||
// search for entry with that language
|
||||
@@ -688,7 +688,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
||||
OUString aAddRplcTxt( xTmp->getReplacementText() );
|
||||
|
||||
// replacement text must not be in negative dictionary itself
|
||||
if (aAddRplcTxt.getLength() &&
|
||||
if (!aAddRplcTxt.isEmpty() &&
|
||||
!SearchDicList( xDList, aAddRplcTxt, nLanguage, sal_False, sal_True ).is())
|
||||
{
|
||||
aProposalList.Prepend( aAddRplcTxt );
|
||||
|
@@ -174,7 +174,7 @@ Sequence< OUString > MergeProposalSeqs(
|
||||
const OUString *pAlt = j == 0 ? pAlt1 : pAlt2;
|
||||
for (i = 0; i < nCount && nIndex < MAX_PROPOSALS; i++)
|
||||
{
|
||||
if (pAlt[i].getLength() &&
|
||||
if (!pAlt[i].isEmpty() &&
|
||||
(bAllowDuplicates || !SeqHasEntry(aMerged, pAlt[i] )))
|
||||
pMerged[ nIndex++ ] = pAlt[ i ];
|
||||
}
|
||||
|
@@ -126,7 +126,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
|
||||
Sequence< Reference< XMeaning > > aMeanings;
|
||||
|
||||
sal_Int16 nLanguage = LocaleToLanguage( rLocale );
|
||||
if (nLanguage == LANGUAGE_NONE || !rTerm.getLength())
|
||||
if (nLanguage == LANGUAGE_NONE || rTerm.isEmpty())
|
||||
return aMeanings;
|
||||
|
||||
// search for entry with that language
|
||||
|
Reference in New Issue
Block a user