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