use strong_int for LanguageType

Change-Id: If99a944f7032180355da291ad283b4cfcea4f448
Reviewed-on: https://gerrit.libreoffice.org/36629
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin 2017-04-17 21:35:35 +02:00 committed by Noel Grandin
parent cd4344d3bd
commit c70d49c7c8
184 changed files with 2528 additions and 2680 deletions

View File

@ -4251,7 +4251,7 @@ RTLFUNC(StrConv)
OUString aOldStr = rPar.Get(1)->GetOUString();
sal_Int32 nConversion = rPar.Get(2)->GetLong();
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
LanguageType nLanguage = LANGUAGE_SYSTEM;
sal_Int32 nOldLen = aOldStr.getLength();
if( nOldLen == 0 )

View File

@ -590,7 +590,7 @@ IMPL_LINK_NOARG(SpellDialog, ChangeAllHdl, Button*, void)
Reference<XDictionary> aXDictionary( LinguMgr::GetChangeAllList(), UNO_QUERY );
DictionaryError nAdded = AddEntryToDic( aXDictionary,
aOldWord, true,
aString, eLang );
aString );
if(nAdded == DictionaryError::NONE)
{
@ -638,7 +638,7 @@ IMPL_LINK( SpellDialog, IgnoreAllHdl, Button *, pButton, void )
OUString sErrorText(m_pSentenceED->GetErrorText());
DictionaryError nAdded = AddEntryToDic( aXDictionary,
sErrorText, false,
OUString(), LANGUAGE_NONE );
OUString() );
if(nAdded == DictionaryError::NONE)
{
SpellUndoAction_Impl* pAction = new SpellUndoAction_Impl(
@ -753,7 +753,7 @@ bool SpellDialog::Close()
LanguageType SpellDialog::GetSelectedLang_Impl() const
{
sal_Int16 nLang = m_pLanguageLB->GetSelectLanguage();
LanguageType nLang = m_pLanguageLB->GetSelectLanguage();
return nLang;
}
@ -771,7 +771,7 @@ IMPL_LINK(SpellDialog, LanguageSelectHdl, ListBox&, rBox, void)
if(!sError.isEmpty())
{
LanguageType eLanguage = static_cast<SvxLanguageBox*>(&rBox)->GetSelectLanguage();
Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, eLanguage,
Reference <XSpellAlternatives> xAlt = xSpell->spell( sError, (sal_uInt16)eLanguage,
Sequence< PropertyValue >() );
if( xAlt.is() )
m_pSentenceED->SetAlternatives( xAlt );
@ -898,7 +898,7 @@ void SpellDialog::AddToDictionaryExecute( sal_uInt16 nItemId, PopupMenu *pMenu )
DictionaryError nAddRes = DictionaryError::UNKNOWN;
if (xDic.is())
{
nAddRes = AddEntryToDic( xDic, aNewWord, false, OUString(), LANGUAGE_NONE );
nAddRes = AddEntryToDic( xDic, aNewWord, false, OUString() );
// save modified user-dictionary if it is persistent
uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY );
if (xSavDic.is())
@ -1605,7 +1605,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css
aCursor.GetIndex() += xEntry->getReplacementText().getLength();
// maybe the error found here is already added to the dictionary and has to be ignored
} else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ), Sequence< PropertyValue >() )) {
} else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid( GetErrorText(), (sal_uInt16)LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale ), Sequence< PropertyValue >() )) {
++aCursor.GetIndex();
}
else

View File

@ -917,7 +917,7 @@ VclPtr<AbstractHangulHanjaConversionDialog> AbstractDialogFactory_Impl::CreateHa
VclPtr<AbstractThesaurusDialog> AbstractDialogFactory_Impl::CreateThesaurusDialog( vcl::Window* pParent,
css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus,
const OUString &rWord, sal_Int16 nLanguage )
const OUString &rWord, LanguageType nLanguage )
{
VclPtrInstance<SvxThesaurusDialog> pDlg( pParent, xThesaurus, rWord, nLanguage );
return VclPtr<AbstractThesaurusDialog_Impl>::Create( pDlg );

View File

@ -495,7 +495,7 @@ public:
virtual VclPtr<AbstractHangulHanjaConversionDialog> CreateHangulHanjaConversionDialog( vcl::Window* _pParent,
editeng::HangulHanjaConversion::ConversionDirection _ePrimaryDirection ) override;
virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog( vcl::Window*, css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus,
const OUString &rWord, sal_Int16 nLanguage ) override;
const OUString &rWord, LanguageType nLanguage ) override;
virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog( vcl::Window*,
const OUString &rWord, LanguageType nLang,

View File

@ -130,7 +130,7 @@ private:
void ShowWords_Impl( sal_uInt16 nId );
void SetLanguage_Impl( css::util::Language nLanguage );
void SetLanguage_Impl( LanguageType nLanguage );
bool IsDicReadonly_Impl() const { return bDicIsReadonly; }
void SetDicReadonly_Impl( css::uno::Reference<
css::linguistic2::XDictionary > &xDic );

View File

@ -113,7 +113,7 @@ void SvxAsianLayoutPage_Impl::addForbiddenCharacters(
}
}
static LanguageType eLastUsedLanguageTypeForForbiddenCharacters = USHRT_MAX;
static LanguageType eLastUsedLanguageTypeForForbiddenCharacters(USHRT_MAX);
SvxAsianLayoutPage::SvxAsianLayoutPage( vcl::Window* pParent, const SfxItemSet& rSet ) :
SfxTabPage(pParent, "OptAsianPage", "cui/ui/optasianpage.ui", &rSet),
@ -291,7 +291,7 @@ void SvxAsianLayoutPage::Reset( const SfxItemSet* )
m_pLanguageLB->SelectEntryPos(0);
//preselect the system language in the box - if available
if(USHRT_MAX == eLastUsedLanguageTypeForForbiddenCharacters)
if(LanguageType(USHRT_MAX) == eLastUsedLanguageTypeForForbiddenCharacters)
{
eLastUsedLanguageTypeForForbiddenCharacters =
Application::GetSettings().GetLanguageTag().getLanguageType();

View File

@ -158,7 +158,7 @@ IMPL_LINK_NOARG(SvxNewDictionaryDialog, OKHdl_Impl, Button*, void)
}
// create and add
sal_uInt16 nLang = pLanguageLB->GetSelectLanguage();
LanguageType nLang = pLanguageLB->GetSelectLanguage();
try
{
// create new dictionary
@ -375,7 +375,7 @@ void SvxEditDictionaryDialog::SetDicReadonly_Impl(
}
void SvxEditDictionaryDialog::SetLanguage_Impl( util::Language nLanguage )
void SvxEditDictionaryDialog::SetLanguage_Impl( LanguageType nLanguage )
{
// select language
pLangLB->SelectLanguage( nLanguage );
@ -447,9 +447,9 @@ IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectBookHdl_Impl, ListBox&, void)
IMPL_LINK_NOARG(SvxEditDictionaryDialog, SelectLangHdl_Impl, ListBox&, void)
{
sal_Int32 nDicPos = pAllDictsLB->GetSelectEntryPos();
sal_Int32 nLang = pLangLB->GetSelectLanguage();
LanguageType nLang = pLangLB->GetSelectLanguage();
Reference< XDictionary > xDic( aDics.getConstArray()[ nDicPos ], UNO_QUERY );
sal_Int16 nOldLang = LanguageTag( xDic->getLocale() ).getLanguageType();
LanguageType nOldLang = LanguageTag( xDic->getLocale() ).getLanguageType();
if ( nLang != nOldLang )
{
@ -627,7 +627,7 @@ bool SvxEditDictionaryDialog::NewDelHdl(void* pBtn)
nAddRes = linguistic::AddEntryToDic( xDic,
aNewWord, bIsNegEntry,
aRplcText, LanguageTag( xDic->getLocale() ).getLanguageType(), false );
aRplcText, false );
}
}
if (DictionaryError::NONE != nAddRes)

View File

