diff --git a/chart2/source/view/main/DrawModelWrapper.cxx b/chart2/source/view/main/DrawModelWrapper.cxx index 89cb02a66f01..40dee7038ef2 100644 --- a/chart2/source/view/main/DrawModelWrapper.cxx +++ b/chart2/source/view/main/DrawModelWrapper.cxx @@ -36,7 +36,7 @@ #include namespace com::sun::star::linguistic2 { class XHyphenator; } -namespace com::sun::star::linguistic2 { class XSpellChecker1; } +namespace com::sun::star::linguistic2 { class XSpellChecker; } using namespace ::com::sun::star; @@ -77,7 +77,7 @@ DrawModelWrapper::DrawModelWrapper() if( xHyphenator.is() ) rOutliner.SetHyphenator( xHyphenator ); - uno::Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + uno::Reference< linguistic2::XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) rOutliner.SetSpeller( xSpellChecker ); } diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 20baa289dfc3..f5deee33226b 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -815,7 +815,7 @@ IMPL_LINK_NOARG(SpellDialog, LanguageSelectHdl, weld::ComboBox&, void) if (!sError.isEmpty()) { LanguageType eLanguage = m_xLanguageLB->get_active_id(); - Reference xAlt = xSpell->spell( sError, static_cast(eLanguage), + Reference xAlt = xSpell->spell( sError, LanguageTag::convertToLocale(eLanguage), Sequence< PropertyValue >() ); if( xAlt.is() ) m_xSentenceED->SetAlternatives( xAlt ); @@ -1723,7 +1723,7 @@ IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OUString&, rCurItemId, void } } -bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css::uno::Reference& xSpell ) +bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css::uno::Reference& xSpell ) { if (bIgnoreCurrentError) m_aIgnoreErrorsAt.insert( m_nErrorStart ); @@ -1800,7 +1800,7 @@ bool SentenceEditWindow_Impl::MarkNextError( bool bIgnoreCurrentError, const css } else if(pSpellErrorDescription && !bGrammarError && xSpell->isValid(GetErrorText(), - static_cast(LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale )), + LanguageTag::convertToLocale(LanguageTag::convertToLanguageType( pSpellErrorDescription->aLocale )), Sequence< PropertyValue >() )) { ++nCursor; diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 6480b61d3e83..ea1e052ff2b6 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -49,7 +49,7 @@ struct ImplSVEvent; // forward --------------------------------------------------------------- struct SpellDialog_Impl; -namespace com::sun::star::linguistic2 { class XSpellChecker1; } +namespace com::sun::star::linguistic2 { class XSpellChecker; } namespace svx{ class SpellDialog; @@ -104,7 +104,7 @@ public: void SetText(const OUString& rStr); - bool MarkNextError( bool bIgnoreCurrentError, const css::uno::Reference& ); + bool MarkNextError( bool bIgnoreCurrentError, const css::uno::Reference& ); int ChangeMarkedWord(const OUString& rNewWord, LanguageType eLanguage); void MoveErrorMarkTo(sal_Int32 nErrorStart, sal_Int32 nErrorEnd, bool bGrammar); OUString GetErrorText() const; @@ -160,8 +160,7 @@ private: svx::SpellPortions m_aSavedSentence; std::unique_ptr pImpl; - css::uno::Reference< - css::linguistic2::XSpellChecker1 > xSpell; + css::uno::Reference xSpell; rtl::Reference m_xChangeAllDictListener; bool m_bResumeClearsChangeAllDict = false; // clear if another instance changed this word list diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 4c0694f8f424..806df645b2fa 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -1295,12 +1295,12 @@ void EditEngine::EraseVirtualDevice() getImpl().EraseVirtualDevice(); } -void EditEngine::SetSpeller( Reference< XSpellChecker1 > const &xSpeller ) +void EditEngine::SetSpeller( Reference< XSpellChecker > const &xSpeller ) { getImpl().SetSpeller(xSpeller); } -Reference< XSpellChecker1 > const & EditEngine::GetSpeller() +Reference< XSpellChecker > const & EditEngine::GetSpeller() { return getImpl().GetSpeller(); } diff --git a/editeng/source/editeng/editview.cxx b/editeng/source/editeng/editview.cxx index 9d35e2636eee..352fd8168718 100644 --- a/editeng/source/editeng/editview.cxx +++ b/editeng/source/editeng/editview.cxx @@ -77,7 +77,7 @@ using namespace com::sun::star::beans; // static LanguageType EditView::CheckLanguage( const OUString &rText, - const Reference< linguistic2::XSpellChecker1 >& xSpell, + const Reference< linguistic2::XSpellChecker >& xSpell, const Reference< linguistic2::XLanguageGuessing >& xLangGuess, bool bIsParaText ) { @@ -138,8 +138,8 @@ LanguageType EditView::CheckLanguage( { if (nTmpLang != LANGUAGE_NONE && nTmpLang != LANGUAGE_DONTKNOW) { - if (xSpell->hasLanguage( static_cast(nTmpLang) ) && - xSpell->isValid( rText, static_cast(nTmpLang), Sequence< PropertyValue >() )) + if (xSpell->hasLocale( LanguageTag::convertToLocale(nTmpLang) ) && + xSpell->isValid( rText, LanguageTag::convertToLocale(nTmpLang), Sequence< PropertyValue >() )) { nLang = nTmpLang; break; @@ -1073,7 +1073,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link xSpeller(getImpEditEngine().GetSpeller()); + Reference< linguistic2::XSpellChecker > xSpeller(getImpEditEngine().GetSpeller()); ESelection aOldSel = GetSelection(); if ( !(xSpeller.is() && getImpl().IsWrongSpelledWord( aPaM, true )) ) return false; @@ -1111,7 +1111,7 @@ bool EditView::ExecuteSpellPopup(const Point& rPosPixel, const Link xSpellAlt = - xSpeller->spell( aSelected, static_cast(getImpEditEngine().GetLanguage( aPaM2 ).nLang), aPropVals ); + xSpeller->spell( aSelected, LanguageTag::convertToLocale(getImpEditEngine().GetLanguage( aPaM2 ).nLang), aPropVals ); Reference< linguistic2::XLanguageGuessing > xLangGuesser( EditDLL::Get().GetGlobalData()->GetLanguageGuesser() ); diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx index 414cc44e7e28..0196df89e495 100644 --- a/editeng/source/editeng/impedit.cxx +++ b/editeng/source/editeng/impedit.cxx @@ -1442,7 +1442,7 @@ void ImpEditView::ShowCursor( bool bGotoCursor, bool bForceVisCursor ) else { // is cursor at a misspelled word ? - uno::Reference xSpeller(getImpEditEngine().GetSpeller()); + uno::Reference xSpeller(getImpEditEngine().GetSpeller()); bool bIsWrong = xSpeller.is() && IsWrongSpelledWord(aPaM, /*bMarkIfWrong*/ false); EditView* pActiveView = GetEditViewPtr(); diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx index ace7a01fd21f..304add975e11 100644 --- a/editeng/source/editeng/impedit.hxx +++ b/editeng/source/editeng/impedit.hxx @@ -45,7 +45,7 @@ #include #include #include -#include +#include #include #include #include @@ -587,7 +587,7 @@ private: EEHorizontalTextDirection meDefaultHorizontalTextDirection; sal_Int32 mnBigTextObjectStart; - css::uno::Reference mxSpeller; + css::uno::Reference mxSpeller; css::uno::Reference mxHyphenator; std::unique_ptr mpSpellInfo; mutable css::uno::Reference mxBI; @@ -1183,9 +1183,9 @@ public: EditView* GetActiveView() const { return mpActiveView; } void SetActiveView( EditView* pView ); - css::uno::Reference< css::linguistic2::XSpellChecker1 > const & + css::uno::Reference< css::linguistic2::XSpellChecker > const & GetSpeller(); - void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpl ) + void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker > const &xSpl ) { mxSpeller = xSpl; } const css::uno::Reference< css::linguistic2::XHyphenator >& GetHyphenator() const { return mxHyphenator; } diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 0e4b6934308d..46458dbca59c 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1624,7 +1624,7 @@ css::lang::Locale ImpEditEngine::GetLocale( const EditPaM& rPaM ) const return LanguageTag( GetLanguage( rPaM ).nLang ).getLocale(); } -Reference< XSpellChecker1 > const & ImpEditEngine::GetSpeller() +Reference< XSpellChecker > const & ImpEditEngine::GetSpeller() { if (!mxSpeller.is()) mxSpeller = LinguMgr::GetSpellChecker(); @@ -2061,7 +2061,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpSpell( EditView* pEditView ) { LanguageType eLang = GetLanguage( aCurSel.Max() ).nLang; SvxSpellWrapper::CheckSpellLang(mxSpeller, eLang); - xSpellAlt = mxSpeller->spell( aWord, static_cast(eLang), aEmptySeq ); + xSpellAlt = mxSpeller->spell( aWord, LanguageTag::convertToLocale(eLang), aEmptySeq ); } if ( !xSpellAlt.is() ) @@ -2108,7 +2108,7 @@ Reference< XSpellAlternatives > ImpEditEngine::ImpFindNextError(EditSelection& r } if ( !aWord.isEmpty() ) - xSpellAlt = mxSpeller->spell( aWord, static_cast(GetLanguage( aCurSel.Max() ).nLang), aEmptySeq ); + xSpellAlt = mxSpeller->spell( aWord, LanguageTag::convertToLocale(GetLanguage( aCurSel.Max() ).nLang), aEmptySeq ); if ( !xSpellAlt.is() ) aCurSel = WordRight( aCurSel.Min(), css::i18n::WordType::DICTIONARY_WORD ); @@ -2479,7 +2479,7 @@ void ImpEditEngine::DoOnlineSpelling( ContentNode* pThisNodeOnly, bool bSpellAtC { const sal_Int32 nWStart = aSel.Min().GetIndex(); const sal_Int32 nWEnd = aSel.Max().GetIndex(); - if (!mxSpeller->isValid( aWord, static_cast(GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ).nLang), aEmptySeq)) + if (!mxSpeller->isValid( aWord, LanguageTag::convertToLocale(GetLanguage( EditPaM( aSel.Min().GetNode(), nWStart+1 ) ).nLang), aEmptySeq)) { // Check if already marked correctly... const sal_Int32 nXEnd = bDottAdded ? nWEnd -1 : nWEnd; @@ -2627,7 +2627,7 @@ EESpellState ImpEditEngine::HasSpellErrors() { LanguageType eLang = GetLanguage( aCurSel.Max() ).nLang; SvxSpellWrapper::CheckSpellLang(mxSpeller, eLang); - xSpellAlt = mxSpeller->spell( aWord, static_cast(eLang), aEmptySeq ); + xSpellAlt = mxSpeller->spell( aWord, LanguageTag::convertToLocale(eLang), aEmptySeq ); } aCurSel = WordRight( aCurSel.Max(), css::i18n::WordType::DICTIONARY_WORD ); } diff --git a/editeng/source/misc/splwrap.cxx b/editeng/source/misc/splwrap.cxx index b12ee6fd5f22..682a0b14175c 100644 --- a/editeng/source/misc/splwrap.cxx +++ b/editeng/source/misc/splwrap.cxx @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -169,7 +169,7 @@ SvxSpellWrapper::SvxSpellWrapper( weld::Widget* pWn, sal_Int16 SvxSpellWrapper::CheckSpellLang( - Reference< XSpellChecker1 > const & xSpell, LanguageType nLang) + Reference< XSpellChecker > const & xSpell, LanguageType nLang) { LangCheckState_map_t &rLCS = GetLangCheckState(); @@ -182,7 +182,7 @@ sal_Int16 SvxSpellWrapper::CheckSpellLang( if (SVX_LANG_NEED_CHECK == (nVal & 0x00FF)) { sal_uInt16 nTmpVal = SVX_LANG_MISSING_DO_WARN; - if (xSpell.is() && xSpell->hasLanguage( static_cast(nLang) )) + if (xSpell.is() && xSpell->hasLocale( LanguageTag::convertToLocale(nLang) )) nTmpVal = SVX_LANG_OK; nVal &= 0xFF00; nVal |= nTmpVal; diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx index e96809d21d8f..c91f20e52739 100644 --- a/editeng/source/misc/svxacorr.cxx +++ b/editeng/source/misc/svxacorr.cxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -441,12 +441,12 @@ void SvxAutoCorrect::FnCapitalStartWord( SvxAutoCorrDoc& rDoc, if( !FindInWordStartExceptList(eLang, sWord) ) { // Check that word isn't correctly spelt before correcting: - css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller = + css::uno::Reference< css::linguistic2::XSpellChecker > xSpeller = LinguMgr::GetSpellChecker(); - if( xSpeller->hasLanguage(static_cast(eLang)) ) + if( xSpeller->hasLocale(LanguageTag::convertToLocale(eLang)) ) { Sequence< css::beans::PropertyValue > aEmptySeq; - if (xSpeller->isValid(sWord, static_cast(eLang), aEmptySeq)) + if (xSpeller->isValid(sWord, LanguageTag::convertToLocale(eLang), aEmptySeq)) { return; } diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 472d885ec186..de913430f5c1 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include @@ -173,26 +173,25 @@ namespace { //! The dummy accesses the real implementation (and thus loading the DLL) //! when it needs to be done only. class SpellDummy_Impl : - public cppu::WeakImplHelper< XSpellChecker1 > + public cppu::WeakImplHelper< XSpellChecker > { - uno::Reference< XSpellChecker1 > xSpell; // the real one... + uno::Reference< XSpellChecker > xSpell; // the real one... void GetSpell_Impl(); public: - // XSupportedLanguages (for XSpellChecker1) - virtual css::uno::Sequence< sal_Int16 > SAL_CALL - getLanguages() override; + // XSupportedLocales (for XSpellChecker) + virtual css::uno::Sequence< css::lang::Locale > SAL_CALL + getLocales() override; virtual sal_Bool SAL_CALL - hasLanguage( sal_Int16 nLanguage ) override; + hasLocale( const css::lang::Locale& ) override; - // XSpellChecker1 (same as XSpellChecker but sal_Int16 for language) virtual sal_Bool SAL_CALL - isValid( const OUString& rWord, sal_Int16 nLanguage, + isValid( const OUString& rWord, const css::lang::Locale& nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override; virtual css::uno::Reference< css::linguistic2::XSpellAlternatives > SAL_CALL - spell( const OUString& rWord, sal_Int16 nLanguage, + spell( const OUString& rWord, const css::lang::Locale& nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override; }; @@ -203,35 +202,35 @@ void SpellDummy_Impl::GetSpell_Impl() if (!xSpell.is()) { uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); - xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); + xSpell = xLngSvcMgr->getSpellChecker(); } } -uno::Sequence< sal_Int16 > SAL_CALL - SpellDummy_Impl::getLanguages() +uno::Sequence< css::lang::Locale > SAL_CALL + SpellDummy_Impl::getLocales() { GetSpell_Impl(); if (xSpell.is()) - return xSpell->getLanguages(); + return xSpell->getLocales(); else - return uno::Sequence< sal_Int16 >(); + return {}; } sal_Bool SAL_CALL - SpellDummy_Impl::hasLanguage( sal_Int16 nLanguage ) + SpellDummy_Impl::hasLocale( const css::lang::Locale& nLanguage ) { GetSpell_Impl(); bool bRes = false; if (xSpell.is()) - bRes = xSpell->hasLanguage( nLanguage ); + bRes = xSpell->hasLocale( nLanguage ); return bRes; } sal_Bool SAL_CALL - SpellDummy_Impl::isValid( const OUString& rWord, sal_Int16 nLanguage, + SpellDummy_Impl::isValid( const OUString& rWord, const css::lang::Locale& nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) { GetSpell_Impl(); @@ -243,7 +242,7 @@ sal_Bool SAL_CALL uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL - SpellDummy_Impl::spell( const OUString& rWord, sal_Int16 nLanguage, + SpellDummy_Impl::spell( const OUString& rWord, const css::lang::Locale& nLanguage, const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) { GetSpell_Impl(); @@ -440,7 +439,7 @@ void LinguMgrExitLstnr::AtExit() rtl::Reference LinguMgr::pExitLstnr; bool LinguMgr::bExiting = false; uno::Reference< XLinguServiceManager2 > LinguMgr::xLngSvcMgr; -uno::Reference< XSpellChecker1 > LinguMgr::xSpell; +uno::Reference< XSpellChecker > LinguMgr::xSpell; uno::Reference< XHyphenator > LinguMgr::xHyph; uno::Reference< XThesaurus > LinguMgr::xThes; uno::Reference< XSearchableDictionaryList > LinguMgr::xDicList; @@ -464,7 +463,7 @@ uno::Reference< XLinguServiceManager2 > LinguMgr::GetLngSvcMgr() } -uno::Reference< XSpellChecker1 > LinguMgr::GetSpellChecker() +uno::Reference< XSpellChecker > LinguMgr::GetSpellChecker() { return xSpell.is() ? xSpell : GetSpell(); } @@ -507,7 +506,7 @@ uno::Reference< XDictionary > LinguMgr::GetChangeAllList() return xChangeAll.is() ? xChangeAll : GetChangeAll(); } -uno::Reference< XSpellChecker1 > LinguMgr::GetSpell() +uno::Reference< XSpellChecker > LinguMgr::GetSpell() { if (bExiting) return nullptr; diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx index c2cbca480b16..f8714c1b4071 100644 --- a/editeng/source/outliner/outlin2.cxx +++ b/editeng/source/outliner/outlin2.cxx @@ -374,12 +374,12 @@ bool Outliner::SpellNextDocument() } -void Outliner::SetSpeller( Reference< XSpellChecker1 > const &xSpeller ) +void Outliner::SetSpeller( Reference< XSpellChecker > const &xSpeller ) { pEditEngine->SetSpeller( xSpeller ); } -Reference< XSpellChecker1 > const & Outliner::GetSpeller() +Reference< XSpellChecker > const & Outliner::GetSpeller() { return pEditEngine->GetSpeller(); } diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx index 7d74d4f4f191..7033a33277c4 100644 --- a/include/editeng/editeng.hxx +++ b/include/editeng/editeng.hxx @@ -51,7 +51,7 @@ template class Link; namespace com::sun::star { namespace linguistic2 { - class XSpellChecker1; + class XSpellChecker; class XHyphenator; } namespace datatransfer { @@ -433,9 +433,9 @@ public: void EraseVirtualDevice(); void SetSpeller( css::uno::Reference< - css::linguistic2::XSpellChecker1 > const &xSpeller ); + css::linguistic2::XSpellChecker > const &xSpeller ); SAL_DLLPRIVATE css::uno::Reference< - css::linguistic2::XSpellChecker1 > const & + css::linguistic2::XSpellChecker > const & GetSpeller(); void SetHyphenator( css::uno::Reference< css::linguistic2::XHyphenator > const & xHyph ); diff --git a/include/editeng/editview.hxx b/include/editeng/editview.hxx index e77cea8c56b1..cf6052e1c52a 100644 --- a/include/editeng/editview.hxx +++ b/include/editeng/editview.hxx @@ -84,7 +84,7 @@ namespace datatransfer { } } namespace linguistic2 { - class XSpellChecker1; + class XSpellChecker; class XLanguageGuessing; } }}} @@ -381,7 +381,7 @@ public: */ static LanguageType CheckLanguage( const OUString &rText, - const css::uno::Reference< css::linguistic2::XSpellChecker1 >& xSpell, + const css::uno::Reference< css::linguistic2::XSpellChecker >& xSpell, const css::uno::Reference< css::linguistic2::XLanguageGuessing >& xLangGuess, bool bIsParaText ); /// Allows adjusting the point or mark of the selection to a document coordinate. diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx index 84bf25345cd9..1f02aa0ea893 100644 --- a/include/editeng/outliner.hxx +++ b/include/editeng/outliner.hxx @@ -82,7 +82,7 @@ class DrawBulletInfo; class StripPortionsHelper; namespace com::sun::star::linguistic2 { - class XSpellChecker1; + class XSpellChecker; class XHyphenator; } namespace svx{ @@ -848,8 +848,8 @@ public: virtual OUString CalcFieldValue( const SvxFieldItem& rField, sal_Int32 nPara, sal_Int32 nPos, std::optional& rTxtColor, std::optional& rFldColor, std::optional& rFldLineStyle ); - void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker1 > const &xSpeller ); - css::uno::Reference< css::linguistic2::XSpellChecker1 > const & + void SetSpeller( css::uno::Reference< css::linguistic2::XSpellChecker > const &xSpeller ); + css::uno::Reference< css::linguistic2::XSpellChecker > const & GetSpeller(); void SetHyphenator( css::uno::Reference< css::linguistic2::XHyphenator > const & xHyph ); diff --git a/include/editeng/splwrap.hxx b/include/editeng/splwrap.hxx index 7ad1505a8251..20084148dcf9 100644 --- a/include/editeng/splwrap.hxx +++ b/include/editeng/splwrap.hxx @@ -30,7 +30,7 @@ namespace com::sun::star::linguistic2 { class XDictionary; - class XSpellChecker1; + class XSpellChecker; class XHyphenator; } @@ -79,7 +79,7 @@ public: virtual ~SvxSpellWrapper(); static sal_Int16 CheckSpellLang( - css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpell, + css::uno::Reference< css::linguistic2::XSpellChecker > const & xSpell, LanguageType nLang ); static sal_Int16 CheckHyphLang( css::uno::Reference< css::linguistic2::XHyphenator >const & xHyph, diff --git a/include/editeng/unolingu.hxx b/include/editeng/unolingu.hxx index 2aec6db1a630..6eb60c359449 100644 --- a/include/editeng/unolingu.hxx +++ b/include/editeng/unolingu.hxx @@ -30,7 +30,7 @@ namespace com::sun::star::linguistic2 { class XHyphenator; } namespace com::sun::star::linguistic2 { class XLinguProperties; } namespace com::sun::star::linguistic2 { class XLinguServiceManager2; } namespace com::sun::star::linguistic2 { class XSearchableDictionaryList; } -namespace com::sun::star::linguistic2 { class XSpellChecker1; } +namespace com::sun::star::linguistic2 { class XSpellChecker; } namespace com::sun::star::linguistic2 { class XThesaurus; } class LinguMgrExitLstnr; @@ -44,7 +44,7 @@ class EDITENG_DLLPUBLIC LinguMgr friend class LinguMgrExitLstnr; static css::uno::Reference< css::linguistic2::XLinguServiceManager2 > xLngSvcMgr; - static css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell; + static css::uno::Reference< css::linguistic2::XSpellChecker > xSpell; static css::uno::Reference< css::linguistic2::XHyphenator > xHyph; static css::uno::Reference< css::linguistic2::XThesaurus > xThes; static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > xDicList; @@ -56,7 +56,7 @@ class EDITENG_DLLPUBLIC LinguMgr static rtl::Reference pExitLstnr; static bool bExiting; - static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpell(); + static css::uno::Reference< css::linguistic2::XSpellChecker > GetSpell(); static css::uno::Reference< css::linguistic2::XHyphenator > GetHyph(); static css::uno::Reference< css::linguistic2::XThesaurus > GetThes(); static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDicList(); @@ -70,7 +70,7 @@ class EDITENG_DLLPUBLIC LinguMgr public: - static css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker(); + static css::uno::Reference< css::linguistic2::XSpellChecker > GetSpellChecker(); static css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator(); static css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus(); static css::uno::Reference< css::linguistic2::XSearchableDictionaryList > GetDictionaryList(); diff --git a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx index 7436455fadb0..5020d755e784 100644 --- a/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/hyphen/hyphenimp.cxx @@ -27,7 +27,7 @@ #include #include #include -#include +#include #include #include #include @@ -481,22 +481,22 @@ Reference< XHyphenatedWord > SAL_CALL Hyphenator::hyphenate( const OUString& aWo minCompoundLead == 0 || minCompoundTrail == 0 ) ) { uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); - uno::Reference< XSpellChecker1 > xSpell; + uno::Reference< XSpellChecker > xSpell; LanguageType nLanguage = LinguLocaleToLanguage( aLocale ); - xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); + xSpell = xLngSvcMgr->getSpellChecker(); // get morphological analysis of the word if ( ( bAnalyzed && xTmpRes.is() ) || ( xSpell.is() && xSpell->isValid( - SPELLML_SUPPORT, static_cast(nLanguage), + SPELLML_SUPPORT, LanguageTag::convertToLocale(nLanguage), uno::Sequence< beans::PropertyValue >() ) ) ) { if ( !bAnalyzed ) { xTmpRes = xSpell->spell( "" + aWord + "", - static_cast(nLanguage), + LanguageTag::convertToLocale(nLanguage), uno::Sequence< beans::PropertyValue >() ); bAnalyzed = true; diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index 8a05885051c5..2d65302d18ce 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -220,7 +220,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM uno::Sequence< Reference< XMeaning > > aMeanings( 1 ); uno::Sequence< Reference< XMeaning > > noMeanings( 0 ); uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); - uno::Reference< XSpellChecker1 > xSpell; + uno::Reference< XSpellChecker > xSpell; OUString aRTerm(qTerm); OUString aPTerm(qTerm); @@ -316,7 +316,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM if (stem) { xTmpRes2 = xSpell->spell( "" + - aPTerm + "", static_cast(nLanguage), rProperties ); + aPTerm + "", LanguageTag::convertToLocale(nLanguage), rProperties ); if (xTmpRes2.is()) { Sequenceseq = xTmpRes2->getAlternatives(); @@ -352,7 +352,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM if (stem && stem2) { Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "" + - sTerm + "" + codeTerm + "", static_cast(nLanguage), rProperties ); + sTerm + "" + codeTerm + "", LanguageTag::convertToLocale(nLanguage), rProperties ); if (xTmpRes.is()) { Sequenceseq = xTmpRes->getAlternatives(); @@ -402,11 +402,11 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM return noMeanings; stem = 1; - xSpell.set( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); - if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, static_cast(nLanguage), rProperties )) + xSpell = xLngSvcMgr->getSpellChecker(); + if (!xSpell.is() || !xSpell->isValid( SPELLML_SUPPORT, LanguageTag::convertToLocale(nLanguage), rProperties )) return noMeanings; Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "" + - aRTerm + "", static_cast(nLanguage), rProperties ); + aRTerm + "", LanguageTag::convertToLocale(nLanguage), rProperties ); if (xTmpRes.is()) { Sequenceseq = xTmpRes->getAlternatives(); @@ -423,7 +423,7 @@ Sequence < Reference < css::linguistic2::XMeaning > > SAL_CALL Thesaurus::queryM if (!pos) return noMeanings; xTmpRes = xSpell->spell( OUString::Concat("") + - aRTerm.subView(pos + 1) + "", static_cast(nLanguage), rProperties ); + aRTerm.subView(pos + 1) + "", LanguageTag::convertToLocale(nLanguage), rProperties ); if (xTmpRes.is()) { Sequenceseq = xTmpRes->getAlternatives(); diff --git a/linguistic/source/dicimp.cxx b/linguistic/source/dicimp.cxx index 24f6384cab3e..3e73f5814930 100644 --- a/linguistic/source/dicimp.cxx +++ b/linguistic/source/dicimp.cxx @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include @@ -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(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(nLanguage), aEmptySeq )) + if (xSpell->isValid( xDicEntry->getReplacementText(), LanguageTag::convertToLocale(nLanguage), aEmptySeq )) { - xTmpRes = xSpell->spell( "" + + Reference< XSpellAlternatives > xTmpRes = xSpell->spell( "" + xDicEntry->getDictionaryWord() + "" + xDicEntry->getReplacementText() + - "", static_cast(nLanguage), aEmptySeq ); + "", LanguageTag::convertToLocale(nLanguage), aEmptySeq ); bRes = true; } else bRes = false; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 6c50a4c9c65a..99c45afe8609 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -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(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(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(nLanguage))), rProperties); -} - - void SpellCheckerDispatcher::SetServiceList( const Locale &rLocale, const Sequence< OUString > &rSvcImplNames ) { diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index a479f7bc7296..ac1f02a46907 100644 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -25,7 +25,7 @@ #include #include -#include +#include #include #include @@ -38,11 +38,7 @@ class LngSvcMgr; class SpellCheckerDispatcher : - public cppu::WeakImplHelper - < - css::linguistic2::XSpellChecker1, - css::linguistic2::XSpellChecker - >, + public cppu::WeakImplHelper, 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; diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index a29f14efecc3..4ff27e052a80 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -2819,8 +2819,6 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/linguistic2,\ XSetSpellAlternatives \ XSpellAlternatives \ XSpellChecker \ - XSpellChecker1 \ - XSupportedLanguages \ XSupportedLocales \ XThesaurus \ )) diff --git a/offapi/com/sun/star/linguistic2/XSpellChecker1.idl b/offapi/com/sun/star/linguistic2/XSpellChecker1.idl deleted file mode 100644 index b6226251731f..000000000000 --- a/offapi/com/sun/star/linguistic2/XSpellChecker1.idl +++ /dev/null @@ -1,44 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - -module com { module sun { module star { module linguistic2 { - -/** @deprecated -*/ -published interface XSpellChecker1 : com::sun::star::linguistic2::XSupportedLanguages -{ - boolean isValid( - [in] string aWord, - [in] short nLanguage, - [in] com::sun::star::beans::PropertyValues aProperties ) - raises( com::sun::star::lang::IllegalArgumentException ); - - com::sun::star::linguistic2::XSpellAlternatives spell( - [in] string aWord, - [in] short nLanguage, - [in] com::sun::star::beans::PropertyValues aProperties ) - raises( com::sun::star::lang::IllegalArgumentException ); - -}; - - -}; }; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/com/sun/star/linguistic2/XSupportedLanguages.idl b/offapi/com/sun/star/linguistic2/XSupportedLanguages.idl deleted file mode 100644 index 33775a8ccbd6..000000000000 --- a/offapi/com/sun/star/linguistic2/XSupportedLanguages.idl +++ /dev/null @@ -1,37 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - - - -module com { module sun { module star { module linguistic2 { - -/** @deprecated -*/ -published interface XSupportedLanguages : com::sun::star::uno::XInterface -{ - sequence getLanguages(); - - boolean hasLanguage( [in] short nLanguage ); - -}; - - -}; }; }; }; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/offapi/type_reference/offapi.idl b/offapi/type_reference/offapi.idl index 6283f44e6962..538044e2cdef 100644 --- a/offapi/type_reference/offapi.idl +++ b/offapi/type_reference/offapi.idl @@ -9139,16 +9139,6 @@ module com { short getAlternativesCount(); sequence< string > getAlternatives(); }; - /** @deprecated */ published interface XSupportedLanguages { - interface ::com::sun::star::uno::XInterface; - sequence< short > getLanguages(); - boolean hasLanguage([in] short nLanguage); - }; - /** @deprecated */ published interface XSpellChecker1 { - interface ::com::sun::star::linguistic2::XSupportedLanguages; - boolean isValid([in] string aWord, [in] short nLanguage, [in] ::com::sun::star::beans::PropertyValues aProperties) raises (::com::sun::star::lang::IllegalArgumentException); - ::com::sun::star::linguistic2::XSpellAlternatives spell([in] string aWord, [in] short nLanguage, [in] ::com::sun::star::beans::PropertyValues aProperties) raises (::com::sun::star::lang::IllegalArgumentException); - }; }; module mozilla { published struct MenuMultipleChange { diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index 6f5ea51bc2b5..0c0b0ad5fac7 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1015,7 +1015,7 @@ void ScInputHandler::UpdateSpellSettings( bool bFromStartTab ) // Language is set separately, so the speller is needed only if online spelling is active if ( bOnlineSpell ) { - css::uno::Reference xXSpellChecker1( LinguMgr::GetSpellChecker() ); + css::uno::Reference xXSpellChecker1( LinguMgr::GetSpellChecker() ); mpEditEngine->SetSpeller( xXSpellChecker1 ); } diff --git a/sc/source/ui/inc/spelleng.hxx b/sc/source/ui/inc/spelleng.hxx index 98baa5c8e46a..d8cc61465573 100644 --- a/sc/source/ui/inc/spelleng.hxx +++ b/sc/source/ui/inc/spelleng.hxx @@ -100,7 +100,7 @@ public: ScViewData& rViewData, ScDocument* pUndoDoc, ScDocument* pRedoDoc, - css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpeller ); + css::uno::Reference< css::linguistic2::XSpellChecker > const & xSpeller ); /** Checks spelling of all cells in the selection or sheet. */ virtual void ConvertAll(weld::Widget* pDialogParent, EditView& rEditView) override; diff --git a/sc/source/ui/view/spellcheckcontext.cxx b/sc/source/ui/view/spellcheckcontext.cxx index eeb807230c06..56f950289269 100644 --- a/sc/source/ui/view/spellcheckcontext.cxx +++ b/sc/source/ui/view/spellcheckcontext.cxx @@ -20,7 +20,7 @@ #include #include -#include +#include #include @@ -407,7 +407,7 @@ void SpellCheckContext::setup() mpEngine->SetWordDelimiters( ScEditUtil::ModifyDelimiters(mpEngine->GetWordDelimiters())); - uno::Reference xXSpellChecker1(LinguMgr::GetSpellChecker()); + uno::Reference xXSpellChecker1(LinguMgr::GetSpellChecker()); mpEngine->SetSpeller(xXSpellChecker1); mpEngine->SetDefaultLanguage(meLanguage); } diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx index c60d1361b1e9..323a4357ee69 100644 --- a/sc/source/ui/view/spelleng.cxx +++ b/sc/source/ui/view/spelleng.cxx @@ -302,7 +302,7 @@ void ScConversionEngineBase::FillFromCell( SCCOL nCol, SCROW nRow, SCTAB nTab ) ScSpellingEngine::ScSpellingEngine( SfxItemPool* pEnginePoolP, ScViewData& rViewData, ScDocument* pUndoDoc, ScDocument* pRedoDoc, - css::uno::Reference< css::linguistic2::XSpellChecker1 > const & xSpeller ) : + css::uno::Reference< css::linguistic2::XSpellChecker > const & xSpeller ) : ScConversionEngineBase( pEnginePoolP, rViewData, pUndoDoc, pRedoDoc ) { SetSpeller( xSpeller ); diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index e1e78cd88a8a..cdf852a7fab0 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -4351,7 +4351,7 @@ void ScViewData::UpdateOutlinerFlags( Outliner& rOutl ) const if ( bOnlineSpell ) { - css::uno::Reference xXSpellChecker1( LinguMgr::GetSpellChecker() ); + css::uno::Reference xXSpellChecker1( LinguMgr::GetSpellChecker() ); rOutl.SetSpeller( xXSpellChecker1 ); } diff --git a/sc/source/ui/view/viewfun4.cxx b/sc/source/ui/view/viewfun4.cxx index fecfb4db2b8e..2ae6a0e4c794 100644 --- a/sc/source/ui/view/viewfun4.cxx +++ b/sc/source/ui/view/viewfun4.cxx @@ -357,7 +357,7 @@ void ScViewFunc::DoThesaurus() return; } - uno::Reference xSpeller = LinguMgr::GetSpellChecker(); + uno::Reference xSpeller = LinguMgr::GetSpellChecker(); pThesaurusEngine.reset(new ScEditEngineDefaulter(rDoc.GetEditEnginePool())); pThesaurusEngine->SetRefDevice(GetViewData().GetActiveWin()->GetOutDev()); diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 5e444329efff..d1a7a972ddca 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -97,7 +97,7 @@ #include namespace com::sun::star::linguistic2 { class XHyphenator; } -namespace com::sun::star::linguistic2 { class XSpellChecker1; } +namespace com::sun::star::linguistic2 { class XSpellChecker; } using namespace ::sd; using namespace ::com::sun::star; @@ -252,7 +252,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) try { - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) rOutliner.SetSpeller( xSpellChecker ); @@ -305,7 +305,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh) try { - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) m_pHitTestOutliner->SetSpeller( xSpellChecker ); diff --git a/sd/source/core/drawdoc4.cxx b/sd/source/core/drawdoc4.cxx index c74f8b6931a3..d903d1416ab9 100644 --- a/sd/source/core/drawdoc4.cxx +++ b/sd/source/core/drawdoc4.cxx @@ -768,7 +768,7 @@ void SdDrawDocument::StartOnlineSpelling(bool bForceSpelling) SdOutliner* pOutl = GetInternalOutliner(); - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) pOutl->SetSpeller( xSpellChecker ); diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx index effaf20e9d0b..f694c1588392 100644 --- a/sd/source/ui/func/futhes.cxx +++ b/sd/source/ui/func/futhes.cxx @@ -89,7 +89,7 @@ void FuThesaurus::DoExecute(SfxRequest& rReq) { if ( !pOutliner->GetSpeller().is() ) { - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) pOutliner->SetSpeller( xSpellChecker ); @@ -111,7 +111,7 @@ void FuThesaurus::DoExecute(SfxRequest& rReq) if ( !pOutliner->GetSpeller().is() ) { - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) pOutliner->SetSpeller( xSpellChecker ); diff --git a/sd/source/ui/view/Outliner.cxx b/sd/source/ui/view/Outliner.cxx index 71cc45e7f3d3..fdc535e5b653 100644 --- a/sd/source/ui/view/Outliner.cxx +++ b/sd/source/ui/view/Outliner.cxx @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #include #include @@ -226,7 +226,7 @@ SdOutliner::SdOutliner( SdDrawDocument& rDoc, OutlinerMode nMode ) SetControlWord(nCntrl); - Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) SetSpeller( xSpellChecker ); diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 4535aa402c00..edf25684f9ad 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include @@ -689,7 +689,7 @@ bool View::SdrBeginTextEdit( pOutl->SetControlWord(nCntrl); - Reference< linguistic2::XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() ); + Reference< linguistic2::XSpellChecker > xSpellChecker( LinguMgr::GetSpellChecker() ); if ( xSpellChecker.is() ) pOutl->SetSpeller( xSpellChecker ); diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 9b837f4c2b03..b3d5e55bba87 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include #include @@ -345,9 +345,14 @@ void SvxLanguageBox::SetLanguageList(SvxLanguageListFlags nLangList, bool bHasLa } if (SvxLanguageListFlags::SPELL_USED & nLangList) { - Reference< XSpellChecker1 > xTmp1 = LinguMgr::GetSpellChecker(); + Reference< XSpellChecker > xTmp1 = LinguMgr::GetSpellChecker(); if (xTmp1.is()) - aSpellUsedLang = xTmp1->getLanguages(); + { + css::uno::Sequence aLocales = xTmp1->getLocales(); + aSpellUsedLang = css::uno::Sequence(aLocales.getLength()); + for (int i=0; i < aLocales.getLength(); ++i) + aSpellUsedLang.getArray()[i] = static_cast(LanguageTag::convertToLanguageType(aLocales[i]).get()); + } } std::vector aKnown; @@ -448,9 +453,14 @@ weld::ComboBoxEntry SvxLanguageBox::BuildEntry(const LanguageType nLangType, sal { if (!m_xSpellUsedLang) { - Reference xSpell = LinguMgr::GetSpellChecker(); + Reference xSpell = LinguMgr::GetSpellChecker(); if (xSpell.is()) - m_xSpellUsedLang.reset(new Sequence(xSpell->getLanguages())); + { + css::uno::Sequence aLocales = xSpell->getLocales(); + m_xSpellUsedLang.reset(new Sequence(aLocales.getLength())); + for (int i=0; i < aLocales.getLength(); ++i) + m_xSpellUsedLang->getArray()[i] = static_cast(LanguageTag::convertToLanguageType(aLocales[i]).get()); + } } bool bFound = m_xSpellUsedLang && lcl_SeqHasLang(*m_xSpellUsedLang, static_cast(nRealLang)); diff --git a/sw/CppunitTest_sw_a11y.mk b/sw/CppunitTest_sw_a11y.mk index 38a801229522..46c8ca6965fa 100644 --- a/sw/CppunitTest_sw_a11y.mk +++ b/sw/CppunitTest_sw_a11y.mk @@ -22,6 +22,7 @@ $(eval $(call gb_CppunitTest_use_libraries,sw_a11y, \ cppu \ cppuhelper \ cui \ + i18nlangtag \ subsequenttest \ test \ unotest \ diff --git a/sw/IwyuFilter_sw.yaml b/sw/IwyuFilter_sw.yaml index 76428605400a..747adb05fd99 100644 --- a/sw/IwyuFilter_sw.yaml +++ b/sw/IwyuFilter_sw.yaml @@ -84,7 +84,7 @@ excludelist: sw/inc/splargs.hxx: # inline dtor, complete type is needed - com/sun/star/linguistic2/XSpellAlternatives.hpp - - com/sun/star/linguistic2/XSpellChecker1.hpp + - com/sun/star/linguistic2/XSpellChecker.hpp sw/inc/unocoll.hxx: # base class has to be a complete type - com/sun/star/container/XEnumerationAccess.hpp diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 684902315065..8d2f15e7c586 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -178,7 +178,7 @@ namespace com::sun::star { namespace embed { class XStorage; } namespace linguistic2 { class XHyphenatedWord; } namespace linguistic2 { class XProofreadingIterator; } - namespace linguistic2 { class XSpellChecker1; } + namespace linguistic2 { class XSpellChecker; } namespace script::vba { class XVBAEventProcessor; } } @@ -680,7 +680,7 @@ public: spell-checking/hyphenating/word-counting */ css::uno::Any - Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker1 > const &, + Spell( SwPaM&, css::uno::Reference< css::linguistic2::XSpellChecker > const &, sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck, SwRootFrame const* pLayout, // for grammar-check SwConversionArgs *pConvArgs = nullptr ) const; diff --git a/sw/inc/splargs.hxx b/sw/inc/splargs.hxx index 198b8e98233e..bba41d5deba3 100644 --- a/sw/inc/splargs.hxx +++ b/sw/inc/splargs.hxx @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include @@ -81,13 +81,13 @@ struct SwConversionArgs : SwArgsBase struct SwSpellArgs : SwArgsBase { - css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpeller; + css::uno::Reference< css::linguistic2::XSpellChecker > xSpeller; css::uno::Reference< css::linguistic2::XSpellAlternatives > xSpellAlt; bool bIsGrammarCheck; - SwSpellArgs(css::uno::Reference< css::linguistic2::XSpellChecker1 > xSplChk, + SwSpellArgs(css::uno::Reference< css::linguistic2::XSpellChecker > xSplChk, SwPosition& rStart, SwPosition& rEnd, bool bGrammar ) diff --git a/sw/inc/swtypes.hxx b/sw/inc/swtypes.hxx index 2ffe4959ec52..9421ab3b6272 100644 --- a/sw/inc/swtypes.hxx +++ b/sw/inc/swtypes.hxx @@ -33,7 +33,7 @@ namespace com::sun::star { namespace linguistic2{ class XLinguProperties; - class XSpellChecker1; + class XSpellChecker; class XHyphenator; class XThesaurus; } @@ -113,7 +113,7 @@ constexpr short lOutlineMinTextDistance = o3tl::toTwips(15, o3tl::Length::in100) SW_DLLPUBLIC OUString SwResId(TranslateId aId); OUString SwResId(TranslateNId aContextSingularPlural, int nCardinality); -css::uno::Reference< css::linguistic2::XSpellChecker1 > GetSpellChecker(); +css::uno::Reference< css::linguistic2::XSpellChecker > GetSpellChecker(); css::uno::Reference< css::linguistic2::XHyphenator > GetHyphenator(); css::uno::Reference< css::linguistic2::XThesaurus > GetThesaurus(); css::uno::Reference< css::linguistic2::XLinguProperties > GetLinguPropertySet(); diff --git a/sw/qa/extras/accessibility/dialogs.cxx b/sw/qa/extras/accessibility/dialogs.cxx index d50d7c6c843e..2044a1eeff72 100644 --- a/sw/qa/extras/accessibility/dialogs.cxx +++ b/sw/qa/extras/accessibility/dialogs.cxx @@ -12,10 +12,12 @@ #include #include #include -#include +#include +#include #include +#include #include #include @@ -207,8 +209,8 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, SpellingDialog) // spell check depends on dictionary being available, so skip test if unavailable uno::Reference xLSM2 = linguistic2::LinguServiceManager::create(m_xContext); - uno::Reference xSpell(xLSM2->getSpellChecker(), uno::UNO_QUERY); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(LANGUAGE_ENGLISH_US))) + uno::Reference xSpell(xLSM2->getSpellChecker()); + if (!xSpell.is() || !xSpell->hasLocale(LanguageTag::convertToLocale(LANGUAGE_ENGLISH_US))) return; loadFromSrc(u"/sw/qa/extras/accessibility/testdocuments/tdf155705.fodt"_ustr); diff --git a/sw/qa/extras/accessibility/tdf155705.cxx b/sw/qa/extras/accessibility/tdf155705.cxx index 5e4a536f9b6a..fa7a1e4dcd3f 100644 --- a/sw/qa/extras/accessibility/tdf155705.cxx +++ b/sw/qa/extras/accessibility/tdf155705.cxx @@ -10,12 +10,12 @@ #include #include #include -#include +#include #include -#include #include +#include #include #include @@ -32,8 +32,8 @@ CPPUNIT_TEST_FIXTURE(test::AccessibleTestBase, tdf155705) uno::Reference xLSM2 = linguistic2::LinguServiceManager::create(m_xContext); - uno::Reference xSpell(xLSM2->getSpellChecker(), uno::UNO_QUERY); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(LANGUAGE_ENGLISH_US))) + uno::Reference xSpell(xLSM2->getSpellChecker()); + if (!xSpell.is() || !xSpell->hasLocale(LanguageTag::convertToLocale(LANGUAGE_ENGLISH_US))) return; auto xContext = getDocumentAccessibleContext(); diff --git a/sw/qa/extras/layout/layout2.cxx b/sw/qa/extras/layout/layout2.cxx index ba2c17427faa..bca742a76331 100644 --- a/sw/qa/extras/layout/layout2.cxx +++ b/sw/qa/extras/layout/layout2.cxx @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include @@ -1236,10 +1236,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf158885_compound_remain) if (!xHyphenator->hasLocale(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString()))) return; - uno::Reference xSpell = LinguMgr::GetSpellChecker(); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString())); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = LinguMgr::GetSpellChecker(); + lang::Locale aLocale(u"hu"_ustr, u"HU"_ustr, OUString()); + if (!xSpell.is() || !xSpell->hasLocale(aLocale)) return; createSwDoc("tdf158885_compound-remain.fodt"); @@ -1267,10 +1266,9 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf158885_not_compound_remain) if (!xHyphenator->hasLocale(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString()))) return; - uno::Reference xSpell = LinguMgr::GetSpellChecker(); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString())); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = LinguMgr::GetSpellChecker(); + lang::Locale aLocale(u"hu"_ustr, u"HU"_ustr, OUString()); + if (!xSpell.is() || !xSpell->hasLocale(aLocale)) return; createSwDoc("tdf158885_not_compound-remain.fodt"); @@ -1299,10 +1297,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf170177_compound_push) if (!xHyphenator->hasLocale(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString()))) return; - uno::Reference xSpell = LinguMgr::GetSpellChecker(); + uno::Reference xSpell = LinguMgr::GetSpellChecker(); LanguageType eLang = LanguageTag::convertToLanguageType(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString())); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + if (!xSpell.is() || !xSpell->hasLocale(LanguageTag::convertToLocale(eLang))) return; createSwDoc("tdf170177_compound-push.fodt"); @@ -1340,10 +1338,10 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf170177_not_compound_push) if (!xHyphenator->hasLocale(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString()))) return; - uno::Reference xSpell = LinguMgr::GetSpellChecker(); + uno::Reference xSpell = LinguMgr::GetSpellChecker(); LanguageType eLang = LanguageTag::convertToLanguageType(lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString())); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + if (!xSpell.is() || !xSpell->hasLocale(LanguageTag::convertToLocale(eLang))) return; createSwDoc("tdf170177_not_compound-push.fodt"); @@ -1364,46 +1362,46 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf170177_not_compound_push) // TODO: move this test to the lingucomponent project CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf170140) { - uno::Reference xSpell = LinguMgr::GetSpellChecker(); + uno::Reference xSpell = LinguMgr::GetSpellChecker(); auto aLocale = lang::Locale(u"hu"_ustr, u"HU"_ustr, OUString()); LanguageType eLang = LanguageTag::convertToLanguageType(aLocale); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + if (!xSpell.is() || !xSpell->hasLocale(aLocale)) return; uno::Sequence aProperties; // correct non-ASCII apostrophe OUString sWord(u"d’Arc"_ustr); - CPPUNIT_ASSERT(xSpell->isValid(sWord, static_cast(eLang), aProperties)); + CPPUNIT_ASSERT(xSpell->isValid(sWord, LanguageTag::convertToLocale(eLang), aProperties)); // bad ASCII apostrophe OUString sWord2(u"d'Arc"_ustr); - CPPUNIT_ASSERT(!xSpell->isValid(sWord2, static_cast(eLang), aProperties)); + CPPUNIT_ASSERT(!xSpell->isValid(sWord2, LanguageTag::convertToLocale(eLang), aProperties)); } // TODO: move this test to the linguistic project CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf40277) { - uno::Reference xSpell = LinguMgr::GetSpellChecker(); + uno::Reference xSpell = LinguMgr::GetSpellChecker(); auto aLocale = lang::Locale(u"en"_ustr, u"US"_ustr, OUString()); LanguageType eLang = LanguageTag::convertToLanguageType(aLocale); - if (!xSpell.is() || !xSpell->hasLanguage(static_cast(eLang))) + if (!xSpell.is() || !xSpell->hasLocale(aLocale)) return; uno::Sequence aProperties; // check Hunspell dictionary OUString sWord(u"based"_ustr); - CPPUNIT_ASSERT(xSpell->isValid(sWord, static_cast(eLang), aProperties)); + CPPUNIT_ASSERT(xSpell->isValid(sWord, LanguageTag::convertToLocale(eLang), aProperties)); // check custom dictionary support (a word which is stored only in technical.dic) OUString sWord2(u"SunHSI"_ustr); - CPPUNIT_ASSERT(xSpell->isValid(sWord2, static_cast(eLang), aProperties)); + CPPUNIT_ASSERT(xSpell->isValid(sWord2, LanguageTag::convertToLocale(eLang), aProperties)); OUString sWord3(u"SunHSI-based"_ustr); // This was false (missing recognition of compounds formed from Hunspell // dictionary words and custom dictionary words) - CPPUNIT_ASSERT(xSpell->isValid(sWord3, static_cast(eLang), aProperties)); + CPPUNIT_ASSERT(xSpell->isValid(sWord3, LanguageTag::convertToLocale(eLang), aProperties)); } CPPUNIT_TEST_FIXTURE(SwLayoutWriter2, testTdf163894) diff --git a/sw/qa/extras/uiwriter/uiwriter6.cxx b/sw/qa/extras/uiwriter/uiwriter6.cxx index 8d4aed361583..5cab1a659d96 100644 --- a/sw/qa/extras/uiwriter/uiwriter6.cxx +++ b/sw/qa/extras/uiwriter/uiwriter6.cxx @@ -67,7 +67,7 @@ #include #include #include -#include +#include #include #include @@ -2392,11 +2392,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf124603) // check available en_US dictionary and test spelling with it uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl()); - uno::Reference xSpell; - xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"en"_ustr, u"US"_ustr, OUString())); - if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = xLngSvcMgr->getSpellChecker(); + lang::Locale aLocale(u"en"_ustr, u"US"_ustr, OUString()); + if (xSpell.is() && xSpell->hasLocale(aLocale)) { // Type a correct word @@ -2441,11 +2439,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf45949) // check available en_US dictionary and test spelling with it uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl()); - uno::Reference xSpell; - xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"en"_ustr, u"US"_ustr, OUString())); - if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = xLngSvcMgr->getSpellChecker(); + lang::Locale aLocale(u"en"_ustr, u"US"_ustr, OUString()); + if (xSpell.is() && xSpell->hasLocale(aLocale)) { emulateTyping(u"baaad http://www.baaad.org baaad"); SwCursorShell* pShell(pDoc->GetEditShell()); @@ -2493,11 +2489,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf157442) // check available en_US dictionary and test spelling with it uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl()); - uno::Reference xSpell; - xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"en"_ustr, u"US"_ustr, OUString())); - if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = xLngSvcMgr->getSpellChecker(); + lang::Locale aLocale(u"en"_ustr, u"US"_ustr, OUString()); + if (xSpell.is() && xSpell->hasLocale(aLocale)) { uno::Reference xLinguProperties( LinguMgr::GetLinguPropertySet()); @@ -2532,11 +2526,9 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest6, testTdf65535) // check available en_US dictionary and test spelling with it uno::Reference xLngSvcMgr(GetLngSvcMgr_Impl()); - uno::Reference xSpell; - xSpell.set(xLngSvcMgr->getSpellChecker(), UNO_QUERY); - LanguageType eLang - = LanguageTag::convertToLanguageType(lang::Locale(u"en"_ustr, u"US"_ustr, OUString())); - if (xSpell.is() && xSpell->hasLanguage(static_cast(eLang))) + uno::Reference xSpell = xLngSvcMgr->getSpellChecker(); + lang::Locale aLocale(u"en"_ustr, u"US"_ustr, OUString()); + if (xSpell.is() && xSpell->hasLocale(aLocale)) { // trigger online spell checking by (a few) spaces to be sure to get it diff --git a/sw/source/core/bastyp/swtypes.cxx b/sw/source/core/bastyp/swtypes.cxx index b0b1c2f162bc..4a54f4f32fbd 100644 --- a/sw/source/core/bastyp/swtypes.cxx +++ b/sw/source/core/bastyp/swtypes.cxx @@ -50,10 +50,7 @@ Size GetGraphicSizeTwip(const Graphic& rGraphic, vcl::RenderContext* pOutDev) return aSize; } -uno::Reference GetSpellChecker() -{ - return LinguMgr::GetSpellChecker(); -} +uno::Reference GetSpellChecker() { return LinguMgr::GetSpellChecker(); } uno::Reference GetHyphenator() { return LinguMgr::GetHyphenator(); } diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index dc63f4c85d3f..45099537b7c6 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -116,7 +116,7 @@ void DocumentDrawModelManager::InitDrawModel() if (!comphelper::IsFuzzing()) { SAL_INFO( "sw.doc", "before create Spellchecker/Hyphenator" ); - css::uno::Reference< css::linguistic2::XSpellChecker1 > xSpell = ::GetSpellChecker(); + css::uno::Reference< css::linguistic2::XSpellChecker > xSpell = ::GetSpellChecker(); rOutliner.SetSpeller( xSpell ); css::uno::Reference< css::linguistic2::XHyphenator > xHyphenator( ::GetHyphenator() ); rOutliner.SetHyphenator( xHyphenator ); diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 5f6a3d45ad94..aec69ba337d3 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -517,7 +517,7 @@ static void lcl_syncGrammarError( SwTextNode &rTextNode, linguistic2::Proofreadi } uno::Any SwDoc::Spell( SwPaM& rPaM, - uno::Reference< XSpellChecker1 > const &xSpeller, + uno::Reference< XSpellChecker > const &xSpeller, sal_uInt16* pPageCnt, sal_uInt16* pPageSt, bool bGrammarCheck, SwRootFrame const*const pLayout, diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index 1c0618b559ed..a646f60558b8 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -103,7 +103,7 @@ namespace { class SwSpellIter : public SwLinguIter { - uno::Reference m_xSpeller; + uno::Reference m_xSpeller; svx::SpellPortions m_aLastPortions; SpellContentPositions m_aLastPositions; @@ -363,7 +363,7 @@ uno::Any SwConvIter::Continue( sal_uInt16* pPageCnt, sal_uInt16* pPageSt ) *pMySh->GetCursor()->GetMark() = *m_oEnd; // call function to find next text portion to be converted - uno::Reference< linguistic2::XSpellChecker1 > xEmpty; + uno::Reference< linguistic2::XSpellChecker > xEmpty; pMySh->GetDoc()->Spell(*pMySh->GetCursor(), xEmpty, pPageCnt, pPageSt, false, pMySh->GetLayout(), &m_rArgs) >>= aConvText; @@ -908,11 +908,11 @@ uno::Reference< XSpellAlternatives > OUString const aWord(aConversionMap.getViewText().copy(nBeginView, aConversionMap.ConvertToViewPosition(nBegin+nLen) - nBeginView)); - uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() ); + uno::Reference< XSpellChecker > xSpell( ::GetSpellChecker() ); if( xSpell.is() ) { LanguageType eActLang = pNode->GetLang( nBegin, nLen ); - if( xSpell->hasLanguage( static_cast(eActLang) )) + if( xSpell->hasLocale( LanguageTag::convertToLocale(eActLang) )) { // restrict the maximal number of suggestions displayed // in the context menu. @@ -926,7 +926,7 @@ uno::Reference< XSpellAlternatives > // implementation here by providing an additional parameter. Sequence< PropertyValue > aPropVals ( { comphelper::makePropertyValue( UPN_MAX_NUMBER_OF_SUGGESTIONS, sal_Int16(7)) } ); - xSpellAlt = xSpell->spell( aWord, static_cast(eActLang), aPropVals ); + xSpellAlt = xSpell->spell( aWord, LanguageTag::convertToLocale(eActLang), aPropVals ); } } diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx index 06f33e199efe..98f06bddf3c0 100644 --- a/sw/source/core/txtnode/txtedt.cxx +++ b/sw/source/core/txtnode/txtedt.cxx @@ -89,10 +89,10 @@ using namespace ::com::sun::star::smarttags; namespace { void DetectAndMarkMissingDictionaries( SwDoc& rDoc, - const uno::Reference< XSpellChecker1 >& xSpell, + const uno::Reference< XSpellChecker >& xSpell, const LanguageType eActLang ) { - if( xSpell.is() && !xSpell->hasLanguage( eActLang.get() ) ) + if( xSpell.is() && !xSpell->hasLocale( LanguageTag::convertToLocale(eActLang) ) ) rDoc.SetMissingDictionaries( true ); else rDoc.SetMissingDictionaries( false ); @@ -1095,7 +1095,7 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs, bool bIsReadOnly) if (pArgs->xSpeller.is()) { SvxSpellWrapper::CheckSpellLang( pArgs->xSpeller, eActLang ); - pArgs->xSpellAlt = pArgs->xSpeller->spell( rWord, static_cast(eActLang), + pArgs->xSpellAlt = pArgs->xSpeller->spell( rWord, LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ); } if( pArgs->xSpellAlt.is() ) @@ -1105,7 +1105,7 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs, bool bIsReadOnly) // we must remove them before spell checking // to avoid false alarm ( (bRestoreString || bContainsComments) && pArgs->xSpeller->isValid( rWord.replaceAll(OUStringChar(CH_TXTATR_INWORD), ""), - static_cast(eActLang), Sequence< PropertyValue >() ) ) ) + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ) ) ) { pArgs->xSpellAlt = nullptr; } @@ -1120,10 +1120,10 @@ bool SwTextNode::Spell(SwSpellArgs* pArgs, bool bIsReadOnly) // check space separated word pairs in the dictionary, e.g. "vice versa" if ( !((bNextWord && !linguistic::HasDigits(aScanner.GetWord()) && pArgs->xSpeller->isValid( rActualWord + " " + aScanner.GetWord(), - static_cast(eActLang), Sequence< PropertyValue >() )) || + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() )) || ( !sPrevWord.isEmpty() && !linguistic::HasDigits(sPrevWord) && pArgs->xSpeller->isValid( sPrevWord + " " + rActualWord, - static_cast(eActLang), Sequence< PropertyValue >() ))) ) + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ))) ) { // make sure the selection build later from the data // below does not include "in word" character to the @@ -1403,7 +1403,7 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos) if( bFresh ) { - uno::Reference< XSpellChecker1 > xSpell( ::GetSpellChecker() ); + uno::Reference< XSpellChecker > xSpell( ::GetSpellChecker() ); SwDoc& rDoc = pNode->GetDoc(); SwScanner aScanner( *pNode, pNode->GetText(), nullptr, ModelToViewHelper(), @@ -1422,17 +1422,17 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos) LanguageType eActLang = aScanner.GetCurrentLanguage(); DetectAndMarkMissingDictionaries( rDoc, xSpell, eActLang ); - bool bSpell = xSpell.is() && xSpell->hasLanguage( static_cast(eActLang) ); + bool bSpell = xSpell.is() && xSpell->hasLocale( LanguageTag::convertToLocale(eActLang) ); if( bSpell && !rWord.isEmpty() && !lcl_IsURL(rWord, *pNode, nBegin, nLen) ) { // check for: bAlter => xHyphWord.is() OSL_ENSURE(!bSpell || xSpell.is(), "NULL pointer"); - if( !xSpell->isValid( rWord, static_cast(eActLang), Sequence< PropertyValue >() ) && + if( !xSpell->isValid( rWord, LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ) && // redlines can leave "in word" character within word, // we must remove them before spell checking // to avoid false alarm ((!bRestoreString && !bContainsComments) || !xSpell->isValid( rWord.replaceAll(OUStringChar(CH_TXTATR_INWORD), ""), - static_cast(eActLang), Sequence< PropertyValue >() ) ) ) + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ) ) ) { OUString sPrevWord = aScanner.GetPrevWord(); bNextWord = aScanner.NextWord(); @@ -1440,10 +1440,10 @@ SwRect SwTextFrame::AutoSpell_(SwTextNode & rNode, sal_Int32 nActPos) // check space separated word pairs in the dictionary, e.g. "vice versa" if ( !((bNextWord && !linguistic::HasDigits(aScanner.GetWord()) && xSpell->isValid( aScanner.GetPrevWord() + " " + aScanner.GetWord(), - static_cast(eActLang), Sequence< PropertyValue >() )) || + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() )) || (!sPrevWord.isEmpty() && !linguistic::HasDigits(sPrevWord) && xSpell->isValid( sPrevWord + " " + aScanner.GetPrevWord(), - static_cast(eActLang), Sequence< PropertyValue >() ))) ) + LanguageTag::convertToLocale(eActLang), Sequence< PropertyValue >() ))) ) { sal_Int32 nSmartTagStt = nBegin; sal_Int32 nDummy = 1; diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx index 316e4de7a0f7..f34c4f327a93 100644 --- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx +++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx @@ -736,7 +736,7 @@ bool SwSpellDialogChildWindow::FindNextDrawTextError_Impl(SwWrtShell& rSh) } if(!m_pSpellState->m_aTextObjects.empty()) { - Reference< XSpellChecker1 > xSpell( GetSpellChecker() ); + Reference< XSpellChecker > xSpell( GetSpellChecker() ); while(!bNextDoc && !m_pSpellState->m_aTextObjects.empty()) { std::list::iterator aStart = m_pSpellState->m_aTextObjects.begin(); diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 042f3c1d2a47..5428a6374354 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -554,7 +554,7 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, SwWrtShell *pSh = &GetWrtShell(); SdrView *pSdrView = pSh->GetDrawView(); std::unique_ptr pOutliner = ::SdrMakeOutliner(OutlinerMode::TextObject, pSdrView->GetModel()); - uno::Reference< linguistic2::XSpellChecker1 > xSpell( ::GetSpellChecker() ); + uno::Reference< linguistic2::XSpellChecker > xSpell( ::GetSpellChecker() ); if (pOutliner) { pOutliner->SetRefDevice(pSh->getIDocumentDeviceAccess().getReferenceDevice(false));