summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-23 09:11:56 +0100
committerAndras Timar <andras.timar@collabora.com>2015-11-10 22:31:16 +0100
commit4d8ab5fcd80942605b28166f7502c71baa4454b2 (patch)
treec8fff967b62b00e479a96b3faf88d0612d4992f8 /editeng
parent258718a9a2084218a574c32db4d3e6bffc7c6849 (diff)
Resolves: tdf#76964 fall back to primary language via getLanguage
instead of bittwiddling which ends up trying to resolve the system language (cherry picked from commit a1ff0745cc4f78777e8dba1e7bb52d18386d7394) more tdf#76964 fall back to primary language via getLanguage (cherry picked from commit 97893e56e61a466e56d12ee46d11f6e4c32a737b) sw: fix SwUiWriterTest pointlessly loading an "empty.odt" ... ... instead of just creating a new document. (cherry picked from commit 98ddd7a32fd0d5fa080fac368b9dc53a06659285) Change-Id: I545bd5e39f99003ddedf3c90031e8b818edc1de2 Reviewed-on: https://gerrit.libreoffice.org/19545 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit de1cb4039756f71d848297981b757c1cfa4609b1)
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/misc/svxacorr.cxx34
1 files changed, 21 insertions, 13 deletions
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 10426e1d9bdb..03b0733c9009 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1729,10 +1729,8 @@ 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
- nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+ LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
if(nTmpKey1 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey1)) != pLangTable->end() ||
CreateLanguageFile(aLanguageTag, false)))
{
@@ -1746,8 +1744,12 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
}
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
+ // otherwise for example EN
+ aLanguageTag.reset(aLanguageTag.getLanguage());
+ LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+ if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+ CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
@@ -1783,8 +1785,7 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
// First search for eLang, then US-English -> English
// and last in LANGUAGE_UNDETERMINED
- LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
- nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+ LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
OUString sTemp(sWord);
if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1806,8 +1807,12 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
return true;
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
+ // otherwise for example EN
+ aLanguageTag.reset(aLanguageTag.getLanguage());
+ LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+ if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+ CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
SvxAutoCorrectLanguageLists* pList = pLangTable->find(aLanguageTag)->second;
@@ -1869,8 +1874,7 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
// First search for eLang, then US-English -> English
// and last in LANGUAGE_UNDETERMINED
- LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
- nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
+ LanguageType nTmpKey1 = eLang & 0x7ff; // the main language in many cases DE
OUString sTemp( sWord );
if(pLangTable->find(aLanguageTag) != pLangTable->end() || CreateLanguageFile(aLanguageTag, false))
@@ -1890,8 +1894,12 @@ bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
return true;
}
- if(nTmpKey2 != eLang && (pLangTable->find(aLanguageTag.reset(nTmpKey2)) != pLangTable->end() ||
- CreateLanguageFile(aLanguageTag, false)))
+ // otherwise for example EN
+ aLanguageTag.reset(aLanguageTag.getLanguage());
+ LanguageType nTmpKey2 = aLanguageTag.getLanguageType(false);
+ if (nTmpKey2 != eLang && nTmpKey2 != LANGUAGE_UNDETERMINED &&
+ (pLangTable->find(aLanguageTag) != pLangTable->end() ||
+ CreateLanguageFile(aLanguageTag, false)))
{
//the language is available - so bring it on
const SvStringsISortDtor* pList = pLangTable->find(aLanguageTag)->second->GetCplSttExceptList();