@ -211,17 +211,14 @@ void SvxGeneralTabPage::InitControls ()
{
// which language bit do we use? (see Lang and vRowInfo[] above)
unsigned LangBit;
switch (Application::GetSettings().GetUILanguageTag().getLanguageType())
LanguageType l = Application::GetSettings().GetUILanguageTag().getLanguageType();
if (l == LANGUAGE_ENGLISH_US)
LangBit = Lang::US;
else if (l == LANGUAGE_RUSSIAN)
LangBit = Lang::Russian;
else
{
case LANGUAGE_ENGLISH_US:
LangBit = Lang::US;
break;
case LANGUAGE_RUSSIAN:
LangBit = Lang::Russian;
break;
default:
LangBit = Lang::Others;
break;
LangBit = Lang::Others;
}
// creating rows

View File

@ -85,31 +85,26 @@ static const sal_Char cThes[] = SN_THESAURUS;
// static ----------------------------------------------------------------
static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &rSeq )
static std::vector< LanguageType > lcl_LocaleSeqToLangSeq( const Sequence< Locale > &rSeq )
{
sal_Int32 nLen = rSeq.getLength();
Sequence< sal_Int16 > aRes( nLen );
sal_Int16 *pRes = aRes.getArray();
std::vector<LanguageType> aRes;
aRes.reserve(nLen);
const Locale *pSeq = rSeq.getConstArray();
for (sal_Int32 i = 0; i < nLen; ++i)
{
pRes[i] = LanguageTag::convertToLanguageType( pSeq[i] );
aRes.push_back( LanguageTag::convertToLanguageType( pSeq[i] ) );
}
return aRes;
}
static bool lcl_SeqHasLang( const Sequence< sal_Int16 > &rSeq, sal_Int16 nLang )
static bool lcl_SeqHasLang( const std::vector< LanguageType > &rSeq, LanguageType nLang )
{
sal_Int32 nLen = rSeq.getLength();
const sal_Int16 *pLang = rSeq.getConstArray();
sal_Int32 nPos = -1;
for (sal_Int32 i = 0; i < nLen && nPos < 0; ++i)
{
if (nLang == pLang[i])
nPos = i;
}
return nPos >= 0;
for (auto const & i : rSeq)
if (i == nLang)
return true;
return false;
}
@ -458,8 +453,8 @@ struct ServiceInfo_Impl
ServiceInfo_Impl() : bConfigured(false) {}
};
typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
typedef std::map< sal_Int16 /*LanguageType*/, Sequence< OUString > > LangImplNameTable;
typedef std::vector< ServiceInfo_Impl > ServiceInfoArr;
typedef std::map< LanguageType, Sequence< OUString > > LangImplNameTable;
// SvxLinguData_Impl ----------------------------------------------------
@ -511,7 +506,7 @@ public:
// I.e. the ones available but not configured in arbitrary order).
// They available ones may contain names that do not(!) support that
// language.
Sequence< OUString > GetSortedImplNames( sal_Int16 nLang, sal_uInt8 nType );
Sequence< OUString > GetSortedImplNames( LanguageType nLang, sal_uInt8 nType );
ServiceInfo_Impl * GetInfoByImplName( const OUString &rSvcImplName );
};
@ -531,7 +526,7 @@ static sal_Int32 lcl_SeqGetIndex( const Sequence< OUString > &rSeq, const OUStri
}
Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( sal_Int16 nLang, sal_uInt8 nType )
Sequence< OUString > SvxLinguData_Impl::GetSortedImplNames( LanguageType nLang, sal_uInt8 nType )
{
LangImplNameTable *pTable = nullptr;
switch (nType)
@ -792,7 +787,7 @@ SvxLinguData_Impl::SvxLinguData_Impl() :
const Locale* pAllLocales = aAllServiceLocales.getConstArray();
for(sal_Int32 nLocale = 0; nLocale < aAllServiceLocales.getLength(); nLocale++)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pAllLocales[nLocale] );
LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[nLocale] );
aCfgSvcs = xLinguSrvcMgr->getConfiguredServices(cSpell, pAllLocales[nLocale]);
SetChecked( aCfgSvcs );
@ -927,7 +922,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pLocale[i] );
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
if (!aCfgSpellTable.count( nLang ) && bEnable)
aCfgSpellTable[ nLang ] = Sequence< OUString >();
if (aCfgSpellTable.count( nLang ))
@ -943,7 +938,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pLocale[i] );
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
if (!aCfgGrammarTable.count( nLang ) && bEnable)
aCfgGrammarTable[ nLang ] = Sequence< OUString >();
if (aCfgGrammarTable.count( nLang ))
@ -959,7 +954,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pLocale[i] );
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
if (!aCfgHyphTable.count( nLang ) && bEnable)
aCfgHyphTable[ nLang ] = Sequence< OUString >();
if (aCfgHyphTable.count( nLang ))
@ -975,7 +970,7 @@ void SvxLinguData_Impl::Reconfigure( const OUString &rDisplayName, bool bEnable
nLocales = aLocales.getLength();
for (i = 0; i < nLocales; ++i)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pLocale[i] );
LanguageType nLang = LanguageTag::convertToLanguageType( pLocale[i] );
if (!aCfgThesTable.count( nLang ) && bEnable)
aCfgThesTable[ nLang ] = Sequence< OUString >();
if (aCfgThesTable.count( nLang ))
@ -1120,7 +1115,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
const LangImplNameTable *pTable = &pLinguData->GetSpellTable();
for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
sal_Int16 nLang = aIt->first;
LanguageType nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
Locale aLocale( LanguageTag::convertToLocale(nLang) );
@ -1132,7 +1127,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
pTable = &pLinguData->GetGrammarTable();
for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
sal_Int16 nLang = aIt->first;
LanguageType nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
Locale aLocale( LanguageTag::convertToLocale(nLang) );
@ -1144,7 +1139,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
pTable = &pLinguData->GetHyphTable();
for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
sal_Int16 nLang = aIt->first;
LanguageType nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
Locale aLocale( LanguageTag::convertToLocale(nLang) );
@ -1156,7 +1151,7 @@ bool SvxLinguTabPage::FillItemSet( SfxItemSet* rCoreSet )
pTable = &pLinguData->GetThesTable();
for (aIt = pTable->begin(); aIt != pTable->end(); ++aIt)
{
sal_Int16 nLang = aIt->first;
LanguageType nLang = aIt->first;
const Sequence< OUString > aImplNames( aIt->second );
uno::Reference< XLinguServiceManager2 > xMgr( pLinguData->GetManager() );
Locale aLocale( LanguageTag::convertToLocale(nLang) );
@ -1529,7 +1524,7 @@ IMPL_LINK( SvxLinguTabPage, ClickHdl_Impl, Button *, pBtn, void )
sal_Int32 nLocales = pLinguData->GetAllSupportedLocales().getLength();
for (sal_Int32 k = 0; k < nLocales; ++k)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pAllLocales[k] );
LanguageType nLang = LanguageTag::convertToLanguageType( pAllLocales[k] );
if (pLinguData->GetSpellTable().count( nLang ))
pLinguData->SetChecked( pLinguData->GetSpellTable()[ nLang ] );
if (pLinguData->GetGrammarTable().count( nLang ))
@ -1796,7 +1791,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rD
m_pMoreDictsLink->Hide();
//fill language box
Sequence< sal_Int16 > aAvailLang;
std::vector< LanguageType > aAvailLang;
uno::Reference< XAvailableLocales > xAvail( rLinguData.GetManager(), UNO_QUERY );
if (xAvail.is())
{
@ -1808,7 +1803,7 @@ SvxEditModulesDlg::SvxEditModulesDlg(vcl::Window* pParent, SvxLinguData_Impl& rD
m_pLanguageLB->Clear();
for(long i = 0; i < rLoc.getLength(); i++)
{
sal_Int16 nLang = LanguageTag::convertToLanguageType( pLocales[i] );
LanguageType nLang = LanguageTag::convertToLanguageType( pLocales[i] );
m_pLanguageLB->InsertLanguage( nLang, lcl_SeqHasLang( aAvailLang, nLang ) );
}
LanguageType eSysLang = MsLangId::getSystemLanguage();
@ -1942,7 +1937,7 @@ void SvxEditModulesDlg::LangSelectHdl_Impl(ListBox* pBox)
// save old probably changed settings
// before switching to new language entries
sal_Int16 nLang = LanguageTag::convertToLanguageType( aLastLocale );
LanguageType nLang = LanguageTag::convertToLanguageType( aLastLocale );
sal_Int32 nStart = 0, nLocalIndex = 0;
Sequence< OUString > aChange;

View File

@ -121,14 +121,14 @@ OfaAutoCorrDlg::OfaAutoCorrDlg(vcl::Window* pParent, const SfxItemSet* _pSet )
m_pLanguageLB->SelectLanguage( LANGUAGE_NONE );
sal_Int32 nPos = m_pLanguageLB->GetSelectEntryPos();
DBG_ASSERT( LISTBOX_ENTRY_NOTFOUND != nPos, "listbox entry missing" );
m_pLanguageLB->SetEntryData( nPos, reinterpret_cast<void*>(LANGUAGE_UNDETERMINED) );
m_pLanguageLB->SetEntryData( nPos, reinterpret_cast<void*>((sal_uInt16)LANGUAGE_UNDETERMINED) );
// Initializing doesn't work for static on linux - therefore here
if( LANGUAGE_SYSTEM == eLastDialogLanguage )
eLastDialogLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
LanguageType nSelectLang = LANGUAGE_UNDETERMINED;
nPos = m_pLanguageLB->GetEntryPos( reinterpret_cast<void*>(eLastDialogLanguage) );
nPos = m_pLanguageLB->GetEntryPos( reinterpret_cast<void*>((sal_uInt16)eLastDialogLanguage) );
if (LISTBOX_ENTRY_NOTFOUND != nPos)
nSelectLang = eLastDialogLanguage;
m_pLanguageLB->SelectLanguage( nSelectLang );
@ -179,7 +179,7 @@ IMPL_LINK(OfaAutoCorrDlg, SelectLanguageHdl, ListBox&, rBox, void)
{
sal_Int32 nPos = rBox.GetSelectEntryPos();
void* pVoid = rBox.GetEntryData(nPos);
LanguageType eNewLang = (LanguageType)reinterpret_cast<sal_IntPtr>(pVoid);
LanguageType eNewLang = LanguageType(reinterpret_cast<sal_IntPtr>(pVoid));
// save old settings and fill anew
if(eNewLang != eLastDialogLanguage)
{

View File

@ -825,7 +825,7 @@ void SvxCharNamePage::Reset_Impl( const SfxItemSet& rSet, LanguageGroup eLangGrp
case SfxItemState::SET:
{
const SvxLanguageItem& rItem = static_cast<const SvxLanguageItem&>(rSet.Get( nWhich ));
LanguageType eLangType = (LanguageType)rItem.GetValue();
LanguageType eLangType = rItem.GetValue();
DBG_ASSERT( eLangType != LANGUAGE_SYSTEM, "LANGUAGE_SYSTEM not allowed" );
if ( eLangType != LANGUAGE_DONTKNOW )
pLangBox->SelectLanguage( eLangType );
@ -1130,13 +1130,13 @@ bool SvxCharNamePage::FillItemSet_Impl( SfxItemSet& rSet, LanguageGroup eLangGrp
}
sal_Int32 nLangPos = pLangBox->GetSelectEntryPosLBB();
LanguageType eLangType = (LanguageType)reinterpret_cast<sal_uLong>(pLangBox->GetEntryDataLBB( nLangPos ));
LanguageType eLangType = LanguageType(reinterpret_cast<sal_uLong>(pLangBox->GetEntryDataLBB( nLangPos )));
if ( pOld )
{
const SvxLanguageItem& rItem = *static_cast<const SvxLanguageItem*>(pOld);
if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == (LanguageType)rItem.GetValue() )
if ( nLangPos == LISTBOX_ENTRY_NOTFOUND || eLangType == rItem.GetValue() )
bChanged = false;
}

View File

@ -1813,7 +1813,7 @@ void SvxNumberFormatTabPage::AddAutomaticLanguage_Impl(LanguageType eAutoLang, b
{
m_pLbLanguage->RemoveLanguage(LANGUAGE_SYSTEM);
const sal_Int32 nPos = m_pLbLanguage->InsertEntry(sAutomaticEntry);
m_pLbLanguage->SetEntryData(nPos, reinterpret_cast<void*>((sal_uLong)eAutoLang));
m_pLbLanguage->SetEntryData(nPos, reinterpret_cast<void*>((sal_uInt16)eAutoLang));
if(bSelect)
m_pLbLanguage->SelectEntryPos(nPos);
}

View File

@ -165,7 +165,7 @@ OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem)
case EE_CHAR_LANGUAGE_CJK:
case EE_CHAR_LANGUAGE_CTL:
aDebStr.append("Language=");
aDebStr.append(static_cast<sal_Int32>(static_cast<const SvxLanguageItem&>(rItem).GetLanguage()));
aDebStr.append((sal_Int32)static_cast<sal_uInt16>(static_cast<const SvxLanguageItem&>(rItem).GetLanguage()));
break;
case EE_CHAR_COLOR:
{

View File

@ -136,11 +136,11 @@ LanguageType EditView::CheckLanguage(
sal_Int32 nCount = SAL_N_ELEMENTS(aLangList);
for (sal_Int32 i = 0; i < nCount; i++)
{
sal_Int16 nTmpLang = aLangList[i];
LanguageType nTmpLang = aLangList[i];
if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW)
{
if (xSpell->hasLanguage( nTmpLang ) &&
xSpell->isValid( rText, nTmpLang, Sequence< PropertyValue >() ))
if (xSpell->hasLanguage( (sal_uInt16)nTmpLang ) &&
xSpell->isValid( rText, (sal_uInt16)nTmpLang, Sequence< PropertyValue >() ))
{
nLang = nTmpLang;
break;
@ -853,7 +853,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
// Are there any replace suggestions?
Reference< linguistic2::XSpellAlternatives > xSpellAlt =
xSpeller->spell( aSelected, pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ), aPropVals );
xSpeller->spell( aSelected, (sal_uInt16)pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 ), aPropVals );
Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() );
@ -936,7 +936,7 @@ void EditView::ExecuteSpellPopup( const Point& rPosPixel, Link<SpellCallbackInfo
aDics = xDicList->getDictionaries();
pDic = aDics.getConstArray();
sal_uInt16 nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
LanguageType nCheckedLanguage = pImpEditView->pEditEngine->pImpEditEngine->GetLanguage( aPaM2 );
sal_uInt16 nDicCount = (sal_uInt16)aDics.getLength();
for (sal_uInt16 i = 0; i < nDicCount; i++)
{

View File

@ -1890,7 +1890,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView )
{
LanguageType eLang = GetLanguage( aCurSel.Max() );
SvxSpellWrapper::CheckSpellLang( xSpeller, eLang );
xSpellAlt = xSpeller->spell( aWord, eLang, aEmptySeq );
xSpellAlt = xSpeller->spell( aWord, (sal_uInt16)eLang, aEmptySeq );
}
if ( !xSpellAlt.is() )
@ -1938,7 +1938,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r
}
if ( !aWord.isEmpty() )
xSpellAlt = xSpeller->spell( aWord, GetLanguage( aCurSel.Max() ), aEmptySeq );
xSpellAlt = xSpeller->spell( aWord, (sal_uInt16)GetLanguage( aCurSel.Max() ), aEmptySeq );
if ( !xSpellAlt.is() )
aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD );
@ -2315,7 +2315,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC
{
const sal_Int32 nWStart = aSel.Min().GetIndex();
const sal_Int32 nWEnd = aSel.Max().GetIndex();
if ( !xSpeller->isValid( aWord, GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ), aEmptySeq ) )
if ( !xSpeller->isValid( aWord, (sal_uInt16)GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ), aEmptySeq ) )
{
// Check if already marked correctly...
const sal_Int32 nXEnd = bDottAdded ? nWEnd -1 : nWEnd;
@ -2463,7 +2463,7 @@ EESpellState ImpEditEngine::HasSpellErrors()
{
LanguageType eLang = GetLanguage( aCurSel.Max() );
SvxSpellWrapper::CheckSpellLang( xSpeller, eLang );
xSpellAlt = xSpeller->spell( aWord, eLang, aEmptySeq );
xSpellAlt = xSpeller->spell( aWord, (sal_uInt16)eLang, aEmptySeq );
}
aCurSel = WordRight( aCurSel.Max(), css::i18n::WordType::DICTIONARY_WORD );
}
@ -2741,7 +2741,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
sal_Int32 nCurrentStart = nStartPos;
sal_Int32 nCurrentEnd = nEndPos;
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
LanguageType nLanguage = LANGUAGE_SYSTEM;
// since we don't use Hiragana/Katakana or half-width/full-width transliterations here
// it is fine to use ANYWORD_IGNOREWHITESPACES. (ANY_WORD btw is broken and will

View File

@ -2366,7 +2366,7 @@ SfxPoolItem* SvxLanguageItem::Clone( SfxItemPool * ) const
SvStream& SvxLanguageItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
{
rStrm.WriteUInt16( GetValue() );
rStrm.WriteUInt16( (sal_uInt16)GetValue() );
return rStrm;
}
@ -2375,7 +2375,7 @@ SfxPoolItem* SvxLanguageItem::Create(SvStream& rStrm, sal_uInt16) const
{
sal_uInt16 nValue;
rStrm.ReadUInt16( nValue );
return new SvxLanguageItem( (LanguageType)nValue, Which() );
return new SvxLanguageItem( LanguageType(nValue), Which() );
}
@ -2387,7 +2387,7 @@ bool SvxLanguageItem::GetPresentation
OUString& rText, const IntlWrapper * /*pIntl*/
) const
{
rText = SvtLanguageTable::GetLanguageString( (LanguageType)GetValue() );
rText = SvtLanguageTable::GetLanguageString( GetValue() );
return true;
}
@ -2397,7 +2397,7 @@ bool SvxLanguageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
switch(nMemberId)
{
case MID_LANG_INT: // for basic conversions!
rVal <<= (sal_Int16)(GetValue());
rVal <<= (sal_Int16)(sal_uInt16)GetValue();
break;
case MID_LANG_LOCALE:
lang::Locale aRet( LanguageTag::convertToLocale( GetValue(), false));
@ -2418,7 +2418,7 @@ bool SvxLanguageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
if(!(rVal >>= nValue))
return false;
SetValue((sal_Int16)nValue);
SetValue(LanguageType(nValue));
}
break;
case MID_LANG_LOCALE:
@ -3434,7 +3434,7 @@ void GetDefaultFonts( SvxFontItem& rLatin, SvxFontItem& rAsian, SvxFontItem& rCo
static struct
{
DefaultFontType nFontType;
sal_uInt16 nLanguage;
LanguageType nLanguage;
}
aOutTypeArr[ nItemCnt ] =
{

View File

@ -30,7 +30,7 @@ SvxForbiddenCharactersTable::SvxForbiddenCharactersTable( const css::uno::Refere
m_xContext = rxContext;
}
const css::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( sal_uInt16 nLanguage, bool bGetDefault )
const css::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault )
{
css::i18n::ForbiddenCharacters* pForbiddenCharacters = nullptr;
Map::iterator it = maMap.find( nLanguage );
@ -45,12 +45,12 @@ const css::i18n::ForbiddenCharacters* SvxForbiddenCharactersTable::GetForbiddenC
return pForbiddenCharacters;
}
void SvxForbiddenCharactersTable::SetForbiddenCharacters( sal_uInt16 nLanguage, const css::i18n::ForbiddenCharacters& rForbiddenChars )
void SvxForbiddenCharactersTable::SetForbiddenCharacters( LanguageType nLanguage, const css::i18n::ForbiddenCharacters& rForbiddenChars )
{
maMap[ nLanguage ] = rForbiddenChars;
}
void SvxForbiddenCharactersTable::ClearForbiddenCharacters( sal_uInt16 nLanguage )
void SvxForbiddenCharactersTable::ClearForbiddenCharacters( LanguageType nLanguage )
{
maMap.erase( nLanguage );
}

View File

@ -175,7 +175,7 @@ SvxSpellWrapper::SvxSpellWrapper( vcl::Window* pWn,
sal_Int16 SvxSpellWrapper::CheckSpellLang(
Reference< XSpellChecker1 > const & xSpell, sal_Int16 nLang)
Reference< XSpellChecker1 > const & xSpell, LanguageType nLang)
{
LangCheckState_map_t &rLCS = GetLangCheckState();
@ -188,7 +188,7 @@ sal_Int16 SvxSpellWrapper::CheckSpellLang(
if (SVX_LANG_NEED_CHECK == (nVal & 0x00FF))
{
sal_uInt16 nTmpVal = SVX_LANG_MISSING_DO_WARN;
if (xSpell.is() && xSpell->hasLanguage( nLang ))
if (xSpell.is() && xSpell->hasLanguage( (sal_uInt16)nLang ))
nTmpVal = SVX_LANG_OK;
nVal &= 0xFF00;
nVal |= nTmpVal;
@ -200,7 +200,7 @@ sal_Int16 SvxSpellWrapper::CheckSpellLang(
}
sal_Int16 SvxSpellWrapper::CheckHyphLang(
Reference< XHyphenator > const & xHyph, sal_Int16 nLang)
Reference< XHyphenator > const & xHyph, LanguageType nLang)
{
LangCheckState_map_t &rLCS = GetLangCheckState();

View File

@ -203,7 +203,7 @@ static const LanguageTag& GetAppLang()
{
return Application::GetSettings().GetLanguageTag();
}
static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang )
static LocaleDataWrapper& GetLocaleDataWrapper( LanguageType nLang )
{
static LocaleDataWrapper aLclDtWrp( GetAppLang() );
LanguageTag aLcl( nLang );
@ -276,21 +276,18 @@ long SvxAutoCorrect::GetDefaultFlags()
| SaveWordWrdSttLst
| CorrectCapsLock;
LanguageType eLang = GetAppLang().getLanguageType();
switch( eLang )
{
case LANGUAGE_ENGLISH:
case LANGUAGE_ENGLISH_US:
case LANGUAGE_ENGLISH_UK:
case LANGUAGE_ENGLISH_AUS:
case LANGUAGE_ENGLISH_CAN:
case LANGUAGE_ENGLISH_NZ:
case LANGUAGE_ENGLISH_EIRE:
case LANGUAGE_ENGLISH_SAFRICA:
case LANGUAGE_ENGLISH_JAMAICA:
case LANGUAGE_ENGLISH_CARRIBEAN:
if( eLang.anyOf(
LANGUAGE_ENGLISH,
LANGUAGE_ENGLISH_US,
LANGUAGE_ENGLISH_UK,
LANGUAGE_ENGLISH_AUS,
LANGUAGE_ENGLISH_CAN,
LANGUAGE_ENGLISH_NZ,
LANGUAGE_ENGLISH_EIRE,
LANGUAGE_ENGLISH_SAFRICA,
LANGUAGE_ENGLISH_JAMAICA,
LANGUAGE_ENGLISH_CARRIBEAN))
nRet &= ~(ChgQuotes|ChgSglQuotes);
break;
}
return nRet;
}
@ -421,10 +418,10 @@ bool SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, const OUString& r
// Check that word isn't correctly spelled before correcting:
css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller =
LinguMgr::GetSpellChecker();
if( xSpeller->hasLanguage(eLang) )
if( xSpeller->hasLanguage((sal_uInt16)eLang) )
{
Sequence< css::beans::PropertyValue > aEmptySeq;
if (xSpeller->isValid(sWord, eLang, aEmptySeq))
if (xSpeller->isValid(sWord, (sal_uInt16)eLang, aEmptySeq))
{
return false;
}
@ -457,12 +454,10 @@ bool SvxAutoCorrect::FnChgOrdinalNumber(
// In some languages ordinal suffixes should never be
// changed to superscript. Let's break for those languages.
switch (eLang)
if (!eLang.anyOf(
LANGUAGE_SWEDISH,
LANGUAGE_SWEDISH_FINLAND))
{
case LANGUAGE_SWEDISH:
case LANGUAGE_SWEDISH_FINLAND:
break;
default:
CharClass& rCC = GetCharClass(eLang);
for (; nSttPos < nEndPos; ++nSttPos)
@ -1187,13 +1182,13 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
{
if( LANGUAGE_SYSTEM == eLang )
eLang = GetAppLang().getLanguageType();
switch( eLang )
if( eLang.anyOf(
LANGUAGE_FRENCH,
LANGUAGE_FRENCH_BELGIAN,
LANGUAGE_FRENCH_CANADIAN,
LANGUAGE_FRENCH_SWISS,
LANGUAGE_FRENCH_LUXEMBOURG))
{
case LANGUAGE_FRENCH:
case LANGUAGE_FRENCH_BELGIAN:
case LANGUAGE_FRENCH_CANADIAN:
case LANGUAGE_FRENCH_SWISS:
case LANGUAGE_FRENCH_LUXEMBOURG:
{
OUString s( cNonBreakingSpace );
// UNICODE code for no break space
@ -1203,7 +1198,6 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
++nInsPos;
}
}
break;
}
}
@ -1222,18 +1216,17 @@ OUString SvxAutoCorrect::GetQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
{
if( LANGUAGE_SYSTEM == eLang )
eLang = GetAppLang().getLanguageType();
switch( eLang )
if( eLang.anyOf(
LANGUAGE_FRENCH,
LANGUAGE_FRENCH_BELGIAN,
LANGUAGE_FRENCH_CANADIAN,
LANGUAGE_FRENCH_SWISS,
LANGUAGE_FRENCH_LUXEMBOURG))
{
case LANGUAGE_FRENCH:
case LANGUAGE_FRENCH_BELGIAN:
case LANGUAGE_FRENCH_CANADIAN:
case LANGUAGE_FRENCH_SWISS:
case LANGUAGE_FRENCH_LUXEMBOURG:
if( bSttQuote )
sRet += " ";
else
sRet = " " + sRet;
break;
}
}
return sRet;

View File

@ -956,7 +956,7 @@ ATTR_SETOVERLINE:
case RTF_LANG:
if( aPlainMap.nLanguage )
{
pSet->Put( SvxLanguageItem( (LanguageType)nTokenValue,
pSet->Put( SvxLanguageItem( LanguageType(nTokenValue),
aPlainMap.nLanguage ));
}
break;
@ -964,13 +964,13 @@ ATTR_SETOVERLINE:
case RTF_LANGFE:
if( aPlainMap.nCJKLanguage )
{
pSet->Put( SvxLanguageItem( (LanguageType)nTokenValue,
pSet->Put( SvxLanguageItem( LanguageType(nTokenValue),
aPlainMap.nCJKLanguage ));
}
break;
case RTF_ALANG:
{
SvxLanguageItem aTmpItem( (LanguageType)nTokenValue,
SvxLanguageItem aTmpItem( LanguageType(nTokenValue),
SID_ATTR_CHAR_LANGUAGE );
SetScriptAttr( eCharType, *pSet, aTmpItem );
}
@ -1835,8 +1835,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue )
// store default Language
if( -1 != nValue )
{
SvxLanguageItem aTmpItem( (const LanguageType)nValue,
SID_ATTR_CHAR_LANGUAGE );
SvxLanguageItem aTmpItem( LanguageType(nValue), SID_ATTR_CHAR_LANGUAGE );
SetScriptAttr( NOTDEF_CHARTYPE, aTmp, aTmpItem );
}
break;

View File

@ -115,8 +115,8 @@ Sequence< lang::Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
for( SvxForbiddenCharactersTable::Map::iterator it = mxForbiddenChars->GetMap().begin();
it != mxForbiddenChars->GetMap().end(); ++it )
{
const sal_uLong nLanguage = it->first;
*pLocales++ = LanguageTag( static_cast < LanguageType > (nLanguage) ).getLocale();
const LanguageType nLanguage = it->first;
*pLocales++ = LanguageTag( nLanguage ).getLocale();
}
}

View File

@ -276,7 +276,7 @@ inline bool CountryEntryPred_Language::operator()( const CountryEntry& rCmp ) co
// rCmp.mbUseSubLang==true -> compare full language type
// rCmp.mbUseSubLang==false -> compare primary language only
return rCmp.mbUseSubLang ? (meLanguage == rCmp.meLanguage) :
((meLanguage & 0x03FF) == (rCmp.meLanguage & 0x03FF));
(primary(meLanguage) == primary(rCmp.meLanguage));
}
} // namespace

View File

@ -4445,7 +4445,7 @@ PPTCharPropSet::PPTCharPropSet(sal_uInt32 nParagraph)
mnHylinkOrigColor = 0;
mbIsHyperlink = false;
mbHardHylinkOrigColor = false;
mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = 0;
mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = LANGUAGE_SYSTEM;
}
PPTCharPropSet::PPTCharPropSet( const PPTCharPropSet& rCharPropSet )
@ -4475,7 +4475,7 @@ PPTCharPropSet::PPTCharPropSet( const PPTCharPropSet& rCharPropSet, sal_uInt32 n
mnOriginalTextPos = rCharPropSet.mnOriginalTextPos;
maString = rCharPropSet.maString;
mpFieldItem.reset( rCharPropSet.mpFieldItem ? new SvxFieldItem( *rCharPropSet.mpFieldItem ) : nullptr );
mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = 0;
mnLanguage[ 0 ] = mnLanguage[ 1 ] = mnLanguage[ 2 ] = LANGUAGE_SYSTEM;
}
PPTCharPropSet::~PPTCharPropSet()
@ -4737,9 +4737,9 @@ PPTTextSpecInfo::PPTTextSpecInfo( sal_uInt32 _nCharIdx ) :
nCharIdx ( _nCharIdx ),
nDontKnow ( 1 )
{
nLanguage[ 0 ] = 0x400;
nLanguage[ 1 ] = 0;
nLanguage[ 2 ] = 0;
nLanguage[ 0 ] = LANGUAGE_PROCESS_OR_USER_DEFAULT;
nLanguage[ 1 ] = LANGUAGE_SYSTEM;
nLanguage[ 2 ] = LANGUAGE_SYSTEM;
}
PPTTextSpecInfo::~PPTTextSpecInfo()
@ -4796,14 +4796,14 @@ bool PPTTextSpecInfoAtomInterpreter::Read( SvStream& rIn, const DffRecordHeader&
if ( nLang )
{
// #i119985#, we could probably handle this better if we have a
// place to over-ride the final language for weak
// place to override the final language for weak
// characters/fields to fallback to, rather than the current
// application locale. Assuming that we can determine what the
// default fallback language for a given .ppt, etc is during
// load time.
if (i == 2)
{
pEntry->nLanguage[ 0 ] = pEntry->nLanguage[ 1 ] = pEntry->nLanguage[ 2 ] = nLang;
pEntry->nLanguage[ 0 ] = pEntry->nLanguage[ 1 ] = pEntry->nLanguage[ 2 ] = LanguageType(nLang);
}
}
nFlags &= ~i;

View File

@ -672,7 +672,7 @@ void OFormattedModel::write(const Reference<XObjectOutputStream>& _rxOutStream)
if (hasProperty(s_aFormatStringProp, xFormat))
xFormat->getPropertyValue(s_aFormatStringProp) >>= sFormatDescription;
_rxOutStream->writeUTF(sFormatDescription);
_rxOutStream->writeLong((sal_Int32)eFormatLanguage);
_rxOutStream->writeLong((sal_uInt16)eFormatLanguage);
}
// version 2 : write the properties common to all OEditBaseModels
writeCommonEditProperties(_rxOutStream);
@ -729,7 +729,7 @@ void OFormattedModel::read(const Reference<XObjectInputStream>& _rxInStream)
{
// read string and language...
OUString sFormatDescription = _rxInStream->readUTF();
LanguageType eDescriptionLanguage = (LanguageType)_rxInStream->readLong();
LanguageType eDescriptionLanguage(_rxInStream->readLong());
// and let a formatter roll dice based on that to create a key...
xSupplier = calcFormatsSupplier();
// calcFormatsSupplier first takes the one from the model, then one from the starform, then a new one...

View File

@ -671,7 +671,7 @@ void SubstitutePathVariables::SetPredefinedPathVariables()
m_aPreDefVars.m_FixedVar[ PREDEFVAR_VLANG ] = aLocaleStr;
// Set $(langid)
m_aPreDefVars.m_FixedVar[ PREDEFVAR_LANGID ] = OUString::number( m_aPreDefVars.m_eLanguageType );
m_aPreDefVars.m_FixedVar[ PREDEFVAR_LANGID ] = OUString::number( (sal_uInt16)m_aPreDefVars.m_eLanguageType );
// Set the other pre defined path variables
// Set $(work)

View File

@ -54,7 +54,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), nLanguageType );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, nLanguageType );
CPPUNIT_ASSERT_EQUAL( OUString("de"), de_DE.getLanguage() );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), de_DE.getCountry() );
CPPUNIT_ASSERT( de_DE.getScript().isEmpty() );
@ -87,7 +87,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("sr"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA), sr_RS.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_CYRILLIC_SERBIA, sr_RS.getLanguageType() );
CPPUNIT_ASSERT( sr_RS.isValidBcp47() );
CPPUNIT_ASSERT( sr_RS.isIsoLocale() );
CPPUNIT_ASSERT( sr_RS.isIsoODF() );
@ -101,7 +101,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_sr_Latn_RS, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_SERBIAN_LATIN_SERBIA), sr_RS.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sr_RS.getLanguageType() );
CPPUNIT_ASSERT( sr_RS.isValidBcp47() );
CPPUNIT_ASSERT( !sr_RS.isIsoLocale() );
CPPUNIT_ASSERT( sr_RS.isIsoODF() );
@ -119,7 +119,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("CS"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_sr_Latn_CS, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_SERBIAN_LATIN_SAM), sr_Latn_CS.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_SERBIAN_LATIN_SAM, sr_Latn_CS.getLanguageType() );
CPPUNIT_ASSERT( sr_Latn_CS.isValidBcp47() );
CPPUNIT_ASSERT( !sr_Latn_CS.isIsoLocale() );
CPPUNIT_ASSERT( sr_Latn_CS.isIsoODF() );
@ -150,7 +150,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString(I18NLANGTAG_QLT) , aLocale.Language);
CPPUNIT_ASSERT_EQUAL( OUString("RS"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_SERBIAN_LATIN_SERBIA), sh_RS.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sh_RS.getLanguageType() );
CPPUNIT_ASSERT( sh_RS.isValidBcp47() );
CPPUNIT_ASSERT( !sh_RS.isIsoLocale() );
CPPUNIT_ASSERT( sh_RS.isIsoODF() );
@ -168,7 +168,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("sr"), sh_RS_Fallbacks[5]);
CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.makeFallback().getBcp47());
CPPUNIT_ASSERT_EQUAL( OUString("sr-Latn-RS"), sh_RS.getBcp47());
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_SERBIAN_LATIN_SERBIA), sh_RS.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_SERBIAN_LATIN_SERBIA, sh_RS.getLanguageType() );
}
// 'bs-Latn-BA' with 'Latn' suppress-script, we map that ourselves for a
@ -182,7 +182,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("bs"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("BA"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA), bs_Latn_BA.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA, bs_Latn_BA.getLanguageType() );
CPPUNIT_ASSERT( bs_Latn_BA.isValidBcp47() );
CPPUNIT_ASSERT( bs_Latn_BA.isIsoLocale() );
CPPUNIT_ASSERT( bs_Latn_BA.isIsoODF() );
@ -196,7 +196,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("bs"), bs_Latn_BA_Fallbacks[1]);
CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.makeFallback().getBcp47());
CPPUNIT_ASSERT_EQUAL( OUString("bs-BA"), bs_Latn_BA.getBcp47());
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA), bs_Latn_BA.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_BOSNIAN_LATIN_BOSNIA_HERZEGOVINA, bs_Latn_BA.getLanguageType() );
}
{
@ -207,7 +207,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_CATALAN_VALENCIAN), ca_ES_valencia.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN, ca_ES_valencia.getLanguageType() );
CPPUNIT_ASSERT( ca_ES_valencia.isValidBcp47() );
CPPUNIT_ASSERT( !ca_ES_valencia.isIsoLocale() );
CPPUNIT_ASSERT( !ca_ES_valencia.isIsoODF() );
@ -258,7 +258,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString(I18NLANGTAG_QLT) , aLocale.Language);
CPPUNIT_ASSERT_EQUAL( OUString("ES"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_ca_ES_valencia, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_CATALAN_VALENCIAN), ca_XV.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_CATALAN_VALENCIAN, ca_XV.getLanguageType() );
CPPUNIT_ASSERT( ca_XV.isValidBcp47() );
CPPUNIT_ASSERT( !ca_XV.isIsoLocale() );
CPPUNIT_ASSERT( !ca_XV.isIsoODF() );
@ -284,7 +284,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), de_DE.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() );
CPPUNIT_ASSERT( de_DE.isValidBcp47() );
CPPUNIT_ASSERT( de_DE.isIsoLocale() );
CPPUNIT_ASSERT( de_DE.isIsoODF() );
@ -307,7 +307,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), de_DE.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() );
}
{
@ -318,7 +318,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), de_DE.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, de_DE.getLanguageType() );
}
// Unmapped but known language-only.
@ -345,7 +345,7 @@ void TestLanguageTag::testAllTags()
LanguageTag bo( "bo", true );
CPPUNIT_ASSERT_EQUAL( MsLangId::getPrimaryLanguage( LANGUAGE_TIBETAN), bo.getLanguageType() );
LanguageTag dz( "dz", true );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_DZONGKHA_MAP_LONLY), dz.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_DZONGKHA_MAP_LONLY, dz.getLanguageType() );
}
// "no", "nb" and "nn" share the same primary language ID, which even is
@ -355,11 +355,11 @@ void TestLanguageTag::testAllTags()
LanguageTag no( "no", true );
CPPUNIT_ASSERT( LanguageTag::isOnTheFlyID( no.getLanguageType()) );
LanguageTag nb( "nb", true );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_NORWEGIAN_BOKMAL_LSO), nb.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_BOKMAL_LSO, nb.getLanguageType() );
LanguageTag nn( "nn", true );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_NORWEGIAN_NYNORSK_LSO), nn.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN_NYNORSK_LSO, nn.getLanguageType() );
LanguageTag no_NO( "no-NO", true );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_NORWEGIAN), no_NO.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_NORWEGIAN, no_NO.getLanguageType() );
}
// 'de-1901' derived from 'de-DE-1901' grandfathered to check that it is
@ -397,7 +397,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_ENGLISH_UK_OXENDICT), en_GB_oed.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT, en_GB_oed.getLanguageType() );
CPPUNIT_ASSERT( en_GB_oed.isValidBcp47() );
CPPUNIT_ASSERT( !en_GB_oed.isIsoLocale() );
CPPUNIT_ASSERT( !en_GB_oed.isIsoODF() );
@ -422,7 +422,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("GB"), aLocale.Country );
CPPUNIT_ASSERT_EQUAL( s_en_GB_oxendict, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_ENGLISH_UK_OXENDICT), en_GB_oxendict.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_ENGLISH_UK_OXENDICT, en_GB_oxendict.getLanguageType() );
CPPUNIT_ASSERT( en_GB_oxendict.isValidBcp47() );
CPPUNIT_ASSERT( !en_GB_oxendict.isIsoLocale() );
CPPUNIT_ASSERT( !en_GB_oxendict.isIsoODF() );
@ -476,7 +476,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qtz"), aLocale.Language );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_KEYID), qtz.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_KEYID, qtz.getLanguageType() );
}
// 'qty' is a local use unknown locale
@ -511,7 +511,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
CPPUNIT_ASSERT_EQUAL( OUString("x-comment"), aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_PRIV_COMMENT), xcomment.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_COMMENT, xcomment.getLanguageType() );
}
// 'x-foobar' is a privateuse unknown "locale"
@ -535,7 +535,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_PRIV_JOKER), joker.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER, joker.getLanguageType() );
joker.reset( LANGUAGE_USER_PRIV_JOKER );
aLocale = joker.getLocale();
@ -543,7 +543,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
CPPUNIT_ASSERT_EQUAL( OUString("*"), aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_USER_PRIV_JOKER), joker.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_USER_PRIV_JOKER, joker.getLanguageType() );
}
// 'C' locale shall map to 'en-US'
@ -556,7 +556,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_ENGLISH_US), aTag.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() );
}
{
LanguageTag aTag( lang::Locale("C","","") );
@ -567,7 +567,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_ENGLISH_US), aTag.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() );
}
// test reset() methods
@ -581,7 +581,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), aTag.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, aTag.getLanguageType() );
aTag.reset( "en-US" );
aLocale = aTag.getLocale();
@ -589,7 +589,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("en"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("US"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_ENGLISH_US), aTag.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_ENGLISH_US, aTag.getLanguageType() );
aTag.reset( lang::Locale( "de", "DE", "" ) );
aLocale = aTag.getLocale();
@ -597,7 +597,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("de"), aLocale.Language );
CPPUNIT_ASSERT_EQUAL( OUString("DE"), aLocale.Country );
CPPUNIT_ASSERT( aLocale.Variant.isEmpty() );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_GERMAN), aTag.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_GERMAN, aTag.getLanguageType() );
}
{
@ -608,7 +608,7 @@ void TestLanguageTag::testAllTags()
CPPUNIT_ASSERT_EQUAL( OUString("qlt"), aLocale.Language );
CPPUNIT_ASSERT( aLocale.Country.isEmpty() );
CPPUNIT_ASSERT_EQUAL( s_uab, aLocale.Variant );
CPPUNIT_ASSERT_EQUAL( static_cast<LanguageType>(LANGUAGE_DONTKNOW), uab.getLanguageType() );
CPPUNIT_ASSERT_EQUAL( LANGUAGE_DONTKNOW, uab.getLanguageType() );
CPPUNIT_ASSERT( !uab.isValidBcp47() );
CPPUNIT_ASSERT( !uab.isIsoLocale() );
CPPUNIT_ASSERT( !uab.isIsoODF() );
@ -722,9 +722,9 @@ void TestLanguageTag::testAllIsoLangEntries()
OString aMessage( OUStringToOString( (*it).maBcp47, RTL_TEXTENCODING_ASCII_US));
aMessage += " " + OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US) + ": " +
OUStringToOString( aTagString.getBcp47(), RTL_TEXTENCODING_ASCII_US) + " " +
OString::number( aTagString.getLanguageType(), 16) +
OString::number( (sal_uInt16)aTagString.getLanguageType(), 16) +
" -> " + OUStringToOString( aTagBack.getBcp47(), RTL_TEXTENCODING_ASCII_US) + " " +
OString::number( aTagBack.getLanguageType(), 16);
OString::number( (sal_uInt16)aTagBack.getLanguageType(), 16);
CPPUNIT_ASSERT_EQUAL_MESSAGE( aMessage.getStr(), aTagBack.getLanguageType(), aTagString.getLanguageType());
}
}

