Kaydet (Commit) 79b2059f authored tarafından Noel Grandin's avatar Noel Grandin

convert CapType to scoped enum

Change-Id: I88fa3672a1f933ae818368c9bc400c6a845babb6
üst 704edbf7
......@@ -69,13 +69,13 @@ enum class DictionaryError
};
// values asigned to capitalization types
enum CapType
enum class CapType
{
CAPTYPE_UNKNOWN,
CAPTYPE_NOCAP,
CAPTYPE_INITCAP,
CAPTYPE_ALLCAP,
CAPTYPE_MIXED
UNKNOWN,
NOCAP,
INITCAP,
ALLCAP,
MIXED
};
LNG_DLLPUBLIC ::osl::Mutex& GetLinguMutex();
......
......@@ -319,7 +319,7 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
if (eEnc == RTL_TEXTENCODING_DONTKNOW)
return NULL;
sal_uInt16 ct = capitalType(aWord, pCC);
CapType ct = capitalType(aWord, pCC);
// first convert any smart quotes or apostrophes to normal ones
OUStringBuffer rBuf(aWord);
......@@ -444,12 +444,12 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo
OUString repHyph;
switch (ct)
{
case CAPTYPE_ALLCAP:
case CapType::ALLCAP:
{
repHyph = makeUpperCase(repHyphlow, pCC);
break;
}
case CAPTYPE_INITCAP:
case CapType::INITCAP:
{
if (nHyphenationPosAlt == -1)
repHyph = makeInitCap(repHyphlow, pCC);
......
......@@ -285,7 +285,7 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes
OUString rTerm(qTerm);
OUString pTerm(qTerm);
sal_uInt16 ct = CAPTYPE_UNKNOWN;
CapType ct = CapType::UNKNOWN;
sal_Int32 stem = 0;
sal_Int32 stem2 = 0;
......@@ -424,16 +424,16 @@ Sequence < Reference < ::com::sun::star::linguistic2::XMeaning > > SAL_CALL Thes
}
}
sal_uInt16 ct1 = capitalType(sTerm, pCC);
if (CAPTYPE_MIXED == ct1)
CapType ct1 = capitalType(sTerm, pCC);
if (CapType::MIXED == ct1)
ct = ct1;
OUString cTerm;
switch (ct)
{
case CAPTYPE_ALLCAP:
case CapType::ALLCAP:
cTerm = makeUpperCase(sTerm, pCC);
break;
case CAPTYPE_INITCAP:
case CapType::INITCAP:
cTerm = makeInitCap(sTerm, pCC);
break;
default:
......
......@@ -622,16 +622,16 @@ CapType SAL_CALL capitalType(const OUString& aTerm, CharClass * pCC)
}
if (nc == 0)
return CAPTYPE_NOCAP;
return CapType::NOCAP;
if (nc == tlen)
return CAPTYPE_ALLCAP;
return CapType::ALLCAP;
if ((nc == 1) && (pCC->getCharacterType(aStr,0) &
::com::sun::star::i18n::KCharacterType::UPPER))
return CAPTYPE_INITCAP;
return CapType::INITCAP;
return CAPTYPE_MIXED;
return CapType::MIXED;
}
return CAPTYPE_UNKNOWN;
return CapType::UNKNOWN;
}
OUString ToLower( const OUString &rText, sal_Int16 nLanguage )
......
......@@ -428,8 +428,8 @@ bool SpellCheckerDispatcher::isValid_Impl(
bRes = !xTmp->isNegative();
} else {
setCharClass(LanguageTag(nLanguage));
sal_uInt16 ct = capitalType(aChkWord, pCharClass);
if (ct == CAPTYPE_INITCAP || ct == CAPTYPE_ALLCAP) {
CapType ct = capitalType(aChkWord, pCharClass);
if (ct == CapType::INITCAP || ct == CapType::ALLCAP) {
Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, pCharClass), nLanguage ) );
if (xTmp2.is()) {
bRes = !xTmp2->isNegative();
......@@ -672,8 +672,8 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
else
{
setCharClass(LanguageTag(nLanguage));
sal_uInt16 ct = capitalType(aChkWord, pCharClass);
if (ct == CAPTYPE_INITCAP || ct == CAPTYPE_ALLCAP)
CapType ct = capitalType(aChkWord, pCharClass);
if (ct == CapType::INITCAP || ct == CapType::ALLCAP)
{
Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, pCharClass), nLanguage ) );
if (xTmp2.is())
......@@ -691,10 +691,10 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
{
switch ( ct )
{
case CAPTYPE_INITCAP:
case CapType::INITCAP:
aProposalList.Prepend( pCharClass->titlecase(aAddRplcTxt) );
break;
case CAPTYPE_ALLCAP:
case CapType::ALLCAP:
aProposalList.Prepend( pCharClass->uppercase(aAddRplcTxt) );
break;
default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment