diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-26 14:24:46 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-30 11:02:39 +0100 |
commit | 43d9f35c2665e55cfb5ee911a554ef71933ad4d1 (patch) | |
tree | d3b5d69db549ae13f0bc2a29c6905fe4235f4737 /editeng | |
parent | 273ee9838cb87d6cf910a92969592709eba650f9 (diff) |
fdo#46808, Adapt linguistic2::LinguServiceManager UNO service to new style
Create a merged XLinguServiceManager2 interface for this service to implement.
Which is backwards-compatible, but does not require creating a new service.
Change-Id: I297bada1066cd74809108641b56ee4d5898112ec
Diffstat (limited to 'editeng')
-rw-r--r-- | editeng/inc/editeng/unolingu.hxx | 6 | ||||
-rw-r--r-- | editeng/source/misc/unolingu.cxx | 32 |
2 files changed, 15 insertions, 23 deletions
diff --git a/editeng/inc/editeng/unolingu.hxx b/editeng/inc/editeng/unolingu.hxx index d35737a24178..66c5370f33a1 100644 --- a/editeng/inc/editeng/unolingu.hxx +++ b/editeng/inc/editeng/unolingu.hxx @@ -33,7 +33,7 @@ #include <tools/string.hxx> #include <com/sun/star/util/Language.hpp> #include <com/sun/star/lang/Locale.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <com/sun/star/linguistic2/XSpellChecker1.hpp> #include <com/sun/star/linguistic2/XHyphenator.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> @@ -52,7 +52,7 @@ class EDITENG_DLLPUBLIC LinguMgr friend class LinguMgrExitLstnr; static ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XLinguServiceManager > xLngSvcMgr; + ::com::sun::star::linguistic2::XLinguServiceManager2 > xLngSvcMgr; static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XSpellChecker1 > xSpell; static ::com::sun::star::uno::Reference< @@ -107,7 +107,7 @@ public: ::com::sun::star::beans::XPropertySet > GetLinguPropertySet(); static ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XLinguServiceManager > GetLngSvcMgr(); + ::com::sun::star::linguistic2::XLinguServiceManager2 > GetLngSvcMgr(); static ::com::sun::star::uno::Reference< ::com::sun::star::linguistic2::XDictionary > GetStandardDic(); diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 16f2eba5e02e..b65ad6029549 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -38,6 +38,7 @@ #include <com/sun/star/frame/XStorable.hpp> #include <com/sun/star/lang/XEventListener.hpp> #include <com/sun/star/linguistic2/XAvailableLocales.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/ucb/XAnyCompareFactory.hpp> #include <com/sun/star/ucb/XContentAccess.hpp> #include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp> @@ -73,16 +74,10 @@ using namespace ::com::sun::star::linguistic2; #define CSS com::sun::star -static uno::Reference< XLinguServiceManager > GetLngSvcMgr_Impl() +static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() { - uno::Reference< XLinguServiceManager > xRes; - uno::Reference< XMultiServiceFactory > xMgr = getProcessServiceFactory(); - if (xMgr.is()) - { - xRes = uno::Reference< XLinguServiceManager > ( xMgr->createInstance( - OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.linguistic2.LinguServiceManager" ) ) ), UNO_QUERY ) ; - } + uno::Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); + uno::Reference< XLinguServiceManager2 > xRes = LinguServiceManager::create(xContext); return xRes; } @@ -155,9 +150,8 @@ void ThesDummy_Impl::GetThes_Impl() { if (!xThes.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xThes = xLngSvcMgr->getThesaurus(); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xThes = xLngSvcMgr->getThesaurus(); if (xThes.is()) { @@ -261,9 +255,8 @@ void SpellDummy_Impl::GetSpell_Impl() { if (!xSpell.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xSpell = uno::Reference< XSpellChecker1 >( xLngSvcMgr->getSpellChecker(), UNO_QUERY ); } } @@ -373,9 +366,8 @@ void HyphDummy_Impl::GetHyph_Impl() { if (!xHyph.is()) { - uno::Reference< XLinguServiceManager > xLngSvcMgr( GetLngSvcMgr_Impl() ); - if (xLngSvcMgr.is()) - xHyph = xLngSvcMgr->getHyphenator(); + uno::Reference< XLinguServiceManager2 > xLngSvcMgr( GetLngSvcMgr_Impl() ); + xHyph = xLngSvcMgr->getHyphenator(); } } @@ -536,7 +528,7 @@ void LinguMgrExitLstnr::AtExit() LinguMgrExitLstnr * LinguMgr::pExitLstnr = 0; sal_Bool LinguMgr::bExiting = sal_False; -uno::Reference< XLinguServiceManager > LinguMgr::xLngSvcMgr = 0; +uno::Reference< XLinguServiceManager2 > LinguMgr::xLngSvcMgr = 0; uno::Reference< XSpellChecker1 > LinguMgr::xSpell = 0; uno::Reference< XHyphenator > LinguMgr::xHyph = 0; uno::Reference< XThesaurus > LinguMgr::xThes = 0; @@ -546,7 +538,7 @@ uno::Reference< XDictionary > LinguMgr::xIgnoreAll = 0; uno::Reference< XDictionary > LinguMgr::xChangeAll = 0; -uno::Reference< XLinguServiceManager > LinguMgr::GetLngSvcMgr() +uno::Reference< XLinguServiceManager2 > LinguMgr::GetLngSvcMgr() { if (bExiting) return 0; |