File diff suppressed because it is too large Load Diff

View File

@ -70,40 +70,36 @@ void MsLangId::setConfiguredComplexFallback( LanguageType nLang )
// static
inline LanguageType MsLangId::simplifySystemLanguages( LanguageType nLang )
{
switch (nLang)
{
case LANGUAGE_PROCESS_OR_USER_DEFAULT :
case LANGUAGE_SYSTEM_DEFAULT :
case LANGUAGE_SYSTEM :
nLang = LANGUAGE_SYSTEM;
break;
default:
; // nothing
}
if (nLang.anyOf( LANGUAGE_PROCESS_OR_USER_DEFAULT,
LANGUAGE_SYSTEM_DEFAULT,
LANGUAGE_SYSTEM))
nLang = LANGUAGE_SYSTEM;
return nLang;
}
// static
LanguageType MsLangId::getRealLanguage( LanguageType nLang )
{
switch (simplifySystemLanguages( nLang))
LanguageType simplifyLang = simplifySystemLanguages( nLang);
if (simplifyLang == LANGUAGE_SYSTEM )
{
case LANGUAGE_SYSTEM :
if (nConfiguredSystemLanguage == LANGUAGE_SYSTEM)
nLang = getSystemLanguage();
else
nLang = nConfiguredSystemLanguage;
break;
case LANGUAGE_HID_HUMAN_INTERFACE_DEVICE :
if (nConfiguredSystemUILanguage == LANGUAGE_SYSTEM)
nLang = getSystemUILanguage();
else
nLang = nConfiguredSystemUILanguage;
break;
default:
/* TODO: would this be useful here? */
//nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
; // nothing
if (nConfiguredSystemLanguage == LANGUAGE_SYSTEM)
nLang = getSystemLanguage();
else
nLang = nConfiguredSystemLanguage;
}
else if (simplifyLang == LANGUAGE_HID_HUMAN_INTERFACE_DEVICE)
{
if (nConfiguredSystemUILanguage == LANGUAGE_SYSTEM)
nLang = getSystemUILanguage();
else
nLang = nConfiguredSystemUILanguage;
}
else
{
/* TODO: would this be useful here? */
//nLang = MsLangId::getReplacementForObsoleteLanguage( nLang);
; // nothing
}
if (nLang == LANGUAGE_DONTKNOW)
nLang = LANGUAGE_ENGLISH_US;
@ -196,39 +192,38 @@ css::lang::Locale MsLangId::getFallbackLocale(
return Conversion::lookupFallbackLocale( rLocale);
}
static constexpr bool equalsPrimary(LanguageType lhs, LanguageType rhs)
{
return (sal_uInt16(lhs) & LANGUAGE_MASK_PRIMARY )
== (sal_uInt16(rhs) & LANGUAGE_MASK_PRIMARY );
}
// static
bool MsLangId::isRightToLeft( LanguageType nLang )
{
switch( nLang & LANGUAGE_MASK_PRIMARY )
if( equalsPrimary(nLang, LANGUAGE_ARABIC_SAUDI_ARABIA)
|| equalsPrimary(nLang, LANGUAGE_HEBREW)
|| equalsPrimary(nLang, LANGUAGE_YIDDISH)
|| equalsPrimary(nLang, LANGUAGE_URDU_PAKISTAN)
|| equalsPrimary(nLang, LANGUAGE_FARSI)
|| equalsPrimary(nLang, LANGUAGE_KASHMIRI)
|| equalsPrimary(nLang, LANGUAGE_SINDHI)
|| equalsPrimary(nLang, LANGUAGE_UIGHUR_CHINA)
|| equalsPrimary(nLang, LANGUAGE_USER_KYRGYZ_CHINA)
|| equalsPrimary(nLang, LANGUAGE_USER_NKO) )
{
case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_YIDDISH & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_URDU_PAKISTAN & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_KASHMIRI & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_UIGHUR_CHINA & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_USER_KYRGYZ_CHINA & LANGUAGE_MASK_PRIMARY :
case LANGUAGE_USER_NKO & LANGUAGE_MASK_PRIMARY :
return true;
default:
break;
return true;
}
switch (nLang)
if (nLang.anyOf(
LANGUAGE_USER_KURDISH_IRAN,
LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ,
LANGUAGE_KURDISH_ARABIC_IRAQ,
LANGUAGE_KURDISH_ARABIC_LSO,
LANGUAGE_USER_KURDISH_SOUTHERN_IRAN,
LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ,
LANGUAGE_USER_HUNGARIAN_ROVAS))
{
case LANGUAGE_USER_KURDISH_IRAN:
case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
case LANGUAGE_KURDISH_ARABIC_IRAQ:
case LANGUAGE_KURDISH_ARABIC_LSO:
case LANGUAGE_USER_KURDISH_SOUTHERN_IRAN:
case LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ:
case LANGUAGE_USER_HUNGARIAN_ROVAS:
return true;
default:
break;
}
if (LanguageTag::isOnTheFlyID(nLang))
return LanguageTag::getOnTheFlyScriptType(nLang) == LanguageTag::ScriptType::RTL;
@ -259,18 +254,10 @@ bool MsLangId::isSimplifiedChinese( const css::lang::Locale & rLocale )
// static
bool MsLangId::isTraditionalChinese( LanguageType nLang )
{
bool bRet = false;
switch (nLang)
{
case LANGUAGE_CHINESE_TRADITIONAL:
case LANGUAGE_CHINESE_HONGKONG:
case LANGUAGE_CHINESE_MACAU:
bRet = true;
break;
default:
break;
}
return bRet;
return nLang.anyOf(
LANGUAGE_CHINESE_TRADITIONAL,
LANGUAGE_CHINESE_HONGKONG,
LANGUAGE_CHINESE_MACAU);
}
// static
@ -295,15 +282,13 @@ bool MsLangId::isKorean( LanguageType nLang )
// static
bool MsLangId::isCJK( LanguageType nLang )
{
switch (nLang & LANGUAGE_MASK_PRIMARY)
if (primary(nLang).anyOf(
primary(LANGUAGE_CHINESE),
primary(LANGUAGE_YUE_CHINESE_HONGKONG),
primary(LANGUAGE_JAPANESE),
primary(LANGUAGE_KOREAN)))
{
case LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_YUE_CHINESE_HONGKONG & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_JAPANESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KOREAN & LANGUAGE_MASK_PRIMARY:
return true;
default:
break;
return true;
}
if (LanguageTag::isOnTheFlyID(nLang))
return LanguageTag::getOnTheFlyScriptType(nLang) == LanguageTag::ScriptType::CJK;
@ -326,17 +311,11 @@ bool MsLangId::hasForbiddenCharacters( LanguageType nLang )
// static
bool MsLangId::needsSequenceChecking( LanguageType nLang )
{
switch (nLang & LANGUAGE_MASK_PRIMARY)
{
case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY:
return true;
default:
break;
}
return false;
return primary(nLang).anyOf(
primary(LANGUAGE_BURMESE),
primary(LANGUAGE_KHMER),
primary(LANGUAGE_LAO),
primary(LANGUAGE_THAI));
}
@ -345,33 +324,33 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
{
sal_Int16 nScript;
switch( nLang )
{
// CTL
case LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA:
case LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA:
case LANGUAGE_MONGOLIAN_MONGOLIAN_LSO:
case LANGUAGE_USER_KURDISH_IRAN:
case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
case LANGUAGE_KURDISH_ARABIC_IRAQ:
case LANGUAGE_KURDISH_ARABIC_LSO:
case LANGUAGE_USER_KURDISH_SOUTHERN_IRAN:
case LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ:
case LANGUAGE_USER_KYRGYZ_CHINA:
case LANGUAGE_USER_HUNGARIAN_ROVAS:
case LANGUAGE_USER_MANCHU:
case LANGUAGE_USER_XIBE:
if( nLang.anyOf(
LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA,
LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA,
LANGUAGE_MONGOLIAN_MONGOLIAN_LSO,
LANGUAGE_USER_KURDISH_IRAN,
LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ,
LANGUAGE_KURDISH_ARABIC_IRAQ,
LANGUAGE_KURDISH_ARABIC_LSO,
LANGUAGE_USER_KURDISH_SOUTHERN_IRAN,
LANGUAGE_USER_KURDISH_SOUTHERN_IRAQ,
LANGUAGE_USER_KYRGYZ_CHINA,
LANGUAGE_USER_HUNGARIAN_ROVAS,
LANGUAGE_USER_MANCHU,
LANGUAGE_USER_XIBE))
{
nScript = css::i18n::ScriptType::COMPLEX;
break;
}
// "Western"
case LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA:
case LANGUAGE_MONGOLIAN_CYRILLIC_LSO:
case LANGUAGE_USER_KURDISH_SYRIA:
case LANGUAGE_USER_KURDISH_TURKEY:
else if (nLang.anyOf(
LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA,
LANGUAGE_MONGOLIAN_CYRILLIC_LSO,
LANGUAGE_USER_KURDISH_SYRIA,
LANGUAGE_USER_KURDISH_TURKEY))
{
nScript = css::i18n::ScriptType::LATIN;
break;
}
// currently not knowing scripttype - defaulted to LATIN:
/*
#define LANGUAGE_ARMENIAN 0x042B
@ -381,83 +360,80 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
#define LANGUAGE_MACEDONIAN 0x042F
#define LANGUAGE_TATAR 0x0444
*/
default:
switch ( nLang & LANGUAGE_MASK_PRIMARY )
{
// CJK catcher
case LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_YUE_CHINESE_HONGKONG & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_JAPANESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KOREAN & LANGUAGE_MASK_PRIMARY:
nScript = css::i18n::ScriptType::ASIAN;
break;
// CTL catcher
case LANGUAGE_AMHARIC_ETHIOPIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_ASSAMESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_DHIVEHI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KASHMIRI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_MANIPURI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_MARATHI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_NEPALI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_ODIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_SANSKRIT & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_SINDHI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_SINHALESE_SRI_LANKA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_SYRIAC & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY: // also LANGUAGE_DZONGKHA
case LANGUAGE_UIGHUR_CHINA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_URDU_INDIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_USER_BODO_INDIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_USER_DOGRI_INDIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_USER_LIMBU & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_USER_MAITHILI_INDIA & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_USER_NKO & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_YIDDISH & LANGUAGE_MASK_PRIMARY:
nScript = css::i18n::ScriptType::COMPLEX;
break;
// Western (actually not necessarily Latin but also Cyrillic,
// for example)
default:
if (LanguageTag::isOnTheFlyID(nLang))
{
switch (LanguageTag::getOnTheFlyScriptType(nLang))
{
case LanguageTag::ScriptType::CJK :
nScript = css::i18n::ScriptType::ASIAN;
break;
case LanguageTag::ScriptType::CTL :
case LanguageTag::ScriptType::RTL :
nScript = css::i18n::ScriptType::COMPLEX;
break;
case LanguageTag::ScriptType::WESTERN :
case LanguageTag::ScriptType::UNKNOWN :
default:
nScript = css::i18n::ScriptType::LATIN;
break;
}
}
else
nScript = css::i18n::ScriptType::LATIN;
}
break;
// CJK catcher
else if ( primary(nLang).anyOf(
primary(LANGUAGE_CHINESE ),
primary(LANGUAGE_YUE_CHINESE_HONGKONG ),
primary(LANGUAGE_JAPANESE ),
primary(LANGUAGE_KOREAN )
))
{
nScript = css::i18n::ScriptType::ASIAN;
}
// CTL catcher
else if (primary(nLang).anyOf(
primary(LANGUAGE_AMHARIC_ETHIOPIA ),
primary(LANGUAGE_ARABIC_SAUDI_ARABIA ),
primary(LANGUAGE_ASSAMESE ),
primary(LANGUAGE_BENGALI ),
primary(LANGUAGE_BURMESE ),
primary(LANGUAGE_DHIVEHI ),
primary(LANGUAGE_FARSI ),
primary(LANGUAGE_GUJARATI ),
primary(LANGUAGE_HEBREW ),
primary(LANGUAGE_HINDI ),
primary(LANGUAGE_KANNADA ),
primary(LANGUAGE_KASHMIRI ),
primary(LANGUAGE_KHMER ),
primary(LANGUAGE_LAO ),
primary(LANGUAGE_MALAYALAM ),
primary(LANGUAGE_MANIPURI ),
primary(LANGUAGE_MARATHI ),
primary(LANGUAGE_NEPALI ),
primary(LANGUAGE_ODIA ),
primary(LANGUAGE_PUNJABI ),
primary(LANGUAGE_SANSKRIT ),
primary(LANGUAGE_SINDHI ),
primary(LANGUAGE_SINHALESE_SRI_LANKA ),
primary(LANGUAGE_SYRIAC ),
primary(LANGUAGE_TAMIL ),
primary(LANGUAGE_TELUGU ),
primary(LANGUAGE_THAI ),
primary(LANGUAGE_TIBETAN ), // also LANGUAGE_DZONGKHA
primary(LANGUAGE_UIGHUR_CHINA ),
primary(LANGUAGE_URDU_INDIA ),
primary(LANGUAGE_USER_BODO_INDIA ),
primary(LANGUAGE_USER_DOGRI_INDIA ),
primary(LANGUAGE_USER_LIMBU ),
primary(LANGUAGE_USER_MAITHILI_INDIA ),
primary(LANGUAGE_USER_NKO ),
primary(LANGUAGE_YIDDISH )))
{
nScript = css::i18n::ScriptType::COMPLEX;
}
// Western (actually not necessarily Latin but also Cyrillic,
// for example)
else if (LanguageTag::isOnTheFlyID(nLang))
{
switch (LanguageTag::getOnTheFlyScriptType(nLang))
{
case LanguageTag::ScriptType::CJK :
nScript = css::i18n::ScriptType::ASIAN;
break;
case LanguageTag::ScriptType::CTL :
case LanguageTag::ScriptType::RTL :
nScript = css::i18n::ScriptType::COMPLEX;
break;
case LanguageTag::ScriptType::WESTERN :
case LanguageTag::ScriptType::UNKNOWN :
default:
nScript = css::i18n::ScriptType::LATIN;
break;
}
}
else
{
nScript = css::i18n::ScriptType::LATIN;
}
return nScript;
}
@ -466,37 +442,34 @@ sal_Int16 MsLangId::getScriptType( LanguageType nLang )
// static
bool MsLangId::isNonLatinWestern( LanguageType nLang )
{
switch (nLang)
if (nLang.anyOf(
LANGUAGE_AZERI_CYRILLIC,
LANGUAGE_AZERI_CYRILLIC_LSO,
LANGUAGE_BELARUSIAN,
LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
LANGUAGE_BOSNIAN_CYRILLIC_LSO,
LANGUAGE_BULGARIAN,
LANGUAGE_GREEK,
LANGUAGE_MONGOLIAN_CYRILLIC_LSO,
LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA,
LANGUAGE_RUSSIAN,
LANGUAGE_RUSSIAN_MOLDOVA,
LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA,
LANGUAGE_SERBIAN_CYRILLIC_LSO,
LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO,
LANGUAGE_SERBIAN_CYRILLIC_SAM,
LANGUAGE_SERBIAN_CYRILLIC_SERBIA,
LANGUAGE_UKRAINIAN,
LANGUAGE_UZBEK_CYRILLIC,
LANGUAGE_UZBEK_CYRILLIC_LSO))
{
case LANGUAGE_AZERI_CYRILLIC:
case LANGUAGE_AZERI_CYRILLIC_LSO:
case LANGUAGE_BELARUSIAN:
case LANGUAGE_BOSNIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
case LANGUAGE_BOSNIAN_CYRILLIC_LSO:
case LANGUAGE_BULGARIAN:
case LANGUAGE_GREEK:
case LANGUAGE_MONGOLIAN_CYRILLIC_LSO:
case LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA:
case LANGUAGE_RUSSIAN:
case LANGUAGE_RUSSIAN_MOLDOVA:
case LANGUAGE_SERBIAN_CYRILLIC_BOSNIA_HERZEGOVINA:
case LANGUAGE_SERBIAN_CYRILLIC_LSO:
case LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO:
case LANGUAGE_SERBIAN_CYRILLIC_SAM:
case LANGUAGE_SERBIAN_CYRILLIC_SERBIA:
case LANGUAGE_UKRAINIAN:
case LANGUAGE_UZBEK_CYRILLIC:
case LANGUAGE_UZBEK_CYRILLIC_LSO:
return true;
default:
{
if (getScriptType( nLang) != css::i18n::ScriptType::LATIN)
return false;
LanguageTag aLanguageTag( nLang);
if (aLanguageTag.hasScript())
return aLanguageTag.getScript() != "Latn";
}
}
if (getScriptType( nLang) != css::i18n::ScriptType::LATIN)
return false;
LanguageTag aLanguageTag( nLang);
if (aLanguageTag.hasScript())
return aLanguageTag.getScript() != "Latn";
return false;
}
@ -504,15 +477,13 @@ bool MsLangId::isNonLatinWestern( LanguageType nLang )
// static
bool MsLangId::isLegacy( LanguageType nLang )
{
switch (nLang)
{
case LANGUAGE_SERBIAN_CYRILLIC_SAM:
case LANGUAGE_SERBIAN_LATIN_SAM:
if (nLang.anyOf(
LANGUAGE_SERBIAN_CYRILLIC_SAM,
LANGUAGE_SERBIAN_LATIN_SAM))
/* TODO: activate once dictionary was renamed from pap-AN to
* pap-CW, or the pap-CW one supports also pap-AN, see fdo#44112 */
//case LANGUAGE_PAPIAMENTU:
return true;
}
return false;
}
@ -520,100 +491,71 @@ bool MsLangId::isLegacy( LanguageType nLang )
// static
LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang )
{
switch (nLang)
{
default:
break; // nothing
case LANGUAGE_OBSOLETE_USER_LATIN:
nLang = LANGUAGE_USER_LATIN_VATICAN;
break;
case LANGUAGE_OBSOLETE_USER_MAORI:
nLang = LANGUAGE_MAORI_NEW_ZEALAND;
break;
case LANGUAGE_OBSOLETE_USER_KINYARWANDA:
nLang = LANGUAGE_KINYARWANDA_RWANDA;
break;
case LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN:
nLang = LANGUAGE_UPPER_SORBIAN_GERMANY;
break;
case LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN:
nLang = LANGUAGE_LOWER_SORBIAN_GERMANY;
break;
case LANGUAGE_OBSOLETE_USER_OCCITAN:
nLang = LANGUAGE_OCCITAN_FRANCE;
break;
case LANGUAGE_OBSOLETE_USER_BRETON:
nLang = LANGUAGE_BRETON_FRANCE;
break;
case LANGUAGE_OBSOLETE_USER_KALAALLISUT:
nLang = LANGUAGE_KALAALLISUT_GREENLAND;
break;
case LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH:
nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG;
break;
case LANGUAGE_OBSOLETE_USER_KABYLE:
nLang = LANGUAGE_TAMAZIGHT_LATIN_ALGERIA;
break;
case LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN:
nLang = LANGUAGE_CATALAN_VALENCIAN;
break;
case LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU:
nLang = LANGUAGE_MALAGASY_PLATEAU;
break;
case LANGUAGE_GAELIC_SCOTLAND_LEGACY:
nLang = LANGUAGE_GAELIC_SCOTLAND;
break;
case LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA:
nLang = LANGUAGE_TSWANA_BOTSWANA;
break;
case LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA:
nLang = LANGUAGE_SERBIAN_LATIN_SERBIA;
break;
case LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO:
nLang = LANGUAGE_SERBIAN_LATIN_MONTENEGRO;
break;
case LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA:
nLang = LANGUAGE_SERBIAN_CYRILLIC_SERBIA;
break;
case LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO:
nLang = LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO;
break;
case LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ:
nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
break;
case LANGUAGE_OBSOLETE_USER_SPANISH_CUBA:
nLang = LANGUAGE_SPANISH_CUBA;
break;
if (nLang == LANGUAGE_OBSOLETE_USER_LATIN)
nLang = LANGUAGE_USER_LATIN_VATICAN;
else if (nLang == LANGUAGE_OBSOLETE_USER_MAORI)
nLang = LANGUAGE_MAORI_NEW_ZEALAND;
else if (nLang == LANGUAGE_OBSOLETE_USER_KINYARWANDA)
nLang = LANGUAGE_KINYARWANDA_RWANDA;
else if (nLang == LANGUAGE_OBSOLETE_USER_UPPER_SORBIAN)
nLang = LANGUAGE_UPPER_SORBIAN_GERMANY;
else if (nLang == LANGUAGE_OBSOLETE_USER_LOWER_SORBIAN)
nLang = LANGUAGE_LOWER_SORBIAN_GERMANY;
else if (nLang == LANGUAGE_OBSOLETE_USER_OCCITAN)
nLang = LANGUAGE_OCCITAN_FRANCE;
else if (nLang == LANGUAGE_OBSOLETE_USER_BRETON)
nLang = LANGUAGE_BRETON_FRANCE;
else if (nLang == LANGUAGE_OBSOLETE_USER_KALAALLISUT)
nLang = LANGUAGE_KALAALLISUT_GREENLAND;
else if (nLang == LANGUAGE_OBSOLETE_USER_LUXEMBOURGISH)
nLang = LANGUAGE_LUXEMBOURGISH_LUXEMBOURG;
else if (nLang == LANGUAGE_OBSOLETE_USER_KABYLE)
nLang = LANGUAGE_TAMAZIGHT_LATIN_ALGERIA;
else if (nLang == LANGUAGE_OBSOLETE_USER_CATALAN_VALENCIAN)
nLang = LANGUAGE_CATALAN_VALENCIAN;
else if (nLang == LANGUAGE_OBSOLETE_USER_MALAGASY_PLATEAU)
nLang = LANGUAGE_MALAGASY_PLATEAU;
else if (nLang == LANGUAGE_GAELIC_SCOTLAND_LEGACY)
nLang = LANGUAGE_GAELIC_SCOTLAND;
else if (nLang == LANGUAGE_OBSOLETE_USER_TSWANA_BOTSWANA)
nLang = LANGUAGE_TSWANA_BOTSWANA;
else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_SERBIA)
nLang = LANGUAGE_SERBIAN_LATIN_SERBIA;
else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_LATIN_MONTENEGRO)
nLang = LANGUAGE_SERBIAN_LATIN_MONTENEGRO;
else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_SERBIA)
nLang = LANGUAGE_SERBIAN_CYRILLIC_SERBIA;
else if (nLang == LANGUAGE_OBSOLETE_USER_SERBIAN_CYRILLIC_MONTENEGRO)
nLang = LANGUAGE_SERBIAN_CYRILLIC_MONTENEGRO;
else if (nLang == LANGUAGE_OBSOLETE_USER_KURDISH_IRAQ)
nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_CUBA)
nLang = LANGUAGE_SPANISH_CUBA;
// The following are not strictly obsolete but should be mapped to a
// replacement locale when encountered.
// The following are not strictly obsolete but should be mapped to a
// replacement locale when encountered.
// no_NO is an alias for nb_NO
case LANGUAGE_NORWEGIAN:
nLang = LANGUAGE_NORWEGIAN_BOKMAL;
break;
// no_NO is an alias for nb_NO
else if (nLang == LANGUAGE_NORWEGIAN)
nLang = LANGUAGE_NORWEGIAN_BOKMAL;
// #i94435# A Spanish variant that differs only in collation details we
// do not support.
case LANGUAGE_SPANISH_DATED:
nLang = LANGUAGE_SPANISH_MODERN;
break;
// #i94435# A Spanish variant that differs only in collation details we
// do not support.
else if (nLang == LANGUAGE_SPANISH_DATED)
nLang = LANGUAGE_SPANISH_MODERN;
// The erroneous Tibetan vs. Dzongkha case, #i53497#
// We (and MS) have stored LANGUAGE_TIBETAN_BHUTAN. This will need
// special attention if MS one day decides to actually use
// LANGUAGE_TIBETAN_BHUTAN for bo-BT instead of having it reserved;
// then remove the mapping and hope every dz-BT user used ODF to store
// documents ;-)
case LANGUAGE_TIBETAN_BHUTAN:
nLang = LANGUAGE_DZONGKHA_BHUTAN;
break;
// The erroneous Tibetan vs. Dzongkha case, #i53497#
// We (and MS) have stored LANGUAGE_TIBETAN_BHUTAN. This will need
// special attention if MS one day decides to actually use
// LANGUAGE_TIBETAN_BHUTAN for bo-BT instead of having it reserved;
// then remove the mapping and hope every dz-BT user used ODF to store
// documents ;-)
else if (nLang == LANGUAGE_TIBETAN_BHUTAN)
nLang = LANGUAGE_DZONGKHA_BHUTAN;
// en-GB-oed is deprecated, use en-GB-oxendict instead.
case LANGUAGE_USER_ENGLISH_UK_OED:
nLang = LANGUAGE_USER_ENGLISH_UK_OXENDICT;
break;
}
// en-GB-oed is deprecated, use en-GB-oxendict instead.
else if (nLang == LANGUAGE_USER_ENGLISH_UK_OED)
nLang = LANGUAGE_USER_ENGLISH_UK_OXENDICT;
return nLang;
}

