summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-01-09 16:48:52 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-01-10 12:18:13 +0100
commitf4078cb3a2366263227328a53e6cab4631e04bd6 (patch)
tree5b5cd3ac6b6ba38b360f012bdfefda1c33037f46 /linguistic
parent6bfd791162fa392600ef8b8df6c1ac04bb4d4099 (diff)
resolved fdo#58503 restore awkward handling of empty locale for legacy
Partly reverts d7a5ec62e91ce3dc5b784815254218f16181f676 An empty locale was treated as LANGUAGE_NONE, effectively being interpreted as absence or undetermined or multiple or all depending on context. Restore this behavior as it was an undocumented feature of the API. Change-Id: I256b352961f09e41cadb3e44c9ef01ee7677fd31 Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/inc/linguistic/misc.hxx18
-rw-r--r--linguistic/source/convdic.cxx2
-rw-r--r--linguistic/source/convdiclist.cxx2
-rw-r--r--linguistic/source/dicimp.cxx7
-rw-r--r--linguistic/source/dlistimp.cxx6
-rw-r--r--linguistic/source/gciterator.cxx6
-rw-r--r--linguistic/source/hyphdsp.cxx18
-rw-r--r--linguistic/source/lngsvcmgr.cxx10
-rw-r--r--linguistic/source/misc.cxx38
-rw-r--r--linguistic/source/spelldsp.cxx14
-rw-r--r--linguistic/source/spelldta.cxx4
-rw-r--r--linguistic/source/thesdsp.cxx10
-rw-r--r--linguistic/workben/sspellimp.cxx4
13 files changed, 95 insertions, 44 deletions
diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx
index 32637ab6c90c..6f4563a1795f 100644
--- a/linguistic/inc/linguistic/misc.hxx
+++ b/linguistic/inc/linguistic/misc.hxx
@@ -90,6 +90,24 @@ LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang );
sal_Int32 LevDistance( const rtl::OUString &rTxt1, const rtl::OUString &rTxt2 );
+/** Convert Locale to LanguageType for legacy handling.
+ Linguistic specific handling of an empty locale denoting LANGUAGE_NONE.
+ Does not resolve empty locale as system locale.
+ */
+LNG_DLLPUBLIC LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale );
+
+/** Convert LanguageType to Locale for legacy handling.
+ Linguistic specific handling of LANGUAGE_NONE resulting in an empty locale.
+ Avoid use!
+ */
+LNG_DLLPUBLIC ::com::sun::star::lang::Locale LinguLanguageToLocale( LanguageType nLanguage );
+
+/** Checks if a LanguageType is one of the values that denote absence of
+ language or undetermined language or multiple languages, in short all
+ values used in linguistic context that do not denote a specific language.
+ */
+LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
+
::com::sun::star::uno::Sequence< sal_Int16 >
LocaleSeqToLangSeq( ::com::sun::star::uno::Sequence<
::com::sun::star::lang::Locale > &rLocaleSeq );
diff --git a/linguistic/source/convdic.cxx b/linguistic/source/convdic.cxx
index c497c8697b6a..37310db0bdb3 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -152,7 +152,7 @@ sal_Bool IsConvDic( const String &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvTy
uno::Reference< XInterface > xRef( (document::XFilter *) pImport, UNO_QUERY );
ReadThroughDic( rFileURL, *pImport ); // will implicitly add the entries
- bRes = pImport->GetLanguage() != LANGUAGE_NONE &&
+ bRes = !LinguIsUnspecified( pImport->GetLanguage()) &&
pImport->GetConversionType() != -1;
DBG_ASSERT( bRes, "conversion dictionary corrupted?" );
diff --git a/linguistic/source/convdiclist.cxx b/linguistic/source/convdiclist.cxx
index 52ea6211f1e0..9fa05f418482 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -483,7 +483,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
if (GetNameContainer().hasByName( rName ))
throw ElementExistException();
diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx
index dafa95d7b6fa..231779b8e7dd 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -419,7 +419,10 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
pStream->WriteLine(rtl::OString(pVerOOo7));
if (0 != (nErr = pStream->GetError()))
return nErr;
- if (nLanguage == LANGUAGE_NONE)
+ /* XXX: the <none> case could be differentiated, is it absence or
+ * undetermined or multiple? Earlier versions did not know about 'und' and
+ * 'mul' and 'zxx' codes. Sync with ReadDicVersion() */
+ if (LinguIsUnspecified(nLanguage))
pStream->WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("lang: <none>")));
else
{
@@ -773,7 +776,7 @@ void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguageP = LanguageTag( aLocale ).getLanguageType();
+ sal_Int16 nLanguageP = LinguLocaleToLanguage( aLocale );
if (!bIsReadonly && nLanguage != nLanguageP)
{
nLanguage = nLanguageP;
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx
index ed7a8a712576..39d816bdca80 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -566,7 +566,7 @@ uno::Reference< XDictionary > SAL_CALL
{
osl::MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
bool bIsWriteablePath = rURL.match( GetDictionaryWriteablePath(), 0 );
return new DictionaryNeo( rName, nLanguage, eDicType, rURL, bIsWriteablePath );
}
@@ -578,7 +578,7 @@ uno::Reference< XDictionaryEntry > SAL_CALL
throw(RuntimeException)
{
osl::MutexGuard aGuard( GetLinguMutex() );
- return SearchDicList( this, rWord, LanguageTag( rLocale ).getLanguageType(),
+ return SearchDicList( this, rWord, LinguLocaleToLanguage( rLocale ),
bSearchPosDics, bSearchSpellEntry );
}
@@ -669,7 +669,7 @@ void DicList::_CreateDicList()
// and add it to list
rtl::OUString aDicName( A2OU( "IgnoreAllList" ) );
uno::Reference< XDictionary > xIgnAll(
- createDictionary( aDicName, LanguageTag( LANGUAGE_NONE ).getLocale(),
+ createDictionary( aDicName, LinguLanguageToLocale( LANGUAGE_NONE ),
DictionaryType_POSITIVE, rtl::OUString() ) );
if (xIgnAll.is())
{
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index c9bafd409374..792d406a3e84 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1072,12 +1072,12 @@ void GrammarCheckingIterator::SetServiceList(
{
::osl::Guard< ::osl::Mutex > aGuard( MyMutex::get() );
- LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
+ LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
OUString aImplName;
if (rSvcImplNames.getLength() > 0)
aImplName = rSvcImplNames[0]; // there is only one grammar checker per language
- if (nLanguage != LANGUAGE_NONE && nLanguage != LANGUAGE_DONTKNOW)
+ if (!LinguIsUnspecified(nLanguage) && nLanguage != LANGUAGE_DONTKNOW)
{
if (!aImplName.isEmpty())
m_aGCImplNamesByLang[ nLanguage ] = aImplName;
@@ -1095,7 +1095,7 @@ uno::Sequence< OUString > GrammarCheckingIterator::GetServiceList(
uno::Sequence< OUString > aRes(1);
OUString aImplName; // there is only one grammar checker per language
- LanguageType nLang = LanguageTag( rLocale ).getLanguageType();
+ LanguageType nLang = LinguLocaleToLanguage( rLocale );
GCImplNames_t::const_iterator aIt( m_aGCImplNamesByLang.find( nLang ) );
if (aIt != m_aGCImplNamesByLang.end())
aImplName = aIt->second;
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index ac08631f9862..757e836fc126 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -236,7 +236,7 @@ sal_Bool SAL_CALL HyphenatorDispatcher::hasLocale(const Locale& rLocale)
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
+ HyphSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LinguLocaleToLanguage( rLocale ) ) );
return aIt != aSvcMap.end();
}
@@ -252,8 +252,8 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
sal_Int32 nWordLen = rWord.getLength();
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
- if (nLanguage == LANGUAGE_NONE || !nWordLen ||
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
+ if (LinguIsUnspecified(nLanguage) || !nWordLen ||
nMaxLeading == 0 || nMaxLeading == nWordLen)
return xRes;
@@ -390,8 +390,8 @@ Reference< XHyphenatedWord > SAL_CALL
Reference< XHyphenatedWord > xRes;
sal_Int32 nWordLen = rWord.getLength();
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
- if (nLanguage == LANGUAGE_NONE || !nWordLen)
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
+ if (LinguIsUnspecified(nLanguage) || !nWordLen)
return xRes;
// search for entry with that language
@@ -521,8 +521,8 @@ Reference< XPossibleHyphens > SAL_CALL
Reference< XPossibleHyphens > xRes;
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
- if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
+ if (LinguIsUnspecified(nLanguage) || rWord.isEmpty())
return xRes;
// search for entry with that language
@@ -638,7 +638,7 @@ void HyphenatorDispatcher::SetServiceList( const Locale &rLocale,
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -673,7 +673,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
HyphenatorDispatcher *pThis = (HyphenatorDispatcher *) this;
const HyphSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Hyph *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 4f6840746991..93697e6f5d56 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -115,7 +115,7 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
for (sal_Int32 k = 0; k < nLoc; ++k)
{
const lang::Locale *pLoc = aLoc.getConstArray();
- LanguageType nLang = LanguageTag( pLoc[k] ).getLanguageType();
+ LanguageType nLang = LinguLocaleToLanguage( pLoc[k] );
// language not already added?
if (aLanguages.find( nLang ) == aLanguages.end())
@@ -1602,11 +1602,11 @@ uno::Sequence< OUString > SAL_CALL
OUString *pImplName = aRes.getArray();
sal_uInt16 nCnt = 0;
- LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
+ LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
for (size_t i = 0; i < nMaxCnt; ++i)
{
const SvcInfo &rInfo = (*pInfoArray)[i];
- if (LANGUAGE_NONE == nLanguage
+ if (LinguIsUnspecified( nLanguage )
|| rInfo.HasLanguage( nLanguage ))
{
pImplName[ nCnt++ ] = rInfo.aSvcImplName;
@@ -1689,8 +1689,8 @@ void SAL_CALL
#if OSL_DEBUG_LEVEL > 1
#endif
- LanguageType nLanguage = LanguageTag( rLocale ).getLanguageType();
- if (LANGUAGE_NONE != nLanguage)
+ LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
+ if (!LinguIsUnspecified( nLanguage))
{
if (0 == rServiceName.compareToAscii( SN_SPELLCHECKER ))
{
diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx
index 536daf4a933d..a7dc5a142389 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -85,6 +85,36 @@ LocaleDataWrapper & GetLocaleDataWrapper( sal_Int16 nLang )
return aLclDtaWrp;
}
+
+LanguageType LinguLocaleToLanguage( const ::com::sun::star::lang::Locale& rLocale )
+{
+ if ( rLocale.Language.isEmpty() )
+ return LANGUAGE_NONE;
+ return LanguageTag( rLocale ).getLanguageType();
+}
+
+
+::com::sun::star::lang::Locale LinguLanguageToLocale( LanguageType nLanguage )
+{
+ if (nLanguage == LANGUAGE_NONE)
+ return ::com::sun::star::lang::Locale();
+ return LanguageTag( nLanguage).getLocale();
+}
+
+
+bool LinguIsUnspecified( LanguageType nLanguage )
+{
+ switch (nLanguage)
+ {
+ case LANGUAGE_NONE:
+ case LANGUAGE_UNDETERMINED:
+ case LANGUAGE_MULTIPLE:
+ return true;
+ }
+ return false;
+}
+
+
static inline sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 )
{
sal_Int32 nMin = n1 < n2 ? n1 : n2;
@@ -266,10 +296,10 @@ uno::Reference< XDictionaryEntry > SearchDicList(
uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY );
DictionaryType eType = axDic->getDictionaryType();
- sal_Int16 nLang = LanguageTag( axDic->getLocale() ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( axDic->getLocale() );
if ( axDic.is() && axDic->isActive()
- && (nLang == nLanguage || nLang == LANGUAGE_NONE) )
+ && (nLang == nLanguage || LinguIsUnspecified( nLang)) )
{
DBG_ASSERT( eType != DictionaryType_MIXED,
"lng : unexpected dictionary type" );
@@ -373,7 +403,7 @@ uno::Sequence< sal_Int16 >
sal_Int16 *pLang = aLangs.getArray();
for (sal_Int32 i = 0; i < nCount; ++i)
{
- pLang[i] = LanguageTag( pLocale[i] ).getLanguageType();
+ pLang[i] = LinguLocaleToLanguage( pLocale[i] );
}
return aLangs;
@@ -554,7 +584,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
}
else
{
- sal_Int16 nLang = LanguageTag( rxHyphWord->getLocale() ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( rxHyphWord->getLocale() );
xRes = new HyphenatedWord(
rOrigWord, nLang, nOrigHyphenationPos,
aOrigHyphenatedWord, nOrigHyphenPos );
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 5c3c9742c274..815a5b3f21a2 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -227,7 +227,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLocale( const Locale& rLocale )
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
+ SpellSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LinguLocaleToLanguage( rLocale ) ) );
return aIt != aSvcMap.end();
}
@@ -238,7 +238,7 @@ sal_Bool SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return isValid_Impl( rWord, LanguageTag( rLocale ).getLanguageType(), rProperties, sal_True );
+ return isValid_Impl( rWord, LinguLocaleToLanguage( rLocale ), rProperties, sal_True );
}
@@ -248,7 +248,7 @@ Reference< XSpellAlternatives > SAL_CALL
throw(IllegalArgumentException, RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- return spell_Impl( rWord, LanguageTag( rLocale ).getLanguageType(), rProperties, sal_True );
+ return spell_Impl( rWord, LinguLocaleToLanguage( rLocale ), rProperties, sal_True );
}
@@ -297,7 +297,7 @@ sal_Bool SpellCheckerDispatcher::isValid_Impl(
sal_Bool bRes = sal_True;
- if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
+ if (LinguIsUnspecified( nLanguage) || rWord.isEmpty())
return bRes;
// search for entry with that language
@@ -467,7 +467,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
Reference< XSpellAlternatives > xRes;
- if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
+ if (LinguIsUnspecified( nLanguage) || rWord.isEmpty())
return xRes;
// search for entry with that language
@@ -774,7 +774,7 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale,
if (pCache)
pCache->Flush(); // new services may spell differently...
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -808,7 +808,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
SpellCheckerDispatcher *pThis = (SpellCheckerDispatcher *) this;
const SpellSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Spell *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx
index f135003e6fba..886af7072522 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -78,10 +78,10 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
{
Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
- sal_Int16 nLang = LanguageTag( xDic->getLocale() ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( xDic->getLocale() );
if ( xDic.is() && xDic->isActive()
- && (nLang == nLanguage || nLang == LANGUAGE_NONE) )
+ && (nLang == nLanguage || LinguIsUnspecified( nLang)) )
{
#if OSL_DEBUG_LEVEL > 1
DictionaryType eType = xDic->getDictionaryType();
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index e8656af3e914..dfd106f0eac7 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -101,7 +101,7 @@ sal_Bool SAL_CALL
throw(RuntimeException)
{
MutexGuard aGuard( GetLinguMutex() );
- ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LanguageTag( rLocale ).getLanguageType() ) );
+ ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( LinguLocaleToLanguage( rLocale ) ) );
return aIt != aSvcMap.end();
}
@@ -116,8 +116,8 @@ Sequence< Reference< XMeaning > > SAL_CALL
Sequence< Reference< XMeaning > > aMeanings;
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
- if (nLanguage == LANGUAGE_NONE || rTerm.isEmpty())
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
+ if (LinguIsUnspecified( nLanguage) || rTerm.isEmpty())
return aMeanings;
// search for entry with that language
@@ -210,7 +210,7 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale,
{
MutexGuard aGuard( GetLinguMutex() );
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@@ -244,7 +244,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
- sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
ThesaurusDispatcher *pThis = (ThesaurusDispatcher *) this;
const ThesSvcByLangMap_t::iterator aIt( pThis->aSvcMap.find( nLanguage ) );
const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : NULL;
diff --git a/linguistic/workben/sspellimp.cxx b/linguistic/workben/sspellimp.cxx
index 68071d2d9c36..003ceab5021a 100644
--- a/linguistic/workben/sspellimp.cxx
+++ b/linguistic/workben/sspellimp.cxx
@@ -185,7 +185,7 @@ sal_Bool SAL_CALL
sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
if (nFailure != -1)
{
- sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
// postprocess result for errors that should be ignored
if ( (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang ))
|| (!rHelper.IsSpellWithDigits() && HasDigits( rWord ))
@@ -214,7 +214,7 @@ Reference< XSpellAlternatives >
String aTmp( rWord );
if (aTmp.Len())
{
- sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+ sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
if (STRING_NOTFOUND != aTmp.SearchAscii( "liss" ))
{