From 704f95e5255ff72bfb548d50d66d4da61dc483ef Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Wed, 23 Oct 2013 14:35:10 -0200 Subject: fdo#54938: More uses of cppu::supportsService Change-Id: I90a7a07a43559b8d7e1d4b886b2624255200d46b Reviewed-on: https://gerrit.libreoffice.org/6406 Tested-by: LibreOffice gerrit bot Reviewed-by: Stephan Bergmann Tested-by: Stephan Bergmann --- .../source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx | 17 ++--------------- lingucomponent/source/languageguessing/guesslang.cxx | 16 ++-------------- .../source/spellcheck/macosxspell/macspellimp.mm | 17 ++--------------- lingucomponent/source/spellcheck/spell/sspellimp.cxx | 16 ++-------------- lingucomponent/source/thesaurus/libnth/nthesimp.cxx | 16 ++-------------- 5 files changed, 10 insertions(+), 72 deletions(-) (limited to 'lingucomponent') diff --git a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx index 686704ebfd1e..60f428f39581 100644 --- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx +++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -847,11 +848,7 @@ void SAL_CALL Hyphenator::removeEventListener( const Reference< XEventListener > aEvtListeners.removeInterface( rxListener ); } - -/////////////////////////////////////////////////////////////////////////// // Service specific part -// - OUString SAL_CALL Hyphenator::getImplementationName() throw(RuntimeException) { @@ -860,21 +857,12 @@ OUString SAL_CALL Hyphenator::getImplementationName() return getImplementationName_Static(); } - sal_Bool SAL_CALL Hyphenator::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - MutexGuard aGuard( GetLinguMutex() ); - - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } - Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames() throw(RuntimeException) { @@ -883,7 +871,6 @@ Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames() return getSupportedServiceNames_Static(); } - Sequence< OUString > Hyphenator::getSupportedServiceNames_Static() throw() { diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx index e6406d213277..a65ec51de4ab 100644 --- a/lingucomponent/source/languageguessing/guesslang.cxx +++ b/lingucomponent/source/languageguessing/guesslang.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -346,7 +347,6 @@ void SAL_CALL LangGuess_Impl::enableLanguages( } } -//************************************************************************* OUString SAL_CALL LangGuess_Impl::getImplementationName( ) throw(RuntimeException) { @@ -354,20 +354,12 @@ OUString SAL_CALL LangGuess_Impl::getImplementationName( ) return OUString( IMPLNAME ); } -//************************************************************************* sal_Bool SAL_CALL LangGuess_Impl::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - osl::MutexGuard aGuard( GetLangGuessMutex() ); - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } -//************************************************************************* Sequence SAL_CALL LangGuess_Impl::getSupportedServiceNames( ) throw(RuntimeException) { @@ -375,16 +367,12 @@ Sequence SAL_CALL LangGuess_Impl::getSupportedServiceNames( ) return getSupportedServiceNames_Static(); } -//************************************************************************* Sequence SAL_CALL LangGuess_Impl::getSupportedServiceNames_Static( ) { OUString aName( SERVICENAME ); return Sequence< OUString >( &aName, 1 ); } -//************************************************************************* - - /** * Function to create a new component instance; is needed by factory helper implementation. * @param xMgr service manager to if the components needs other component instances diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm index c862fcc8c844..9bed1265656c 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -520,11 +521,7 @@ void SAL_CALL aEvtListeners.removeInterface( rxListener ); } - -/////////////////////////////////////////////////////////////////////////// // Service specific part -// - OUString SAL_CALL MacSpellChecker::getImplementationName() throw(RuntimeException) { @@ -533,21 +530,12 @@ OUString SAL_CALL MacSpellChecker::getImplementationName() return getImplementationName_Static(); } - sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - MutexGuard aGuard( GetLinguMutex() ); - - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } - Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames() throw(RuntimeException) { @@ -556,7 +544,6 @@ Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames() return getSupportedServiceNames_Static(); } - Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static() throw() { diff --git a/lingucomponent/source/spellcheck/spell/sspellimp.cxx b/lingucomponent/source/spellcheck/spell/sspellimp.cxx index c0e84100f735..cec853547039 100644 --- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx +++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx @@ -23,6 +23,7 @@ #include #include +#include #include #include #include @@ -630,10 +631,7 @@ void SAL_CALL SpellChecker::removeEventListener( const Reference< XEventListener } -/////////////////////////////////////////////////////////////////////////// // Service specific part -// - OUString SAL_CALL SpellChecker::getImplementationName() throw(RuntimeException) { @@ -642,21 +640,12 @@ OUString SAL_CALL SpellChecker::getImplementationName() return getImplementationName_Static(); } - sal_Bool SAL_CALL SpellChecker::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - MutexGuard aGuard( GetLinguMutex() ); - - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } - Sequence< OUString > SAL_CALL SpellChecker::getSupportedServiceNames() throw(RuntimeException) { @@ -665,7 +654,6 @@ Sequence< OUString > SAL_CALL SpellChecker::getSupportedServiceNames() return getSupportedServiceNames_Static(); } - Sequence< OUString > SpellChecker::getSupportedServiceNames_Static() throw() { diff --git a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx index 132f03d23366..e549e45847af 100644 --- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx +++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -645,11 +646,7 @@ void SAL_CALL Thesaurus::removeEventListener( const Reference< XEventListener >& aEvtListeners.removeInterface( rxListener ); } - -/////////////////////////////////////////////////////////////////////////// // Service specific part -// - OUString SAL_CALL Thesaurus::getImplementationName() throw(RuntimeException) { @@ -661,17 +658,9 @@ OUString SAL_CALL Thesaurus::getImplementationName() sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - MutexGuard aGuard( GetLinguMutex() ); - - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } - Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames() throw(RuntimeException) { @@ -679,7 +668,6 @@ Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames() return getSupportedServiceNames_Static(); } - Sequence< OUString > Thesaurus::getSupportedServiceNames_Static() throw() { -- cgit v1.2.3