View File

@ -98,7 +98,7 @@ struct theSystemLocale : public rtl::Static< LanguageTag::ImplPtr, theSystemLoca
static LanguageType getNextOnTheFlyLanguage()
{
static LanguageType nOnTheFlyLanguage = 0;
static LanguageType nOnTheFlyLanguage(0);
osl::MutexGuard aGuard( theMutex::get());
if (!nOnTheFlyLanguage)
nOnTheFlyLanguage = MsLangId::makeLangID( LANGUAGE_ON_THE_FLY_SUB_START, LANGUAGE_ON_THE_FLY_START);
@ -114,10 +114,10 @@ static LanguageType getNextOnTheFlyLanguage()
else
{
SAL_WARN( "i18nlangtag", "getNextOnTheFlyLanguage: none left! ("
<< ((LANGUAGE_ON_THE_FLY_END - LANGUAGE_ON_THE_FLY_START + 1)
* (LANGUAGE_ON_THE_FLY_SUB_END - LANGUAGE_ON_THE_FLY_SUB_START + 1))
<< ((sal_uInt16(LANGUAGE_ON_THE_FLY_END) - sal_uInt16(LANGUAGE_ON_THE_FLY_START) + 1)
* (sal_uInt16(LANGUAGE_ON_THE_FLY_SUB_END) - sal_uInt16(LANGUAGE_ON_THE_FLY_SUB_START) + 1))
<< " consumed?!?)");
return 0;
return LanguageType(0);
}
}
}
@ -643,7 +643,7 @@ LanguageTag::ImplPtr LanguageTagImpl::registerOnTheFly( LanguageType nRegisterID
if (!bOtherImpl || !pImpl->mbInitializedLangID)
{
if (nRegisterID == 0 || nRegisterID == LANGUAGE_DONTKNOW)
if (nRegisterID == LANGUAGE_SYSTEM || nRegisterID == LANGUAGE_DONTKNOW)
nRegisterID = getNextOnTheFlyLanguage();
else
{

View File

@ -91,7 +91,7 @@ public:
virtual ~EditAbstractDialogFactory() override; // needed for export of vtable
static EditAbstractDialogFactory* Create();
virtual VclPtr<AbstractThesaurusDialog> CreateThesaurusDialog( vcl::Window*, css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus,
const OUString &rWord, sal_Int16 nLanguage ) = 0;
const OUString &rWord, LanguageType nLanguage ) = 0;
virtual VclPtr<AbstractHyphenWordDialog> CreateHyphenWordDialog( vcl::Window*,
const OUString &rWord, LanguageType nLang,

View File

@ -24,6 +24,7 @@
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/i18n/ForbiddenCharacters.hpp>
#include <editeng/editengdllapi.h>
#include <i18nlangtag/lang.h>
#include <map>
namespace com {
@ -36,7 +37,7 @@ namespace uno {
class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
{
public:
typedef std::map<sal_uInt16, css::i18n::ForbiddenCharacters> Map;
typedef std::map<LanguageType, css::i18n::ForbiddenCharacters> Map;
private:
Map maMap;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
@ -44,10 +45,10 @@ private:
public:
SvxForbiddenCharactersTable( const css::uno::Reference< css::uno::XComponentContext >& rxContext);
Map& GetMap() { return maMap; }
const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( sal_uInt16 nLanguage, bool bGetDefault );
void SetForbiddenCharacters( sal_uInt16 nLanguage , const css::i18n::ForbiddenCharacters& );
void ClearForbiddenCharacters( sal_uInt16 nLanguage );
Map& GetMap() { return maMap; }
const css::i18n::ForbiddenCharacters* GetForbiddenCharacters( LanguageType nLanguage, bool bGetDefault );
void SetForbiddenCharacters( LanguageType nLanguage , const css::i18n::ForbiddenCharacters& );
void ClearForbiddenCharacters( LanguageType nLanguage );
};
#endif // INCLUDED_EDITENG_FORBIDDENCHARACTERSTABLE_HXX

View File

@ -83,10 +83,10 @@ public:
static sal_Int16 CheckSpellLang(
css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpell,
sal_Int16 nLang );
LanguageType nLang );
static sal_Int16 CheckHyphLang(
css::uno::Reference< css::linguistic2::XHyphenator >const & xHyph,
sal_Int16 nLang );
LanguageType nLang );
static void ShowLanguageErrors();

View File

@ -643,7 +643,7 @@ struct PPTTextParagraphStyleAtomInterpreter
struct PPTTextSpecInfo
{
sal_uInt32 nCharIdx;
sal_uInt16 nLanguage[ 3 ];
LanguageType nLanguage[ 3 ];
sal_uInt16 nDontKnow;
explicit PPTTextSpecInfo( sal_uInt32 nCharIdx );
@ -933,7 +933,7 @@ struct PPTCharPropSet
OUString maString;
std::unique_ptr<SvxFieldItem>
mpFieldItem;
sal_uInt16 mnLanguage[ 3 ];
LanguageType mnLanguage[ 3 ];
void SetFont( sal_uInt16 nFont );
void SetColor( sal_uInt32 nColor );

File diff suppressed because it is too large Load Diff

View File

@ -40,19 +40,19 @@ public:
/// Create a LangID from a primary and a sublanguage.
static LanguageType makeLangID( LanguageType nSubLangId, LanguageType nPriLangId)
{
return (nSubLangId << 10) | nPriLangId;
return LanguageType((sal_uInt16(nSubLangId) << 10) | sal_uInt16(nPriLangId));
}
/// Get the primary language of a LangID.
static LanguageType getPrimaryLanguage( LanguageType nLangID)
{
return nLangID & LANGUAGE_MASK_PRIMARY;
return LanguageType(sal_uInt16(nLangID) & LANGUAGE_MASK_PRIMARY);
}
/// Get the sublanguage of a LangID.
static LanguageType getSubLanguage( LanguageType nLangID)
{
return (nLangID & ~LANGUAGE_MASK_PRIMARY) >> 10;
return LanguageType((sal_uInt16(nLangID) & ~LANGUAGE_MASK_PRIMARY) >> 10);
}
/** Language/locale of category LC_CTYPE (on Unix, else the system

View File

@ -24,6 +24,7 @@
#include <com/sun/star/linguistic2/XPossibleHyphens.hpp>
#include <cppuhelper/implbase.hxx>
#include <linguistic/lngdllapi.h>
#include <i18nlangtag/lang.h>
namespace linguistic
{
@ -35,14 +36,14 @@ class HyphenatedWord :
OUString aHyphenatedWord;
sal_Int16 nHyphPos;
sal_Int16 nHyphenationPos;
sal_uInt16 nLanguage;
LanguageType nLanguage;
bool bIsAltSpelling;
HyphenatedWord(const HyphenatedWord &) = delete;
HyphenatedWord & operator = (const HyphenatedWord &) = delete;
public:
HyphenatedWord(const OUString &rWord, sal_uInt16 nLang, sal_Int16 nHyphenationPos,
HyphenatedWord(const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos,
const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
virtual ~HyphenatedWord() override;
@ -61,7 +62,7 @@ public:
isAlternativeSpelling() override;
static css::uno::Reference <css::linguistic2::XHyphenatedWord> LNG_DLLPUBLIC CreateHyphenatedWord(
const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos,
const OUString &rHyphenatedWord, sal_Int16 nHyphenPos );
};
@ -75,13 +76,13 @@ class PossibleHyphens :
OUString aWord;
OUString aWordWithHyphens;
css::uno::Sequence< sal_Int16 > aOrigHyphenPos;
sal_uInt16 nLanguage;
LanguageType nLanguage;
PossibleHyphens(const PossibleHyphens &) = delete;
PossibleHyphens & operator = (const PossibleHyphens &) = delete;
public:
PossibleHyphens(const OUString &rWord, sal_uInt16 nLang,
PossibleHyphens(const OUString &rWord, LanguageType nLang,
const OUString &rHyphWord,
const css::uno::Sequence< sal_Int16 > &rPositions);
virtual ~PossibleHyphens() override;
@ -97,7 +98,7 @@ public:
getHyphenationPositions() override;
static css::uno::Reference < css::linguistic2::XPossibleHyphens > LNG_DLLPUBLIC CreatePossibleHyphens
(const OUString &rWord, sal_Int16 nLang,
(const OUString &rWord, LanguageType nLang,
const OUString &rHyphWord,
const css::uno::Sequence< sal_Int16 > &rPositions);
};

View File

@ -106,7 +106,9 @@ LNG_DLLPUBLIC bool LinguIsUnspecified( LanguageType nLanguage );
tag string instead. */
LNG_DLLPUBLIC bool LinguIsUnspecified( const OUString & rBcp47 );
css::uno::Sequence< sal_Int16 >
std::vector< LanguageType >
LocaleSeqToLangVec( css::uno::Sequence< css::lang::Locale > &rLocaleSeq );
css::uno::Sequence<sal_Int16>
LocaleSeqToLangSeq( css::uno::Sequence< css::lang::Locale > &rLocaleSeq );
// checks if file pointed to by rURL is readonly
@ -132,12 +134,12 @@ css::uno::Reference< css::linguistic2::XHyphenatedWord >
css::uno::Reference< css::linguistic2::XHyphenatedWord > &rxHyphWord );
LNG_DLLPUBLIC bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, sal_Int16 nLanguage );
LNG_DLLPUBLIC bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage );
inline bool IsUpper( const OUString &rText, sal_Int16 nLanguage ) { return IsUpper( rText, 0, rText.getLength(), nLanguage ); }
inline bool IsUpper( const OUString &rText, LanguageType nLanguage ) { return IsUpper( rText, 0, rText.getLength(), nLanguage ); }
LNG_DLLPUBLIC CapType SAL_CALL capitalType(const OUString&, CharClass *);
OUString ToLower( const OUString &rText, sal_Int16 nLanguage );
OUString ToLower( const OUString &rText, LanguageType nLanguage );
LNG_DLLPUBLIC bool HasDigits( const OUString &rText );
LNG_DLLPUBLIC bool IsNumeric( const OUString &rText );
@ -157,13 +159,13 @@ css::uno::Reference<
css::linguistic2::XDictionaryEntry >
SearchDicList(
const css::uno::Reference< css::linguistic2::XSearchableDictionaryList >& rDicList,
const OUString& rWord, sal_Int16 nLanguage,
const OUString& rWord, LanguageType nLanguage,
bool bSearchPosDics, bool bSearchSpellEntry );
LNG_DLLPUBLIC DictionaryError AddEntryToDic(
css::uno::Reference< css::linguistic2::XDictionary > &rxDic,
const OUString &rWord, bool bIsNeg,
const OUString &rRplcTxt, sal_Int16 nRplcLang,
const OUString &rRplcTxt,
bool bStripDot = true );
LNG_DLLPUBLIC bool SaveDictionaries( const css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &xDicList );

View File

@ -26,6 +26,7 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <cppuhelper/implbase.hxx>
#include <linguistic/lngdllapi.h>
#include <i18nlangtag/lang.h>
namespace com { namespace sun { namespace star {
namespace linguistic2 {
@ -46,9 +47,9 @@ std::vector< OUString >
void SeqRemoveNegEntries(
std::vector< OUString > &rSeq,
css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage );
LanguageType nLanguage );
void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
css::uno::Reference< css::linguistic2::XSearchableDictionaryList > &xDicList,
std::vector< OUString > & rDicListProps );
@ -63,11 +64,11 @@ class SpellAlternatives
css::uno::Sequence< OUString > aAlt; // list of alternatives, may be empty.
OUString aWord;
sal_Int16 nType; // type of failure
sal_Int16 nLanguage;
LanguageType nLanguage;
public:
LNG_DLLPUBLIC SpellAlternatives();
SpellAlternatives(const OUString &rWord, sal_Int16 nLang,
SpellAlternatives(const OUString &rWord, LanguageType nLang,
const css::uno::Sequence< OUString > &rAlternatives );
virtual ~SpellAlternatives() override;
SpellAlternatives(const SpellAlternatives&) = delete;
@ -85,11 +86,11 @@ public:
virtual void SAL_CALL setFailureType( ::sal_Int16 nFailureType ) override;
// non-interface specific functions
void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, sal_Int16 nLang);
void LNG_DLLPUBLIC SetWordLanguage(const OUString &rWord, LanguageType nLang);
void LNG_DLLPUBLIC SetFailureType(sal_Int16 nTypeP);
void LNG_DLLPUBLIC SetAlternatives( const css::uno::Sequence< OUString > &rAlt );
static css::uno::Reference < css::linguistic2::XSpellAlternatives > LNG_DLLPUBLIC CreateSpellAlternatives(
const OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt );
const OUString &rWord, LanguageType nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt );
};
} // namespace linguistic

View File

@ -43,7 +43,7 @@ public:
explicit constexpr strong_int(UNDERLYING_TYPE value) : m_value(value) {}
strong_int() : m_value(0) {}
explicit operator UNDERLYING_TYPE() const { return m_value; }
explicit constexpr operator UNDERLYING_TYPE() const { return m_value; }
explicit operator bool() const { return m_value != 0; }
UNDERLYING_TYPE get() const { return m_value; }
@ -56,6 +56,15 @@ public:
strong_int& operator++() { ++m_value; return *this; }
strong_int operator++(int) { UNDERLYING_TYPE nOldValue = m_value; ++m_value; return strong_int(nOldValue); }
bool anyOf(strong_int v) const {
return *this == v;
}
template<typename... Args>
bool anyOf(strong_int first, Args... args) const {
return *this == first || anyOf(args...);
}
private:
UNDERLYING_TYPE m_value;
};

View File

@ -98,14 +98,14 @@ public:
bool IsReadOnly(EOption eOption) const;
// returns for a language the scripttype
static SvtScriptType GetScriptTypeOfLanguage( sal_uInt16 nLang );
static SvtScriptType GetScriptTypeOfLanguage( LanguageType nLang );
// convert from css::i18n::ScriptType constants to SvtScriptType
static SvtScriptType FromI18NToSvtScriptType( sal_Int16 nI18NType );
static sal_Int16 FromSvtScriptTypeToI18N( SvtScriptType nI18NType );
static sal_Int16 GetI18NScriptTypeOfLanguage( sal_uInt16 nLang );
static sal_Int16 GetI18NScriptTypeOfLanguage( LanguageType nLang );
};

View File

@ -96,28 +96,27 @@ public:
void changeLocale( const LanguageTag& rLanguageTag )
{
LanguageType eLang = rLanguageTag.getLanguageType( false);
switch ( eLang )
{
case LANGUAGE_SYSTEM :
if ( eLang == LANGUAGE_SYSTEM )
pCurrent = pSystem;
break;
case LANGUAGE_ENGLISH_US :
else if ( eLang == LANGUAGE_ENGLISH_US )
{
if ( !pEnglish )
pEnglish = new LocaleDataWrapper( m_xContext, rLanguageTag );
pCurrent = pEnglish;
break;
default:
if ( !pAny )
{
pAny = new LocaleDataWrapper( m_xContext, rLanguageTag );
eLastAnyLanguage = eLang;
}
else if ( eLastAnyLanguage != eLang )
{
pAny->setLanguageTag( rLanguageTag );
eLastAnyLanguage = eLang;
}
pCurrent = pAny;
}
else
{
if ( !pAny )
{
pAny = new LocaleDataWrapper( m_xContext, rLanguageTag );
eLastAnyLanguage = eLang;
}
else if ( eLastAnyLanguage != eLang )
{
pAny->setLanguageTag( rLanguageTag );
eLastAnyLanguage = eLang;
}
pCurrent = pAny;
}
eCurrentLanguage = eLang;
}

View File

@ -754,7 +754,7 @@ public:
void GetCompatibilityCurrency( OUString& rSymbol, OUString& rAbbrev ) const;
/// Fill rList with the language/country codes that have been allocated
void GetUsedLanguages( std::vector<sal_uInt16>& rList );
void GetUsedLanguages( std::vector<LanguageType>& rList );
/// Fill a NfKeywordIndex table with keywords of a language/country
void FillKeywordTable( NfKeywordTable& rKeywords, LanguageType eLang );

View File

@ -54,7 +54,7 @@ namespace o3tl
}
// load language strings from resource
SVX_DLLPUBLIC OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg );
SVX_DLLPUBLIC OUString GetDicInfoStr( const OUString& rName, const LanguageType nLang, bool bNeg );
class SVX_DLLPUBLIC SvxLanguageBoxBase
{
@ -69,7 +69,7 @@ public:
bool bHasLangNone, bool bLangNoneIsLangAll = false,
bool bCheckSpellAvail = false );
void AddLanguages( const css::uno::Sequence< sal_Int16 >& rLanguageTypes, SvxLanguageListFlags nLangList );
void AddLanguages( const std::vector< LanguageType >& rLanguageTypes, SvxLanguageListFlags nLangList );
sal_Int32 InsertLanguage( const LanguageType eLangType );
void InsertDefaultLanguage( sal_Int16 nType );

View File

@ -53,9 +53,9 @@ struct UNOTOOLS_DLLPUBLIC SvtLinguOptions
bROHyphMinWordLength;
// misc options (non-service specific)
sal_Int16 nDefaultLanguage;
sal_Int16 nDefaultLanguage_CJK;
sal_Int16 nDefaultLanguage_CTL;
LanguageType nDefaultLanguage;
LanguageType nDefaultLanguage_CJK;
LanguageType nDefaultLanguage_CTL;
bool bRODefaultLanguage;
bool bRODefaultLanguage_CJK;

View File

@ -170,7 +170,7 @@ public:
matching, excluding already known problems.
(e.g. used in number formatter dialog init)
*/
static css::uno::Sequence< sal_uInt16 > getInstalledLanguageTypes();
static std::vector< LanguageType > getInstalledLanguageTypes();
/// maps the LocaleData string to the International enum
MeasurementSystem mapMeasurementStringToEnum( const OUString& rMS ) const;

View File

