summaryrefslogtreecommitdiff
path: root/linguistic/source/spelldsp.cxx
diff options
context:
space:
mode:
authorAndras Timar <andras.timar@collabora.com>2014-11-03 12:03:48 +0100
committerAndras Timar <andras.timar@collabora.com>2014-11-03 12:10:33 +0100
commit86f876b45a2737a1f7ccf9581af05277e1650159 (patch)
tree32b054567dbc4e20bdc2575a71f7248a1c1b286d /linguistic/source/spelldsp.cxx
parent4e87e0f2da6bc132edc42056db1d91e63e9497e7 (diff)
fdo#61167 suggest titlecase and uppercase words from exception dict
Change-Id: I280ffed996814e246ac3e93de5ff0acaad84018c
Diffstat (limited to 'linguistic/source/spelldsp.cxx')
-rw-r--r--linguistic/source/spelldsp.cxx44
1 files changed, 42 insertions, 2 deletions
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 15ecfeff7999..3a2f025e8512 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -649,7 +649,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
Reference< XDictionaryEntry > xTmp( lcl_GetRulingDictionaryEntry( aChkWord, nLanguage ) );
if (xTmp.is())
{
- if (xTmp->isNegative()) // positive entry found
+ if (xTmp->isNegative()) // negative entry found
{
eFailureType = SpellFailure::IS_NEGATIVE_WORD;
@@ -669,6 +669,46 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
eFailureType = -1; // no failure
}
}
+ else
+ {
+ setCharClass(LanguageTag(nLanguage));
+ sal_uInt16 ct = capitalType(aChkWord, pCharClass);
+ if (ct == CAPTYPE_INITCAP || ct == CAPTYPE_ALLCAP)
+ {
+ Reference< XDictionaryEntry > xTmp2( lcl_GetRulingDictionaryEntry( makeLowerCase(aChkWord, pCharClass), nLanguage ) );
+ if (xTmp2.is())
+ {
+ if (xTmp2->isNegative()) // negative entry found
+ {
+ eFailureType = SpellFailure::IS_NEGATIVE_WORD;
+
+ // replacement text to be added to suggestions, if not empty
+ OUString aAddRplcTxt( xTmp2->getReplacementText() );
+
+ // replacement text must not be in negative dictionary itself
+ if (!aAddRplcTxt.isEmpty() &&
+ !SearchDicList( xDList, aAddRplcTxt, nLanguage, false, true ).is())
+ {
+ switch ( ct )
+ {
+ case CAPTYPE_INITCAP:
+ aProposalList.Prepend( pCharClass->titlecase(aAddRplcTxt) );
+ break;
+ case CAPTYPE_ALLCAP:
+ aProposalList.Prepend( pCharClass->uppercase(aAddRplcTxt) );
+ default:
+ aProposalList.Prepend( aAddRplcTxt );
+ }
+ }
+ }
+ else // positive entry found
+ {
+ xRes = NULL;
+ eFailureType = -1; // no failure
+ }
+ }
+ }
+ }
}
if (eFailureType != -1) // word misspelled or found in negative user-dictionary
@@ -681,7 +721,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
Sequence< OUString > aProposals = aProposalList.GetSequence();
// remove entries listed in negative dictionaries
- // (we don't want to display suggestions that will be regarded as misspelledlater on)
+ // (we don't want to display suggestions that will be regarded as misspelled later on)
if (bCheckDics && xDList.is())
SeqRemoveNegEntries( aProposals, xDList, nLanguage );