Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/1616

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/16/1616/1

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
---
M lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
M lingucomponent/source/lingutil/lingutil.cxx
M lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
M lingucomponent/source/spellcheck/spell/sspellimp.cxx
M lingucomponent/source/thesaurus/libnth/nthesimp.cxx
M linguistic/inc/linguistic/misc.hxx
M linguistic/source/convdic.cxx
M linguistic/source/convdiclist.cxx
M linguistic/source/dicimp.cxx
M linguistic/source/dlistimp.cxx
M linguistic/source/gciterator.cxx
M linguistic/source/hyphdsp.cxx
M linguistic/source/lngsvcmgr.cxx
M linguistic/source/misc.cxx
M linguistic/source/spelldsp.cxx
M linguistic/source/spelldta.cxx
M linguistic/source/thesdsp.cxx
M linguistic/workben/sspellimp.cxx
18 files changed, 106 insertions(+), 55 deletions(-)



diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx 
b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
index e7fe7a4..990b45b 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -485,13 +485,13 @@
                 sal_Int16 nPos = (sal_Int16) ((nHyphenationPosAltHyph < nHyphenationPos) ?
                 nHyphenationPosAltHyph : nHyphenationPos);
                 // dicretionary hyphenation
-                xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LanguageTag( aLocale 
).getLanguageType(), nPos,
+                xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LinguLocaleToLanguage( aLocale 
), nPos,
                     aWord.replaceAt(nHyphenationPosAlt + 1, cut[nHyphenationPos], repHyph),
                     (sal_Int16) nHyphenationPosAltHyph);
             }
             else
             {
-                xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LanguageTag( aLocale 
).getLanguageType(),
+                xRes = HyphenatedWord::CreateHyphenatedWord( aWord, LinguLocaleToLanguage( aLocale 
),
                     (sal_Int16)nHyphenationPos, aWord, (sal_Int16) nHyphenationPos);
             }
         }
@@ -542,7 +542,7 @@
     //well as "hyphenate"
     if (aWord.getLength() < minLen)
     {
-        return PossibleHyphens::CreatePossibleHyphens( aWord, LanguageTag( aLocale 
).getLanguageType(),
+        return PossibleHyphens::CreatePossibleHyphens( aWord, LinguLocaleToLanguage( aLocale ),
                       aWord, Sequence< sal_Int16 >() );
     }
 
@@ -689,7 +689,7 @@
         OUString hyphenatedWord = hyphenatedWordBuffer.makeStringAndClear();
 
         Reference< XPossibleHyphens > xRes = PossibleHyphens::CreatePossibleHyphens(
-            aWord, LanguageTag( aLocale ).getLanguageType(), hyphenatedWord, aHyphPos);
+            aWord, LinguLocaleToLanguage( aLocale ), hyphenatedWord, aHyphPos);
 
         delete[] hyphens;
         delete[] lcword;
diff --git a/lingucomponent/source/lingutil/lingutil.cxx 
b/lingucomponent/source/lingutil/lingutil.cxx
index 194f0b7..8754442 100644
--- a/lingucomponent/source/lingutil/lingutil.cxx
+++ b/lingucomponent/source/lingutil/lingutil.cxx
@@ -216,7 +216,7 @@
         {
             LanguageType nLang = LanguageTag( aIt2->aLocaleNames[0] ).getLanguageType();
 
-            if (nLang == LANGUAGE_DONTKNOW || nLang == LANGUAGE_NONE)
+            if (nLang == LANGUAGE_DONTKNOW || linguistic::LinguIsUnspecified( nLang))
             {
                 OSL_FAIL( "old style dictionary with invalid language found!" );
                 continue;
diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm 
b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
index d021fc0..3149c02 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -296,7 +296,7 @@
     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 ))
@@ -320,7 +320,7 @@
     Reference< XSpellAlternatives > xRes;
         // note: mutex is held by higher up by spell which covers both
 
-    sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+    sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
     int count;
     Sequence< OUString > aStr( 0 );
 
diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx 
b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
index 160eed15..273743b 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -375,7 +375,7 @@
     sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
     if (nFailure != -1 && !rWord.match(A2OU(SPELLML_HEADER), 0))
     {
-        sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+        sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
         // postprocess result for errors that should be ignored
         const bool bIgnoreError =
                 (!rHelper.IsSpellUpperCase()  && IsUpper( rWord, nLang )) ||
@@ -418,7 +418,7 @@
 
     if (n)
     {
-        sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+        sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
         int numsug = 0;
 
         Sequence< OUString > aStr( 0 );
diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx 
b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
index 7f17e22..886f37a 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -308,9 +308,9 @@
     sal_Int32 stem = 0;
     sal_Int32 stem2 = 0;
 
-    sal_Int16 nLanguage = LanguageTag( rLocale ).getLanguageType();
+    sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
 
-    if (nLanguage == LANGUAGE_NONE || rTerm.isEmpty())
+    if (LinguIsUnspecified( nLanguage) || rTerm.isEmpty())
         return noMeanings;
 
     if (!hasLocale( rLocale ))
diff --git a/linguistic/inc/linguistic/misc.hxx b/linguistic/inc/linguistic/misc.hxx
index 32637ab..6f4563a 100644
--- a/linguistic/inc/linguistic/misc.hxx
+++ b/linguistic/inc/linguistic/misc.hxx
@@ -90,6 +90,24 @@
 
 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 c497c86..37310db 100644
--- a/linguistic/source/convdic.cxx
+++ b/linguistic/source/convdic.cxx
@@ -152,7 +152,7 @@
     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 52ea621..9fa05f4 100644
--- a/linguistic/source/convdiclist.cxx
+++ b/linguistic/source/convdiclist.cxx
@@ -483,7 +483,7 @@
 {
     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 dafa95d..231779b 100644
--- a/linguistic/source/dicimp.cxx
+++ b/linguistic/source/dicimp.cxx
@@ -419,7 +419,10 @@
     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 @@
         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 ed7a8a7..39d816b 100644
--- a/linguistic/source/dlistimp.cxx
+++ b/linguistic/source/dlistimp.cxx
@@ -566,7 +566,7 @@
 {
     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 @@
         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 @@
     // 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 c9bafd4..792d406 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -1072,12 +1072,12 @@
 {
     ::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 > 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 ac08631..757e836 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -236,7 +236,7 @@
         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 >    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 >    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 >   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 @@
 {
     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 > 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 4f68407..93697e6 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -115,7 +115,7 @@
                 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 @@
         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 @@
 #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 536daf4..a7dc5a1 100644
--- a/linguistic/source/misc.cxx
+++ b/linguistic/source/misc.cxx
@@ -85,6 +85,36 @@
     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< 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 @@
     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 @@
         }
         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 5c3c974..815a5b3 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -227,7 +227,7 @@
         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 @@
         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 @@
         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 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 > xRes;
 
-    if (nLanguage == LANGUAGE_NONE || rWord.isEmpty())
+    if (LinguIsUnspecified( nLanguage) || rWord.isEmpty())
         return xRes;
 
     // search for entry with that language
@@ -774,7 +774,7 @@
     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 > 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 f135003..886af70 100644
--- a/linguistic/source/spelldta.cxx
+++ b/linguistic/source/spelldta.cxx
@@ -78,10 +78,10 @@
     {
         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 e8656af..dfd106f 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -101,7 +101,7 @@
         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 > >   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 @@
 {
     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 > 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 68071d2..003ceab 100644
--- a/linguistic/workben/sspellimp.cxx
+++ b/linguistic/workben/sspellimp.cxx
@@ -185,7 +185,7 @@
     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 @@
     String aTmp( rWord );
     if (aTmp.Len())
     {
-        sal_Int16 nLang = LanguageTag( rLocale ).getLanguageType();
+        sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
 
         if (STRING_NOTFOUND != aTmp.SearchAscii( "liss" ))
         {

-- 
To view, visit https://gerrit.libreoffice.org/1616
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I256b352961f09e41cadb3e44c9ef01ee7677fd31
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Eike Rathke <erack@redhat.com>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.