@ -46,7 +46,7 @@ class UNOTOOLS_DLLPUBLIC TransliterationWrapper
TransliterationWrapper& operator=( const TransliterationWrapper& ) = delete;
void loadModuleImpl() const;
void setLanguageLocaleImpl( sal_uInt16 nLang );
void setLanguageLocaleImpl( LanguageType nLang );
public:
TransliterationWrapper( const css::uno::Reference< css::uno::XComponentContext > & rxContext,
@ -60,7 +60,7 @@ public:
/** set a new language and load the corresponding transliteration module if
needed for the mode set with nType in the ctor */
void loadModuleIfNeeded( sal_uInt16 nLang );
void loadModuleIfNeeded( LanguageType nLang );
/** Load the transliteration module specified by rModuleName, which has to
be the UNO service implementation name that is expanded to the full UNO
@ -74,7 +74,7 @@ public:
those may load a different module and overwrite this setting. Only the
transliterate() method that takes no LanguageType parameter may be used
for a specific module loaded with this method. */
void loadModuleByImplName( const OUString& rModuleName, sal_uInt16 nLang );
void loadModuleByImplName( const OUString& rModuleName, LanguageType nLang );
/** This transliteration method corresponds with the loadModuleByImplName()
method. It relies on a module being loaded and does not try load one.
@ -84,7 +84,7 @@ public:
sal_Int32 nStart, sal_Int32 nLen ) const;
// Wrapper implementations of class Transliteration
OUString transliterate( const OUString& rStr, sal_uInt16 nLanguage,
OUString transliterate( const OUString& rStr, LanguageType nLanguage,
sal_Int32 nStart, sal_Int32 nLen,
css::uno::Sequence <sal_Int32>* pOffset );

View File

@ -26,6 +26,7 @@
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
#include <com/sun/star/uno/Sequence.h>
#include <rtl/ustrbuf.hxx>
#include <i18nlangtag/lang.h>
#include <memory>
#define XML_WRITTENNUMBERSTYLES "WrittenNumberStyles"
@ -56,7 +57,7 @@ private:
SAL_DLLPRIVATE void AddCalendarAttr_Impl( const OUString& rCalendar );
SAL_DLLPRIVATE void AddStyleAttr_Impl( bool bLong );
SAL_DLLPRIVATE void AddLanguageAttr_Impl( sal_Int32 nLang );
SAL_DLLPRIVATE void AddLanguageAttr_Impl( LanguageType nLang );
SAL_DLLPRIVATE void AddToTextElement_Impl( const OUString& rString );
SAL_DLLPRIVATE void FinishTextElement_Impl(bool bUseExtensionNS = false);

View File

@ -292,7 +292,7 @@ sal_Bool SAL_CALL
sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
if (nFailure != -1)
{
sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
LanguageType nLang = LinguLocaleToLanguage( rLocale );
// postprocess result for errors that should be ignored
if ( (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang ))
|| (!rHelper.IsSpellWithDigits() && HasDigits( rWord ))
@ -316,7 +316,7 @@ Reference< XSpellAlternatives >
Reference< XSpellAlternatives > xRes;
// note: mutex is held by higher up by spell which covers both
sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
LanguageType nLang = LinguLocaleToLanguage( rLocale );
int count;
Sequence< OUString > aStr( 0 );

View File

@ -431,7 +431,7 @@ sal_Bool SAL_CALL SpellChecker::isValid( const OUString& rWord, const Locale& rL
sal_Int16 nFailure = GetSpellFailure( rWord, rLocale );
if (nFailure != -1 && !rWord.match(SPELL_XML, 0))
{
sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
LanguageType nLang = LinguLocaleToLanguage( rLocale );
// postprocess result for errors that should be ignored
const bool bIgnoreError =
(!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang )) ||
@ -472,7 +472,7 @@ Reference< XSpellAlternatives >
if (n)
{
sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
LanguageType nLang = LinguLocaleToLanguage( rLocale );
int numsug = 0;
Sequence< OUString > aStr( 0 );

View File

@ -286,7 +286,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
sal_Int32 stem = 0;
sal_Int32 stem2 = 0;
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
if (LinguIsUnspecified( nLanguage) || aRTerm.isEmpty())
return noMeanings;
@ -375,7 +375,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (stem)
{
xTmpRes2 = xSpell->spell( "<?xml?><query type='analyze'><word>" +
aPTerm + "</word></query>", nLanguage, rProperties );
aPTerm + "</word></query>", (sal_uInt16)nLanguage, rProperties );
if (xTmpRes2.is())
{
Sequence<OUString>seq = xTmpRes2->getAlternatives();
@ -412,7 +412,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
{
Reference< XSpellAlternatives > xTmpRes;
xTmpRes = xSpell->spell( "<?xml?><query type='generate'><word>" +
sTerm + "</word>" + codeTerm + "</query>", nLanguage, rProperties );
sTerm + "</word>" + codeTerm + "</query>", (sal_uInt16)nLanguage, rProperties );
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
@ -464,11 +464,11 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
stem = 1;
xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, nLanguage, rProperties ))
if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, (sal_uInt16)nLanguage, rProperties ))
return noMeanings;
Reference< XSpellAlternatives > xTmpRes;
xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
aRTerm + "</word></query>", nLanguage, rProperties );
aRTerm + "</word></query>", (sal_uInt16)nLanguage, rProperties );
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();
@ -485,7 +485,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM
if (!pos)
return noMeanings;
xTmpRes = xSpell->spell( "<?xml?><query type='stem'><word>" +
aRTerm.copy(pos + 1) + "</word></query>", nLanguage, rProperties );
aRTerm.copy(pos + 1) + "</word></query>", (sal_uInt16)nLanguage, rProperties );
if (xTmpRes.is())
{
Sequence<OUString>seq = xTmpRes->getAlternatives();

View File

@ -79,7 +79,7 @@ class Thesaurus :
// cache for the Thesaurus dialog
Sequence < Reference < css::linguistic2::XMeaning > > prevMeanings;
OUString prevTerm;
sal_Int16 prevLocale;
LanguageType prevLocale;
Thesaurus(const Thesaurus &) = delete;
Thesaurus & operator = (const Thesaurus &) = delete;

View File

@ -124,7 +124,7 @@ void ReadThroughDic( const OUString &rMainURL, ConvDicXMLImport &rImport )
}
}
bool IsConvDic( const OUString &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType )
bool IsConvDic( const OUString &rFileURL, LanguageType &nLang, sal_Int16 &nConvType )
{
bool bRes = false;
@ -164,7 +164,7 @@ bool IsConvDic( const OUString &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType
ConvDic::ConvDic(
const OUString &rName,
sal_Int16 nLang,
LanguageType nLang,
sal_Int16 nConvType,
bool bBiDirectional,
const OUString &rMainURL) :

View File

@ -39,7 +39,7 @@
#define SN_CONV_DICTIONARY "com.sun.star.linguistic2.ConversionDictionary"
bool IsConvDic( const OUString &rFileURL, sal_Int16 &nLang, sal_Int16 &nConvType );
bool IsConvDic( const OUString &rFileURL, LanguageType &nLang, sal_Int16 &nConvType );
typedef std::unordered_multimap<OUString, OUString, const OUStringHash> ConvMap;
@ -69,7 +69,7 @@ protected:
OUString aMainURL; // URL to file
OUString aName;
sal_Int16 nLanguage;
LanguageType nLanguage;
sal_Int16 nConversionType;
sal_Int16 nMaxLeftCharCount;
sal_Int16 nMaxRightCharCount;
@ -89,7 +89,7 @@ protected:
public:
ConvDic( const OUString &rName,
sal_Int16 nLanguage,
LanguageType nLanguage,
sal_Int16 nConversionType,
bool bBiDirectional,
const OUString &rMainURL);

View File

@ -293,7 +293,7 @@ void ConvDicNameContainer::AddConvDics(
if(aExt != aSearchExt)
continue; // skip other files
sal_Int16 nLang;
LanguageType nLang;
sal_Int16 nConvType;
if (IsConvDic( aURL, nLang, nConvType ))
{
@ -413,7 +413,7 @@ uno::Reference< XConversionDictionary > SAL_CALL ConvDicList::addNewDictionary(
{
MutexGuard aGuard( GetLinguMutex() );
sal_Int16 nLang = LinguLocaleToLanguage( rLocale );
LanguageType nLang = LinguLocaleToLanguage( rLocale );
if (GetNameContainer().hasByName( rName ))
throw ElementExistException();

View File

@ -106,8 +106,8 @@ public:
class ConvDicXMLDictionaryContext_Impl :
public ConvDicXMLImportContext
{
sal_Int16 nLanguage;
sal_Int16 nConversionType;
LanguageType nLanguage;
sal_Int16 nConversionType;
public:
ConvDicXMLDictionaryContext_Impl( ConvDicXMLImport &rImport,

View File

@ -72,7 +72,7 @@ class ConvDicXMLImport : public SvXMLImport
// but the language and conversion type will
// still be determined!
sal_Int16 nLanguage; // language of the dictionary
LanguageType nLanguage; // language of the dictionary
sal_Int16 nConversionType; // conversion type the dictionary is used for
public:
@ -92,12 +92,12 @@ public:
sal_uInt16 nPrefix, const OUString &rLocalName,
const css::uno::Reference < css::xml::sax::XAttributeList > &rxAttrList ) override;
ConvDic * GetDic() { return pDic; }
sal_Int16 GetLanguage() const { return nLanguage; }
sal_Int16 GetConversionType() const { return nConversionType; }
ConvDic * GetDic() { return pDic; }
LanguageType GetLanguage() const { return nLanguage; }
sal_Int16 GetConversionType() const { return nConversionType; }
void SetLanguage( sal_Int16 nLang ) { nLanguage = nLang; }
void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
void SetLanguage( LanguageType nLang ) { nLanguage = nLang; }
void SetConversionType( sal_Int16 nType ) { nConversionType = nType; }
};

View File

@ -83,7 +83,7 @@ static bool getTag(const OString &rLine, const sal_Char *pTagName,
}
sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg )
sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, LanguageType &nLng, bool &bNeg )
{
// Sniff the header
sal_Int16 nDicVersion = DIC_VERSION_DONTKNOW;
@ -167,9 +167,10 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg )
DIC_VERSION_6 == nDicVersion)
{
// The language of the dictionary
rpStream->ReadUInt16( nLng );
if (VERS2_NOLANGUAGE == nLng)
sal_uInt16 nTmp = 0;
rpStream->ReadUInt16( nTmp );
nLng = LanguageType(nTmp);
if (VERS2_NOLANGUAGE == static_cast<sal_uInt16>(nLng))
nLng = LANGUAGE_NONE;
// Negative Flag
@ -181,7 +182,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg )
}
DictionaryNeo::DictionaryNeo(const OUString &rName,
sal_Int16 nLang, DictionaryType eType,
LanguageType nLang, DictionaryType eType,
const OUString &rMainURL,
bool bWriteable) :
aDicEvtListeners( GetLinguMutex() ),
@ -259,7 +260,7 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
// read header
bool bNegativ;
sal_uInt16 nLang;
LanguageType nLang;
nDicVersion = ReadDicVersion(pStream, nLang, bNegativ);
sal_uLong nErr = pStream->GetError();
if (0 != nErr)
@ -753,7 +754,7 @@ Locale SAL_CALL DictionaryNeo::getLocale( )
void SAL_CALL DictionaryNeo::setLocale( const Locale& aLocale )
{
MutexGuard aGuard( GetLinguMutex() );
sal_Int16 nLanguageP = LinguLocaleToLanguage( aLocale );
LanguageType nLanguageP = LinguLocaleToLanguage( aLocale );
if (!bIsReadonly && nLanguage != nLanguageP)
{
nLanguage = nLanguageP;

View File

@ -33,7 +33,7 @@
#define DIC_MAX_ENTRIES 30000
sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, bool &bNeg );
sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, LanguageType &nLng, bool &bNeg );
class DictionaryNeo :
public ::cppu::WeakImplHelper
@ -49,7 +49,7 @@ class DictionaryNeo :
OUString aDicName;
OUString aMainURL;
css::linguistic2::DictionaryType eDicType;
sal_Int16 nLanguage;
LanguageType nLanguage;
sal_Int16 nDicVersion;
bool bNeedEntries;
bool bIsModified;
@ -75,7 +75,7 @@ class DictionaryNeo :
bool bIsLoadEntries = false);
public:
DictionaryNeo(const OUString &rName, sal_Int16 nLang,
DictionaryNeo(const OUString &rName, LanguageType nLang,
css::linguistic2::DictionaryType eType,
const OUString &rMainURL,
bool bWriteable );

View File

@ -52,7 +52,7 @@ using namespace com::sun::star::linguistic2;
using namespace linguistic;
static bool IsVers2OrNewer( const OUString& rFileURL, sal_uInt16& nLng, bool& bNeg );
static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg );
static void AddInternal( const uno::Reference< XDictionary > &rDic,
const OUString& rNew );
@ -295,9 +295,9 @@ void DicList::SearchForDictionaries(
OUString aDCP("dcp");
for (sal_Int32 i = 0; i < nEntries; ++i)
{
OUString aURL( pDirCnt[i] );
sal_uInt16 nLang = LANGUAGE_NONE;
bool bNeg = false;
OUString aURL( pDirCnt[i] );
LanguageType nLang = LANGUAGE_NONE;
bool bNeg = false;
if(!::IsVers2OrNewer( aURL, nLang, bNeg ))
{
@ -315,7 +315,7 @@ void DicList::SearchForDictionaries(
// Record in the list of Dictionaries
// When it already exists don't record
sal_Int16 nSystemLanguage = MsLangId::getSystemLanguage();
LanguageType nSystemLanguage = MsLangId::getSystemLanguage();
OUString aTmp1 = ToLower( aURL, nSystemLanguage );
sal_Int32 nPos = aTmp1.lastIndexOf( '/' );
if (-1 != nPos)
@ -520,7 +520,7 @@ uno::Reference< XDictionary > SAL_CALL
{
osl::MutexGuard aGuard( GetLinguMutex() );
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
bool bIsWriteablePath = rURL.match( GetDictionaryWriteablePath() );
return new DictionaryNeo( rName, nLanguage, eDicType, rURL, bIsWriteablePath );
}
@ -801,7 +801,7 @@ static void AddUserData( const uno::Reference< XDictionary > &rDic )
}
}
static bool IsVers2OrNewer( const OUString& rFileURL, sal_uInt16& nLng, bool& bNeg )
static bool IsVers2OrNewer( const OUString& rFileURL, LanguageType& nLng, bool& bNeg )
{
if (rFileURL.isEmpty())
return false;

View File

@ -40,7 +40,7 @@ namespace linguistic
{
HyphenatedWord::HyphenatedWord(const OUString &rWord, sal_uInt16 nLang, sal_Int16 nHPos,
HyphenatedWord::HyphenatedWord(const OUString &rWord, LanguageType nLang, sal_Int16 nHPos,
const OUString &rHyphWord, sal_Int16 nPos ) :
aWord (rWord),
aHyphenatedWord (rHyphWord),
@ -113,7 +113,7 @@ sal_Bool SAL_CALL HyphenatedWord::isAlternativeSpelling()
}
PossibleHyphens::PossibleHyphens(const OUString &rWord, sal_uInt16 nLang,
PossibleHyphens::PossibleHyphens(const OUString &rWord, LanguageType nLang,
const OUString &rHyphWord,
const Sequence< sal_Int16 > &rPositions) :
aWord (rWord),
@ -157,14 +157,14 @@ Sequence< sal_Int16 > SAL_CALL PossibleHyphens::getHyphenationPositions()
}
css::uno::Reference <css::linguistic2::XHyphenatedWord> HyphenatedWord::CreateHyphenatedWord(
const OUString &rWord, sal_Int16 nLang, sal_Int16 nHyphenationPos,
const OUString &rWord, LanguageType nLang, sal_Int16 nHyphenationPos,
const OUString &rHyphenatedWord, sal_Int16 nHyphenPos )
{
return new HyphenatedWord( rWord, nLang, nHyphenationPos, rHyphenatedWord, nHyphenPos );
}
css::uno::Reference < css::linguistic2::XPossibleHyphens > PossibleHyphens::CreatePossibleHyphens
(const OUString &rWord, sal_Int16 nLang,
(const OUString &rWord, LanguageType nLang,
const OUString &rHyphWord,
const css::uno::Sequence< sal_Int16 > &rPositions)
{

View File

@ -146,31 +146,27 @@ static uno::Sequence< lang::Locale > GetAvailLocales(
struct SvcInfo
{
const OUString aSvcImplName;
const uno::Sequence< sal_Int16 > aSuppLanguages;
const std::vector< LanguageType > aSuppLanguages;
SvcInfo( const OUString &rSvcImplName,
const uno::Sequence< sal_Int16 > &rSuppLanguages ) :
const std::vector< LanguageType > &rSuppLanguages ) :
aSvcImplName (rSvcImplName),
aSuppLanguages (rSuppLanguages)
{
}
bool HasLanguage( sal_Int16 nLanguage ) const;
bool HasLanguage( LanguageType nLanguage ) const;
};
bool SvcInfo::HasLanguage( sal_Int16 nLanguage ) const
bool SvcInfo::HasLanguage( LanguageType nLanguage ) const
{
sal_Int32 nCnt = aSuppLanguages.getLength();
const sal_Int16 *pLang = aSuppLanguages.getConstArray();
sal_Int32 i;
for ( i = 0; i < nCnt; ++i)
for ( auto const & i : aSuppLanguages)
{
if (nLanguage == pLang[i])
break;
if (nLanguage == i)
return true;
}
return i < nCnt;
return false;
}
class LngSvcMgrListenerHelper :
@ -1035,7 +1031,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
if (xSvc.is())
{
OUString aImplName;
uno::Sequence< sal_Int16 > aLanguages;
std::vector< LanguageType > aLanguages;
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
@ -1044,7 +1040,7 @@ void LngSvcMgr::GetAvailableSpellSvcs_Impl()
SAL_WARN_IF( !xSuppLoc.is(), "linguistic", "interfaces not supported" );
if (xSuppLoc.is()) {
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailSpellSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
@ -1097,7 +1093,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
if (xSvc.is() && pAvailGrammarSvcs)
{
OUString aImplName;
uno::Sequence< sal_Int16 > aLanguages;
std::vector< LanguageType > aLanguages;
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
@ -1107,7 +1103,7 @@ void LngSvcMgr::GetAvailableGrammarSvcs_Impl()
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailGrammarSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
@ -1158,7 +1154,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
if (xSvc.is())
{
OUString aImplName;
uno::Sequence< sal_Int16 > aLanguages;
std::vector< LanguageType > aLanguages;
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
@ -1168,7 +1164,7 @@ void LngSvcMgr::GetAvailableHyphSvcs_Impl()
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailHyphSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );
}
@ -1219,7 +1215,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
if (xSvc.is())
{
OUString aImplName;
uno::Sequence< sal_Int16 > aLanguages;
std::vector< LanguageType > aLanguages;
uno::Reference< XServiceInfo > xInfo( xSvc, uno::UNO_QUERY );
if (xInfo.is())
aImplName = xInfo->getImplementationName();
@ -1229,7 +1225,7 @@ void LngSvcMgr::GetAvailableThesSvcs_Impl()
if (xSuppLoc.is())
{
uno::Sequence<lang::Locale> aLocaleSequence(xSuppLoc->getLocales());
aLanguages = LocaleSeqToLangSeq( aLocaleSequence );
aLanguages = LocaleSeqToLangVec( aLocaleSequence );
}
pAvailThesSvcs->push_back( o3tl::make_unique<SvcInfo>( aImplName, aLanguages ) );

View File

@ -93,14 +93,10 @@ css::lang::Locale LinguLanguageToLocale( LanguageType nLanguage )
bool LinguIsUnspecified( LanguageType nLanguage )
{
switch (nLanguage)
{
case LANGUAGE_NONE:
case LANGUAGE_UNDETERMINED:
case LANGUAGE_MULTIPLE:
return true;
}
return false;
return nLanguage.anyOf(
LANGUAGE_NONE,
LANGUAGE_UNDETERMINED,
LANGUAGE_MULTIPLE);
}
// When adding anything keep both LinguIsUnspecified() methods in sync!
@ -264,7 +260,7 @@ static bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry )
uno::Reference< XDictionaryEntry > SearchDicList(
const uno::Reference< XSearchableDictionaryList > &xDicList,
const OUString &rWord, sal_Int16 nLanguage,
const OUString &rWord, LanguageType nLanguage,
bool bSearchPosDics, bool bSearchSpellEntry )
{
MutexGuard aGuard( GetLinguMutex() );
@ -286,7 +282,7 @@ uno::Reference< XDictionaryEntry > SearchDicList(
uno::Reference< XDictionary > axDic( pDic[i], UNO_QUERY );
DictionaryType eType = axDic->getDictionaryType();
sal_Int16 nLang = LinguLocaleToLanguage( axDic->getLocale() );
LanguageType nLang = LinguLocaleToLanguage( axDic->getLocale() );
if ( axDic.is() && axDic->isActive()
&& (nLang == nLanguage || LinguIsUnspecified( nLang)) )
@ -343,7 +339,7 @@ bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicLi
DictionaryError AddEntryToDic(
uno::Reference< XDictionary > &rxDic,
const OUString &rWord, bool bIsNeg,
const OUString &rRplcTxt, sal_Int16 /* nRplcLang */,
const OUString &rRplcTxt,
bool bStripDot )
{
if (!rxDic.is())
@ -380,8 +376,23 @@ DictionaryError AddEntryToDic(
return nRes;
}
std::vector< LanguageType >
LocaleSeqToLangVec( uno::Sequence< Locale > &rLocaleSeq )
{
const Locale *pLocale = rLocaleSeq.getConstArray();
sal_Int32 nCount = rLocaleSeq.getLength();
std::vector< LanguageType > aLangs;
for (sal_Int32 i = 0; i < nCount; ++i)
{
aLangs.push_back( LinguLocaleToLanguage( pLocale[i] ) );
}
return aLangs;
}
uno::Sequence< sal_Int16 >
LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq )
LocaleSeqToLangSeq( uno::Sequence< Locale > &rLocaleSeq )
{
const Locale *pLocale = rLocaleSeq.getConstArray();
sal_Int32 nCount = rLocaleSeq.getLength();
@ -390,12 +401,11 @@ uno::Sequence< sal_Int16 >
sal_Int16 *pLang = aLangs.getArray();
for (sal_Int32 i = 0; i < nCount; ++i)
{
pLang[i] = LinguLocaleToLanguage( pLocale[i] );
pLang[i] = (sal_uInt16)LinguLocaleToLanguage( pLocale[i] );
}
return aLangs;
}
bool IsReadOnly( const OUString &rURL, bool *pbExist )
{
bool bRes = false;
@ -562,7 +572,7 @@ uno::Reference< XHyphenatedWord > RebuildHyphensAndControlChars(
}
else
{
sal_Int16 nLang = LinguLocaleToLanguage( rxHyphWord->getLocale() );
LanguageType nLang = LinguLocaleToLanguage( rxHyphWord->getLocale() );
xRes = new HyphenatedWord(
rOrigWord, nLang, nOrigHyphenationPos,
aOrigHyphenatedWord, nOrigHyphenPos );
@ -584,7 +594,7 @@ osl::Mutex & lcl_GetCharClassMutex()
return aMutex;
}
bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, sal_Int16 nLanguage )
bool IsUpper( const OUString &rText, sal_Int32 nPos, sal_Int32 nLen, LanguageType nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );
@ -620,7 +630,7 @@ CapType SAL_CALL capitalType(const OUString& aTerm, CharClass * pCC)
return CapType::UNKNOWN;
}
OUString ToLower( const OUString &rText, sal_Int16 nLanguage )
OUString ToLower( const OUString &rText, LanguageType nLanguage )
{
MutexGuard aGuard( lcl_GetCharClassMutex() );

View File

@ -756,7 +756,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage(
sal_Int16 nLanguage )
{
MutexGuard aGuard( GetLinguMutex() );
return hasLocale( LanguageTag::convertToLocale( nLanguage) );
return hasLocale( LanguageTag::convertToLocale( LanguageType(nLanguage)) );
}
@ -766,7 +766,7 @@ sal_Bool SAL_CALL SpellCheckerDispatcher::isValid(
const uno::Sequence< beans::PropertyValue >& rProperties )
{
MutexGuard aGuard( GetLinguMutex() );
return isValid( rWord, LanguageTag::convertToLocale( nLanguage ), rProperties);
return isValid( rWord, LanguageTag::convertToLocale( LanguageType(nLanguage) ), rProperties);
}
@ -776,7 +776,7 @@ uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL SpellCheckerDispatche
const uno::Sequence< beans::PropertyValue >& rProperties )
{
MutexGuard aGuard( GetLinguMutex() );
return spell( rWord, LanguageTag::convertToLocale( nLanguage), rProperties);
return spell( rWord, LanguageTag::convertToLocale( LanguageType(nLanguage) ), rProperties);
}
@ -788,7 +788,7 @@ void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale,
if (m_pCache)
m_pCache->Flush(); // new services may spell differently...
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@ -822,7 +822,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
const SpellSvcByLangMap_t::const_iterator aIt( m_aSvcMap.find( nLanguage ) );
const LangSvcEntries_Spell *pEntry = aIt != m_aSvcMap.end() ? aIt->second.get() : nullptr;
if (pEntry)

View File

