From 704f95e5255ff72bfb548d50d66d4da61dc483ef Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Wed, 23 Oct 2013 14:35:10 -0200 Subject: [PATCH] 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 --- animations/source/animcore/animcore.cxx | 14 +------ avmedia/source/framework/soundhandler.cxx | 41 +++---------------- .../accessibledialogcontrolshape.cxx | 22 +--------- .../accessibility/accessibledialogwindow.cxx | 22 +--------- binaryurp/source/bridgefactory.cxx | 9 +--- bridges/test/java_uno/acquire/testacquire.cxx | 10 +---- bridges/test/java_uno/equals/testequals.cxx | 8 +--- .../altlinuxhyph/hyphen/hyphenimp.cxx | 17 +------- .../source/languageguessing/guesslang.cxx | 16 +------- .../spellcheck/macosxspell/macspellimp.mm | 17 +------- .../source/spellcheck/spell/sspellimp.cxx | 16 +------- .../source/thesaurus/libnth/nthesimp.cxx | 16 +------- .../backends/localebe/localebackend.cxx | 17 +------- shell/source/backends/macbe/macbackend.mm | 15 +------ .../backends/wininetbe/wininetbackend.cxx | 16 +------- shell/source/cmdmail/cmdmailsuppl.cxx | 18 +------- shell/source/unix/exec/shellexec.cxx | 19 +-------- shell/source/win32/SysShExec.cxx | 18 +------- .../source/win32/simplemail/smplmailsuppl.cxx | 9 +--- starmath/source/smdetect.cxx | 12 +----- 20 files changed, 44 insertions(+), 288 deletions(-) diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index 90b50625322b..6678893c95fb 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -47,6 +47,7 @@ #include #include #include +#include #include #include @@ -781,23 +782,12 @@ OUString AnimationNode::getImplementationName() throw() } } -// -------------------------------------------------------------------- - // XServiceInfo sal_Bool AnimationNode::supportsService(const OUString& ServiceName) throw() { - 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); } -// -------------------------------------------------------------------- - // XServiceInfo Sequence< OUString > AnimationNode::getSupportedServiceNames(void) throw() { diff --git a/avmedia/source/framework/soundhandler.cxx b/avmedia/source/framework/soundhandler.cxx index bf70b6e2261d..b9e76a2c052f 100644 --- a/avmedia/source/framework/soundhandler.cxx +++ b/avmedia/source/framework/soundhandler.cxx @@ -29,6 +29,7 @@ #include #include +#include namespace avmedia{ @@ -134,47 +135,19 @@ OUString SAL_CALL SoundHandler::getImplementationName() throw( css::uno::Runtime return impl_getStaticImplementationName(); } -/*===========================================================================================================*/ -/* XServiceInfo */ -/*===========================================================================================================*/ +// XServiceInfo sal_Bool SAL_CALL SoundHandler::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) { - /* Set default return value. */ - bool bReturn = sal_False ; - /* Get names of all supported servicenames. */ - css::uno::Sequence < OUString > seqServiceNames = getSupportedServiceNames(); - const OUString* pArray = seqServiceNames.getConstArray(); - sal_Int32 nCounter = 0; - sal_Int32 nLength = seqServiceNames.getLength(); - /* Search for right name in list. */ - while ( - ( nCounter < nLength ) && - ( bReturn == sal_False ) - ) - { - /* Is name was found, say "YES, SERVICE IS SUPPORTED." and break loop. */ - if ( pArray[nCounter] == sServiceName ) - { - bReturn = sal_True ; - } - /* Else step to next element in list. */ - ++nCounter; - } - /* Return state of search. */ - return bReturn; + return cppu::supportsService(this, sServiceName); } -/*===========================================================================================================*/ -/* XServiceInfo */ -/*===========================================================================================================*/ +// XServiceInfo css::uno::Sequence< OUString > SAL_CALL SoundHandler::getSupportedServiceNames() throw( css::uno::RuntimeException ) { return impl_getStaticSupportedServiceNames(); } -/*===========================================================================================================*/ -/* Helper for XServiceInfo */ -/*===========================================================================================================*/ +// Helper for XServiceInfo css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames() { css::uno::Sequence< OUString > seqServiceNames( 1 ); @@ -182,9 +155,7 @@ css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames return seqServiceNames; } -/*===========================================================================================================*/ -/* Helper for XServiceInfo */ -/*===========================================================================================================*/ +// Helper for XServiceInfo OUString SoundHandler::impl_getStaticImplementationName() { return IMPLEMENTATIONNAME_SOUNDHANDLER; diff --git a/basctl/source/accessibility/accessibledialogcontrolshape.cxx b/basctl/source/accessibility/accessibledialogcontrolshape.cxx index 86738b6efbb6..c9dd46de11d6 100644 --- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx +++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -309,30 +310,17 @@ void AccessibleDialogControlShape::propertyChange( const beans::PropertyChangeEv } } -// ----------------------------------------------------------------------------- // XServiceInfo -// ----------------------------------------------------------------------------- - OUString AccessibleDialogControlShape::getImplementationName() throw (RuntimeException) { return OUString( "com.sun.star.comp.basctl.AccessibleShape" ); } -// ----------------------------------------------------------------------------- - sal_Bool AccessibleDialogControlShape::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - Sequence< OUString > aNames( getSupportedServiceNames() ); - const OUString* pNames = aNames.getConstArray(); - const OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; + return cppu::supportsService(this, rServiceName); } -// ----------------------------------------------------------------------------- - Sequence< OUString > AccessibleDialogControlShape::getSupportedServiceNames() throw (RuntimeException) { Sequence< OUString > aNames(1); @@ -340,10 +328,7 @@ Sequence< OUString > AccessibleDialogControlShape::getSupportedServiceNames() th return aNames; } -// ----------------------------------------------------------------------------- // XAccessible -// ----------------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleContext( ) throw (RuntimeException) { OExternalLockGuard aGuard( this ); @@ -351,10 +336,7 @@ Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleConte return this; } -// ----------------------------------------------------------------------------- // XAccessibleContext -// ----------------------------------------------------------------------------- - sal_Int32 AccessibleDialogControlShape::getAccessibleChildCount() throw (RuntimeException) { OExternalLockGuard aGuard( this ); diff --git a/basctl/source/accessibility/accessibledialogwindow.cxx b/basctl/source/accessibility/accessibledialogwindow.cxx index 21e995034467..ee170473898a 100644 --- a/basctl/source/accessibility/accessibledialogwindow.cxx +++ b/basctl/source/accessibility/accessibledialogwindow.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -605,30 +606,17 @@ void AccessibleDialogWindow::disposing() } } -// ----------------------------------------------------------------------------- // XServiceInfo -// ----------------------------------------------------------------------------- - OUString AccessibleDialogWindow::getImplementationName() throw (RuntimeException) { return OUString( "com.sun.star.comp.basctl.AccessibleWindow" ); } -// ----------------------------------------------------------------------------- - sal_Bool AccessibleDialogWindow::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - Sequence< OUString > aNames( getSupportedServiceNames() ); - const OUString* pNames = aNames.getConstArray(); - const OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; + return cppu::supportsService(this, rServiceName); } -// ----------------------------------------------------------------------------- - Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (RuntimeException) { Sequence< OUString > aNames(1); @@ -636,10 +624,7 @@ Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (R return aNames; } -// ----------------------------------------------------------------------------- // XAccessible -// ----------------------------------------------------------------------------- - Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) throw (RuntimeException) { OExternalLockGuard aGuard( this ); @@ -647,10 +632,7 @@ Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) return this; } -// ----------------------------------------------------------------------------- // XAccessibleContext -// ----------------------------------------------------------------------------- - sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() throw (RuntimeException) { OExternalLockGuard aGuard( this ); diff --git a/binaryurp/source/bridgefactory.cxx b/binaryurp/source/bridgefactory.cxx index 24105f30ff9d..34182b354c0a 100644 --- a/binaryurp/source/bridgefactory.cxx +++ b/binaryurp/source/bridgefactory.cxx @@ -30,6 +30,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/factory.hxx" #include "cppuhelper/implementationentry.hxx" +#include #include "rtl/ref.hxx" #include "sal/types.h" @@ -93,13 +94,7 @@ OUString BridgeFactory::getImplementationName() sal_Bool BridgeFactory::supportsService(OUString const & ServiceName) throw (css::uno::RuntimeException) { - css::uno::Sequence< OUString > s(getSupportedServiceNames()); - for (sal_Int32 i = 0; i != s.getLength(); ++i) { - if (ServiceName == s[i]) { - return true; - } - } - return false; + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames() diff --git a/bridges/test/java_uno/acquire/testacquire.cxx b/bridges/test/java_uno/acquire/testacquire.cxx index e88be55b3e01..7a8de19cb44d 100644 --- a/bridges/test/java_uno/acquire/testacquire.cxx +++ b/bridges/test/java_uno/acquire/testacquire.cxx @@ -35,6 +35,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/factory.hxx" #include "cppuhelper/implbase3.hxx" +#include #include "cppuhelper/weak.hxx" #include "osl/conditn.hxx" #include "osl/interlck.h" @@ -319,14 +320,7 @@ private: sal_Bool Service::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - css::uno::Sequence< OUString > names( - getSupportedServiceNames_static()); - for (sal_Int32 i = 0; i< names.getLength(); ++i) { - if (names[i] == serviceName) { - return true; - } - } - return false; + return cppu::supportsService(this, serviceName); } namespace { diff --git a/bridges/test/java_uno/equals/testequals.cxx b/bridges/test/java_uno/equals/testequals.cxx index a56e5b928a39..9124b757a57b 100644 --- a/bridges/test/java_uno/equals/testequals.cxx +++ b/bridges/test/java_uno/equals/testequals.cxx @@ -36,6 +36,7 @@ #include "com/sun/star/uno/XInterface.hpp" #include "cppuhelper/factory.hxx" #include "cppuhelper/implbase2.hxx" +#include #include "cppuhelper/weak.hxx" #include "rtl/string.h" #include "rtl/ustring.hxx" @@ -94,12 +95,7 @@ private: sal_Bool Service::supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException) { - css::uno::Sequence< OUString > aNames( - getSupportedServiceNames_static()); - for (sal_Int32 i = 0; i< aNames.getLength(); ++i) - if (aNames[i] == rServiceName) - return true; - return false; + return cppu::supportsService(this, rServiceName); } void Service::connect(OUString const & rConnection, 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() { diff --git a/shell/source/backends/localebe/localebackend.cxx b/shell/source/backends/localebe/localebackend.cxx index 42405d76f0db..35f43d4e2c05 100644 --- a/shell/source/backends/localebe/localebackend.cxx +++ b/shell/source/backends/localebe/localebackend.cxx @@ -20,6 +20,7 @@ #include "localebackend.hxx" #include +#include #include #include @@ -311,16 +312,12 @@ OUString SAL_CALL LocaleBackend::getBackendName(void) { return OUString("com.sun.star.comp.configuration.backend.LocaleBackend") ; } -//------------------------------------------------------------------------------ - OUString SAL_CALL LocaleBackend::getImplementationName(void) throw (uno::RuntimeException) { return getBackendName() ; } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL LocaleBackend::getBackendServiceNames(void) { uno::Sequence aServiceNameList(1); @@ -328,22 +325,12 @@ uno::Sequence SAL_CALL LocaleBackend::getBackendServiceNames(void) return aServiceNameList ; } -//------------------------------------------------------------------------------ - sal_Bool SAL_CALL LocaleBackend::supportsService(const OUString& aServiceName) throw (uno::RuntimeException) { - uno::Sequence< OUString > const svc = getBackendServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - - return false; + return cppu::supportsService(this, aServiceName); } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL LocaleBackend::getSupportedServiceNames(void) throw (uno::RuntimeException) { diff --git a/shell/source/backends/macbe/macbackend.mm b/shell/source/backends/macbe/macbackend.mm index e57013e5297c..4a095ff75996 100644 --- a/shell/source/backends/macbe/macbackend.mm +++ b/shell/source/backends/macbe/macbackend.mm @@ -29,6 +29,7 @@ #include "macbackend.hxx" #include "com/sun/star/beans/Optional.hpp" +#include #include "rtl/ustrbuf.hxx" #include "osl/file.h" @@ -447,8 +448,6 @@ rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void) return getBackendName(); } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL MacOSXBackend::getBackendServiceNames(void) { uno::Sequence aServiceNameList(1); @@ -457,22 +456,12 @@ uno::Sequence SAL_CALL MacOSXBackend::getBackendServiceNames(void return aServiceNameList; } -//------------------------------------------------------------------------------ - sal_Bool SAL_CALL MacOSXBackend::supportsService(const rtl::OUString& aServiceName) throw (uno::RuntimeException) { - uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - - return false; + return cppu::supportsService(this, aServiceName); } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL MacOSXBackend::getSupportedServiceNames(void) throw (uno::RuntimeException) { diff --git a/shell/source/backends/wininetbe/wininetbackend.cxx b/shell/source/backends/wininetbe/wininetbackend.cxx index 559eb0e51d5b..69b8f28a8e24 100644 --- a/shell/source/backends/wininetbe/wininetbackend.cxx +++ b/shell/source/backends/wininetbe/wininetbackend.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include #include "rtl/ustrbuf.hxx" #include "wininetbackend.hxx" @@ -374,8 +374,6 @@ OUString SAL_CALL WinInetBackend::getImplementationName(void) return getBackendName() ; } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL WinInetBackend::getBackendServiceNames(void) { uno::Sequence aServiceNameList(1); @@ -384,22 +382,12 @@ uno::Sequence SAL_CALL WinInetBackend::getBackendServiceNames(void) return aServiceNameList ; } -//------------------------------------------------------------------------------ - sal_Bool SAL_CALL WinInetBackend::supportsService(const OUString& aServiceName) throw (uno::RuntimeException) { - uno::Sequence< OUString > const svc = getBackendServiceNames(); - - for(sal_Int32 i = 0; i < svc.getLength(); ++i ) - if(svc[i] == aServiceName) - return true; - - return false; + return cppu::supportsService(this, aServiceName); } -//------------------------------------------------------------------------------ - uno::Sequence SAL_CALL WinInetBackend::getSupportedServiceNames(void) throw (uno::RuntimeException) { diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx index 90f5e8af051a..ab670afbde59 100644 --- a/shell/source/cmdmail/cmdmailsuppl.cxx +++ b/shell/source/cmdmail/cmdmailsuppl.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include #include @@ -267,36 +268,21 @@ void SAL_CALL CmdMailSuppl::sendSimpleMailMessage( const Reference< XSimpleMailM } } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - OUString SAL_CALL CmdMailSuppl::getImplementationName( ) throw( RuntimeException ) { return OUString(COMP_IMPL_NAME); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - sal_Bool SAL_CALL CmdMailSuppl::supportsService( const OUString& ServiceName ) throw( RuntimeException ) { - Sequence < OUString > SupportedServicesNames = Component_getSupportedServiceNames(); - - for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) - if ( SupportedServicesNames[n] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - Sequence< OUString > SAL_CALL CmdMailSuppl::getSupportedServiceNames( ) throw( RuntimeException ) { diff --git a/shell/source/unix/exec/shellexec.cxx b/shell/source/unix/exec/shellexec.cxx index 3f97806d33c5..b3138677e09e 100644 --- a/shell/source/unix/exec/shellexec.cxx +++ b/shell/source/unix/exec/shellexec.cxx @@ -33,6 +33,7 @@ #include #include #include +#include #include "uno/current_context.hxx" @@ -265,37 +266,21 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar } } - -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - OUString SAL_CALL ShellExec::getImplementationName( ) throw( RuntimeException ) { return OUString(SHELLEXEC_IMPL_NAME ); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - sal_Bool SAL_CALL ShellExec::supportsService( const OUString& ServiceName ) throw( RuntimeException ) { - Sequence < OUString > SupportedServicesNames = ShellExec_getSupportedServiceNames(); - - for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) - if ( SupportedServicesNames[n] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - Sequence< OUString > SAL_CALL ShellExec::getSupportedServiceNames( ) throw( RuntimeException ) { diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx index b08160764b95..1a39e9ab472b 100644 --- a/shell/source/win32/SysShExec.cxx +++ b/shell/source/win32/SysShExec.cxx @@ -24,6 +24,7 @@ #include #include +#include #define WIN32_LEAN_AND_MEAN #if defined _MSC_VER @@ -341,36 +342,21 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa } } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - OUString SAL_CALL CSysShExec::getImplementationName( ) throw( RuntimeException ) { return OUString(SYSSHEXEC_IMPL_NAME ); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - sal_Bool SAL_CALL CSysShExec::supportsService( const OUString& ServiceName ) throw( RuntimeException ) { - Sequence < OUString > SupportedServicesNames = SysShExec_getSupportedServiceNames(); - - for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; ) - if ( SupportedServicesNames[n] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -// ------------------------------------------------- // XServiceInfo -// ------------------------------------------------- - Sequence< OUString > SAL_CALL CSysShExec::getSupportedServiceNames( ) throw( RuntimeException ) { diff --git a/shell/source/win32/simplemail/smplmailsuppl.cxx b/shell/source/win32/simplemail/smplmailsuppl.cxx index 610699459822..6f530db8d989 100644 --- a/shell/source/win32/simplemail/smplmailsuppl.cxx +++ b/shell/source/win32/simplemail/smplmailsuppl.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include #include #include "smplmailsuppl.hxx" #include "smplmailclient.hxx" @@ -79,13 +80,7 @@ OUString SAL_CALL CSmplMailSuppl::getImplementationName() sal_Bool SAL_CALL CSmplMailSuppl::supportsService(const OUString& ServiceName) throw(RuntimeException) { - Sequence SupportedServicesNames = Component_getSupportedServiceNames(); - - for (sal_Int32 n = SupportedServicesNames.getLength(); n--;) - if ( SupportedServicesNames[n] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } Sequence SAL_CALL CSmplMailSuppl::getSupportedServiceNames() diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx index be21c53e727b..ca9453ad09c7 100644 --- a/starmath/source/smdetect.cxx +++ b/starmath/source/smdetect.cxx @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -437,16 +438,7 @@ OUString SAL_CALL SmFilterDetect::getImplementationName() throw( RuntimeExceptio /* XServiceInfo */ sal_Bool SAL_CALL SmFilterDetect::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - Sequence< OUString > seqServiceNames = getSupportedServiceNames(); - const OUString* pArray = seqServiceNames.getConstArray(); - for ( sal_Int32 nCounter=0; nCounter