summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2017-04-17 21:35:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-26 08:50:54 +0200
commitc70d49c7c888da8cfd73db8585e7be1f37fc398a (patch)
treec0e540401850018464ca76300536faf9aa7e27d2 /sc
parentcd4344d3bdef631b3e64ac12a9e64bc9670c1b7c (diff)
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>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/scmod.hxx6
-rw-r--r--sc/source/core/data/documen8.cxx2
-rw-r--r--sc/source/core/tool/zforauto.cxx6
-rw-r--r--sc/source/filter/excel/xlstyle.cxx6
-rw-r--r--sc/source/ui/app/scmod.cxx8
-rw-r--r--sc/source/ui/dbgui/asciiopt.cxx2
-rw-r--r--sc/source/ui/dbgui/scuiasciiopt.cxx2
-rw-r--r--sc/source/ui/docshell/docsh3.cxx4
-rw-r--r--sc/source/ui/inc/viewutil.hxx3
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx2
-rw-r--r--sc/source/ui/view/cellsh.cxx2
-rw-r--r--sc/source/ui/view/gridwin.cxx2
-rw-r--r--sc/source/ui/view/spelleng.cxx2
-rw-r--r--sc/source/ui/view/viewutil.cxx4
14 files changed, 26 insertions, 25 deletions
diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx
index b57a208e297d..8eaccd2558e3 100644
--- a/sc/inc/scmod.hxx
+++ b/sc/inc/scmod.hxx
@@ -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();
diff --git a/sc/source/core/data/documen8.cxx b/sc/source/core/data/documen8.cxx
index de5d06c09ff4..e49a8cd2ca45 100644
--- a/sc/source/core/data/documen8.cxx
+++ b/sc/source/core/data/documen8.cxx
@@ -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
diff --git a/sc/source/core/tool/zforauto.cxx b/sc/source/core/tool/zforauto.cxx
index 6551c9c3c4d5..ffd7cb39434c 100644
--- a/sc/source/core/tool/zforauto.cxx
+++ b/sc/source/core/tool/zforauto.cxx
@@ -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,
diff --git a/sc/source/filter/excel/xlstyle.cxx b/sc/source/filter/excel/xlstyle.cxx
index 75ebe2d6dad2..4ca798fe0f11 100644
--- a/sc/source/filter/excel/xlstyle.cxx
+++ b/sc/source/filter/excel/xlstyle.cxx
@@ -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
diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx
index c25910d55dc0..2c65b5c69944 100644
--- a/sc/source/ui/app/scmod.cxx
+++ b/sc/source/ui/app/scmod.cxx
@@ -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;
diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx
index 1d91334c877c..acccdfb55bb3 100644
--- a/sc/source/ui/dbgui/asciiopt.cxx
+++ b/sc/source/ui/dbgui/asciiopt.cxx
@@ -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.
diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx
index ebf8ac90867f..feeed32efb77 100644
--- a/sc/source/ui/dbgui/scuiasciiopt.cxx
+++ b/sc/source/ui/dbgui/scuiasciiopt.cxx
@@ -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()
diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx
index 3efd9f1c530d..8a75619c2157 100644
--- a/sc/source/ui/docshell/docsh3.cxx
+++ b/sc/source/ui/docshell/docsh3.cxx
@@ -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
diff --git a/sc/source/ui/inc/viewutil.hxx b/sc/source/ui/inc/viewutil.hxx
index af37b9620edb..dc84c2880b1d 100644
--- a/sc/source/ui/inc/viewutil.hxx
+++ b/sc/source/ui/inc/viewutil.hxx
@@ -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 );
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index b24219ae6017..451f3974189d 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -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();
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 40e9c650f0a7..4e286e323a4a 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -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 );
}
}
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 169ff3808d18..7225b78eac40 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -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
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 4a64409ec8e0..8ad1f59c1c74 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -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 )
diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx
index 8c00d51c6028..30376f3529ac 100644
--- a/sc/source/ui/view/viewutil.cxx
+++ b/sc/source/ui/view/viewutil.cxx
@@ -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;