[API CHANGE] remove deprecated XSpell1 and XSupportedLanguages
in favour of their replacements XSpell and XSupportedLocales Change-Id: I3ad20d0c6c3bf0a00d7ef3947705059027a1ff6f Signed-off-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4228 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins CPCI <releng@collaboraoffice.com> (cherry picked from commit 35842d441f2e82204ce77ba8c53735be3f18dc78) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206467 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
This commit is contained in:
committed by
Xisco Fauli
parent
9fb6bc06eb
commit
bce4b4af9d
@@ -40,7 +40,7 @@
|
||||
#include <com/sun/star/io/XInputStream.hpp>
|
||||
|
||||
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
|
||||
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
|
||||
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
@@ -715,19 +715,16 @@ bool DictionaryNeo::addEntry_Impl(const uno::Reference< XDictionaryEntry >& xDic
|
||||
|
||||
// add word to the Hunspell dictionary using a sample word for affixation/compounding
|
||||
if (xDicEntry.is() && !xDicEntry->isNegative() && !xDicEntry->getReplacementText().isEmpty()) {
|
||||
uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() );
|
||||
uno::Reference< XSpellChecker1 > xSpell;
|
||||
Reference< XSpellAlternatives > xTmpRes;
|
||||
xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY );
|
||||
uno::Reference< XSpellChecker > xSpell = GetLngSvcMgr_Impl()->getSpellChecker();
|
||||
Sequence< css::beans::PropertyValue > aEmptySeq;
|
||||
if (xSpell.is() && (xSpell->isValid( SPELLML_SUPPORT, static_cast<sal_uInt16>(nLanguage), aEmptySeq )))
|
||||
if (xSpell.is() && (xSpell->isValid( SPELLML_SUPPORT, LanguageTag::convertToLocale(nLanguage), aEmptySeq )))
|
||||
{
|
||||
// "Grammar By" sample word is a Hunspell dictionary word?
|
||||
if (xSpell->isValid( xDicEntry->getReplacementText(), static_cast<sal_uInt16>(nLanguage), aEmptySeq ))
|
||||
if (xSpell->isValid( xDicEntry->getReplacementText(), LanguageTag::convertToLocale(nLanguage), aEmptySeq ))
|
||||
{
|
||||
xTmpRes = xSpell->spell( "<?xml?><query type='add'><word>" +
|
||||
Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "<?xml?><query type='add'><word>" +
|
||||
xDicEntry->getDictionaryWord() + "</word><word>" + xDicEntry->getReplacementText() +
|
||||
"</word></query>", static_cast<sal_uInt16>(nLanguage), aEmptySeq );
|
||||
"</word></query>", LanguageTag::convertToLocale(nLanguage), aEmptySeq );
|
||||
bRes = true;
|
||||
} else
|
||||
bRes = false;
|
||||
|
||||
@@ -744,43 +744,6 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl(
|
||||
return xRes;
|
||||
}
|
||||
|
||||
uno::Sequence< sal_Int16 > SAL_CALL SpellCheckerDispatcher::getLanguages( )
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
uno::Sequence< Locale > aTmp( getLocales() );
|
||||
uno::Sequence< sal_Int16 > aRes( LocaleSeqToLangSeq( aTmp ) );
|
||||
return aRes;
|
||||
}
|
||||
|
||||
|
||||
sal_Bool SAL_CALL SpellCheckerDispatcher::hasLanguage(
|
||||
sal_Int16 nLanguage )
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
return hasLocale( LanguageTag::convertToLocale(LanguageType(static_cast<sal_uInt16>(nLanguage))));
|
||||
}
|
||||
|
||||
|
||||
sal_Bool SAL_CALL SpellCheckerDispatcher::isValid(
|
||||
const OUString& rWord,
|
||||
sal_Int16 nLanguage,
|
||||
const uno::Sequence< beans::PropertyValue >& rProperties )
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
return isValid( rWord, LanguageTag::convertToLocale(LanguageType(static_cast<sal_uInt16>(nLanguage))), rProperties);
|
||||
}
|
||||
|
||||
|
||||
uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL SpellCheckerDispatcher::spell(
|
||||
const OUString& rWord,
|
||||
sal_Int16 nLanguage,
|
||||
const uno::Sequence< beans::PropertyValue >& rProperties )
|
||||
{
|
||||
MutexGuard aGuard( GetLinguMutex() );
|
||||
return spell(rWord, LanguageTag::convertToLocale(LanguageType(static_cast<sal_uInt16>(nLanguage))), rProperties);
|
||||
}
|
||||
|
||||
|
||||
void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale,
|
||||
const Sequence< OUString > &rSvcImplNames )
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <cppuhelper/implbase.hxx>
|
||||
#include <com/sun/star/beans/PropertyValues.hpp>
|
||||
#include <com/sun/star/linguistic2/XSpellChecker1.hpp>
|
||||
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
|
||||
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
|
||||
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
|
||||
|
||||
@@ -38,11 +38,7 @@ class LngSvcMgr;
|
||||
|
||||
|
||||
class SpellCheckerDispatcher :
|
||||
public cppu::WeakImplHelper
|
||||
<
|
||||
css::linguistic2::XSpellChecker1,
|
||||
css::linguistic2::XSpellChecker
|
||||
>,
|
||||
public cppu::WeakImplHelper<css::linguistic2::XSpellChecker>,
|
||||
public LinguDispatcher
|
||||
{
|
||||
typedef std::shared_ptr< LangSvcEntries_Spell > LangSvcEntries_Spell_Ptr_t;
|
||||
@@ -91,14 +87,6 @@ public:
|
||||
virtual sal_Bool SAL_CALL isValid( const OUString& aWord, const css::lang::Locale& aLocale, const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
|
||||
virtual css::uno::Reference< css::linguistic2::XSpellAlternatives > SAL_CALL spell( const OUString& aWord, const css::lang::Locale& aLocale, const css::uno::Sequence< ::css::beans::PropertyValue >& aProperties ) override;
|
||||
|
||||
// XSupportedLanguages
|
||||
virtual css::uno::Sequence< ::sal_Int16 > SAL_CALL getLanguages( ) override;
|
||||
virtual sal_Bool SAL_CALL hasLanguage( ::sal_Int16 nLanguage ) override;
|
||||
|
||||
// XSpellChecker1
|
||||
virtual sal_Bool SAL_CALL isValid( const OUString& aWord, ::sal_Int16 nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ) override;
|
||||
virtual css::uno::Reference< css::linguistic2::XSpellAlternatives > SAL_CALL spell( const OUString& aWord, ::sal_Int16 nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& aProperties ) override;
|
||||
|
||||
// LinguDispatcher
|
||||
virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames ) override;
|
||||
virtual css::uno::Sequence< OUString > GetServiceList( const css::lang::Locale &rLocale ) const override;
|
||||
|
||||
Reference in New Issue
Block a user