#85243# dispatcher checks for language support before quering the service
This commit is contained in:
parent
6fa0add0b4
commit
67edad23e5
3 changed files with 38 additions and 40 deletions
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: hyphdsp.cxx,v $
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* last change: $Author: tl $ $Date: 2001-05-16 10:44:54 $
|
||||
* last change: $Author: tl $ $Date: 2001-06-13 10:55:07 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -184,7 +184,7 @@ Reference<XHyphenatedWord> HyphenatorDispatcher::buildHyphWord(
|
|||
if (!bSkip && nHyphIdx >= 0)
|
||||
{
|
||||
if (nLeading <= nMaxLeading)
|
||||
nHyphenationPos = nHyphIdx;
|
||||
nHyphenationPos = (INT16) nHyphIdx;
|
||||
}
|
||||
bSkip = TRUE; //! multiple '=' should count as one only
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ Reference< XPossibleHyphens > HyphenatorDispatcher::buildPossHyphens(
|
|||
else
|
||||
{
|
||||
if (!bSkip && nHyphIdx >= 0)
|
||||
pPos[ nHyphCount++ ] = nHyphIdx;
|
||||
pPos[ nHyphCount++ ] = (INT16) nHyphIdx;
|
||||
bSkip = TRUE; //! multiple '=' should count as one only
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ Sequence< Locale > SAL_CALL HyphenatorDispatcher::getLocales()
|
|||
for (ULONG i = 0; i < nCnt; i++)
|
||||
{
|
||||
DBG_ASSERT( pEntry, "lng : pEntry is NULL pointer" );
|
||||
pItem[i] = CreateLocale( aSvcList.GetKey( pEntry ) );
|
||||
pItem[i] = CreateLocale( (LanguageType) aSvcList.GetKey( pEntry ) );
|
||||
pEntry = aSvcList.Next();
|
||||
}
|
||||
return aLocales;
|
||||
|
@ -321,7 +321,7 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
bWordModified |= RemoveHyphens( aChkWord );
|
||||
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
|
||||
bWordModified |= RemoveControlChars( aChkWord );
|
||||
INT16 nChkMaxLeading = GetPosInWordToCheck( rWord, nMaxLeading );
|
||||
INT16 nChkMaxLeading = (INT16) GetPosInWordToCheck( rWord, nMaxLeading );
|
||||
|
||||
// check for results from (positive) dictionaries which have precedence!
|
||||
Reference< XDictionaryEntry > xEntry;
|
||||
|
@ -348,7 +348,7 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
// try already instantiated service
|
||||
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
|
||||
{
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
|
||||
rProperties );
|
||||
++i;
|
||||
|
@ -378,11 +378,11 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
if (xBroadcaster.is())
|
||||
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
|
||||
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->hyphenate( aChkWord, rLocale, nChkMaxLeading,
|
||||
rProperties );
|
||||
|
||||
pEntry->aFlags.nLastTriedSvcIndex = i;
|
||||
pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
|
||||
++i;
|
||||
|
||||
// if language is not supported by the services
|
||||
|
@ -431,7 +431,7 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
bWordModified |= RemoveHyphens( aChkWord );
|
||||
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
|
||||
bWordModified |= RemoveControlChars( aChkWord );
|
||||
INT16 nChkIndex = GetPosInWordToCheck( rWord, nIndex );
|
||||
INT16 nChkIndex = (INT16) GetPosInWordToCheck( rWord, nIndex );
|
||||
|
||||
// check for results from (positive) dictionaries which have precedence!
|
||||
Reference< XDictionaryEntry > xEntry;
|
||||
|
@ -458,7 +458,7 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
// try already instantiated service
|
||||
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
|
||||
{
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
|
||||
nChkIndex, rProperties );
|
||||
++i;
|
||||
|
@ -488,11 +488,11 @@ Reference< XHyphenatedWord > SAL_CALL
|
|||
if (xBroadcaster.is())
|
||||
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
|
||||
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->queryAlternativeSpelling( aChkWord, rLocale,
|
||||
nChkIndex, rProperties );
|
||||
|
||||
pEntry->aFlags.nLastTriedSvcIndex = i;
|
||||
pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
|
||||
++i;
|
||||
|
||||
// if language is not supported by the services
|
||||
|
@ -566,7 +566,7 @@ Reference< XPossibleHyphens > SAL_CALL
|
|||
// try already instantiated service
|
||||
if (i <= pEntry->aFlags.nLastTriedSvcIndex)
|
||||
{
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
|
||||
rProperties );
|
||||
++i;
|
||||
|
@ -596,11 +596,11 @@ Reference< XPossibleHyphens > SAL_CALL
|
|||
if (xBroadcaster.is())
|
||||
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
|
||||
|
||||
if (rHyph.is())
|
||||
if (rHyph.is() && rHyph->hasLocale( rLocale ))
|
||||
xRes = rHyph->createPossibleHyphens( aChkWord, rLocale,
|
||||
rProperties );
|
||||
|
||||
pEntry->aFlags.nLastTriedSvcIndex = i;
|
||||
pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
|
||||
++i;
|
||||
|
||||
// if language is not supported by the services
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: spelldsp.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: vg $ $Date: 2001-06-07 15:33:07 $
|
||||
* last change: $Author: tl $ $Date: 2001-06-13 10:54:15 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -317,6 +317,7 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
|
|||
else
|
||||
{
|
||||
OUString aChkWord( rWord );
|
||||
Locale aLocale( CreateLocale( nLanguage ) );
|
||||
RemoveHyphens( aChkWord );
|
||||
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
|
||||
RemoveControlChars( aChkWord );
|
||||
|
@ -341,15 +342,14 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
|
|||
&& (!bTmpResValid || FALSE == bTmpRes))
|
||||
{
|
||||
bTmpResValid = TRUE;
|
||||
if (pRef1[i].is())
|
||||
if (pRef1[i].is() && pRef1[i]->hasLanguage( nLanguage ))
|
||||
bTmpRes = pRef1[i]->isValid( aChkWord, nLanguage, rProperties );
|
||||
else if (pRef[i].is())
|
||||
else if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
|
||||
{
|
||||
bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
|
||||
if (!bTmpRes)
|
||||
{
|
||||
bTmpRes = pRef[i]->isValid( aChkWord,
|
||||
CreateLocale( nLanguage ), rProperties );
|
||||
bTmpRes = pRef[i]->isValid( aChkWord, aLocale, rProperties );
|
||||
|
||||
// Add correct words to the cache.
|
||||
// But not those that are correct only because of
|
||||
|
@ -403,15 +403,14 @@ BOOL SpellCheckerDispatcher::isValid_Impl(
|
|||
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
|
||||
|
||||
bTmpResValid = TRUE;
|
||||
if (xSpell1.is())
|
||||
if (xSpell1.is() && xSpell1->hasLanguage( nLanguage ))
|
||||
bTmpRes = xSpell1->isValid( aChkWord, nLanguage, rProperties );
|
||||
else if (xSpell.is())
|
||||
else if (xSpell.is() && xSpell->hasLocale( aLocale ))
|
||||
{
|
||||
bTmpRes = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
|
||||
if (!bTmpRes)
|
||||
{
|
||||
bTmpRes = xSpell->isValid( aChkWord,
|
||||
CreateLocale( nLanguage ), rProperties );
|
||||
bTmpRes = xSpell->isValid( aChkWord, aLocale, rProperties );
|
||||
|
||||
// Add correct words to the cache.
|
||||
// But not those that are correct only because of
|
||||
|
@ -557,6 +556,7 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
|||
else
|
||||
{
|
||||
OUString aChkWord( rWord );
|
||||
Locale aLocale( CreateLocale( nLanguage ) );
|
||||
RemoveHyphens( aChkWord );
|
||||
if (IsIgnoreControlChars( rProperties, GetPropSet() ))
|
||||
RemoveControlChars( aChkWord );
|
||||
|
@ -581,17 +581,16 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
|||
&& (!bTmpResValid || xTmpRes.is()) )
|
||||
{
|
||||
bTmpResValid = TRUE;
|
||||
if (pRef1[i].is())
|
||||
if (pRef1[i].is() && pRef1[i]->hasLanguage( nLanguage ))
|
||||
xTmpRes = pRef1[i]->spell( aChkWord, nLanguage, rProperties );
|
||||
else if (pRef[i].is())
|
||||
else if (pRef[i].is() && pRef[i]->hasLocale( aLocale ))
|
||||
{
|
||||
BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
|
||||
if (bOK)
|
||||
xTmpRes = NULL;
|
||||
else
|
||||
{
|
||||
xTmpRes = pRef[i]->spell( aChkWord,
|
||||
CreateLocale( nLanguage ), rProperties );
|
||||
xTmpRes = pRef[i]->spell( aChkWord, aLocale, rProperties );
|
||||
|
||||
// Add correct words to the cache.
|
||||
// But not those that are correct only because of
|
||||
|
@ -646,17 +645,16 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
|||
rMgr.AddLngSvcEvtBroadcaster( xBroadcaster );
|
||||
|
||||
bTmpResValid = TRUE;
|
||||
if (xSpell1.is())
|
||||
if (xSpell1.is() && xSpell1->hasLanguage( nLanguage ))
|
||||
xTmpRes = xSpell1->spell( aChkWord, nLanguage, rProperties );
|
||||
else if (xSpell.is())
|
||||
else if (xSpell.is() && xSpell->hasLocale( aLocale ))
|
||||
{
|
||||
BOOL bOK = GetExtCache().CheckWord( aChkWord, nLanguage, FALSE );
|
||||
if (bOK)
|
||||
xTmpRes = NULL;
|
||||
else
|
||||
{
|
||||
xTmpRes = xSpell->spell( aChkWord,
|
||||
CreateLocale( nLanguage ), rProperties );
|
||||
xTmpRes = xSpell->spell( aChkWord, aLocale, rProperties );
|
||||
|
||||
// Add correct words to the cache.
|
||||
// But not those that are correct only because of
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
*
|
||||
* $RCSfile: thesdsp.cxx,v $
|
||||
*
|
||||
* $Revision: 1.6 $
|
||||
* $Revision: 1.7 $
|
||||
*
|
||||
* last change: $Author: tl $ $Date: 2001-05-16 10:47:15 $
|
||||
* last change: $Author: tl $ $Date: 2001-06-13 10:55:50 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
|
@ -167,7 +167,7 @@ Sequence< Locale > SAL_CALL
|
|||
for (ULONG i = 0; i < nCnt; i++)
|
||||
{
|
||||
DBG_ASSERT( pEntry, "lng : pEntry is NULL pointer" );
|
||||
pItem[i] = CreateLocale( aSvcList.GetKey( pEntry ) );
|
||||
pItem[i] = CreateLocale( (LanguageType) aSvcList.GetKey( pEntry ) );
|
||||
pEntry = aSvcList.Next();
|
||||
}
|
||||
return aLocales;
|
||||
|
@ -227,7 +227,7 @@ Sequence< Reference< XMeaning > > SAL_CALL
|
|||
while (i <= pEntry->aFlags.nLastTriedSvcIndex
|
||||
&& aMeanings.getLength() == 0)
|
||||
{
|
||||
if (pRef[i].is())
|
||||
if (pRef[i].is() && pRef[i]->hasLocale( rLocale ))
|
||||
aMeanings = pRef[i]->queryMeanings( aChkWord, rLocale, rProperties );
|
||||
++i;
|
||||
}
|
||||
|
@ -256,10 +256,10 @@ Sequence< Reference< XMeaning > > SAL_CALL
|
|||
UNO_QUERY );
|
||||
pRef[i] = xThes;
|
||||
|
||||
if (xThes.is())
|
||||
if (xThes.is() && xThes->hasLocale( rLocale ))
|
||||
aMeanings = xThes->queryMeanings( aChkWord, rLocale, rProperties );
|
||||
|
||||
pEntry->aFlags.nLastTriedSvcIndex = i;
|
||||
pEntry->aFlags.nLastTriedSvcIndex = (INT16) i;
|
||||
++i;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue