summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linguistic/source/hyphdsp.cxx39
-rw-r--r--linguistic/source/spelldsp.cxx138
-rw-r--r--linguistic/source/thesdsp.cxx13
3 files changed, 111 insertions, 79 deletions
diff --git a/linguistic/source/hyphdsp.cxx b/linguistic/source/hyphdsp.cxx
index 9616928daf4a..c1a44886cf76 100644
--- a/linguistic/source/hyphdsp.cxx
+++ b/linguistic/source/hyphdsp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: hyphdsp.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-11-17 12:37:35 $
+ * last change: $Author: tl $ $Date: 2000-12-21 09:58:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -305,6 +305,7 @@ Reference< XHyphenatedWord > SAL_CALL
// search for entry with that language
LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage );
+ BOOL bWordModified = FALSE;
if (!pEntry)
{
#ifdef LINGU_EXCEPTIONS
@@ -313,12 +314,17 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
+ OUString aChkWord( rWord );
+ bWordModified |= RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ bWordModified |= RemoveControlChars( aChkWord );
+
// check for results from (positive) dictionaries which have precedence!
Reference< XDictionaryEntry > xEntry;
if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
{
- xEntry = GetDicList()->queryDictionaryEntry( rWord, rLocale,
+ xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
TRUE, FALSE );
}
@@ -339,7 +345,7 @@ Reference< XHyphenatedWord > SAL_CALL
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
{
if (rHyph.is())
- xRes = rHyph->hyphenate( rWord, rLocale, nMaxLeading,
+ xRes = rHyph->hyphenate( aChkWord, rLocale, nMaxLeading,
rProperties );
++i;
}
@@ -369,7 +375,7 @@ Reference< XHyphenatedWord > SAL_CALL
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
if (rHyph.is())
- xRes = rHyph->hyphenate( rWord, rLocale, nMaxLeading,
+ xRes = rHyph->hyphenate( aChkWord, rLocale, nMaxLeading,
rProperties );
pEntry->aFlags.nLastTriedSvcIndex = i;
@@ -400,6 +406,7 @@ Reference< XHyphenatedWord > SAL_CALL
// search for entry with that language
LangSvcEntry_Hyph *pEntry = aSvcList.Seek( nLanguage );
+ BOOL bWordModified = FALSE;
if (!pEntry)
{
#ifdef LINGU_EXCEPTIONS
@@ -408,12 +415,17 @@ Reference< XHyphenatedWord > SAL_CALL
}
else
{
+ OUString aChkWord( rWord );
+ bWordModified |= RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ bWordModified |= RemoveControlChars( aChkWord );
+
// check for results from (positive) dictionaries which have precedence!
Reference< XDictionaryEntry > xEntry;
if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
{
- xEntry = GetDicList()->queryDictionaryEntry( rWord, rLocale,
+ xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
TRUE, FALSE );
}
@@ -434,7 +446,7 @@ Reference< XHyphenatedWord > SAL_CALL
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
{
if (rHyph.is())
- xRes = rHyph->queryAlternativeSpelling( rWord, rLocale,
+ xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
nIndex, rProperties );
++i;
}
@@ -464,7 +476,7 @@ Reference< XHyphenatedWord > SAL_CALL
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
if (rHyph.is())
- xRes = rHyph->queryAlternativeSpelling( rWord, rLocale,
+ xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
nIndex, rProperties );
pEntry->aFlags.nLastTriedSvcIndex = i;
@@ -503,12 +515,17 @@ Reference< XPossibleHyphens > SAL_CALL
}
else
{
+ OUString aChkWord( rWord );
+ RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ RemoveControlChars( aChkWord );
+
// check for results from (positive) dictionaries which have precedence!
Reference< XDictionaryEntry > xEntry;
if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
{
- xEntry = GetDicList()->queryDictionaryEntry( rWord, rLocale,
+ xEntry = GetDicList()->queryDictionaryEntry( aChkWord, rLocale,
TRUE, FALSE );
}
@@ -529,7 +546,7 @@ Reference< XPossibleHyphens > SAL_CALL
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
{
if (rHyph.is())
- xRes = rHyph->createPossibleHyphens( rWord, rLocale,
+ xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
rProperties );
++i;
}
@@ -559,7 +576,7 @@ Reference< XPossibleHyphens > SAL_CALL
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
if (rHyph.is())
- xRes = rHyph->createPossibleHyphens( rWord, rLocale,
+ xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
rProperties );
pEntry->aFlags.nLastTriedSvcIndex = i;
diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index 729d224f1793..17b06c7c0690 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: spelldsp.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-11-17 12:37:42 $
+ * last change: $Author: tl $ $Date: 2000-12-21 09:58:21 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -284,6 +284,11 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
}
else
{
+ OUString aChkWord( rWord );
+ RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ RemoveControlChars( aChkWord );
+
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen = pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
@@ -305,20 +310,20 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
{
bTmpResValid = TRUE;
if (pRef1[i].is())
- bTmpRes = pRef1[i]->isValid( rWord, nLanguage, rProperties );
+ bTmpRes = pRef1[i]->isValid( aChkWord, nLanguage, rProperties );
else if (pRef[i].is())
{
- bTmpRes = GetExtCache().CheckWord( rWord, nLanguage, FALSE );
+ bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
if (!bTmpRes)
{
- bTmpRes = pRef[i]->isValid( rWord,
+ bTmpRes = pRef[i]->isValid( aChkWord,
CreateLocale( nLanguage ), rProperties );
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
- GetExtCache().AddWord( rWord, nLanguage );
+ GetExtCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -367,20 +372,20 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
bTmpResValid = TRUE;
if (xSpell1.is())
- bTmpRes = xSpell1->isValid( rWord, nLanguage, rProperties );
+ bTmpRes = xSpell1->isValid( aChkWord, nLanguage, rProperties );
else if (xSpell.is())
{
- bTmpRes = GetExtCache().CheckWord( rWord, nLanguage, FALSE );
+ bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
if (!bTmpRes)
{
- bTmpRes = xSpell->isValid( rWord,
+ bTmpRes = xSpell->isValid( aChkWord,
CreateLocale( nLanguage ), rProperties );
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (bTmpRes && 0 == rProperties.getLength())
- GetExtCache().AddWord( rWord, nLanguage );
+ GetExtCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -394,19 +399,19 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
}
}
}
- }
- // countercheck against results from dictionary which have precedence!
- if (bCheckDics &&
- GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
- {
- BOOL bIsWordOk = bRes;
+ // countercheck against results from dictionary which have precedence!
+ if (bCheckDics &&
+ GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
+ {
+ BOOL bIsWordOk = bRes;
- Reference< XDictionaryList > xDicList( GetDicList(), UNO_QUERY );
- Reference< XDictionaryEntry > xEntry( SearchDicList( xDicList,
- rWord, nLanguage, !bIsWordOk, TRUE ) );
- if (xEntry.is())
- bRes = !bIsWordOk;
+ Reference< XDictionaryList > xDicList( GetDicList(), UNO_QUERY );
+ Reference< XDictionaryEntry > xEntry( SearchDicList( xDicList,
+ aChkWord, nLanguage, !bIsWordOk, TRUE ) );
+ if (xEntry.is())
+ bRes = !bIsWordOk;
+ }
}
return bRes;
@@ -511,6 +516,11 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
}
else
{
+ OUString aChkWord( rWord );
+ RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ RemoveControlChars( aChkWord );
+
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen = pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
@@ -532,22 +542,22 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
{
bTmpResValid = TRUE;
if (pRef1[i].is())
- xTmpRes = pRef1[i]->spell( rWord, nLanguage, rProperties );
+ xTmpRes = pRef1[i]->spell( aChkWord, nLanguage, rProperties );
else if (pRef[i].is())
{
- BOOL bOK = GetExtCache().CheckWord( rWord, nLanguage, FALSE );
+ BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
if (bOK)
xTmpRes = NULL;
else
{
- xTmpRes = pRef[i]->spell( rWord,
+ xTmpRes = pRef[i]->spell( aChkWord,
CreateLocale( nLanguage ), rProperties );
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
- GetExtCache().AddWord( rWord, nLanguage );
+ GetExtCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -597,22 +607,22 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
bTmpResValid = TRUE;
if (xSpell1.is())
- xTmpRes = xSpell1->spell( rWord, nLanguage, rProperties );
+ xTmpRes = xSpell1->spell( aChkWord, nLanguage, rProperties );
else if (xSpell.is())
{
- BOOL bOK = GetExtCache().CheckWord( rWord, nLanguage, FALSE );
+ BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
if (bOK)
xTmpRes = NULL;
else
{
- xTmpRes = xSpell->spell( rWord,
+ xTmpRes = xSpell->spell( aChkWord,
CreateLocale( nLanguage ), rProperties );
// Add correct words to the cache.
// But not those that are correct only because of
// the temporary supplied settings.
if (!xTmpRes.is() && 0 == rProperties.getLength())
- GetExtCache().AddWord( rWord, nLanguage );
+ GetExtCache().AddWord( aChkWord, nLanguage );
}
}
else
@@ -632,50 +642,50 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
// clear previously remembered alternatives
if (bTmpResValid && !xTmpRes.is())
xRes = NULL;
- }
- // countercheck against results from dictionary which have precedence!
- if (bCheckDics &&
- GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
- {
- BOOL bIsWordOk = !xRes.is();
+ // countercheck against results from dictionary which have precedence!
+ if (bCheckDics &&
+ GetDicList().is() && IsUseDicList( rProperties, GetPropSet() ))
+ {
+ BOOL bIsWordOk = !xRes.is();
- Reference< XDictionaryList > xDicList( GetDicList(), UNO_QUERY );
- Reference< XDictionaryEntry > xEntry( SearchDicList( xDicList,
- rWord, nLanguage, !bIsWordOk, TRUE ) );
+ Reference< XDictionaryList > xDicList( GetDicList(), UNO_QUERY );
+ Reference< XDictionaryEntry > xEntry( SearchDicList( xDicList,
+ aChkWord, nLanguage, !bIsWordOk, TRUE ) );
- OUString aRplcTxt;
- BOOL bAddAlternative = FALSE;
+ OUString aRplcTxt;
+ BOOL bAddAlternative = FALSE;
- if (bIsWordOk && xEntry.is()) // negative entry found
- {
- aRplcTxt = xEntry->getReplacementText();
- bAddAlternative = TRUE;
- }
- else if (!bIsWordOk)
- {
- if (xEntry.is()) // positive entry found
- xRes = NULL;
- else
+ if (bIsWordOk && xEntry.is()) // negative entry found
+ {
+ aRplcTxt = xEntry->getReplacementText();
+ bAddAlternative = TRUE;
+ }
+ else if (!bIsWordOk)
{
- // search for negative entry to provide additional alternative
- xEntry = SearchDicList( xDicList,
- rWord, nLanguage, FALSE, TRUE );
- if (xEntry.is())
+ if (xEntry.is()) // positive entry found
+ xRes = NULL;
+ else
{
- aRplcTxt = xEntry->getReplacementText();
- bAddAlternative = TRUE;
+ // search for negative entry to provide additional alternative
+ xEntry = SearchDicList( xDicList,
+ aChkWord, nLanguage, FALSE, TRUE );
+ if (xEntry.is())
+ {
+ aRplcTxt = xEntry->getReplacementText();
+ bAddAlternative = TRUE;
+ }
}
}
- }
- // (additional) alternative found?
- if (bAddAlternative)
- {
- Reference< XSpellAlternatives > xAlt(
- new SpellAlternatives( rWord, nLanguage,
- SpellFailure::IS_NEGATIVE_WORD, aRplcTxt ) );
- xRes = MergeProposals( xAlt, xRes );
+ // (additional) alternative found?
+ if (bAddAlternative)
+ {
+ Reference< XSpellAlternatives > xAlt(
+ new SpellAlternatives( aChkWord, nLanguage,
+ SpellFailure::IS_NEGATIVE_WORD, aRplcTxt ) );
+ xRes = MergeProposals( xAlt, xRes );
+ }
}
}
diff --git a/linguistic/source/thesdsp.cxx b/linguistic/source/thesdsp.cxx
index 6978ff900414..8e4c5d670f42 100644
--- a/linguistic/source/thesdsp.cxx
+++ b/linguistic/source/thesdsp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: thesdsp.cxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-11-17 12:37:43 $
+ * last change: $Author: tl $ $Date: 2000-12-21 09:58:34 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -186,6 +186,11 @@ Sequence< Reference< XMeaning > > SAL_CALL
}
else
{
+ OUString aChkWord( rTerm );
+ RemoveHyphens( aChkWord );
+ if (IsIgnoreControlChars( rProperties, GetPropSet() ))
+ RemoveControlChars( aChkWord );
+
INT32 nLen = pEntry->aSvcRefs.getLength();
DBG_ASSERT( nLen = pEntry->aSvcImplNames.getLength(),
"lng : sequence length mismatch");
@@ -201,7 +206,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
&& aMeanings.getLength() == 0)
{
if (pRef[i].is())
- aMeanings = pRef[i]->queryMeanings( rTerm, rLocale, rProperties );
+ aMeanings = pRef[i]->queryMeanings( aChkWord, rLocale, rProperties );
++i;
}
}
@@ -230,7 +235,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
pRef[i] = xThes;
if (xThes.is())
- aMeanings = xThes->queryMeanings( rTerm, rLocale, rProperties );
+ aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties );
pEntry->aFlags.nLastTriedSvcIndex = i;
++i;