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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/source/menu/thessubmenu.cxx | 23 | ||||
-rw-r--r-- | sfx2/source/menu/thessubmenu.hxx | 4 |
2 files changed, 11 insertions, 16 deletions
diff --git a/sfx2/source/menu/thessubmenu.cxx b/sfx2/source/menu/thessubmenu.cxx index 3a94f5e39f8f..1a645885adb1 100644 --- a/sfx2/source/menu/thessubmenu.cxx +++ b/sfx2/source/menu/thessubmenu.cxx @@ -21,7 +21,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/linguistic2/XThesaurus.hpp> #include <com/sun/star/linguistic2/XMeaning.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <comphelper/processfactory.hxx> #include <svl/stritem.hxx> @@ -68,9 +68,8 @@ SfxThesSubMenuHelper::SfxThesSubMenuHelper() { try { - uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); - m_xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( - OUString( "com.sun.star.linguistic2.LinguServiceManager" )), uno::UNO_QUERY_THROW ); + uno::Reference< uno::XComponentContext > xContext( ::comphelper::getProcessComponentContext() ); + m_xLngMgr = linguistic2::LinguServiceManager::create(xContext); m_xThesarus = m_xLngMgr->getThesaurus(); } catch (const uno::Exception &) @@ -140,16 +139,12 @@ bool SfxThesSubMenuHelper::GetMeanings( String SfxThesSubMenuHelper::GetThesImplName( const lang::Locale &rLocale ) const { String aRes; - DBG_ASSERT( m_xLngMgr.is(), "LinguServiceManager missing" ); - if (m_xLngMgr.is()) - { - uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( - OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); - // there should be at most one thesaurus configured for each language - DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); - if (aServiceNames.getLength() == 1) - aRes = aServiceNames[0]; - } + uno::Sequence< OUString > aServiceNames = m_xLngMgr->getConfiguredServices( + OUString("com.sun.star.linguistic2.Thesaurus"), rLocale ); + // there should be at most one thesaurus configured for each language + DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); + if (aServiceNames.getLength() == 1) + aRes = aServiceNames[0]; return aRes; } diff --git a/sfx2/source/menu/thessubmenu.hxx b/sfx2/source/menu/thessubmenu.hxx index a30883e8abc3..56f6639fe299 100644 --- a/sfx2/source/menu/thessubmenu.hxx +++ b/sfx2/source/menu/thessubmenu.hxx @@ -22,7 +22,7 @@ #define _THESSUBMENU_HXX_ #include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XLinguServiceManager.hpp> +#include <com/sun/star/linguistic2/XLinguServiceManager2.hpp> #include <vcl/menu.hxx> #include <sfx2/mnuitem.hxx> @@ -31,7 +31,7 @@ namespace css = ::com::sun::star; class SfxThesSubMenuHelper { - css::uno::Reference< css::linguistic2::XLinguServiceManager > m_xLngMgr; + css::uno::Reference< css::linguistic2::XLinguServiceManager2 > m_xLngMgr; css::uno::Reference< css::linguistic2::XThesaurus > m_xThesarus; private: |