@ -60,7 +60,7 @@ bool SeqHasEntry(
}
void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
void SearchSimilarText( const OUString &rText, LanguageType nLanguage,
Reference< XSearchableDictionaryList > &xDicList,
std::vector< OUString > & rDicListProps )
{
@ -77,7 +77,7 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
{
Reference< XDictionary > xDic( pDic[i], UNO_QUERY );
sal_Int16 nLang = LinguLocaleToLanguage( xDic->getLocale() );
LanguageType nLang = LinguLocaleToLanguage( xDic->getLocale() );
if ( xDic.is() && xDic->isActive()
&& (nLang == nLanguage || LinguIsUnspecified( nLang)) )
@ -108,7 +108,7 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage,
void SeqRemoveNegEntries( std::vector< OUString > &rSeq,
Reference< XSearchableDictionaryList > &rxDicList,
sal_Int16 nLanguage )
LanguageType nLanguage )
{
bool bSthRemoved = false;
sal_Int32 nLen = rSeq.size();
@ -179,7 +179,7 @@ SpellAlternatives::SpellAlternatives()
SpellAlternatives::SpellAlternatives(
const OUString &rWord, sal_Int16 nLang,
const OUString &rWord, LanguageType nLang,
const Sequence< OUString > &rAlternatives ) :
aAlt (rAlternatives),
aWord (rWord),
@ -243,7 +243,7 @@ void SAL_CALL SpellAlternatives::setFailureType( sal_Int16 nFailureType )
}
void SpellAlternatives::SetWordLanguage(const OUString &rWord, sal_Int16 nLang)
void SpellAlternatives::SetWordLanguage(const OUString &rWord, LanguageType nLang)
{
MutexGuard aGuard( GetLinguMutex() );
aWord = rWord;
@ -266,7 +266,7 @@ void SpellAlternatives::SetAlternatives( const Sequence< OUString > &rAlt )
css::uno::Reference < css::linguistic2::XSpellAlternatives > SpellAlternatives::CreateSpellAlternatives(
const OUString &rWord, sal_Int16 nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt )
const OUString &rWord, LanguageType nLang, sal_Int16 nTypeP, const css::uno::Sequence< OUString > &rAlt )
{
SpellAlternatives* pAlt = new SpellAlternatives;
pAlt->SetWordLanguage( rWord, nLang );

View File

@ -110,7 +110,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
Sequence< Reference< XMeaning > > aMeanings;
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
if (LinguIsUnspecified( nLanguage) || rTerm.isEmpty())
return aMeanings;
@ -202,7 +202,7 @@ void ThesaurusDispatcher::SetServiceList( const Locale &rLocale,
{
MutexGuard aGuard( GetLinguMutex() );
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
sal_Int32 nLen = rSvcImplNames.getLength();
if (0 == nLen)
@ -236,7 +236,7 @@ Sequence< OUString >
Sequence< OUString > aRes;
// search for entry with that language and use data from that
sal_Int16 nLanguage = LinguLocaleToLanguage( rLocale );
LanguageType nLanguage = LinguLocaleToLanguage( rLocale );
const ThesSvcByLangMap_t::const_iterator aIt( aSvcMap.find( nLanguage ) );
const LangSvcEntries_Thes *pEntry = aIt != aSvcMap.end() ? aIt->second.get() : nullptr;
if (pEntry)

View File

@ -76,8 +76,8 @@ sal_uInt32 GetLangId(const OString &rLang)
void RscLangEnum::Init( RscNameTable& rNames )
{
SetConstant( rNames.Put( "SYSTEM", CONSTNAME, (long)LANGUAGE_SYSTEM ), LANGUAGE_SYSTEM );
SetConstant( rNames.Put( "DONTKNOW", CONSTNAME, LANGUAGE_DONTKNOW ), LANGUAGE_DONTKNOW );
SetConstant( rNames.Put( "SYSTEM", CONSTNAME, (sal_uInt16)LANGUAGE_SYSTEM ), (sal_uInt16)LANGUAGE_SYSTEM );
SetConstant( rNames.Put( "DONTKNOW", CONSTNAME, (sal_uInt16)LANGUAGE_DONTKNOW ), (sal_uInt16)LANGUAGE_DONTKNOW );
sal_Int32 nIndex = 0;
mnLangId = 0x400; // stay away from selfdefined...

View File

@ -177,12 +177,12 @@ public:
void SetPrintOptions ( const ScPrintOptions& rOpt );
void InsertEntryToLRUList(sal_uInt16 nFIndex);
static void GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang,
static void GetSpellSettings( LanguageType& rDefLang, LanguageType& rCjkLang, LanguageType& rCtlLang,
bool& rAutoSpell );
static void SetAutoSpellProperty( bool bSet );
static bool HasThesaurusLanguage( sal_uInt16 nLang );
static bool HasThesaurusLanguage( LanguageType nLang );
sal_uInt16 GetOptDigitLanguage(); // from CTL options
LanguageType GetOptDigitLanguage(); // from CTL options
ScNavipiCfg& GetNavipiCfg();
ScAddInCfg& GetAddInCfg();

View File

@ -1188,7 +1188,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, Transliteratio
utl::TransliterationWrapper aTransliterationWrapper( comphelper::getProcessComponentContext(), nType );
bool bConsiderLanguage = aTransliterationWrapper.needLanguageForTheMode();
sal_uInt16 nLanguage = LANGUAGE_SYSTEM;
LanguageType nLanguage = LANGUAGE_SYSTEM;
std::unique_ptr<ScEditEngineDefaulter> pEngine; // not using pEditEngine member because of defaults

View File

@ -50,8 +50,8 @@ void ScNumFormatAbbrev::Load( SvStream& rStream, rtl_TextEncoding eByteStrSet )
sal_uInt16 nSysLang, nLang;
sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
rStream.ReadUInt16( nSysLang ).ReadUInt16( nLang );
eLanguage = (LanguageType) nLang;
eSysLanguage = (LanguageType) nSysLang;
eLanguage = LanguageType(nLang);
eSysLanguage = LanguageType(nSysLang);
if ( eSysLanguage == LANGUAGE_SYSTEM ) // old versions did write it
eSysLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
}
@ -59,7 +59,7 @@ void ScNumFormatAbbrev::Load( SvStream& rStream, rtl_TextEncoding eByteStrSet )
void ScNumFormatAbbrev::Save( SvStream& rStream, rtl_TextEncoding eByteStrSet ) const
{
rStream.WriteUniOrByteString( sFormatstring, eByteStrSet );
rStream.WriteUInt16( eSysLanguage ).WriteUInt16( eLanguage );
rStream.WriteUInt16( (sal_uInt16)eSysLanguage ).WriteUInt16( (sal_uInt16)eLanguage );
}
void ScNumFormatAbbrev::PutFormatIndex(sal_uInt32 nFormat,

View File

@ -758,11 +758,11 @@ namespace {
const NfIndexTableOffset PRV_NF_INDEX_REUSE = NF_INDEX_TABLE_ENTRIES;
/** German primary language not defined, LANGUAGE_GERMAN belongs to Germany. */
const LanguageType PRV_LANGUAGE_GERMAN_PRIM = LANGUAGE_GERMAN & LANGUAGE_MASK_PRIMARY;
constexpr LanguageType PRV_LANGUAGE_GERMAN_PRIM = primary(LANGUAGE_GERMAN);
/** French primary language not defined, LANGUAGE_FRENCH belongs to France. */
const LanguageType PRV_LANGUAGE_FRENCH_PRIM = LANGUAGE_FRENCH & LANGUAGE_MASK_PRIMARY;
constexpr LanguageType PRV_LANGUAGE_FRENCH_PRIM = primary(LANGUAGE_FRENCH);
/** Parent language identifier for Asian languages. */
const LanguageType PRV_LANGUAGE_ASIAN_PRIM = LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY;
constexpr LanguageType PRV_LANGUAGE_ASIAN_PRIM = primary(LANGUAGE_CHINESE);
/** Stores the number format used in Calc for an Excel built-in number format. */
struct XclBuiltInFormat

View File

@ -912,7 +912,7 @@ SvtUserOptions& ScModule::GetUserOptions()
return *pUserOptions;
}
sal_uInt16 ScModule::GetOptDigitLanguage()
LanguageType ScModule::GetOptDigitLanguage()
{
SvtCTLOptions::TextNumerals eNumerals = GetCTLOptions().GetCTLTextNumerals();
return ( eNumerals == SvtCTLOptions::NUMERALS_ARABIC ) ? LANGUAGE_ENGLISH_US :
@ -927,7 +927,7 @@ sal_uInt16 ScModule::GetOptDigitLanguage()
*/
void ScModule::ModifyOptions( const SfxItemSet& rOptSet )
{
sal_uInt16 nOldSpellLang, nOldCjkLang, nOldCtlLang;
LanguageType nOldSpellLang, nOldCjkLang, nOldCtlLang;
bool bOldAutoSpell;
GetSpellSettings( nOldSpellLang, nOldCjkLang, nOldCtlLang, bOldAutoSpell );
@ -2230,7 +2230,7 @@ using namespace com::sun::star;
#define LINGUPROP_AUTOSPELL "IsSpellAuto"
void ScModule::GetSpellSettings( sal_uInt16& rDefLang, sal_uInt16& rCjkLang, sal_uInt16& rCtlLang,
void ScModule::GetSpellSettings( LanguageType& rDefLang, LanguageType& rCjkLang, LanguageType& rCtlLang,
bool& rAutoSpell )
{
// use SvtLinguConfig instead of service LinguProperties to avoid
@ -2255,7 +2255,7 @@ void ScModule::SetAutoSpellProperty( bool bSet )
aConfig.SetProperty( OUString( LINGUPROP_AUTOSPELL ), uno::Any(bSet) );
}
bool ScModule::HasThesaurusLanguage( sal_uInt16 nLang )
bool ScModule::HasThesaurusLanguage( LanguageType nLang )
{
if ( nLang == LANGUAGE_NONE )
return false;

View File

@ -304,7 +304,7 @@ OUString ScAsciiOptions::WriteToString() const
aOutStr += "," +
// Language
OUString::number(eLang) + "," +
OUString::number((sal_uInt16)eLang) + "," +
// Import quoted field as text.
OUString::boolean( bQuotedFieldAsText ) + "," +
// Detect special numbers.

View File

@ -596,7 +596,7 @@ void ScImportAsciiDlg::SaveParameters()
pRbFixed->IsChecked(),
static_cast<sal_Int32>(pNfRow->GetValue()),
pLbCharSet->GetSelectEntryPos(),
static_cast<sal_Int32>(pLbCustomLang->GetSelectLanguage()), meCall );
static_cast<sal_uInt16>(pLbCustomLang->GetSelectLanguage()), meCall );
}
void ScImportAsciiDlg::SetSeparators()

View File

@ -404,7 +404,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L
{
// Settings from the SpellCheckCfg get into Doc- and ViewOptions
sal_uInt16 nDefLang, nCjkLang, nCtlLang;
LanguageType nDefLang, nCjkLang, nCtlLang;
bool bAutoSpell;
ScModule::GetSpellSettings( nDefLang, nCjkLang, nCtlLang, bAutoSpell );
ScModule* pScMod = SC_MOD();
@ -437,7 +437,7 @@ void ScDocShell::InitOptions(bool bForLoading) // called from InitNew and L
// print options are now set directly before the printing
aDocument.SetLanguage( (LanguageType) nDefLang, (LanguageType) nCjkLang, (LanguageType) nCtlLang );
aDocument.SetLanguage( nDefLang, nCjkLang, nCtlLang );
}
Printer* ScDocShell::GetDocumentPrinter() // for OLE

View File

@ -21,6 +21,7 @@
#include "address.hxx"
#include <sal/types.h>
#include <i18nlangtag/lang.h>
class SfxItemSet;
class SfxBindings;
@ -54,7 +55,7 @@ public:
static void PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSet,
sal_uInt16 nWhichId, SvtScriptType nScript );
static sal_uInt16 GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos );
static LanguageType GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos );
static TransliterationFlags GetTransliterationType( sal_uInt16 nSlotID );

View File

@ -200,7 +200,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
LanguageType eLang = pDlg->GetLanguageType();
OUStringBuffer aBuf;
aBuf.append(OUString::number(static_cast<sal_Int32>(eLang)));
aBuf.append(OUString::number(static_cast<sal_uInt16>(eLang)));
aBuf.append(' ');
aBuf.append(pDlg->IsDateConversionSet() ? sal_Unicode('1') : sal_Unicode('0'));
aFilterOptions = aBuf.makeStringAndClear();

View File

@ -328,7 +328,7 @@ void ScCellShell::GetCellState( SfxItemSet& rSet )
if (!bDisable)
{
// test for available languages
sal_uInt16 nLang = ScViewUtil::GetEffLanguage( &rDoc, aCursor );
LanguageType nLang = ScViewUtil::GetEffLanguage( &rDoc, aCursor );
bDisable = !ScModule::HasThesaurusLanguage( nLang );
}
}

View File

@ -5396,7 +5396,7 @@ bool ScGridWindow::ContinueOnlineSpelling()
}
const ScPatternAttr* pPattern = pDoc->GetPattern(nCol, nRow, nTab);
sal_uInt16 nCellLang =
LanguageType nCellLang =
static_cast<const SvxLanguageItem&>(pPattern->GetItem(ATTR_FONT_LANGUAGE)).GetValue();
if (nCellLang == LANGUAGE_SYSTEM)
nCellLang = Application::GetSettings().GetLanguageTag().getLanguageType(); // never use SYSTEM for spelling

View File

@ -192,7 +192,7 @@ bool ScConversionEngineBase::FindNextConversionCell()
const SfxPoolItem* pItem = mrDoc.GetAttr( nNewCol, nNewRow, mnStartTab, ATTR_FONT_LANGUAGE );
if( const SvxLanguageItem* pLangItem = dynamic_cast<const SvxLanguageItem*>( pItem ) )
{
LanguageType eLang = static_cast< LanguageType >( pLangItem->GetValue() );
LanguageType eLang = pLangItem->GetValue();
if( eLang == LANGUAGE_SYSTEM )
eLang = Application::GetSettings().GetLanguageTag().getLanguageType(); // never use SYSTEM for spelling
if( eLang != meCurrLang )

View File

@ -69,7 +69,7 @@ void ScViewUtil::PutItemScript( SfxItemSet& rShellSet, const SfxItemSet& rCoreSe
rShellSet.InvalidateItem( nWhichId );
}
sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
LanguageType ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
{
// used for thesaurus
@ -81,7 +81,7 @@ sal_uInt16 ScViewUtil::GetEffLanguage( ScDocument* pDoc, const ScAddress& rPos )
LanguageType eLnge;
if (pLangIt)
{
eLnge = (LanguageType) pLangIt->GetValue();
eLnge = pLangIt->GetValue();
if (eLnge == LANGUAGE_DONTKNOW) //! can this happen?
{
LanguageType eLatin, eCjk, eCtl;

View File

@ -172,7 +172,7 @@ public:
/** Starts the text conversion (hangul/hanja or Chinese simplified/traditional)
for the current viewshell */
void StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
void StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage,
const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
/** This is called internally when text conversion is started.
@ -214,7 +214,7 @@ private:
/** this is the language that is used for current text conversion.
Only valid if meMode is TEXT_CONVERSION.
*/
sal_Int16 mnConversionLanguage;
LanguageType mnConversionLanguage;
/** While the value of this flag is greater than 0 changes of the current page
do not lead to selecting the corresponding text in the outliner.

View File

@ -3320,7 +3320,7 @@ void TextObjBinary::WriteTextSpecInfo( SvStream* pStrm )
pStrm ->WriteUInt32( nPortionSize )
.WriteInt32( nFlags )
.WriteInt16( 1 ) // spellinfo -> needs rechecking
.WriteInt16( LanguageTag( rPortion.meCharLocale ).makeFallback().getLanguageType() )
.WriteInt16( (sal_uInt16)LanguageTag( rPortion.meCharLocale ).makeFallback().getLanguageType() )
.WriteInt16( 0 ); // alt language
}
}

View File

@ -95,7 +95,7 @@ rtl::Reference<FuPoor> FuHangulHanjaConversion::Create( ViewShell* pViewSh, ::sd
/**
* Search and replace
*/
void FuHangulHanjaConversion::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
void FuHangulHanjaConversion::StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage,
const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive )
{
@ -147,7 +147,7 @@ void FuHangulHanjaConversion::StartConversion( sal_Int16 nSourceLanguage, sal_In
mpView->EndUndo();
}
void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const vcl::Font *pTargetFont )
void FuHangulHanjaConversion::ConvertStyles( LanguageType nTargetLanguage, const vcl::Font *pTargetFont )
{
if( !mpDoc )
return;
@ -182,7 +182,7 @@ void FuHangulHanjaConversion::ConvertStyles( sal_Int16 nTargetLanguage, const vc
pStyle = pStyleSheetPool->Next();
}
mpDoc->SetLanguage( EE_CHAR_LANGUAGE_CJK, nTargetLanguage );
mpDoc->SetLanguage( nTargetLanguage, EE_CHAR_LANGUAGE_CJK );
}
void FuHangulHanjaConversion::StartChineseConversion()
@ -234,9 +234,9 @@ void FuHangulHanjaConversion::StartChineseConversion()
}
//execute translation
sal_Int16 nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
sal_Int16 nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
LanguageType nSourceLang = bToSimplified ? LANGUAGE_CHINESE_TRADITIONAL : LANGUAGE_CHINESE_SIMPLIFIED;
LanguageType nTargetLang = bToSimplified ? LANGUAGE_CHINESE_SIMPLIFIED : LANGUAGE_CHINESE_TRADITIONAL;
sal_Int32 nOptions = bUseVariants ? i18n::TextConversionOption::USE_CHARACTER_VARIANTS : 0;
if( !bCommonTerms )
nOptions = nOptions | i18n::TextConversionOption::CHARACTER_BY_CHARACTER;

View File

@ -32,12 +32,12 @@ public:
static rtl::Reference<FuPoor> Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq );
void StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
void StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage,
const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive );
void StartChineseConversion();
void ConvertStyles( sal_Int16 nTargetLanguage, const vcl::Font *pTargetFont );
void ConvertStyles( LanguageType nTargetLanguage, const vcl::Font *pTargetFont );
protected:
virtual ~FuHangulHanjaConversion() override;

View File

@ -273,8 +273,8 @@ EditEngine* PresenterTextView::Implementation::CreateEditEngine()
SvtLinguConfig().GetOptions( aOpt );
struct FontDta {
sal_Int16 nFallbackLang;
sal_Int16 nLang;
LanguageType nFallbackLang;
LanguageType nLang;
DefaultFontType nFontType;
sal_uInt16 nFontInfoId;
} aTable[3] =

View File

@ -1560,7 +1560,7 @@ void SdOutliner::HandleChangedSelection()
}
}
void SdOutliner::StartConversion( sal_Int16 nSourceLanguage, sal_Int16 nTargetLanguage,
void SdOutliner::StartConversion( LanguageType nSourceLanguage, LanguageType nTargetLanguage,
const vcl::Font *pTargetFont, sal_Int32 nOptions, bool bIsInteractive )
{
std::shared_ptr<sd::ViewShell> pViewShell (mpWeakViewShell.lock());

View File

@ -322,13 +322,13 @@ double SfxHTMLParser::GetTableDataOptionsValNum( sal_uInt32& nNumForm,
LanguageType& eNumLang, const OUString& aValStr, const OUString& aNumStr,
SvNumberFormatter& rFormatter )
{
LanguageType eParseLang = (LanguageType )aNumStr.toInt32();
LanguageType eParseLang(aNumStr.toInt32());
sal_uInt32 nParseForm = rFormatter.GetFormatForLanguageIfBuiltIn( 0, eParseLang );
double fVal;
(void)rFormatter.IsNumberFormat(aValStr, nParseForm, fVal);
if ( comphelper::string::getTokenCount(aNumStr, ';') > 2 )
{
eNumLang = (LanguageType)aNumStr.getToken( 1, ';' ).toInt32();
eNumLang = LanguageType(aNumStr.getToken( 1, ';' ).toInt32());
sal_Int32 nPos = aNumStr.indexOf( ';' );
nPos = aNumStr.indexOf( ';', nPos + 1 );
OUString aFormat( aNumStr.copy( nPos + 1 ) );

View File

@ -289,7 +289,7 @@ void add_group_entries(
aConfig.SetGroup(GroupName);
size_t key_count = aConfig.GetKeyCount();
std::map< unsigned short , std::string > map;
std::map< LanguageType, std::string > map;
for (size_t i = 0; i < key_count; i++)
{
@ -297,7 +297,7 @@ void add_group_entries(
OString key_value_utf8 = aConfig.ReadKey(sal::static_int_cast<sal_uInt16>(i));
iso_lang_identifier myiso_lang( iso_lang );
LanguageType ltype = LanguageTag( myiso_lang.make_OUString()).makeFallback().getLanguageType();
if( ( ltype & 0x0200 ) == 0 && map[ ltype ].empty() )
if( ( (sal_uInt16)ltype & 0x0200 ) == 0 && map[ ltype ].empty() )
{
Substitutor.set_language(iso_lang_identifier(iso_lang));
@ -308,13 +308,13 @@ void add_group_entries(
Substitutor.add_substitution(
GroupName.getStr(), make_winrc_unicode_string(key_value_utf16));
map[ static_cast<unsigned short>(ltype) ] = std::string( iso_lang.getStr() );
map[ ltype ] = std::string( iso_lang.getStr() );
}
else
{
if( !map[ ltype ].empty() )
{
printf("ERROR: Duplicated ms id %d found for the languages %s and %s !!!! This does not work in microsoft resources\nPlease remove one!\n", ltype , map[ ltype ].c_str() , iso_lang.getStr());
printf("ERROR: Duplicated ms id %d found for the languages %s and %s !!!! This does not work in microsoft resources\nPlease remove one!\n", (sal_uInt16)ltype , map[ ltype ].c_str() , iso_lang.getStr());
exit( -1 );
}
}

View File

@ -272,7 +272,7 @@ void SmDocShell::ArrangeFormula()
// and numbers should not be converted
ComplexTextLayoutFlags nLayoutMode = pOutDev->GetLayoutMode();
pOutDev->SetLayoutMode( ComplexTextLayoutFlags::Default );
sal_Int16 nDigitLang = pOutDev->GetDigitLanguage();
LanguageType nDigitLang = pOutDev->GetDigitLanguage();
pOutDev->SetDigitLanguage( LANGUAGE_ENGLISH );
mpTree->Arrange(*pOutDev, rFormat);
@ -290,8 +290,8 @@ void SetEditEngineDefaultFonts(SfxItemPool &rEditEngineItemPool, const SvtLinguO
{
// set fonts to be used
struct FontDta {
sal_Int16 nFallbackLang;
sal_Int16 nLang;
LanguageType nFallbackLang;
LanguageType nLang;
DefaultFontType nFontType;
sal_uInt16 nFontInfoId;
} aTable[3] =
@ -419,7 +419,7 @@ void SmDocShell::DrawFormula(OutputDevice &rDev, Point &rPosition, bool bDrawSel
// and numbers should not be converted
ComplexTextLayoutFlags nLayoutMode = rDev.GetLayoutMode();
rDev.SetLayoutMode( ComplexTextLayoutFlags::Default );
sal_Int16 nDigitLang = rDev.GetDigitLanguage();
LanguageType nDigitLang = rDev.GetDigitLanguage();
rDev.SetDigitLanguage( LANGUAGE_ENGLISH );
//Set selection if any

View File

@ -405,7 +405,7 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter,
aMessage += "\", ";
aMessage += rtl::OString::number( fPreviewNumber );
aMessage += ", sStr, ppColor, ";
aMessage += rtl::OString::number( eLang );
aMessage += rtl::OString::number( (sal_uInt16)eLang );
aMessage += " ) failed";
CPPUNIT_FAIL( aMessage.getStr() );
}

View File

@ -134,7 +134,7 @@ bool SvtLanguageOptions::IsReadOnly(SvtLanguageOptions::EOption eOption) const
}
// returns for a language the scripttype
SvtScriptType SvtLanguageOptions::GetScriptTypeOfLanguage( sal_uInt16 nLang )
SvtScriptType SvtLanguageOptions::GetScriptTypeOfLanguage( LanguageType nLang )
{
if( LANGUAGE_DONTKNOW == nLang )
nLang = LANGUAGE_ENGLISH_US;
@ -184,7 +184,7 @@ sal_Int16 SvtLanguageOptions::FromSvtScriptTypeToI18N( SvtScriptType nItemType )
return 0;
}
sal_Int16 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( sal_uInt16 nLang )
sal_Int16 SvtLanguageOptions::GetI18NScriptTypeOfLanguage( LanguageType nLang )
{
return FromSvtScriptTypeToI18N( GetScriptTypeOfLanguage( nLang ) );
}
@ -237,7 +237,7 @@ bool SvtSystemLanguageOptions::isKeyboardLayoutTypeInstalled(sal_Int16 scriptTyp
for(int i = 0; i < nLayouts; ++i)
{
LCID lang = MAKELCID((WORD)(reinterpret_cast<DWORD_PTR>(lpList[i]) & 0xffff), SORT_DEFAULT);
if (MsLangId::getScriptType(lang) == scriptType)
if (MsLangId::getScriptType(LanguageType(lang)) == scriptType)
{
isInstalled = true;
break;

View File

@ -481,12 +481,12 @@ bool SvxSearchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
rVal <<= (sal_Int32)m_aSearchOpt.transliterateFlags; break;
case MID_SEARCH_LOCALE:
{
sal_Int16 nLocale;
LanguageType nLocale;
if (!m_aSearchOpt.Locale.Language.isEmpty() || !m_aSearchOpt.Locale.Country.isEmpty() )
nLocale = LanguageTag::convertToLanguageType( m_aSearchOpt.Locale );
else
nLocale = LANGUAGE_NONE;
rVal <<= nLocale;
rVal <<= (sal_Int16)(sal_uInt16)nLocale;
break;
}
@ -655,13 +655,13 @@ bool SvxSearchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
bRet = (rVal >>= nInt);
if ( bRet )
{
if ( nInt == LANGUAGE_NONE )
if ( LanguageType(nInt) == LANGUAGE_NONE )
{
m_aSearchOpt.Locale = css::lang::Locale();
}
else
{
m_aSearchOpt.Locale = LanguageTag::convertToLocale( nInt);
m_aSearchOpt.Locale = LanguageTag::convertToLocale( LanguageType(nInt) );
}
}
break;

View File

@ -748,7 +748,7 @@ void SvNumberFormatter::DeleteEntry(sal_uInt32 nKey)
aFTable.erase(nKey);
}
void SvNumberFormatter::GetUsedLanguages( std::vector<sal_uInt16>& rList )
void SvNumberFormatter::GetUsedLanguages( std::vector<LanguageType>& rList )
{
rList.clear();
@ -3593,7 +3593,7 @@ const NfCurrencyEntry* SvNumberFormatter::GetCurrencyEntry( bool & bFoundBank,
}
else
{
eExtLang = (LanguageType) ((nExtLang < 0) ? -nExtLang : nExtLang);
eExtLang = LanguageType((nExtLang < 0) ? -nExtLang : nExtLang);
}
}
else
@ -4091,7 +4091,7 @@ OUString NfCurrencyEntry::BuildSymbolString(bool bBank,
}
if ( !bWithoutExtension && eLanguage != LANGUAGE_DONTKNOW && eLanguage != LANGUAGE_SYSTEM )
{
sal_Int32 nLang = static_cast<sal_Int32>(eLanguage);
sal_Int32 nLang = static_cast<sal_uInt16>(eLanguage);
aBuf.append('-').append( OUString::number(nLang, 16).toAsciiUpperCase());
}
}

View File

@ -142,10 +142,10 @@ sal_uInt8 SvNumberNatNum::MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang
{
sal_uInt8 nNatNum = 0;
eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc.
eLang &= 0x03FF; // 10 bit primary language
eLang = primary(eLang); // 10 bit primary language
if ( bDate )
{
if ( nDBNum == 4 && eLang == (LANGUAGE_KOREAN & 0x03FF) )
if ( nDBNum == 4 && eLang == primary(LANGUAGE_KOREAN) )
{
nNatNum = 9;
}
@ -159,57 +159,34 @@ sal_uInt8 SvNumberNatNum::MapDBNumToNatNum( sal_uInt8 nDBNum, LanguageType eLang
switch ( nDBNum )
{
case 1:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE) )
nNatNum = 4;
break;
case (LANGUAGE_JAPANESE & 0x03FF):
else if ( eLang == primary(LANGUAGE_JAPANESE) )
nNatNum = 1;
break;
case (LANGUAGE_KOREAN & 0x03FF):
else if ( eLang == primary(LANGUAGE_KOREAN) )
nNatNum = 1;
break;
}
break;
case 2:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE))
nNatNum = 5;
break;
case (LANGUAGE_JAPANESE & 0x03FF):
else if ( eLang == primary(LANGUAGE_JAPANESE) )
nNatNum = 4;
break;
case (LANGUAGE_KOREAN & 0x03FF):
else if ( eLang == primary(LANGUAGE_KOREAN) )
nNatNum = 2;
break;
}
break;
case 3:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE) )
nNatNum = 6;
break;
case (LANGUAGE_JAPANESE & 0x03FF):
else if ( eLang == primary(LANGUAGE_JAPANESE) )
nNatNum = 5;
break;
case (LANGUAGE_KOREAN & 0x03FF):
else if ( eLang == primary(LANGUAGE_KOREAN) )
nNatNum = 3;
break;
}
break;
case 4:
switch ( eLang )
{
case (LANGUAGE_JAPANESE & 0x03FF):
if ( eLang == primary(LANGUAGE_JAPANESE) )
nNatNum = 7;
break;
case (LANGUAGE_KOREAN & 0x03FF):
else if ( eLang == primary(LANGUAGE_KOREAN) )
nNatNum = 9;
break;
}
break;
}
}
@ -221,10 +198,10 @@ sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLan
{
sal_uInt8 nDBNum = 0;
eLang = MsLangId::getRealLanguage( eLang ); // resolve SYSTEM etc.
eLang &= 0x03FF; // 10 bit primary language
eLang = primary(eLang); // 10 bit primary language
if ( bDate )
{
if ( nNatNum == 9 && eLang == (LANGUAGE_KOREAN & 0x03FF) )
if ( nNatNum == 9 && eLang == primary(LANGUAGE_KOREAN) )
{
nDBNum = 4;
}
@ -238,79 +215,44 @@ sal_uInt8 SvNumberNatNum::MapNatNumToDBNum( sal_uInt8 nNatNum, LanguageType eLan
switch ( nNatNum )
{
case 1:
switch ( eLang )
{
case (LANGUAGE_JAPANESE & 0x03FF):
if ( eLang == primary(LANGUAGE_JAPANESE) )
nDBNum = 1;
break;
case (LANGUAGE_KOREAN & 0x03FF):
else if ( eLang == primary(LANGUAGE_KOREAN) )
nDBNum = 1;
break;
}
break;
case 2:
switch ( eLang )
{
case (LANGUAGE_KOREAN & 0x03FF):
if ( eLang == primary(LANGUAGE_KOREAN) )
nDBNum = 2;
break;
}
break;
case 3:
switch ( eLang )
{
case (LANGUAGE_KOREAN & 0x03FF):
if ( eLang == primary(LANGUAGE_KOREAN) )
nDBNum = 3;
break;
}
break;
case 4:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE) )
nDBNum = 1;
break;
case (LANGUAGE_JAPANESE & 0x03FF):
else if ( eLang == primary(LANGUAGE_JAPANESE) )
nDBNum = 2;
break;
}
break;
case 5:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE) )
nDBNum = 2;
break;
case (LANGUAGE_JAPANESE & 0x03FF):
else if ( eLang == primary(LANGUAGE_JAPANESE) )
nDBNum = 3;
break;
}
break;
case 6:
switch ( eLang )
{
case (LANGUAGE_CHINESE & 0x03FF):
if ( eLang == primary(LANGUAGE_CHINESE) )
nDBNum = 3;
break;
}
break;
case 7:
switch ( eLang )
{
case (LANGUAGE_JAPANESE & 0x03FF):
if ( eLang == primary(LANGUAGE_JAPANESE) )
nDBNum = 4;
break;
}
break;
case 8:
break;
case 9:
switch ( eLang )
{
case (LANGUAGE_KOREAN & 0x03FF):
if ( eLang == primary(LANGUAGE_KOREAN) )
nDBNum = 4;
break;
}
break;
case 10:
break;
@ -577,10 +519,10 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
case 0x17 : // same?
sCalendar = "[~hijri]";
// Only Arabic or Farsi languages support Hijri calendar
if ( ( ( nLocaleLang & LANGUAGE_MASK_PRIMARY ) != LANGUAGE_ARABIC_PRIMARY_ONLY )
if ( ( primary( nLocaleLang ) != LANGUAGE_ARABIC_PRIMARY_ONLY )
&& nLocaleLang != LANGUAGE_FARSI )
{
if ( ( ( nTmpLocaleLang & LANGUAGE_MASK_PRIMARY ) == LANGUAGE_ARABIC_PRIMARY_ONLY )
if ( ( primary( nTmpLocaleLang ) == LANGUAGE_ARABIC_PRIMARY_ONLY )
|| nTmpLocaleLang == LANGUAGE_FARSI )
{
nLang = maLocale.meLanguage = aTmpLocale.meLanguage;
@ -686,9 +628,9 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
case 0x10 : // Burmese (Myanmar) numerals
case 0x11 : // Tigrigna (Ethiopia) numerals
case 0x12 : // Khmer numerals
if ( ( nLocaleLang & LANGUAGE_MASK_PRIMARY ) != ( nReferenceLanguage & LANGUAGE_MASK_PRIMARY ) )
if ( primary( nLocaleLang ) != primary( nReferenceLanguage ) )
{
if ( ( nTmpLocaleLang & LANGUAGE_MASK_PRIMARY ) == ( nReferenceLanguage & LANGUAGE_MASK_PRIMARY ) )
if ( primary( nTmpLocaleLang ) == primary( nReferenceLanguage ) )
{
nLang = maLocale.meLanguage = aTmpLocale.meLanguage;
}
@ -702,10 +644,10 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
case 0x04 : // Devanagari (Hindi) numerals
// same numerals (Devanagari) for languages with different primary masks
if ( nLocaleLang != LANGUAGE_HINDI && nLocaleLang != LANGUAGE_MARATHI
&& ( nLocaleLang & LANGUAGE_MASK_PRIMARY ) != ( LANGUAGE_NEPALI & LANGUAGE_MASK_PRIMARY ) )
&& primary( nLocaleLang ) != primary( LANGUAGE_NEPALI ) )
{
if ( nTmpLocaleLang == LANGUAGE_HINDI || nTmpLocaleLang == LANGUAGE_MARATHI
|| ( nTmpLocaleLang & LANGUAGE_MASK_PRIMARY ) == ( LANGUAGE_NEPALI & LANGUAGE_MASK_PRIMARY ) )
|| primary( nTmpLocaleLang ) == primary( LANGUAGE_NEPALI ) )
{
nLang = maLocale.meLanguage = aTmpLocale.meLanguage;
}
@ -735,10 +677,10 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
break;
case 0x02 : // Eastern-Arabic numerals
// all arabic primary mask + LANGUAGE_PUNJABI_ARABIC_LSO
if ( ( nLocaleLang & LANGUAGE_MASK_PRIMARY ) != LANGUAGE_ARABIC_PRIMARY_ONLY
if ( primary( nLocaleLang ) != LANGUAGE_ARABIC_PRIMARY_ONLY
&& nLocaleLang != LANGUAGE_PUNJABI_ARABIC_LSO )
{
if ( ( nTmpLocaleLang & LANGUAGE_MASK_PRIMARY ) == LANGUAGE_ARABIC_PRIMARY_ONLY
if ( primary( nTmpLocaleLang ) == LANGUAGE_ARABIC_PRIMARY_ONLY
|| nTmpLocaleLang != LANGUAGE_PUNJABI_ARABIC_LSO )
{
nLang = maLocale.meLanguage = aTmpLocale.meLanguage;
@ -758,9 +700,9 @@ OUString SvNumberformat::ImpObtainCalendarAndNumerals( OUStringBuffer& rString,
case 0x26 : // Arabic fullwidth numerals, Korean
case 0x27 : // Korean Hangul numerals
// Japanese and Korean are regular
if ( ( nLocaleLang & LANGUAGE_MASK_PRIMARY ) != ( nReferenceLanguage & LANGUAGE_MASK_PRIMARY ) )
if ( primary( nLocaleLang ) != primary( nReferenceLanguage ) )
{
if ( ( nTmpLocaleLang & LANGUAGE_MASK_PRIMARY ) == ( nReferenceLanguage & LANGUAGE_MASK_PRIMARY ) )
if ( primary( nTmpLocaleLang ) == primary( nReferenceLanguage ) )
{
nLang = maLocale.meLanguage = aTmpLocale.meLanguage;
}
@ -1057,7 +999,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
// result in an unknown (empty) language
// listbox entry and the user would never see
// this format.
if (nIndex == 0 && (aTmpLocale.meLanguage == 0 ||
if (nIndex == 0 && (aTmpLocale.meLanguage == LANGUAGE_SYSTEM ||
SvNumberFormatter::IsLocaleInstalled( aTmpLocale.meLanguage)))
{
maLocale = aTmpLocale;
@ -1173,7 +1115,7 @@ SvNumberformat::SvNumberformat(OUString& rString,
((eLanguage = MsLangId::getRealLanguage( eLan)) == LANGUAGE_THAI) &&
NumFor[nIndex].GetNatNum().GetLang() == LANGUAGE_DONTKNOW)
{
sStr = "[$-" + OUString::number( eLanguage, 16 ).toAsciiUpperCase() + "]" + sStr;
sStr = "[$-" + OUString::number( sal_uInt16(eLanguage), 16 ).toAsciiUpperCase() + "]" + sStr;
NumFor[nIndex].SetNatNumLang( eLanguage);
}
sBuff.remove(nPosOld, nPos - nPosOld);
@ -1551,7 +1493,7 @@ SvNumberformat::LocaleType SvNumberformat::ImpGetLocaleType(const OUString& rStr
}
else
{
return LANGUAGE_DONTKNOW;
return LocaleType(); // LANGUAGE_DONTKNOW;
}
++nPos;
}
@ -5159,7 +5101,7 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
}
}
sal_uInt32 nAlphabetID = 0x0000000; // Excel ID of alphabet used for numerals see tdf#36038
sal_uInt32 nLanguageID = 0x0000000;
LanguageType nLanguageID = LANGUAGE_SYSTEM;
if ( aNatNum.IsComplete() )
{
nLanguageID = MsLangId::getRealLanguage( aNatNum.GetLang());
@ -5171,115 +5113,105 @@ OUString SvNumberformat::GetMappedFormatstring( const NfKeywordTable& rKeywords,
{ // if no DBNum code then use long LCID
// if DBNum value != NatNum value, use DBNum and not extended LCID
// if calendar, then DBNum will be removed
switch ( nLanguageID & LANGUAGE_MASK_PRIMARY )
{
case LANGUAGE_ARABIC_PRIMARY_ONLY:
LanguageType pri = primary(nLanguageID);
if ( pri == LANGUAGE_ARABIC_PRIMARY_ONLY )
nAlphabetID = 0x02000000; // Arabic-indic numerals
break;
case LANGUAGE_FARSI & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_FARSI) )
nAlphabetID = 0x03000000; // Farsi numerals
break;
case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_MARATHI & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_NEPALI & LANGUAGE_MASK_PRIMARY:
else if ( pri.anyOf(
primary(LANGUAGE_HINDI),
primary(LANGUAGE_MARATHI),
primary(LANGUAGE_NEPALI) ))
nAlphabetID = 0x04000000; // Devanagari numerals
break;
case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_BENGALI) )
nAlphabetID = 0x05000000; // Bengali numerals
break;
case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY:
if ( nLanguageID == LANGUAGE_PUNJABI_ARABIC_LSO )
nAlphabetID = 0x02000000; // Arabic-indic numerals
else
nAlphabetID = 0x06000000; // Punjabi numerals
break;
case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_PUNJABI) )
{
if ( nLanguageID == LANGUAGE_PUNJABI_ARABIC_LSO )
nAlphabetID = 0x02000000; // Arabic-indic numerals
else
nAlphabetID = 0x06000000; // Punjabi numerals
}
else if ( pri == primary(LANGUAGE_GUJARATI) )
nAlphabetID = 0x07000000; // Gujarati numerals
break;
case LANGUAGE_ODIA & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_ODIA))
nAlphabetID = 0x08000000; // Odia (Oriya) numerals
break;
case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_TAMIL))
nAlphabetID = 0x09000000; // Tamil numerals
break;
case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_TELUGU))
nAlphabetID = 0x0A000000; // Telugu numerals
break;
case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_KANNADA))
nAlphabetID = 0x0B000000; // Kannada numerals
break;
case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_MALAYALAM))
nAlphabetID = 0x0C000000; // Malayalam numerals
break;
case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY:
// The Thai T NatNum modifier during Xcl export.
if ( rKeywords[NF_KEY_THAI_T] == "T" )
nAlphabetID = 0x0D000000; // Thai numerals
break;
case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_THAI))
{
// The Thai T NatNum modifier during Xcl export.
if ( rKeywords[NF_KEY_THAI_T] == "T" )
nAlphabetID = 0x0D000000; // Thai numerals
}
else if ( pri == primary(LANGUAGE_LAO))
nAlphabetID = 0x0E000000; // Lao numerals
break;
case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_TIBETAN))
nAlphabetID = 0x0F000000; // Tibetan numerals
break;
case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_BURMESE))
nAlphabetID = 0x10000000; // Burmese numerals
break;
case LANGUAGE_TIGRIGNA_ETHIOPIA & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_TIGRIGNA_ETHIOPIA))
nAlphabetID = 0x11000000; // Tigrigna numerals
break;
case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY:
else if ( pri == primary(LANGUAGE_KHMER))
nAlphabetID = 0x12000000; // Khmer numerals
break;
case LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA & LANGUAGE_MASK_PRIMARY:
if ( nLanguageID != LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA
&& nLanguageID != LANGUAGE_MONGOLIAN_CYRILLIC_LSO )
nAlphabetID = 0x13000000; // Mongolian numerals
break;
else if ( pri == primary(LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA))
{
if ( nLanguageID != LANGUAGE_MONGOLIAN_CYRILLIC_MONGOLIA
&& nLanguageID != LANGUAGE_MONGOLIAN_CYRILLIC_LSO )
nAlphabetID = 0x13000000; // Mongolian numerals
}
// CJK numerals
case LANGUAGE_JAPANESE & LANGUAGE_MASK_PRIMARY:
nAlphabetID = 0x1B;
else if ( pri == primary(LANGUAGE_JAPANESE))
{
nAlphabetID = 0x1B;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
else if ( pri == primary(LANGUAGE_CHINESE))
{
if ( nLanguageID == LANGUAGE_CHINESE_TRADITIONAL
|| nLanguageID == LANGUAGE_CHINESE_HONGKONG
|| nLanguageID == LANGUAGE_CHINESE_MACAU )
{
nAlphabetID = 0x21;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
break;
case LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY:
if ( nLanguageID == LANGUAGE_CHINESE_TRADITIONAL
|| nLanguageID == LANGUAGE_CHINESE_HONGKONG
|| nLanguageID == LANGUAGE_CHINESE_MACAU )
{
nAlphabetID = 0x21;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
else // LANGUAGE_CHINESE_SIMPLIFIED
{
nAlphabetID = 0x1E;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
break;
case LANGUAGE_KOREAN & LANGUAGE_MASK_PRIMARY:
if ( aNatNum.GetNatNum() == 9 ) // Hangul
{
nAlphabetID = 0x27000000;
}
else
{
nAlphabetID = 0x24;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
break;
}
else // LANGUAGE_CHINESE_SIMPLIFIED
{
nAlphabetID = 0x1E;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
}
else if ( pri == primary(LANGUAGE_KOREAN))
{
if ( aNatNum.GetNatNum() == 9 ) // Hangul
{
nAlphabetID = 0x27000000;
}
else
{
nAlphabetID = 0x24;
lcl_incrementAlphabetWithNatNum ( nAlphabetID, aNatNum.GetNatNum() );
}
}
}
// Add LCID to DBNum
if ( aNatNum.GetDBNum() > 0 && nLanguageID == 0 )
if ( aNatNum.GetDBNum() > 0 && nLanguageID == LANGUAGE_SYSTEM )
nLanguageID = MsLangId::getRealLanguage( aNatNum.GetLang());
}
if ( nCalendarID > 0 )
{ // Add alphabet and language to calendar
if ( nAlphabetID == 0 )
nAlphabetID = 0x01000000;
if ( nLanguageID == 0 && nOriginalLang != LANGUAGE_DONTKNOW )
if ( nLanguageID == LANGUAGE_SYSTEM && nOriginalLang != LANGUAGE_DONTKNOW )
nLanguageID = nOriginalLang;
}
lcl_insertLCID( aStr, nAlphabetID + nCalendarID + nLanguageID, nPosInsertLCID );
lcl_insertLCID( aStr, nAlphabetID + nCalendarID + (sal_uInt16)nLanguageID, nPosInsertLCID );
}
for ( ; nSub<4 && bDefault[nSub]; ++nSub )
{ // append empty subformats

View File

@ -228,13 +228,13 @@ void ImpSvNumberformatScan::SetDependentKeywords()
{
sKeyword[NF_KEY_THAI_T] = "t";
}
switch ( eLang )
if ( eLang.anyOf(
LANGUAGE_GERMAN,
LANGUAGE_GERMAN_SWISS,
LANGUAGE_GERMAN_AUSTRIAN,
LANGUAGE_GERMAN_LUXEMBOURG,
LANGUAGE_GERMAN_LIECHTENSTEIN))
{
case LANGUAGE_GERMAN:
case LANGUAGE_GERMAN_SWISS:
case LANGUAGE_GERMAN_AUSTRIAN:
case LANGUAGE_GERMAN_LUXEMBOURG:
case LANGUAGE_GERMAN_LIECHTENSTEIN:
//! all capital letters
sKeyword[NF_KEY_M] = "M"; // month 1
sKeyword[NF_KEY_MM] = "MM"; // month 01
@ -261,13 +261,14 @@ void ImpSvNumberformatScan::SetDependentKeywords()
sKeyword[NF_KEY_GREY] = "GRAU";
sKeyword[NF_KEY_YELLOW] = "GELB";
sKeyword[NF_KEY_WHITE] = "WEISS";
break;
default:
}
else
{
// day
switch ( eLang )
if ( eLang.anyOf(
LANGUAGE_ITALIAN,
LANGUAGE_ITALIAN_SWISS))
{
case LANGUAGE_ITALIAN:
case LANGUAGE_ITALIAN_SWISS:
sKeyword[NF_KEY_D] = "G";
sKeyword[NF_KEY_DD] = "GG";
sKeyword[NF_KEY_DDD] = "GGG";
@ -276,41 +277,45 @@ void ImpSvNumberformatScan::SetDependentKeywords()
sKeyword[NF_KEY_G] = "X";
sKeyword[NF_KEY_GG] = "XX";
sKeyword[NF_KEY_GGG] = "XXX";
break;
case LANGUAGE_FRENCH:
case LANGUAGE_FRENCH_BELGIAN:
case LANGUAGE_FRENCH_CANADIAN:
case LANGUAGE_FRENCH_SWISS:
case LANGUAGE_FRENCH_LUXEMBOURG:
case LANGUAGE_FRENCH_MONACO:
}
else if ( eLang.anyOf(
LANGUAGE_FRENCH,
LANGUAGE_FRENCH_BELGIAN,
LANGUAGE_FRENCH_CANADIAN,
LANGUAGE_FRENCH_SWISS,
LANGUAGE_FRENCH_LUXEMBOURG,
LANGUAGE_FRENCH_MONACO))
{
sKeyword[NF_KEY_D] = "J";
sKeyword[NF_KEY_DD] = "JJ";
sKeyword[NF_KEY_DDD] = "JJJ";
sKeyword[NF_KEY_DDDD] = "JJJJ";
break;
case LANGUAGE_FINNISH:
}
else if ( eLang == LANGUAGE_FINNISH )
{
sKeyword[NF_KEY_D] = "P";
sKeyword[NF_KEY_DD] = "PP";
sKeyword[NF_KEY_DDD] = "PPP";
sKeyword[NF_KEY_DDDD] = "PPPP";
break;
default:
}
else
{
sKeyword[NF_KEY_D] = "D";
sKeyword[NF_KEY_DD] = "DD";
sKeyword[NF_KEY_DDD] = "DDD";
sKeyword[NF_KEY_DDDD] = "DDDD";
}
// month
switch ( eLang )
if ( eLang == LANGUAGE_FINNISH )
{
case LANGUAGE_FINNISH:
sKeyword[NF_KEY_M] = "K";
sKeyword[NF_KEY_MM] = "KK";
sKeyword[NF_KEY_MMM] = "KKK";
sKeyword[NF_KEY_MMMM] = "KKKK";
sKeyword[NF_KEY_MMMMM] = "KKKKK";
break;
default:
}
else
{
sKeyword[NF_KEY_M] = "M";
sKeyword[NF_KEY_MM] = "MM";
sKeyword[NF_KEY_MMM] = "MMM";
@ -318,76 +323,83 @@ void ImpSvNumberformatScan::SetDependentKeywords()
sKeyword[NF_KEY_MMMMM] = "MMMMM";
}
// year
switch ( eLang )
if ( eLang.anyOf(
LANGUAGE_ITALIAN,
LANGUAGE_ITALIAN_SWISS,
LANGUAGE_FRENCH,
LANGUAGE_FRENCH_BELGIAN,
LANGUAGE_FRENCH_CANADIAN,
LANGUAGE_FRENCH_SWISS,
LANGUAGE_FRENCH_LUXEMBOURG,
LANGUAGE_FRENCH_MONACO,
LANGUAGE_PORTUGUESE,
LANGUAGE_PORTUGUESE_BRAZILIAN,
LANGUAGE_SPANISH_MODERN,
LANGUAGE_SPANISH_DATED,
LANGUAGE_SPANISH_MEXICAN,
LANGUAGE_SPANISH_GUATEMALA,
LANGUAGE_SPANISH_COSTARICA,
LANGUAGE_SPANISH_PANAMA,
LANGUAGE_SPANISH_DOMINICAN_REPUBLIC,
LANGUAGE_SPANISH_VENEZUELA,
LANGUAGE_SPANISH_COLOMBIA,
LANGUAGE_SPANISH_PERU,
LANGUAGE_SPANISH_ARGENTINA,
LANGUAGE_SPANISH_ECUADOR,
LANGUAGE_SPANISH_CHILE,
LANGUAGE_SPANISH_URUGUAY,
LANGUAGE_SPANISH_PARAGUAY,
LANGUAGE_SPANISH_BOLIVIA,
LANGUAGE_SPANISH_EL_SALVADOR,
LANGUAGE_SPANISH_HONDURAS,
LANGUAGE_SPANISH_NICARAGUA,
LANGUAGE_SPANISH_PUERTO_RICO))
{
case LANGUAGE_ITALIAN:
case LANGUAGE_ITALIAN_SWISS:
case LANGUAGE_FRENCH:
case LANGUAGE_FRENCH_BELGIAN:
case LANGUAGE_FRENCH_CANADIAN:
case LANGUAGE_FRENCH_SWISS:
case LANGUAGE_FRENCH_LUXEMBOURG:
case LANGUAGE_FRENCH_MONACO:
case LANGUAGE_PORTUGUESE:
case LANGUAGE_PORTUGUESE_BRAZILIAN:
case LANGUAGE_SPANISH_MODERN:
case LANGUAGE_SPANISH_DATED:
case LANGUAGE_SPANISH_MEXICAN:
case LANGUAGE_SPANISH_GUATEMALA:
case LANGUAGE_SPANISH_COSTARICA:
case LANGUAGE_SPANISH_PANAMA:
case LANGUAGE_SPANISH_DOMINICAN_REPUBLIC:
case LANGUAGE_SPANISH_VENEZUELA:
case LANGUAGE_SPANISH_COLOMBIA:
case LANGUAGE_SPANISH_PERU:
case LANGUAGE_SPANISH_ARGENTINA:
case LANGUAGE_SPANISH_ECUADOR:
case LANGUAGE_SPANISH_CHILE:
case LANGUAGE_SPANISH_URUGUAY:
case LANGUAGE_SPANISH_PARAGUAY:
case LANGUAGE_SPANISH_BOLIVIA:
case LANGUAGE_SPANISH_EL_SALVADOR:
case LANGUAGE_SPANISH_HONDURAS:
case LANGUAGE_SPANISH_NICARAGUA:
case LANGUAGE_SPANISH_PUERTO_RICO:
sKeyword[NF_KEY_YY] = "AA";
sKeyword[NF_KEY_YYYY] = "AAAA";
// must exchange the day of week name code, same as Xcl
sKeyword[NF_KEY_AAA] = "OOO";
sKeyword[NF_KEY_AAAA] = "OOOO";
break;
case LANGUAGE_DUTCH:
case LANGUAGE_DUTCH_BELGIAN:
}
else if ( eLang.anyOf(
LANGUAGE_DUTCH,
LANGUAGE_DUTCH_BELGIAN))
{
sKeyword[NF_KEY_YY] = "JJ";
sKeyword[NF_KEY_YYYY] = "JJJJ";
break;
case LANGUAGE_FINNISH:
}
else if ( eLang == LANGUAGE_FINNISH )
{
sKeyword[NF_KEY_YY] = "VV";
sKeyword[NF_KEY_YYYY] = "VVVV";
break;
default:
}
else
{
sKeyword[NF_KEY_YY] = "YY";
sKeyword[NF_KEY_YYYY] = "YYYY";
}
// hour
switch ( eLang )
if ( eLang.anyOf(
LANGUAGE_DUTCH,
LANGUAGE_DUTCH_BELGIAN))
{
case LANGUAGE_DUTCH:
case LANGUAGE_DUTCH_BELGIAN:
sKeyword[NF_KEY_H] = "U";
sKeyword[NF_KEY_HH] = "UU";
break;
case LANGUAGE_FINNISH:
case LANGUAGE_SWEDISH:
case LANGUAGE_SWEDISH_FINLAND:
case LANGUAGE_DANISH:
case LANGUAGE_NORWEGIAN:
case LANGUAGE_NORWEGIAN_BOKMAL:
case LANGUAGE_NORWEGIAN_NYNORSK:
}
else if ( eLang.anyOf(
LANGUAGE_FINNISH,
LANGUAGE_SWEDISH,
LANGUAGE_SWEDISH_FINLAND,
LANGUAGE_DANISH,
LANGUAGE_NORWEGIAN,
LANGUAGE_NORWEGIAN_BOKMAL,
LANGUAGE_NORWEGIAN_NYNORSK))
{
sKeyword[NF_KEY_H] = "T";
sKeyword[NF_KEY_HH] = "TT";
break;
default:
}
else
{
sKeyword[NF_KEY_H] = "H";
sKeyword[NF_KEY_HH] = "HH";
}
@ -405,7 +417,6 @@ void ImpSvNumberformatScan::SetDependentKeywords()
sKeyword[NF_KEY_GREY] = "GREY";
sKeyword[NF_KEY_YELLOW] = "YELLOW";
sKeyword[NF_KEY_WHITE] = "WHITE";
break;
}
// boolean keywords

View File

@ -150,9 +150,9 @@ SvtLanguageTableImpl::SvtLanguageTableImpl() :
LanguageType nLangType = aLang.getLanguageType();
if (nType <= LanguageTag::ScriptType::RTL && nType > LanguageTag::ScriptType::UNKNOWN)
aLang.setScriptType(LanguageTag::ScriptType(nType));
sal_uInt32 nPos = FindIndex(nLangType);
sal_uInt32 nPos = FindIndex((sal_uInt16)nLangType);
if (nPos == RESARRAY_INDEX_NOTFOUND)
AddItem((aName.isEmpty() ? rElementNames[i] : aName), nLangType);
AddItem((aName.isEmpty() ? rElementNames[i] : aName), (sal_uInt16)nLangType);
}
}
}
@ -165,7 +165,7 @@ SvtLanguageTableImpl::~SvtLanguageTableImpl()
bool SvtLanguageTableImpl::HasType( const LanguageType eType ) const
{
LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType );
sal_uInt32 nPos = FindIndex( eLang );
sal_uInt32 nPos = FindIndex( (sal_uInt16)eLang );
return RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count();
}
@ -190,7 +190,7 @@ OUString lcl_getDescription( const OUString& rBcp47 )
const OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
{
LanguageType eLang = MsLangId::getReplacementForObsoleteLanguage( eType );
sal_uInt32 nPos = FindIndex( eLang );
sal_uInt32 nPos = FindIndex( (sal_uInt16)eLang );
if ( RESARRAY_INDEX_NOTFOUND != nPos && nPos < Count() )
return ResStringArray::GetString( nPos );
@ -205,7 +205,7 @@ const OUString SvtLanguageTableImpl::GetString( const LanguageType eType ) const
// And add it to the table if it is an on-the-fly-id, which it usually is,
// so it is available in all subsequent language boxes.
if (LanguageTag::isOnTheFlyID( eType))
const_cast<SvtLanguageTableImpl*>(this)->AddItem( sLangTag, eType);
const_cast<SvtLanguageTableImpl*>(this)->AddItem( sLangTag, (sal_uInt16)eType);
return sLangTag;
}
@ -265,7 +265,7 @@ LanguageType SvtLanguageTable::GetLanguageTypeAtIndex( sal_uInt32 nIndex )
sal_uInt32 SvtLanguageTable::AddLanguageTag( const LanguageTag& rLanguageTag, const OUString& rString )
{
return theLanguageTable::get().AddItem( (rString.isEmpty() ? lcl_getDescription(rLanguageTag.getBcp47()) : rString),
rLanguageTag.getLanguageType());
(sal_uInt16)rLanguageTag.getLanguageType());
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -618,121 +618,85 @@ OUString makeMinimalTextForScript(UScriptCode eScript)
OUString makeRepresentativeTextForLanguage(LanguageType eLang)
{
OUString sRet;
switch( eLang & LANGUAGE_MASK_PRIMARY )
LanguageType pri = primary(eLang);
if( pri == primary(LANGUAGE_ARMENIAN) )
sRet = makeRepresentativeTextForScript(USCRIPT_ARMENIAN);
else if( pri == primary(LANGUAGE_CHINESE) )
sRet = makeRepresentativeTextForScript(USCRIPT_HAN);
else if( pri == primary(LANGUAGE_GREEK) )
sRet = makeRepresentativeTextForScript(USCRIPT_GREEK);
else if( pri.anyOf(
primary(LANGUAGE_HEBREW),
primary(LANGUAGE_YIDDISH)) )
sRet = makeRepresentativeTextForScript(USCRIPT_HEBREW);
else if( pri == primary(LANGUAGE_ARABIC_SAUDI_ARABIA) )
sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC);
else if( pri == primary(LANGUAGE_HINDI) )
sRet = makeRepresentativeTextForScript(USCRIPT_DEVANAGARI);
else if( pri == primary(LANGUAGE_ASSAMESE) )
{
case LANGUAGE_ARMENIAN & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_ARMENIAN);
break;
case LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_HAN);
break;
case LANGUAGE_GREEK & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_GREEK);
break;
case LANGUAGE_HEBREW & LANGUAGE_MASK_PRIMARY:
case LANGUAGE_YIDDISH & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_HEBREW);
break;
case LANGUAGE_ARABIC_SAUDI_ARABIA & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_ARABIC);
break;
case LANGUAGE_HINDI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_DEVANAGARI);
break;
case LANGUAGE_ASSAMESE & LANGUAGE_MASK_PRIMARY:
{
static const sal_Unicode aAs[] = {
0x0985, 0x09B8, 0x09AE, 0x09C0, 0x09AF, 0x09BC, 0x09BE,
0x0020, 0x0986, 0x0996, 0x09F0
};
sRet = OUString(aAs, SAL_N_ELEMENTS(aAs));
break;
}
case LANGUAGE_BENGALI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_BENGALI);
break;
case LANGUAGE_PUNJABI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_GURMUKHI);
break;
case LANGUAGE_GUJARATI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_GUJARATI);
break;
case LANGUAGE_ODIA & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_ORIYA);
break;
case LANGUAGE_TAMIL & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_TAMIL);
break;
case LANGUAGE_TELUGU & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_TELUGU);
break;
case LANGUAGE_KANNADA & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_KANNADA);
break;
case LANGUAGE_MALAYALAM & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_MALAYALAM);
break;
case LANGUAGE_THAI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_THAI);
break;
case LANGUAGE_LAO & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_LAO);
break;
case LANGUAGE_GEORGIAN & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_GEORGIAN);
break;
case LANGUAGE_KOREAN & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_KOREAN);
break;
case LANGUAGE_TIBETAN & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_TIBETAN);
break;
case LANGUAGE_SYRIAC & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_SYRIAC);
break;
case LANGUAGE_SINHALESE_SRI_LANKA & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_SINHALA);
break;
case LANGUAGE_BURMESE & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_MYANMAR);
break;
case LANGUAGE_AMHARIC_ETHIOPIA & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_ETHIOPIC);
break;
case LANGUAGE_CHEROKEE_UNITED_STATES & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_CHEROKEE);
break;
case LANGUAGE_KHMER & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_KHMER);
break;
case LANGUAGE_MONGOLIAN_MONGOLIAN_LSO & LANGUAGE_MASK_PRIMARY:
switch (eLang)
{
case LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA:
case LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA:
case LANGUAGE_MONGOLIAN_MONGOLIAN_LSO:
sRet = makeRepresentativeTextForScript(USCRIPT_MONGOLIAN);
break;
default:
break;
}
break;
case LANGUAGE_JAPANESE & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_JAPANESE);
break;
case LANGUAGE_YI & LANGUAGE_MASK_PRIMARY:
sRet = makeRepresentativeTextForScript(USCRIPT_YI);
break;
case LANGUAGE_GAELIC_IRELAND & LANGUAGE_MASK_PRIMARY:
{
static const sal_Unicode aGa[] = {
'T', 0x00E9, 'a', 'c', 's', ' ', 'S', 'a', 'm', 'p', 'l', 'a', 'c', 'h'
};
sRet = OUString(aGa, SAL_N_ELEMENTS(aGa));
break;
}
default:
break;
static const sal_Unicode aAs[] = {
0x0985, 0x09B8, 0x09AE, 0x09C0, 0x09AF, 0x09BC, 0x09BE,
0x0020, 0x0986, 0x0996, 0x09F0
};
sRet = OUString(aAs, SAL_N_ELEMENTS(aAs));
}
else if( pri == primary(LANGUAGE_BENGALI) )
sRet = makeRepresentativeTextForScript(USCRIPT_BENGALI);
else if( pri == primary(LANGUAGE_PUNJABI) )
sRet = makeRepresentativeTextForScript(USCRIPT_GURMUKHI);
else if( pri == primary(LANGUAGE_GUJARATI) )
sRet = makeRepresentativeTextForScript(USCRIPT_GUJARATI);
else if( pri == primary(LANGUAGE_ODIA) )
sRet = makeRepresentativeTextForScript(USCRIPT_ORIYA);
else if( pri == primary(LANGUAGE_TAMIL) )
sRet = makeRepresentativeTextForScript(USCRIPT_TAMIL);
else if( pri == primary(LANGUAGE_TELUGU) )
sRet = makeRepresentativeTextForScript(USCRIPT_TELUGU);
else if( pri == primary(LANGUAGE_KANNADA) )
sRet = makeRepresentativeTextForScript(USCRIPT_KANNADA);
else if( pri == primary(LANGUAGE_MALAYALAM) )
sRet = makeRepresentativeTextForScript(USCRIPT_MALAYALAM);
else if( pri == primary(LANGUAGE_THAI) )
sRet = makeRepresentativeTextForScript(USCRIPT_THAI);
else if( pri == primary(LANGUAGE_LAO) )
sRet = makeRepresentativeTextForScript(USCRIPT_LAO);
else if( pri == primary(LANGUAGE_GEORGIAN) )
sRet = makeRepresentativeTextForScript(USCRIPT_GEORGIAN);
else if( pri == primary(LANGUAGE_KOREAN) )
sRet = makeRepresentativeTextForScript(USCRIPT_KOREAN);
else if( pri == primary(LANGUAGE_TIBETAN) )
sRet = makeRepresentativeTextForScript(USCRIPT_TIBETAN);
else if( pri == primary(LANGUAGE_SYRIAC) )
sRet = makeRepresentativeTextForScript(USCRIPT_SYRIAC);
else if( pri == primary(LANGUAGE_SINHALESE_SRI_LANKA) )
sRet = makeRepresentativeTextForScript(USCRIPT_SINHALA);
else if( pri == primary(LANGUAGE_BURMESE) )
sRet = makeRepresentativeTextForScript(USCRIPT_MYANMAR);
else if( pri == primary(LANGUAGE_AMHARIC_ETHIOPIA) )
sRet = makeRepresentativeTextForScript(USCRIPT_ETHIOPIC);
else if( pri == primary(LANGUAGE_CHEROKEE_UNITED_STATES) )
sRet = makeRepresentativeTextForScript(USCRIPT_CHEROKEE);
else if( pri == primary(LANGUAGE_KHMER) )
sRet = makeRepresentativeTextForScript(USCRIPT_KHMER);
else if( pri == primary(LANGUAGE_MONGOLIAN_MONGOLIAN_LSO) )
{
if (eLang.anyOf(
LANGUAGE_MONGOLIAN_MONGOLIAN_MONGOLIA,
LANGUAGE_MONGOLIAN_MONGOLIAN_CHINA,
LANGUAGE_MONGOLIAN_MONGOLIAN_LSO))
sRet = makeRepresentativeTextForScript(USCRIPT_MONGOLIAN);
}
else if( pri == primary(LANGUAGE_JAPANESE) )
sRet = makeRepresentativeTextForScript(USCRIPT_JAPANESE);
else if( pri == primary(LANGUAGE_YI) )
sRet = makeRepresentativeTextForScript(USCRIPT_YI);
else if( pri == primary(LANGUAGE_GAELIC_IRELAND) )
{
static const sal_Unicode aGa[] = {
'T', 0x00E9, 'a', 'c', 's', ' ', 'S', 'a', 'm', 'p', 'l', 'a', 'c', 'h'
};
sRet = OUString(aGa, SAL_N_ELEMENTS(aGa));
}
return sRet;

