[Libreoffice-commits] .: Branch 'libreoffice-4-0' - cui/source desktop/source editeng/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Thu Dec 13 11:22:22 PST 2012
cui/source/tabpages/autocdlg.cxx | 6 ++---
desktop/source/migration/migration.cxx | 8 +++++++
editeng/source/misc/svxacorr.cxx | 35 +++++++++++++++------------------
3 files changed, 27 insertions(+), 22 deletions(-)
New commits:
commit cbd9177a3985910312d4f6a4b7c2068bbab50619
Author: Eike Rathke <erack at redhat.com>
Date: Thu Dec 13 19:51:52 2012 +0100
fdo#58060 use acor_und.dat and LANGUAGE_UNDETERMINED
Previous versions used an empty language tag for LANGUAGE_DONTKNOW with the
"[All]" autocorrection entry and read/wrote from/to arco_.dat file. An empty
language tag otherwise is used for system locale and doesn't convert flawlessly
with the new LanguageTag system. Instead use LANGUAGE_UNDETERMINED with the ISO
639 code 'und' so the file name is "acor_und.dat".
During user profile migration an existing 3/user/autocorr/acor_.dat is copied
to the new 4/user/autocorr/acor_und.dat
Change-Id: I593f24829c6efd58f36e93ebd3385a3c925f7217
(cherry picked from commit 623410669fa2d5da9a2ce4e3c4b81ce23605a6df)
diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx
index 66bf164..48bd0c7 100644
--- a/cui/source/tabpages/autocdlg.cxx
+++ b/cui/source/tabpages/autocdlg.cxx
@@ -111,7 +111,7 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) :
// initialize languages
//! LANGUAGE_NONE is displayed as '[All]' and the LanguageType
- //! will be set to LANGUAGE_DONTKNOW
+ //! will be set to LANGUAGE_UNDETERMINED
sal_Int16 nLangList = LANG_LIST_WESTERN;
if( SvtLanguageOptions().IsCTLFontEnabled() )
@@ -120,13 +120,13 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(Window* pParent, const SfxItemSet* _pSet ) :
aLanguageLB.SelectLanguage( LANGUAGE_NONE );
sal_uInt16 nPos = aLanguageLB.GetSelectEntryPos();
DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" );
- aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_DONTKNOW );
+ aLanguageLB.SetEntryData( nPos, (void*)(long) LANGUAGE_UNDETERMINED );
// Initializing doesn't work for static on linux - therefore here
if( LANGUAGE_SYSTEM == eLastDialogLanguage )
eLastDialogLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
- LanguageType nSelectLang = LANGUAGE_DONTKNOW;
+ LanguageType nSelectLang = LANGUAGE_UNDETERMINED;
nPos = aLanguageLB.GetEntryPos( (void*)(long) eLastDialogLanguage );
if (LISTBOX_ENTRY_NOTFOUND != nPos)
nSelectLang = eLastDialogLanguage;
diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx
index 6036ef5..1b4115a 100644
--- a/desktop/source/migration/migration.cxx
+++ b/desktop/source/migration/migration.cxx
@@ -922,6 +922,14 @@ void MigrationImpl::copyFiles()
{
// remove installation prefix from file
localName = i_file->copy(m_aInfo.userdata.getLength());
+ if (localName.endsWith( "/autocorr/acor_.dat"))
+ {
+ // Previous versions used an empty language tag for
+ // LANGUAGE_DONTKNOW with the "[All]" autocorrection entry.
+ // As of LibreOffice 4.0 it is 'und' for LANGUAGE_UNDETERMINED
+ // so the file name is "acor_und.dat".
+ localName = localName.copy( 0, localName.getLength() - 4) + "und.dat";
+ }
destName = userInstall + localName;
INetURLObject aURL(destName);
// check whether destination directory exists
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 4e59f09..cf486af 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1481,11 +1481,11 @@ sal_Bool SvxAutoCorrect::AddCplSttException( const String& rNew,
pLists = nTmpVal->second;
else
{
- nTmpVal = pLangTable->find(LANGUAGE_DONTKNOW);
+ nTmpVal = pLangTable->find(LANGUAGE_UNDETERMINED);
if(nTmpVal != pLangTable->end())
pLists = nTmpVal->second;
- else if(CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True))
- pLists = pLangTable->find(LANGUAGE_DONTKNOW)->second;
+ else if(CreateLanguageFile(LANGUAGE_UNDETERMINED, sal_True))
+ pLists = pLangTable->find(LANGUAGE_UNDETERMINED)->second;
}
OSL_ENSURE(pLists, "No auto correction data");
return pLists->AddToCplSttExceptList(rNew);
@@ -1502,11 +1502,11 @@ sal_Bool SvxAutoCorrect::AddWrtSttException( const String& rNew,
pLists = nTmpVal->second;
else
{
- nTmpVal = pLangTable->find(LANGUAGE_DONTKNOW);
+ nTmpVal = pLangTable->find(LANGUAGE_UNDETERMINED);
if(nTmpVal != pLangTable->end())
pLists = nTmpVal->second;
- else if(CreateLanguageFile(LANGUAGE_DONTKNOW, sal_True))
- pLists = pLangTable->find(LANGUAGE_DONTKNOW)->second;
+ else if(CreateLanguageFile(LANGUAGE_UNDETERMINED, sal_True))
+ pLists = pLangTable->find(LANGUAGE_UNDETERMINED)->second;
}
OSL_ENSURE(pLists, "No auto correction file!");
return pLists->AddToWrdSttExceptList(rNew);
@@ -1689,7 +1689,7 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
eLang = MsLangId::getSystemLanguage();
// First search for eLang, then US-English -> English
- // and last in LANGUAGE_DONTKNOW
+ // and last in LANGUAGE_UNDETERMINED
if(pLangTable->find(eLang) != pLangTable->end() || CreateLanguageFile(eLang, sal_False))
{
//the language is available - so bring it on
@@ -1730,14 +1730,14 @@ const SvxAutocorrWord* SvxAutoCorrect::SearchWordsInList(
}
}
- if(pLangTable->find(LANGUAGE_DONTKNOW) != pLangTable->end() || CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False))
+ if(pLangTable->find(LANGUAGE_UNDETERMINED) != pLangTable->end() || CreateLanguageFile(LANGUAGE_UNDETERMINED, sal_False))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(LANGUAGE_DONTKNOW)->second;
+ SvxAutoCorrectLanguageLists* pList = pLangTable->find(LANGUAGE_UNDETERMINED)->second;
pRet = lcl_SearchWordsInList( pList, rTxt, rStt, nEndPos );
if( pRet )
{
- rLang = LANGUAGE_DONTKNOW;
+ rLang = LANGUAGE_UNDETERMINED;
return pRet;
}
}
@@ -1748,7 +1748,7 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
const String& sWord )
{
// First search for eLang, then US-English -> English
- // and last in LANGUAGE_DONTKNOW
+ // and last in LANGUAGE_UNDETERMINED
LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
String sTemp(sWord);
@@ -1779,10 +1779,10 @@ sal_Bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
return sal_True;
}
- if(pLangTable->find(LANGUAGE_DONTKNOW) != pLangTable->end() || CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False))
+ if(pLangTable->find(LANGUAGE_UNDETERMINED) != pLangTable->end() || CreateLanguageFile(LANGUAGE_UNDETERMINED, sal_False))
{
//the language is available - so bring it on
- SvxAutoCorrectLanguageLists* pList = pLangTable->find(LANGUAGE_DONTKNOW)->second;
+ SvxAutoCorrectLanguageLists* pList = pLangTable->find(LANGUAGE_UNDETERMINED)->second;
if(pList->GetWrdSttExceptList()->find(&sTemp) != pList->GetWrdSttExceptList()->end() )
return sal_True;
}
@@ -1827,7 +1827,7 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
const String& sWord, sal_Bool bAbbreviation)
{
// First search for eLang, then US-English -> English
- // and last in LANGUAGE_DONTKNOW
+ // and last in LANGUAGE_UNDETERMINED
LanguageType nTmpKey1 = eLang & 0x7ff, // the main language in many cases DE
nTmpKey2 = eLang & 0x3ff; // otherwise for example EN
String sTemp( sWord );
@@ -1856,10 +1856,10 @@ sal_Bool SvxAutoCorrect::FindInCplSttExceptList(LanguageType eLang,
return sal_True;
}
- if(pLangTable->find(LANGUAGE_DONTKNOW) != pLangTable->end() || CreateLanguageFile(LANGUAGE_DONTKNOW, sal_False))
+ if(pLangTable->find(LANGUAGE_UNDETERMINED) != pLangTable->end() || CreateLanguageFile(LANGUAGE_UNDETERMINED, sal_False))
{
//the language is available - so bring it on
- const SvStringsISortDtor* pList = pLangTable->find(LANGUAGE_DONTKNOW)->second->GetCplSttExceptList();
+ const SvStringsISortDtor* pList = pLangTable->find(LANGUAGE_UNDETERMINED)->second->GetCplSttExceptList();
if(bAbbreviation ? lcl_FindAbbreviation(pList, sWord) : pList->find(&sTemp) != pList->end() )
return sal_True;
}
@@ -1871,9 +1871,6 @@ String SvxAutoCorrect::GetAutoCorrFileName( LanguageType eLang,
{
String sRet, sExt( LanguageTag( eLang ).getBcp47() );
- // fdo#58060 user added dictionary - saved as acorr_.dat
- if (eLang == LANGUAGE_DONTKNOW)
- sExt = String();
sExt.Insert('_', 0);
sExt.AppendAscii( ".dat" );
if( bNewFile )
More information about the Libreoffice-commits
mailing list