[Libreoffice-commits] core.git: editeng/source
Caolán McNamara
caolanm at redhat.com
Fri Oct 23 12:39:32 PDT 2015
editeng/source/misc/svxacorr.cxx | 55 +++++++--------------------------------
1 file changed, 11 insertions(+), 44 deletions(-)
New commits:
commit 7076cc68fd16e28c53138502cbe374efe606a768
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Oct 23 20:35:32 2015 +0100
get rid of erroneous 0x7ff language mask
Change-Id: I2b3501967fc0088e0bebf6c366e033c61b652921
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e1879ee..84a0df1 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1718,24 +1718,10 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
// If it still could not be found here, then keep on searching
LanguageType eLang = aLanguageTag.getLanguageType();
- LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
- if(nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
- {
- //the language is available - so bring it on
- std::unique_ptr<SvxAutoCorrectLanguageLists> const& pList = m_pLangTable->find(aLanguageTag)->second;
- pRet = lcl_SearchWordsInList( pList.get(), rTxt, rStt, nEndPos );
- if( pRet )
- {
- rLang = aLanguageTag;
- return pRet;
- }
- }
-
- // otherwise for example EN
+ // the primary language for example EN
aLanguageTag.reset(aLanguageTag.getLanguage());
- LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
- if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
+ if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
@@ -1771,9 +1757,8 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
/* TODO-BCP47: again horrible uglyness */
- // First search for eLang, then US-English -> English
+ // First search for eLang, then primary language of eLang
// and last in LANGUAGE_UNDETERMINED
- LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
OUString sTemp(sWord);
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1786,19 +1771,10 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
}
// If it still could not be found here, then keep on searching
- if (nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
- {
- //the language is available - so bring it on
- auto const& pList = m_pLangTable->find(aLanguageTag)->second;
- if(pList->GetWrdSttExceptList()->find(sTemp) != pList->GetWrdSttExceptList()->end() )
- return true;
- }
-
- // otherwise for example EN
+ // the primary language for example EN
aLanguageTag.reset(aLanguageTag.getLanguage());
- LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
- if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
+ if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
@@ -1860,9 +1836,8 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
/* TODO-BCP47: did I mention terrible horrible uglyness? */
- // First search for eLang, then US-English -> English
+ // First search for eLang, then primary language of eLang
// and last in LANGUAGE_UNDETERMINED
- LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
OUString sTemp( sWord );
if (m_pLangTable->find(aLanguageTag) != m_pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1874,18 +1849,10 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
}
// If it still could not be found here, then keep on searching
- if(nTmpKey1 != eLang && (m_pLangTable->find(aLanguageTag.reset(nTmpKey1)) != m_pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
- {
- const SvStringsISortDtor* pList = m_pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();
- if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(sTemp) != pList->end() )
- return true;
- }
-
- // otherwise for example EN
+ // the primary language for example EN
aLanguageTag.reset(aLanguageTag.getLanguage());
- LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
- if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ LanguageType nTmpKey = aLanguageTag.getLanguageType(false);
+ if (nTmpKey != eLang && nTmpKey != LANGUAGE_UNDETERMINED &&
(m_pLangTable->find(aLanguageTag) != m_pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
More information about the Libreoffice-commits
mailing list