View File

@ -955,7 +955,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum(
aStrTD.append(' ').
append(OOO_STRING_SVTOOLS_HTML_O_SDnum).
append("=\"").
append(static_cast<sal_Int32>(
append((sal_Int32)static_cast<sal_uInt16>(
Application::GetSettings().GetLanguageTag().getLanguageType())).
append(';'); // Language for Format 0
if ( nFormat )
@ -971,7 +971,7 @@ OString HTMLOutFuncs::CreateTableDataOptionsValNum(
}
else
nLang = LANGUAGE_SYSTEM;
aStrTD.append(static_cast<sal_Int32>(nLang)).append(';').
aStrTD.append((sal_Int32)static_cast<sal_uInt16>(nLang)).append(';').
append(aNumStr);
}
aStrTD.append('\"');

View File

@ -41,7 +41,7 @@ using namespace ::com::sun::star::uno;
static_assert((LISTBOX_APPEND == COMBOBOX_APPEND) && (LISTBOX_ENTRY_NOTFOUND == COMBOBOX_ENTRY_NOTFOUND), "If these ever dispersed we'd need a solution");
OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg )
OUString GetDicInfoStr( const OUString& rName, const LanguageType nLang, bool bNeg )
{
INetURLObject aURLObj;
aURLObj.SetSmartProtocol( INetProtocol::File );
@ -59,7 +59,7 @@ OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg
else
{
aTmp += "[";
aTmp += SvtLanguageTable::GetLanguageString( (LanguageType)nLang );
aTmp += SvtLanguageTable::GetLanguageString( nLang );
aTmp += "]";
}
@ -70,16 +70,15 @@ OUString GetDicInfoStr( const OUString& rName, const sal_uInt16 nLang, bool bNeg
// misc local helper functions
static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( Sequence< css::lang::Locale > &rSeq )
static std::vector< LanguageType > lcl_LocaleSeqToLangSeq( Sequence< css::lang::Locale > &rSeq )
{
const css::lang::Locale *pLocale = rSeq.getConstArray();
sal_Int32 nCount = rSeq.getLength();
Sequence< sal_Int16 > aLangs( nCount );
sal_Int16 *pLang = aLangs.getArray();
std::vector< LanguageType > aLangs;
for (sal_Int32 i = 0; i < nCount; ++i)
{
pLang[i] = LanguageTag::convertToLanguageType( pLocale[i] );
aLangs.push_back( LanguageTag::convertToLanguageType( pLocale[i] ) );
}
@ -87,6 +86,13 @@ static Sequence< sal_Int16 > lcl_LocaleSeqToLangSeq( Sequence< css::lang::Locale
}
static bool lcl_SeqHasLang( const std::vector< LanguageType > & rLangSeq, LanguageType nLang )
{
for (auto const & i : rLangSeq)
if (i == nLang)
return true;
return false;
}
static bool lcl_SeqHasLang( const Sequence< sal_Int16 > & rLangSeq, sal_Int16 nLang )
{
sal_Int32 i = -1;
@ -197,14 +203,11 @@ bool lcl_isScriptTypeRequested( LanguageType nLangType, SvxLanguageListFlags nLa
(SvtLanguageOptions::GetScriptTypeOfLanguage(nLangType) == SvtScriptType::ASIAN));
}
void SvxLanguageBoxBase::AddLanguages( const css::uno::Sequence< sal_Int16 >& rLanguageTypes,
void SvxLanguageBoxBase::AddLanguages( const std::vector< LanguageType >& rLanguageTypes,
SvxLanguageListFlags nLangList )
{
sal_Int16 const * pLang = rLanguageTypes.getConstArray();
sal_Int16 const * const pStop = pLang + rLanguageTypes.getLength();
for ( ; pLang < pStop; ++pLang )
for ( auto const & nLangType : rLanguageTypes )
{
LanguageType nLangType = static_cast<LanguageType>(*pLang);
if (lcl_isPrerequisite( nLangType, nLangList))
{
LanguageType nLang = MsLangId::getReplacementForObsoleteLanguage( nLangType );
@ -235,12 +238,12 @@ void SvxLanguageBoxBase::SetLanguageList( SvxLanguageListFlags nLangList,
(nLangList & SvxLanguageListFlags::WESTERN) ||
(nLangList & SvxLanguageListFlags::CTL) ||
(nLangList & SvxLanguageListFlags::CJK)));
Sequence< sal_Int16 > aSpellAvailLang;
Sequence< sal_Int16 > aHyphAvailLang;
Sequence< sal_Int16 > aThesAvailLang;
std::vector< LanguageType > aSpellAvailLang;
std::vector< LanguageType > aHyphAvailLang;
std::vector< LanguageType > aThesAvailLang;
Sequence< sal_Int16 > aSpellUsedLang;
Sequence< sal_Int16 > aHyphUsedLang;
Sequence< sal_Int16 > aThesUsedLang;
std::vector< LanguageType > aHyphUsedLang;
std::vector< LanguageType > aThesUsedLang;
Reference< XAvailableLocales > xAvail( LinguMgr::GetLngSvcMgr(), UNO_QUERY );
if (xAvail.is())
{
@ -285,25 +288,22 @@ void SvxLanguageBoxBase::SetLanguageList( SvxLanguageListFlags nLangList,
}
}
css::uno::Sequence< sal_uInt16 > xKnown;
const sal_uInt16* pKnown;
std::vector<LanguageType> aKnown;
sal_uInt32 nCount;
if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
{
xKnown = LocaleDataWrapper::getInstalledLanguageTypes();
pKnown = xKnown.getConstArray();
nCount = xKnown.getLength();
aKnown = LocaleDataWrapper::getInstalledLanguageTypes();
nCount = aKnown.size();
}
else
{
nCount = SvtLanguageTable::GetLanguageEntryCount();
pKnown = nullptr;
}
for ( sal_uInt32 i = 0; i < nCount; i++ )
{
LanguageType nLangType;
if ( nLangList & SvxLanguageListFlags::ONLY_KNOWN )
nLangType = pKnown[i];
nLangType = aKnown[i];
else
nLangType = SvtLanguageTable::GetLanguageTypeAtIndex( i );
if ( lcl_isPrerequisite( nLangType, nLangList) &&
@ -317,7 +317,7 @@ void SvxLanguageBoxBase::SetLanguageList( SvxLanguageListFlags nLangList,
(bool(nLangList & SvxLanguageListFlags::THES_AVAIL) &&
lcl_SeqHasLang(aThesAvailLang, nLangType)) ||
(bool(nLangList & SvxLanguageListFlags::SPELL_USED) &&
lcl_SeqHasLang(aSpellUsedLang, nLangType)) ||
lcl_SeqHasLang(aSpellUsedLang, (sal_uInt16)nLangType)) ||
(bool(nLangList & SvxLanguageListFlags::HYPH_USED) &&
lcl_SeqHasLang(aHyphUsedLang, nLangType)) ||
(bool(nLangList & SvxLanguageListFlags::THES_USED) &&
@ -389,14 +389,14 @@ sal_Int32 SvxLanguageBoxBase::ImplInsertLanguage( const LanguageType nLangType,
m_pSpellUsedLang.reset( new Sequence< sal_Int16 >( xSpell->getLanguages() ) );
}
bFound = m_pSpellUsedLang &&
lcl_SeqHasLang( *m_pSpellUsedLang, nRealLang );
lcl_SeqHasLang( *m_pSpellUsedLang, (sal_uInt16)nRealLang );
nAt = ImplInsertImgEntry( aStrEntry, nPos, bFound );
}
else
nAt = ImplInsertEntry( aStrEntry, nPos );
ImplSetEntryData( nAt, reinterpret_cast<void*>(nLangType) );
ImplSetEntryData( nAt, reinterpret_cast<void*>((sal_uInt16)nLangType) );
return nAt;
}
@ -432,7 +432,7 @@ void SvxLanguageBoxBase::InsertLanguage( const LanguageType nLangType,
aStrEntry = m_aAllString;
sal_Int32 nAt = ImplInsertImgEntry( aStrEntry, LISTBOX_APPEND, bCheckEntry );
ImplSetEntryData( nAt, reinterpret_cast<void*>(nLang) );
ImplSetEntryData( nAt, reinterpret_cast<void*>((sal_uInt16)nLang) );
}
@ -488,7 +488,7 @@ bool SvxLanguageBoxBase::IsLanguageSelected( const LanguageType eLangType ) cons
sal_Int32 SvxLanguageBoxBase::ImplTypeToPos( LanguageType eType ) const
{
return ImplGetEntryPos( reinterpret_cast<void*>(eType) );
return ImplGetEntryPos( reinterpret_cast<void*>((sal_uInt16)eType) );
}

View File

@ -712,7 +712,7 @@ void SdrModel::SetTextDefaults( SfxItemPool* pItemPool, sal_uIntPtr nDefTextHgt
SvxFontItem aSvxFontItem( EE_CHAR_FONTINFO) ;
SvxFontItem aSvxFontItemCJK(EE_CHAR_FONTINFO_CJK);
SvxFontItem aSvxFontItemCTL(EE_CHAR_FONTINFO_CTL);
sal_uInt16 nLanguage;
LanguageType nLanguage;
if (!utl::ConfigManager::IsAvoidConfig())
nLanguage = Application::GetSettings().GetLanguageTag().getLanguageType();
else

Some files were not shown because too many files have changed in this diff Show More