Kaydet (Commit) 4767bbb0 authored tarafından Eike Rathke's avatar Eike Rathke

use LanguageTag

Change-Id: I740e221ad16974c88b98c114850e663f25723b76
üst 378e437f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/fsys.hxx> #include <tools/fsys.hxx>
#include <tools/string.hxx> #include <tools/string.hxx>
#include <i18npool/mslangid.hxx> #include <i18npool/languagetag.hxx>
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <ucbhelper/content.hxx> #include <ucbhelper/content.hxx>
...@@ -225,7 +225,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement( ...@@ -225,7 +225,7 @@ void ConvDicXMLDictionaryContext_Impl::StartElement(
OUString aValue = rxAttrList->getValueByIndex(i); OUString aValue = rxAttrList->getValueByIndex(i);
if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" ) if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "lang" )
nLanguage = MsLangId::convertIsoStringToLanguage( aValue ); nLanguage = LanguageTag( aValue ).getLanguageType();
else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" ) else if ( nPrefix == XML_NAMESPACE_TCD && aLocalName == "conversion-type" )
nConversionType = GetConversionTypeFromText( aValue ); nConversionType = GetConversionTypeFromText( aValue );
} }
...@@ -327,7 +327,7 @@ sal_uInt32 ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eCl ...@@ -327,7 +327,7 @@ sal_uInt32 ConvDicXMLExport::exportDoc( enum ::xmloff::token::XMLTokenEnum /*eCl
_GetNamespaceMap().GetNameByKey( XML_NAMESPACE_TCD ) ); _GetNamespaceMap().GetNameByKey( XML_NAMESPACE_TCD ) );
AddAttributeASCII( XML_NAMESPACE_TCD, "package", "org.openoffice.Office" ); AddAttributeASCII( XML_NAMESPACE_TCD, "package", "org.openoffice.Office" );
OUString aIsoLang( MsLangId::convertLanguageToIsoString( rDic.nLanguage ) ); OUString aIsoLang( LanguageTag( rDic.nLanguage ).getBcp47() );
AddAttribute( XML_NAMESPACE_TCD, "lang", aIsoLang ); AddAttribute( XML_NAMESPACE_TCD, "lang", aIsoLang );
OUString aConvType( ConversionTypeToText( rDic.nConversionType ) ); OUString aConvType( ConversionTypeToText( rDic.nConversionType ) );
AddAttribute( XML_NAMESPACE_TCD, "conversion-type", aConvType ); AddAttribute( XML_NAMESPACE_TCD, "conversion-type", aConvType );
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <dicimp.hxx> #include <dicimp.hxx>
#include <hyphdsp.hxx> #include <hyphdsp.hxx>
#include <i18npool/lang.h> #include <i18npool/lang.h>
#include <i18npool/mslangid.hxx> #include <i18npool/languagetag.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <tools/fsys.hxx> #include <tools/fsys.hxx>
...@@ -123,8 +123,8 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe ...@@ -123,8 +123,8 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>"))) if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>")))
nLng = LANGUAGE_NONE; nLng = LANGUAGE_NONE;
else else
nLng = MsLangId::convertIsoStringToLanguage(rtl::OStringToOUString( nLng = LanguageTag(rtl::OStringToOUString(
aTagValue, RTL_TEXTENCODING_ASCII_US)); aTagValue, RTL_TEXTENCODING_ASCII_US)).getLanguageType();
} }
// type: negative / positive // type: negative / positive
...@@ -424,7 +424,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL) ...@@ -424,7 +424,7 @@ sal_uLong DictionaryNeo::saveEntries(const OUString &rURL)
else else
{ {
rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("lang: ")); rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("lang: "));
aLine.append(rtl::OUStringToOString(MsLangId::convertLanguageToIsoString(nLanguage), eEnc)); aLine.append(rtl::OUStringToOString(LanguageTag(nLanguage).getBcp47(), eEnc));
pStream->WriteLine(aLine.makeStringAndClear()); pStream->WriteLine(aLine.makeStringAndClear());
} }
if (0 != (nErr = pStream->GetError())) if (0 != (nErr = pStream->GetError()))
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
#include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/interfacecontainer.h> #include <cppuhelper/interfacecontainer.h>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <i18npool/mslangid.hxx> #include <i18npool/languagetag.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/extract.hxx> #include <comphelper/extract.hxx>
...@@ -446,7 +446,7 @@ uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarC ...@@ -446,7 +446,7 @@ uno::Reference< linguistic2::XProofreader > GrammarCheckingIterator::GetGrammarC
m_bGCServicesChecked = sal_True; m_bGCServicesChecked = sal_True;
} }
const LanguageType nLang = MsLangId::convertLocaleToLanguage( rLocale ); const LanguageType nLang = LanguageTag( rLocale ).getLanguageType( false);
GCImplNames_t::const_iterator aLangIt( m_aGCImplNamesByLang.find( nLang ) ); GCImplNames_t::const_iterator aLangIt( m_aGCImplNamesByLang.find( nLang ) );
if (aLangIt != m_aGCImplNamesByLang.end()) // matching configured language found? if (aLangIt != m_aGCImplNamesByLang.end()) // matching configured language found?
{ {
...@@ -1015,7 +1015,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl() ...@@ -1015,7 +1015,7 @@ void GrammarCheckingIterator::GetConfiguredGCSvcs_Impl()
{ {
// only the first entry is used, there should be only one grammar checker per language // only the first entry is used, there should be only one grammar checker per language
const OUString aImplName( aImplNames[0] ); const OUString aImplName( aImplNames[0] );
const LanguageType nLang = MsLangId::convertIsoStringToLanguage( pElementNames[i] ); const LanguageType nLang = LanguageTag( pElementNames[i] ).getLanguageType();
aTmpGCImplNamesByLang[ nLang ] = aImplName; aTmpGCImplNamesByLang[ nLang ] = aImplName;
} }
} }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#include <unotools/lingucfg.hxx> #include <unotools/lingucfg.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <i18npool/lang.h> #include <i18npool/lang.h>
#include <i18npool/mslangid.hxx> #include <i18npool/languagetag.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <comphelper/extract.hxx> #include <comphelper/extract.hxx>
#include <rtl/logfile.hxx> #include <rtl/logfile.hxx>
...@@ -611,8 +611,8 @@ namespace ...@@ -611,8 +611,8 @@ namespace
{ {
Sequence< OUString > aRes; Sequence< OUString > aRes;
OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString( OUString aCfgLocaleStr( LanguageTag(
LocaleToLanguage( rAvailLocale ) ) ); LocaleToLanguage( rAvailLocale ) ).getBcp47() );
Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) ); Sequence< OUString > aNodeNames( rCfg.GetNodeNames(rLastFoundList) );
sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames); sal_Bool bFound = lcl_FindEntry( aCfgLocaleStr, aNodeNames);
...@@ -745,7 +745,7 @@ void LngSvcMgr::UpdateAll() ...@@ -745,7 +745,7 @@ void LngSvcMgr::UpdateAll()
const OUString *pNodeName = aNodeNames.getConstArray(); const OUString *pNodeName = aNodeNames.getConstArray();
for (i = 0; i < nNodeNames; ++i) for (i = 0; i < nNodeNames; ++i)
{ {
Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(pNodeName[i]) ) ); Locale aLocale( CreateLocale( LanguageTag( pNodeName[i]).getLanguageType() ) );
Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale )); Sequence< OUString > aCfgSvcs( getConfiguredServices( aService, aLocale ));
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale )); Sequence< OUString > aAvailSvcs( getAvailableServices( aService, aLocale ));
...@@ -764,8 +764,8 @@ void LngSvcMgr::UpdateAll() ...@@ -764,8 +764,8 @@ void LngSvcMgr::UpdateAll()
const Locale *pAvailLocale = aAvailLocales.getConstArray(); const Locale *pAvailLocale = aAvailLocales.getConstArray();
for (i = 0; i < nAvailLocales; ++i) for (i = 0; i < nAvailLocales; ++i)
{ {
OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString( OUString aCfgLocaleStr( LanguageTag(
LocaleToLanguage( pAvailLocale[i] ) ) ); LocaleToLanguage( pAvailLocale[i] ) ).getBcp47() );
Sequence< OUString > aAvailSvcs( getAvailableServices( aService, pAvailLocale[i] )); Sequence< OUString > aAvailSvcs( getAvailableServices( aService, pAvailLocale[i] ));
...@@ -881,7 +881,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) ...@@ -881,7 +881,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE; LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty()) if (!aKeyText.isEmpty())
nLang = MsLangId::convertIsoStringToLanguage( aKeyText ); nLang = LanguageTag( aKeyText ).getLanguageType();
GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below GetSpellCheckerDsp_Impl( sal_False ); // don't set service list, it will be done below
pSpellDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames ); pSpellDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
...@@ -906,7 +906,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) ...@@ -906,7 +906,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE; LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty()) if (!aKeyText.isEmpty())
nLang = MsLangId::convertIsoStringToLanguage( aKeyText ); nLang = LanguageTag( aKeyText ).getLanguageType();
if (SvtLinguConfig().HasGrammarChecker()) if (SvtLinguConfig().HasGrammarChecker())
{ {
...@@ -934,7 +934,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) ...@@ -934,7 +934,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE; LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty()) if (!aKeyText.isEmpty())
nLang = MsLangId::convertIsoStringToLanguage( aKeyText ); nLang = LanguageTag( aKeyText ).getLanguageType();
GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below GetHyphenatorDsp_Impl( sal_False ); // don't set service list, it will be done below
pHyphDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames ); pHyphDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
...@@ -959,7 +959,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames ) ...@@ -959,7 +959,7 @@ void LngSvcMgr::Notify( const uno::Sequence< OUString > &rPropertyNames )
LanguageType nLang = LANGUAGE_NONE; LanguageType nLang = LANGUAGE_NONE;
if (!aKeyText.isEmpty()) if (!aKeyText.isEmpty())
nLang = MsLangId::convertIsoStringToLanguage( aKeyText ); nLang = LanguageTag( aKeyText ).getLanguageType();
GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below GetThesaurusDsp_Impl( sal_False ); // don't set service list, it will be done below
pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames ); pThesDsp->SetServiceList( CreateLocale(nLang), aSvcImplNames );
...@@ -1338,7 +1338,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp ) ...@@ -1338,7 +1338,7 @@ void LngSvcMgr::SetCfgServiceLists( SpellCheckerDispatcher &rSpellDsp )
String aLocaleStr( pNames[i] ); String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 ); aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) ); lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rSpellDsp.SetServiceList( aLocale, aSvcImplNames ); rSpellDsp.SetServiceList( aLocale, aSvcImplNames );
} }
} }
...@@ -1381,7 +1381,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp ) ...@@ -1381,7 +1381,7 @@ void LngSvcMgr::SetCfgServiceLists( GrammarCheckingIterator &rGrammarDsp )
String aLocaleStr( pNames[i] ); String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 ); aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) ); lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rGrammarDsp.SetServiceList( aLocale, aSvcImplNames ); rGrammarDsp.SetServiceList( aLocale, aSvcImplNames );
} }
} }
...@@ -1424,7 +1424,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp ) ...@@ -1424,7 +1424,7 @@ void LngSvcMgr::SetCfgServiceLists( HyphenatorDispatcher &rHyphDsp )
String aLocaleStr( pNames[i] ); String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 ); aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) ); lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rHyphDsp.SetServiceList( aLocale, aSvcImplNames ); rHyphDsp.SetServiceList( aLocale, aSvcImplNames );
} }
} }
...@@ -1463,7 +1463,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp ) ...@@ -1463,7 +1463,7 @@ void LngSvcMgr::SetCfgServiceLists( ThesaurusDispatcher &rThesDsp )
String aLocaleStr( pNames[i] ); String aLocaleStr( pNames[i] );
xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) ); xub_StrLen nSeperatorPos = aLocaleStr.SearchBackward( sal_Unicode( '/' ) );
aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 ); aLocaleStr = aLocaleStr.Copy( nSeperatorPos + 1 );
lang::Locale aLocale( CreateLocale( MsLangId::convertIsoStringToLanguage(aLocaleStr) ) ); lang::Locale aLocale( CreateLocale( LanguageTag(aLocaleStr).getLanguageType() ) );
rThesDsp.SetServiceList( aLocale, aSvcImplNames ); rThesDsp.SetServiceList( aLocale, aSvcImplNames );
} }
} }
...@@ -1846,8 +1846,8 @@ sal_Bool LngSvcMgr::SaveCfgSvcs( const String &rServiceName ) ...@@ -1846,8 +1846,8 @@ sal_Bool LngSvcMgr::SaveCfgSvcs( const String &rServiceName )
aCfgAny <<= aSvcImplNames; aCfgAny <<= aSvcImplNames;
DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" ); DBG_ASSERT( aCfgAny.hasValue(), "missing value for 'Any' type" );
OUString aCfgLocaleStr( MsLangId::convertLanguageToIsoString( OUString aCfgLocaleStr( LanguageTag(
LocaleToLanguage( pLocale[i] ) ) ); LocaleToLanguage( pLocale[i] ) ).getBcp47() );
pValue->Value = aCfgAny; pValue->Value = aCfgAny;
pValue->Name = aNodeName; pValue->Name = aNodeName;
pValue->Name += OUString::valueOf( (sal_Unicode) '/' ); pValue->Name += OUString::valueOf( (sal_Unicode) '/' );
...@@ -1936,7 +1936,7 @@ uno::Sequence< OUString > SAL_CALL ...@@ -1936,7 +1936,7 @@ uno::Sequence< OUString > SAL_CALL
uno::Sequence< OUString > aSvcImplNames; uno::Sequence< OUString > aSvcImplNames;
LanguageType nLanguage = LocaleToLanguage( rLocale ); LanguageType nLanguage = LocaleToLanguage( rLocale );
OUString aCfgLocale( MsLangId::convertLanguageToIsoString( nLanguage ) ); OUString aCfgLocale( LanguageTag( nLanguage ).getBcp47() );
uno::Sequence< uno::Any > aValues; uno::Sequence< uno::Any > aValues;
uno::Sequence< OUString > aNames( 1 ); uno::Sequence< OUString > aNames( 1 );
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
#include <svl/lngmisc.hxx> #include <svl/lngmisc.hxx>
#include <ucbhelper/content.hxx> #include <ucbhelper/content.hxx>
#include <i18npool/mslangid.hxx> #include <i18npool/languagetag.hxx>
#include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp> #include <com/sun/star/beans/XFastPropertySet.hpp>
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "defs.hxx" #include "defs.hxx"
#include "linguistic/lngprops.hxx" #include "linguistic/lngprops.hxx"
#include "linguistic/hyphdta.hxx" #include "linguistic/hyphdta.hxx"
#include <i18npool/mslangid.hxx>
using namespace osl; using namespace osl;
using namespace com::sun::star; using namespace com::sun::star;
...@@ -374,14 +373,14 @@ LanguageType LocaleToLanguage( const Locale& rLocale ) ...@@ -374,14 +373,14 @@ LanguageType LocaleToLanguage( const Locale& rLocale )
if ( rLocale.Language.isEmpty() ) if ( rLocale.Language.isEmpty() )
return LANGUAGE_NONE; return LANGUAGE_NONE;
return MsLangId::convertLocaleToLanguage( rLocale ); return LanguageTag( rLocale ).getLanguageType();
} }
Locale& LanguageToLocale( Locale& rLocale, LanguageType eLang ) Locale& LanguageToLocale( Locale& rLocale, LanguageType eLang )
{ {
if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
MsLangId::convertLanguageToLocale( eLang, rLocale ); rLocale = LanguageTag( eLang ).getLocale();
return rLocale; return rLocale;
} }
...@@ -390,7 +389,7 @@ Locale CreateLocale( LanguageType eLang ) ...@@ -390,7 +389,7 @@ Locale CreateLocale( LanguageType eLang )
{ {
Locale aLocale; Locale aLocale;
if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */) if ( eLang != LANGUAGE_NONE /* && eLang != LANGUAGE_SYSTEM */)
return MsLangId::convertLanguageToLocale( eLang ); return LanguageTag( eLang ).getLocale();
return aLocale; return aLocale;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment