pPropHelper = new PropertyHelper_Spell( (XSpellChecker *) this, xPropSet );
xPropHelper = pPropHelper;
pPropHelper->AddAsPropListener(); //! after a reference is established
} return *pPropHelper;
}
sal_Bool bRes = sal_False; if (!aSuppLocales.getLength())
getLocales();
sal_Int32 nLen = aSuppLocales.getLength(); for (sal_Int32 i = 0; i < nLen; ++i)
{ const Locale *pLocale = aSuppLocales.getConstArray(); if (rLocale == pLocale[i])
{
bRes = sal_True; break;
}
} return bRes;
}
sal_Int16 SpellChecker::GetSpellFailure( const OUString &rWord, const Locale & )
{ // Checks whether a word is OK in a given language (Locale) or not, and // provides a failure type for the incorrect ones. // - words with "liss" (case sensitive) as substring will be negative. // - words with 'x' or 'X' will have incorrect spelling. // - words with 's' or 'S' as first letter will have the wrong caption. // - all other words will be OK.
// Get property values to be used. // These are be the default values set in the SN_LINGU_PROPERTIES // PropertySet which are overridden by the supplied ones from the // last argument. // You'll probably like to use a simpler solution than the provided // one using the PropertyHelper_Spell.
PropertyHelper_Spell &rHelper = GetPropHelper();
rHelper.SetTmpPropVals( rProperties );
sal_Int16 nFailure = GetSpellFailure( rWord, rLocale ); if (nFailure != -1)
{
sal_Int16 nLang = LinguLocaleToLanguage( rLocale ); // postprocess result for errors that should be ignored if ( (!rHelper.IsSpellUpperCase() && IsUpper( rWord, nLang ))
|| (!rHelper.IsSpellWithDigits() && HasDigits( rWord ))
|| (!rHelper.IsSpellCapitalization()
&& nFailure == SpellFailure::CAPTION_ERROR)
)
nFailure = -1;
} return nFailure == -1;
}
Reference< XSpellAlternatives >
SpellChecker::GetProposals( const OUString &rWord, const Locale &rLocale )
{ // Retrieves the return values for the 'spell' function call in case // of a misspelled word. // Especially it may give a list of suggested (correct) words: // - a "liss" substring will be replaced by "liz". // - 'x' or 'X' will be replaced by 'u' or 'U' for the first proposal // and they will be removed from the word for the second proposal. // - 's' or 'S' as first letter will be changed to the other caption.
if (!pPropHelper)
{
sal_Int32 nLen = rArguments.getLength(); if (2 == nLen)
{
Reference< XPropertySet > xPropSet;
rArguments.getConstArray()[0] >>= xPropSet;
//! Pointer allows for access of the non-UNO functions. //! And the reference to the UNO-functions while increasing //! the ref-count and will implicitly free the memory //! when the object is no longer used.
pPropHelper = new PropertyHelper_Spell( (XSpellChecker *) this, xPropSet );
xPropHelper = pPropHelper;
pPropHelper->AddAsPropListener(); //! after a reference is established
} else
OSL_FAIL( "wrong number of arguments in sequence" );
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.