diff options
author | Noel Grandin <noel@peralex.com> | 2013-02-04 16:18:01 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-02-12 10:14:43 +0200 |
commit | 53ec703c14470cb18845fc4483ec36c13b0d744e (patch) | |
tree | 4cde768b9b70c00e34801680ac6bcc4a889c5489 /linguistic/source | |
parent | a6a8a8707b6ae111f94bac094d3c2909f523ca6f (diff) |
fdo#46808, Adapt linguistic2::DictionaryList UNO service to new style
Change-Id: Iaf81a38063411b8a003b78f7eb7d6aab6c9df292
Diffstat (limited to 'linguistic/source')
-rw-r--r-- | linguistic/source/dlistimp.cxx | 2 | ||||
-rw-r--r-- | linguistic/source/hyphdsp.hxx | 4 | ||||
-rw-r--r-- | linguistic/source/iprcache.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/lngsvcmgr.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/misc.cxx | 50 | ||||
-rw-r--r-- | linguistic/source/spelldsp.cxx | 6 | ||||
-rw-r--r-- | linguistic/source/spelldsp.hxx | 2 | ||||
-rw-r--r-- | linguistic/source/spelldta.cxx | 4 |
8 files changed, 39 insertions, 41 deletions
diff --git a/linguistic/source/dlistimp.cxx b/linguistic/source/dlistimp.cxx index ba9c6a34a004..f447738b2167 100644 --- a/linguistic/source/dlistimp.cxx +++ b/linguistic/source/dlistimp.cxx @@ -772,7 +772,7 @@ uno::Sequence< rtl::OUString > DicList::getSupportedServiceNames_Static() throw( osl::MutexGuard aGuard( GetLinguMutex() ); uno::Sequence< rtl::OUString > aSNS( 1 ); // more than 1 service possible - aSNS.getArray()[0] = SN_DICTIONARY_LIST; + aSNS.getArray()[0] = "com.sun.star.linguistic2.DictionaryList"; return aSNS; } diff --git a/linguistic/source/hyphdsp.hxx b/linguistic/source/hyphdsp.hxx index d6e81920603e..a770f5fe9262 100644 --- a/linguistic/source/hyphdsp.hxx +++ b/linguistic/source/hyphdsp.hxx @@ -57,7 +57,7 @@ class HyphenatorDispatcher : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet; ::com::sun::star::uno::Reference< - ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; + ::com::sun::star::linguistic2::XSearchableDictionaryList > xDicList; LngSvcMgr &rMgr; @@ -152,7 +152,7 @@ inline ::com::sun::star::uno::Reference< HyphenatorDispatcher::GetDicList() { return xDicList.is() ? - xDicList : xDicList = ::linguistic::GetSearchableDictionaryList(); + xDicList : xDicList = ::linguistic::GetDictionaryList(); } diff --git a/linguistic/source/iprcache.cxx b/linguistic/source/iprcache.cxx index 436859281338..513c419f3b4c 100644 --- a/linguistic/source/iprcache.cxx +++ b/linguistic/source/iprcache.cxx @@ -111,7 +111,7 @@ FlushListener::~FlushListener() } -void FlushListener::SetDicList( Reference<XDictionaryList> &rDL ) +void FlushListener::SetDicList( Reference<XSearchableDictionaryList> &rDL ) { MutexGuard aGuard( GetLinguMutex() ); @@ -206,7 +206,7 @@ SpellCache::SpellCache() { pFlushLstnr = new FlushListener( this ); xFlushLstnr = pFlushLstnr; - Reference<XDictionaryList> aDictionaryList(GetDictionaryList()); + Reference<XSearchableDictionaryList> aDictionaryList(GetDictionaryList()); pFlushLstnr->SetDicList( aDictionaryList ); //! after reference is established Reference<XPropertySet> aPropertySet(GetLinguProperties()); pFlushLstnr->SetPropSet( aPropertySet ); //! after reference is established @@ -214,7 +214,7 @@ SpellCache::SpellCache() SpellCache::~SpellCache() { - Reference<XDictionaryList> aEmptyList; + Reference<XSearchableDictionaryList> aEmptyList; Reference<XPropertySet> aEmptySet; pFlushLstnr->SetDicList( aEmptyList ); pFlushLstnr->SetPropSet( aEmptySet ); diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx index fefef1cdc009..abce09198e26 100644 --- a/linguistic/source/lngsvcmgr.cxx +++ b/linguistic/source/lngsvcmgr.cxx @@ -185,7 +185,7 @@ class LngSvcMgrListenerHelper : ::cppu::OInterfaceContainerHelper aLngSvcMgrListeners; ::cppu::OInterfaceContainerHelper aLngSvcEvtBroadcasters; - uno::Reference< linguistic2::XDictionaryList > xDicList; + uno::Reference< linguistic2::XSearchableDictionaryList > xDicList; sal_Int16 nCombinedLngSvcEvt; @@ -199,7 +199,7 @@ class LngSvcMgrListenerHelper : public: LngSvcMgrListenerHelper( LngSvcMgr &rLngSvcMgr, - const uno::Reference< linguistic2::XDictionaryList > &rxDicList ); + const uno::Reference< linguistic2::XSearchableDictionaryList > &rxDicList ); // lang::XEventListener virtual void SAL_CALL @@ -233,7 +233,7 @@ public: LngSvcMgrListenerHelper::LngSvcMgrListenerHelper( LngSvcMgr &rLngSvcMgr, - const uno::Reference< linguistic2::XDictionaryList > &rxDicList ) : + const uno::Reference< linguistic2::XSearchableDictionaryList > &rxDicList ) : rMyManager ( rLngSvcMgr ), aLngSvcMgrListeners ( GetLinguMutex() ), aLngSvcEvtBroadcasters ( GetLinguMutex() ), diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index 266013188728..333a6ffb6315 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -37,7 +37,7 @@ #include <com/sun/star/uno/Sequence.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/linguistic2/DictionaryType.hpp> -#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> +#include <com/sun/star/linguistic2/DictionaryList.hpp> #include <comphelper/processfactory.hxx> #include <unotools/localedatawrapper.hxx> #include <unotools/syslocale.hxx> @@ -273,7 +273,7 @@ static sal_Bool lcl_HasHyphInfo( const uno::Reference<XDictionaryEntry> &xEntry uno::Reference< XDictionaryEntry > SearchDicList( - const uno::Reference< XDictionaryList > &xDicList, + const uno::Reference< XSearchableDictionaryList > &xDicList, const OUString &rWord, sal_Int16 nLanguage, sal_Bool bSearchPosDics, sal_Bool bSearchSpellEntry ) { @@ -321,7 +321,7 @@ uno::Reference< XDictionaryEntry > SearchDicList( } -sal_Bool SaveDictionaries( const uno::Reference< XDictionaryList > &xDicList ) +sal_Bool SaveDictionaries( const uno::Reference< XSearchableDictionaryList > &xDicList ) { if (!xDicList.is()) return sal_True; @@ -747,21 +747,15 @@ uno::Reference< XInterface > GetOneInstanceService( const char *pServiceName ) { uno::Reference< XInterface > xRef; - if (pServiceName) + uno::Reference< XMultiServiceFactory > xMgr( + comphelper::getProcessServiceFactory() ); + try { - uno::Reference< XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - if (xMgr.is()) - { - try - { - xRef = xMgr->createInstance( ::rtl::OUString::createFromAscii( pServiceName ) ); - } - catch (uno::Exception &) - { - DBG_ASSERT( 0, "createInstance failed" ); - } - } + xRef = xMgr->createInstance( ::rtl::OUString::createFromAscii( pServiceName ) ); + } + catch (const uno::Exception &) + { + DBG_ASSERT( 0, "createInstance failed" ); } return xRef; @@ -773,22 +767,26 @@ uno::Reference< XPropertySet > GetLinguProperties() GetOneInstanceService( SN_LINGU_PROPERTIES ), UNO_QUERY ); } -uno::Reference< XSearchableDictionaryList > GetSearchableDictionaryList() +uno::Reference< XSearchableDictionaryList > GetDictionaryList() { - return uno::Reference< XSearchableDictionaryList > ( - GetOneInstanceService( SN_DICTIONARY_LIST ), UNO_QUERY ); -} + uno::Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); + uno::Reference< XSearchableDictionaryList > xRef; + try + { + xRef = DictionaryList::create(xContext); + } + catch (const uno::Exception &) + { + DBG_ASSERT( 0, "createInstance failed" ); + } -uno::Reference< XDictionaryList > GetDictionaryList() -{ - return uno::Reference< XDictionaryList > ( - GetOneInstanceService( SN_DICTIONARY_LIST ), UNO_QUERY ); + return xRef; } uno::Reference< XDictionary > GetIgnoreAllList() { uno::Reference< XDictionary > xRes; - uno::Reference< XDictionaryList > xDL( GetDictionaryList() ); + uno::Reference< XSearchableDictionaryList > xDL( GetDictionaryList() ); if (xDL.is()) xRes = xDL->getDictionaryByName( "IgnoreAllList" ); return xRes; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index 5b6727f2e9c2..d44cbdfeee20 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -261,7 +261,7 @@ static Reference< XDictionaryEntry > lcl_GetRulingDictionaryEntry( xRes = xIgnoreAll->getEntry( rWord ); if (!xRes.is()) { - Reference< XDictionaryList > xDList( GetDictionaryList() ); + Reference< XSearchableDictionaryList > xDList( GetDictionaryList() ); Reference< XDictionaryEntry > xNegEntry( SearchDicList( xDList, rWord, nLanguage, sal_False, sal_True ) ); if (xNegEntry.is()) @@ -646,9 +646,9 @@ Reference< XSpellAlternatives > SpellCheckerDispatcher::spell_Impl( aProposalList.Append( xRes->getAlternatives() ); eFailureType = xRes->getFailureType(); } - Reference< XDictionaryList > xDList; + Reference< XSearchableDictionaryList > xDList; if (GetDicList().is() && IsUseDicList( rProperties, GetPropSet() )) - xDList = Reference< XDictionaryList >( GetDicList(), UNO_QUERY ); + xDList = GetDicList(); // cross-check against results from user-dictionaries which have precedence! if (bCheckDics && xDList.is()) diff --git a/linguistic/source/spelldsp.hxx b/linguistic/source/spelldsp.hxx index 888652ef0976..4fef68d97351 100644 --- a/linguistic/source/spelldsp.hxx +++ b/linguistic/source/spelldsp.hxx @@ -150,7 +150,7 @@ inline ::com::sun::star::uno::Reference< SpellCheckerDispatcher::GetDicList() { return xDicList.is() ? - xDicList : xDicList = linguistic::GetSearchableDictionaryList(); + xDicList : xDicList = linguistic::GetDictionaryList(); } diff --git a/linguistic/source/spelldta.cxx b/linguistic/source/spelldta.cxx index 886af7072522..37089bff5d64 100644 --- a/linguistic/source/spelldta.cxx +++ b/linguistic/source/spelldta.cxx @@ -62,7 +62,7 @@ sal_Bool SeqHasEntry( void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage, - Reference< XDictionaryList > &xDicList, + Reference< XSearchableDictionaryList > &xDicList, std::vector< OUString > & rDicListProps ) { if (!xDicList.is()) @@ -108,7 +108,7 @@ void SearchSimilarText( const OUString &rText, sal_Int16 nLanguage, void SeqRemoveNegEntries( Sequence< OUString > &rSeq, - Reference< XDictionaryList > &rxDicList, + Reference< XSearchableDictionaryList > &rxDicList, sal_Int16 nLanguage ) { static const OUString aEmpty; |