fdo#54938: More uses of cppu::supportsService

Change-Id: I90a7a07a43559b8d7e1d4b886b2624255200d46b
Reviewed-on: https://gerrit.libreoffice.org/6406
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Marcos Paulo de Souza
2013-10-23 14:35:10 -02:00
committed by Stephan Bergmann
parent a95ecd8b65
commit 704f95e525
20 changed files with 44 additions and 288 deletions

View File

@@ -47,6 +47,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/servicehelper.hxx> #include <comphelper/servicehelper.hxx>
#include <cppuhelper/interfacecontainer.hxx> #include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weakref.hxx> #include <cppuhelper/weakref.hxx>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
@@ -781,23 +782,12 @@ OUString AnimationNode::getImplementationName() throw()
} }
} }
// --------------------------------------------------------------------
// XServiceInfo // XServiceInfo
sal_Bool AnimationNode::supportsService(const OUString& ServiceName) throw() sal_Bool AnimationNode::supportsService(const OUString& ServiceName) throw()
{ {
Sequence< OUString > aSNL( getSupportedServiceNames() ); return cppu::supportsService(this, ServiceName);
const OUString * pArray = aSNL.getConstArray();
for( sal_Int32 i = 0; i < aSNL.getLength(); i++ )
if( pArray[i] == ServiceName )
return sal_True;
return sal_False;
} }
// --------------------------------------------------------------------
// XServiceInfo // XServiceInfo
Sequence< OUString > AnimationNode::getSupportedServiceNames(void) throw() Sequence< OUString > AnimationNode::getSupportedServiceNames(void) throw()
{ {

View File

@@ -29,6 +29,7 @@
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
namespace avmedia{ namespace avmedia{
@@ -134,47 +135,19 @@ OUString SAL_CALL SoundHandler::getImplementationName() throw( css::uno::Runtime
return impl_getStaticImplementationName(); return impl_getStaticImplementationName();
} }
/*===========================================================================================================*/ // XServiceInfo
/* XServiceInfo */
/*===========================================================================================================*/
sal_Bool SAL_CALL SoundHandler::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) sal_Bool SAL_CALL SoundHandler::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException )
{ {
/* Set default return value. */ return cppu::supportsService(this, sServiceName);
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;
} }
/*===========================================================================================================*/ // XServiceInfo
/* XServiceInfo */
/*===========================================================================================================*/
css::uno::Sequence< OUString > SAL_CALL SoundHandler::getSupportedServiceNames() throw( css::uno::RuntimeException ) css::uno::Sequence< OUString > SAL_CALL SoundHandler::getSupportedServiceNames() throw( css::uno::RuntimeException )
{ {
return impl_getStaticSupportedServiceNames(); return impl_getStaticSupportedServiceNames();
} }
/*===========================================================================================================*/ // Helper for XServiceInfo
/* Helper for XServiceInfo */
/*===========================================================================================================*/
css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames() css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames()
{ {
css::uno::Sequence< OUString > seqServiceNames( 1 ); css::uno::Sequence< OUString > seqServiceNames( 1 );
@@ -182,9 +155,7 @@ css::uno::Sequence< OUString > SoundHandler::impl_getStaticSupportedServiceNames
return seqServiceNames; return seqServiceNames;
} }
/*===========================================================================================================*/ // Helper for XServiceInfo
/* Helper for XServiceInfo */
/*===========================================================================================================*/
OUString SoundHandler::impl_getStaticImplementationName() OUString SoundHandler::impl_getStaticImplementationName()
{ {
return IMPLEMENTATIONNAME_SOUNDHANDLER; return IMPLEMENTATIONNAME_SOUNDHANDLER;

View File

@@ -25,6 +25,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
#include <toolkit/awt/vclxfont.hxx> #include <toolkit/awt/vclxfont.hxx>
@@ -309,30 +310,17 @@ void AccessibleDialogControlShape::propertyChange( const beans::PropertyChangeEv
} }
} }
// -----------------------------------------------------------------------------
// XServiceInfo // XServiceInfo
// -----------------------------------------------------------------------------
OUString AccessibleDialogControlShape::getImplementationName() throw (RuntimeException) OUString AccessibleDialogControlShape::getImplementationName() throw (RuntimeException)
{ {
return OUString( "com.sun.star.comp.basctl.AccessibleShape" ); return OUString( "com.sun.star.comp.basctl.AccessibleShape" );
} }
// -----------------------------------------------------------------------------
sal_Bool AccessibleDialogControlShape::supportsService( const OUString& rServiceName ) throw (RuntimeException) sal_Bool AccessibleDialogControlShape::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{ {
Sequence< OUString > aNames( getSupportedServiceNames() ); return cppu::supportsService(this, rServiceName);
const OUString* pNames = aNames.getConstArray();
const OUString* pEnd = pNames + aNames.getLength();
for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
;
return pNames != pEnd;
} }
// -----------------------------------------------------------------------------
Sequence< OUString > AccessibleDialogControlShape::getSupportedServiceNames() throw (RuntimeException) Sequence< OUString > AccessibleDialogControlShape::getSupportedServiceNames() throw (RuntimeException)
{ {
Sequence< OUString > aNames(1); Sequence< OUString > aNames(1);
@@ -340,10 +328,7 @@ Sequence< OUString > AccessibleDialogControlShape::getSupportedServiceNames() th
return aNames; return aNames;
} }
// -----------------------------------------------------------------------------
// XAccessible // XAccessible
// -----------------------------------------------------------------------------
Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleContext( ) throw (RuntimeException) Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleContext( ) throw (RuntimeException)
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
@@ -351,10 +336,7 @@ Reference< XAccessibleContext > AccessibleDialogControlShape::getAccessibleConte
return this; return this;
} }
// -----------------------------------------------------------------------------
// XAccessibleContext // XAccessibleContext
// -----------------------------------------------------------------------------
sal_Int32 AccessibleDialogControlShape::getAccessibleChildCount() throw (RuntimeException) sal_Int32 AccessibleDialogControlShape::getAccessibleChildCount() throw (RuntimeException)
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );

View File

@@ -29,6 +29,7 @@
#include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/AccessibleEventId.hpp>
#include <com/sun/star/accessibility/AccessibleRole.hpp> #include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <unotools/accessiblestatesethelper.hxx> #include <unotools/accessiblestatesethelper.hxx>
#include <unotools/accessiblerelationsethelper.hxx> #include <unotools/accessiblerelationsethelper.hxx>
#include <toolkit/awt/vclxfont.hxx> #include <toolkit/awt/vclxfont.hxx>
@@ -605,30 +606,17 @@ void AccessibleDialogWindow::disposing()
} }
} }
// -----------------------------------------------------------------------------
// XServiceInfo // XServiceInfo
// -----------------------------------------------------------------------------
OUString AccessibleDialogWindow::getImplementationName() throw (RuntimeException) OUString AccessibleDialogWindow::getImplementationName() throw (RuntimeException)
{ {
return OUString( "com.sun.star.comp.basctl.AccessibleWindow" ); return OUString( "com.sun.star.comp.basctl.AccessibleWindow" );
} }
// -----------------------------------------------------------------------------
sal_Bool AccessibleDialogWindow::supportsService( const OUString& rServiceName ) throw (RuntimeException) sal_Bool AccessibleDialogWindow::supportsService( const OUString& rServiceName ) throw (RuntimeException)
{ {
Sequence< OUString > aNames( getSupportedServiceNames() ); return cppu::supportsService(this, rServiceName);
const OUString* pNames = aNames.getConstArray();
const OUString* pEnd = pNames + aNames.getLength();
for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
;
return pNames != pEnd;
} }
// -----------------------------------------------------------------------------
Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (RuntimeException) Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (RuntimeException)
{ {
Sequence< OUString > aNames(1); Sequence< OUString > aNames(1);
@@ -636,10 +624,7 @@ Sequence< OUString > AccessibleDialogWindow::getSupportedServiceNames() throw (R
return aNames; return aNames;
} }
// -----------------------------------------------------------------------------
// XAccessible // XAccessible
// -----------------------------------------------------------------------------
Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) throw (RuntimeException) Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( ) throw (RuntimeException)
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );
@@ -647,10 +632,7 @@ Reference< XAccessibleContext > AccessibleDialogWindow::getAccessibleContext( )
return this; return this;
} }
// -----------------------------------------------------------------------------
// XAccessibleContext // XAccessibleContext
// -----------------------------------------------------------------------------
sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() throw (RuntimeException) sal_Int32 AccessibleDialogWindow::getAccessibleChildCount() throw (RuntimeException)
{ {
OExternalLockGuard aGuard( this ); OExternalLockGuard aGuard( this );

View File

@@ -30,6 +30,7 @@
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include "cppuhelper/implementationentry.hxx" #include "cppuhelper/implementationentry.hxx"
#include <cppuhelper/supportsservice.hxx>
#include "rtl/ref.hxx" #include "rtl/ref.hxx"
#include "sal/types.h" #include "sal/types.h"
@@ -93,13 +94,7 @@ OUString BridgeFactory::getImplementationName()
sal_Bool BridgeFactory::supportsService(OUString const & ServiceName) sal_Bool BridgeFactory::supportsService(OUString const & ServiceName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< OUString > s(getSupportedServiceNames()); return cppu::supportsService(this, ServiceName);
for (sal_Int32 i = 0; i != s.getLength(); ++i) {
if (ServiceName == s[i]) {
return true;
}
}
return false;
} }
css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames() css::uno::Sequence< OUString > BridgeFactory::getSupportedServiceNames()

View File

@@ -35,6 +35,7 @@
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase3.hxx" #include "cppuhelper/implbase3.hxx"
#include <cppuhelper/supportsservice.hxx>
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/conditn.hxx" #include "osl/conditn.hxx"
#include "osl/interlck.h" #include "osl/interlck.h"
@@ -319,14 +320,7 @@ private:
sal_Bool Service::supportsService(OUString const & serviceName) sal_Bool Service::supportsService(OUString const & serviceName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< OUString > names( return cppu::supportsService(this, serviceName);
getSupportedServiceNames_static());
for (sal_Int32 i = 0; i< names.getLength(); ++i) {
if (names[i] == serviceName) {
return true;
}
}
return false;
} }
namespace { namespace {

View File

@@ -36,6 +36,7 @@
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase2.hxx" #include "cppuhelper/implbase2.hxx"
#include <cppuhelper/supportsservice.hxx>
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "rtl/string.h" #include "rtl/string.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
@@ -94,12 +95,7 @@ private:
sal_Bool Service::supportsService(OUString const & rServiceName) sal_Bool Service::supportsService(OUString const & rServiceName)
throw (css::uno::RuntimeException) throw (css::uno::RuntimeException)
{ {
css::uno::Sequence< OUString > aNames( return cppu::supportsService(this, rServiceName);
getSupportedServiceNames_static());
for (sal_Int32 i = 0; i< aNames.getLength(); ++i)
if (aNames[i] == rServiceName)
return true;
return false;
} }
void Service::connect(OUString const & rConnection, void Service::connect(OUString const & rConnection,

View File

@@ -21,6 +21,7 @@
#include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp> #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <i18nlangtag/languagetag.hxx> #include <i18nlangtag/languagetag.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
@@ -847,11 +848,7 @@ void SAL_CALL Hyphenator::removeEventListener( const Reference< XEventListener >
aEvtListeners.removeInterface( rxListener ); aEvtListeners.removeInterface( rxListener );
} }
///////////////////////////////////////////////////////////////////////////
// Service specific part // Service specific part
//
OUString SAL_CALL Hyphenator::getImplementationName() OUString SAL_CALL Hyphenator::getImplementationName()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -860,21 +857,12 @@ OUString SAL_CALL Hyphenator::getImplementationName()
return getImplementationName_Static(); return getImplementationName_Static();
} }
sal_Bool SAL_CALL Hyphenator::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL Hyphenator::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
MutexGuard aGuard( GetLinguMutex() ); return cppu::supportsService(this, ServiceName);
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;
} }
Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames() Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -883,7 +871,6 @@ Sequence< OUString > SAL_CALL Hyphenator::getSupportedServiceNames()
return getSupportedServiceNames_Static(); return getSupportedServiceNames_Static();
} }
Sequence< OUString > Hyphenator::getSupportedServiceNames_Static() Sequence< OUString > Hyphenator::getSupportedServiceNames_Static()
throw() throw()
{ {

View File

@@ -26,6 +26,7 @@
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/implbase2.hxx> #include <cppuhelper/implbase2.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <simpleguesser.hxx> #include <simpleguesser.hxx>
#include <guess.hxx> #include <guess.hxx>
@@ -346,7 +347,6 @@ void SAL_CALL LangGuess_Impl::enableLanguages(
} }
} }
//*************************************************************************
OUString SAL_CALL LangGuess_Impl::getImplementationName( ) OUString SAL_CALL LangGuess_Impl::getImplementationName( )
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -354,20 +354,12 @@ OUString SAL_CALL LangGuess_Impl::getImplementationName( )
return OUString( IMPLNAME ); return OUString( IMPLNAME );
} }
//*************************************************************************
sal_Bool SAL_CALL LangGuess_Impl::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL LangGuess_Impl::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
osl::MutexGuard aGuard( GetLangGuessMutex() ); return cppu::supportsService(this, ServiceName);
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;
} }
//*************************************************************************
Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames( ) Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames( )
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -375,16 +367,12 @@ Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames( )
return getSupportedServiceNames_Static(); return getSupportedServiceNames_Static();
} }
//*************************************************************************
Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames_Static( ) Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames_Static( )
{ {
OUString aName( SERVICENAME ); OUString aName( SERVICENAME );
return Sequence< OUString >( &aName, 1 ); return Sequence< OUString >( &aName, 1 );
} }
//*************************************************************************
/** /**
* Function to create a new component instance; is needed by factory helper implementation. * 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 * @param xMgr service manager to if the components needs other component instances

View File

@@ -22,6 +22,7 @@
#include <com/sun/star/linguistic2/SpellFailure.hpp> #include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
@@ -520,11 +521,7 @@ void SAL_CALL
aEvtListeners.removeInterface( rxListener ); aEvtListeners.removeInterface( rxListener );
} }
///////////////////////////////////////////////////////////////////////////
// Service specific part // Service specific part
//
OUString SAL_CALL MacSpellChecker::getImplementationName() OUString SAL_CALL MacSpellChecker::getImplementationName()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -533,21 +530,12 @@ OUString SAL_CALL MacSpellChecker::getImplementationName()
return getImplementationName_Static(); return getImplementationName_Static();
} }
sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL MacSpellChecker::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
MutexGuard aGuard( GetLinguMutex() ); return cppu::supportsService(this, ServiceName);
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;
} }
Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames() Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -556,7 +544,6 @@ Sequence< OUString > SAL_CALL MacSpellChecker::getSupportedServiceNames()
return getSupportedServiceNames_Static(); return getSupportedServiceNames_Static();
} }
Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static() Sequence< OUString > MacSpellChecker::getSupportedServiceNames_Static()
throw() throw()
{ {

View File

@@ -23,6 +23,7 @@
#include <com/sun/star/linguistic2/SpellFailure.hpp> #include <com/sun/star/linguistic2/SpellFailure.hpp>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
@@ -630,10 +631,7 @@ void SAL_CALL SpellChecker::removeEventListener( const Reference< XEventListener
} }
///////////////////////////////////////////////////////////////////////////
// Service specific part // Service specific part
//
OUString SAL_CALL SpellChecker::getImplementationName() OUString SAL_CALL SpellChecker::getImplementationName()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -642,21 +640,12 @@ OUString SAL_CALL SpellChecker::getImplementationName()
return getImplementationName_Static(); return getImplementationName_Static();
} }
sal_Bool SAL_CALL SpellChecker::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL SpellChecker::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
MutexGuard aGuard( GetLinguMutex() ); return cppu::supportsService(this, ServiceName);
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;
} }
Sequence< OUString > SAL_CALL SpellChecker::getSupportedServiceNames() Sequence< OUString > SAL_CALL SpellChecker::getSupportedServiceNames()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -665,7 +654,6 @@ Sequence< OUString > SAL_CALL SpellChecker::getSupportedServiceNames()
return getSupportedServiceNames_Static(); return getSupportedServiceNames_Static();
} }
Sequence< OUString > SpellChecker::getSupportedServiceNames_Static() Sequence< OUString > SpellChecker::getSupportedServiceNames_Static()
throw() throw()
{ {

View File

@@ -20,6 +20,7 @@
#include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Reference.h>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/linguistic2/LinguServiceManager.hpp> #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
@@ -645,11 +646,7 @@ void SAL_CALL Thesaurus::removeEventListener( const Reference< XEventListener >&
aEvtListeners.removeInterface( rxListener ); aEvtListeners.removeInterface( rxListener );
} }
///////////////////////////////////////////////////////////////////////////
// Service specific part // Service specific part
//
OUString SAL_CALL Thesaurus::getImplementationName() OUString SAL_CALL Thesaurus::getImplementationName()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -661,17 +658,9 @@ OUString SAL_CALL Thesaurus::getImplementationName()
sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL Thesaurus::supportsService( const OUString& ServiceName )
throw(RuntimeException) throw(RuntimeException)
{ {
MutexGuard aGuard( GetLinguMutex() ); return cppu::supportsService(this, ServiceName);
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;
} }
Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames() Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames()
throw(RuntimeException) throw(RuntimeException)
{ {
@@ -679,7 +668,6 @@ Sequence< OUString > SAL_CALL Thesaurus::getSupportedServiceNames()
return getSupportedServiceNames_Static(); return getSupportedServiceNames_Static();
} }
Sequence< OUString > Thesaurus::getSupportedServiceNames_Static() Sequence< OUString > Thesaurus::getSupportedServiceNames_Static()
throw() throw()
{ {

View File

@@ -20,6 +20,7 @@
#include "localebackend.hxx" #include "localebackend.hxx"
#include <com/sun/star/beans/Optional.hpp> #include <com/sun/star/beans/Optional.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <osl/time.h> #include <osl/time.h>
#include <stdio.h> #include <stdio.h>
@@ -311,16 +312,12 @@ OUString SAL_CALL LocaleBackend::getBackendName(void) {
return OUString("com.sun.star.comp.configuration.backend.LocaleBackend") ; return OUString("com.sun.star.comp.configuration.backend.LocaleBackend") ;
} }
//------------------------------------------------------------------------------
OUString SAL_CALL LocaleBackend::getImplementationName(void) OUString SAL_CALL LocaleBackend::getImplementationName(void)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
return getBackendName() ; return getBackendName() ;
} }
//------------------------------------------------------------------------------
uno::Sequence<OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void) uno::Sequence<OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void)
{ {
uno::Sequence<OUString> aServiceNameList(1); uno::Sequence<OUString> aServiceNameList(1);
@@ -328,22 +325,12 @@ uno::Sequence<OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void)
return aServiceNameList ; return aServiceNameList ;
} }
//------------------------------------------------------------------------------
sal_Bool SAL_CALL LocaleBackend::supportsService(const OUString& aServiceName) sal_Bool SAL_CALL LocaleBackend::supportsService(const OUString& aServiceName)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
uno::Sequence< OUString > const svc = getBackendServiceNames(); return cppu::supportsService(this, aServiceName);
for(sal_Int32 i = 0; i < svc.getLength(); ++i )
if(svc[i] == aServiceName)
return true;
return false;
} }
//------------------------------------------------------------------------------
uno::Sequence<OUString> SAL_CALL LocaleBackend::getSupportedServiceNames(void) uno::Sequence<OUString> SAL_CALL LocaleBackend::getSupportedServiceNames(void)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {

View File

@@ -29,6 +29,7 @@
#include "macbackend.hxx" #include "macbackend.hxx"
#include "com/sun/star/beans/Optional.hpp" #include "com/sun/star/beans/Optional.hpp"
#include <cppuhelper/supportsservice.hxx>
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
#include "osl/file.h" #include "osl/file.h"
@@ -447,8 +448,6 @@ rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void)
return getBackendName(); return getBackendName();
} }
//------------------------------------------------------------------------------
uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void) uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void)
{ {
uno::Sequence<rtl::OUString> aServiceNameList(1); uno::Sequence<rtl::OUString> aServiceNameList(1);
@@ -457,22 +456,12 @@ uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void
return aServiceNameList; return aServiceNameList;
} }
//------------------------------------------------------------------------------
sal_Bool SAL_CALL MacOSXBackend::supportsService(const rtl::OUString& aServiceName) sal_Bool SAL_CALL MacOSXBackend::supportsService(const rtl::OUString& aServiceName)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
uno::Sequence< rtl::OUString > const svc = getBackendServiceNames(); return cppu::supportsService(this, aServiceName);
for(sal_Int32 i = 0; i < svc.getLength(); ++i )
if(svc[i] == aServiceName)
return true;
return false;
} }
//------------------------------------------------------------------------------
uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void) uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getSupportedServiceNames(void)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {

View File

@@ -17,7 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <cppuhelper/supportsservice.hxx>
#include "rtl/ustrbuf.hxx" #include "rtl/ustrbuf.hxx"
#include "wininetbackend.hxx" #include "wininetbackend.hxx"
@@ -374,8 +374,6 @@ OUString SAL_CALL WinInetBackend::getImplementationName(void)
return getBackendName() ; return getBackendName() ;
} }
//------------------------------------------------------------------------------
uno::Sequence<OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void) uno::Sequence<OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
{ {
uno::Sequence<OUString> aServiceNameList(1); uno::Sequence<OUString> aServiceNameList(1);
@@ -384,22 +382,12 @@ uno::Sequence<OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
return aServiceNameList ; return aServiceNameList ;
} }
//------------------------------------------------------------------------------
sal_Bool SAL_CALL WinInetBackend::supportsService(const OUString& aServiceName) sal_Bool SAL_CALL WinInetBackend::supportsService(const OUString& aServiceName)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {
uno::Sequence< OUString > const svc = getBackendServiceNames(); return cppu::supportsService(this, aServiceName);
for(sal_Int32 i = 0; i < svc.getLength(); ++i )
if(svc[i] == aServiceName)
return true;
return false;
} }
//------------------------------------------------------------------------------
uno::Sequence<OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(void) uno::Sequence<OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(void)
throw (uno::RuntimeException) throw (uno::RuntimeException)
{ {

View File

@@ -34,6 +34,7 @@
#include <com/sun/star/beans/PropertyValue.hpp> #include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp> #include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/supportsservice.hxx>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
@@ -267,36 +268,21 @@ void SAL_CALL CmdMailSuppl::sendSimpleMailMessage( const Reference< XSimpleMailM
} }
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
OUString SAL_CALL CmdMailSuppl::getImplementationName( ) OUString SAL_CALL CmdMailSuppl::getImplementationName( )
throw( RuntimeException ) throw( RuntimeException )
{ {
return OUString(COMP_IMPL_NAME); return OUString(COMP_IMPL_NAME);
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
sal_Bool SAL_CALL CmdMailSuppl::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL CmdMailSuppl::supportsService( const OUString& ServiceName )
throw( RuntimeException ) throw( RuntimeException )
{ {
Sequence < OUString > SupportedServicesNames = Component_getSupportedServiceNames(); return cppu::supportsService(this, ServiceName);
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
Sequence< OUString > SAL_CALL CmdMailSuppl::getSupportedServiceNames( ) Sequence< OUString > SAL_CALL CmdMailSuppl::getSupportedServiceNames( )
throw( RuntimeException ) throw( RuntimeException )
{ {

View File

@@ -33,6 +33,7 @@
#include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp> #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp> #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <cppuhelper/supportsservice.hxx>
#include "uno/current_context.hxx" #include "uno/current_context.hxx"
@@ -265,37 +266,21 @@ void SAL_CALL ShellExec::execute( const OUString& aCommand, const OUString& aPar
} }
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
OUString SAL_CALL ShellExec::getImplementationName( ) OUString SAL_CALL ShellExec::getImplementationName( )
throw( RuntimeException ) throw( RuntimeException )
{ {
return OUString(SHELLEXEC_IMPL_NAME ); return OUString(SHELLEXEC_IMPL_NAME );
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
sal_Bool SAL_CALL ShellExec::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL ShellExec::supportsService( const OUString& ServiceName )
throw( RuntimeException ) throw( RuntimeException )
{ {
Sequence < OUString > SupportedServicesNames = ShellExec_getSupportedServiceNames(); return cppu::supportsService(this, ServiceName);
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
Sequence< OUString > SAL_CALL ShellExec::getSupportedServiceNames( ) Sequence< OUString > SAL_CALL ShellExec::getSupportedServiceNames( )
throw( RuntimeException ) throw( RuntimeException )
{ {

View File

@@ -24,6 +24,7 @@
#include <com/sun/star/system/SystemShellExecuteFlags.hpp> #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
#include <com/sun/star/uri/UriReferenceFactory.hpp> #include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <cppuhelper/supportsservice.hxx>
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#if defined _MSC_VER #if defined _MSC_VER
@@ -341,36 +342,21 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
} }
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
OUString SAL_CALL CSysShExec::getImplementationName( ) OUString SAL_CALL CSysShExec::getImplementationName( )
throw( RuntimeException ) throw( RuntimeException )
{ {
return OUString(SYSSHEXEC_IMPL_NAME ); return OUString(SYSSHEXEC_IMPL_NAME );
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
sal_Bool SAL_CALL CSysShExec::supportsService( const OUString& ServiceName ) sal_Bool SAL_CALL CSysShExec::supportsService( const OUString& ServiceName )
throw( RuntimeException ) throw( RuntimeException )
{ {
Sequence < OUString > SupportedServicesNames = SysShExec_getSupportedServiceNames(); return cppu::supportsService(this, ServiceName);
for ( sal_Int32 n = SupportedServicesNames.getLength(); n--; )
if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
} }
// -------------------------------------------------
// XServiceInfo // XServiceInfo
// -------------------------------------------------
Sequence< OUString > SAL_CALL CSysShExec::getSupportedServiceNames( ) Sequence< OUString > SAL_CALL CSysShExec::getSupportedServiceNames( )
throw( RuntimeException ) throw( RuntimeException )
{ {

View File

@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 . * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/ */
#include <cppuhelper/supportsservice.hxx>
#include <osl/diagnose.h> #include <osl/diagnose.h>
#include "smplmailsuppl.hxx" #include "smplmailsuppl.hxx"
#include "smplmailclient.hxx" #include "smplmailclient.hxx"
@@ -79,13 +80,7 @@ OUString SAL_CALL CSmplMailSuppl::getImplementationName()
sal_Bool SAL_CALL CSmplMailSuppl::supportsService(const OUString& ServiceName) sal_Bool SAL_CALL CSmplMailSuppl::supportsService(const OUString& ServiceName)
throw(RuntimeException) throw(RuntimeException)
{ {
Sequence <OUString> SupportedServicesNames = Component_getSupportedServiceNames(); return cppu::supportsService(this, ServiceName);
for (sal_Int32 n = SupportedServicesNames.getLength(); n--;)
if ( SupportedServicesNames[n] == ServiceName )
return sal_True;
return sal_False;
} }
Sequence<OUString> SAL_CALL CSmplMailSuppl::getSupportedServiceNames() Sequence<OUString> SAL_CALL CSmplMailSuppl::getSupportedServiceNames()

View File

@@ -26,6 +26,7 @@
#include <com/sun/star/awt/XWindow.hpp> #include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp> #include <com/sun/star/task/XInteractionHandler.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp> #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -437,16 +438,7 @@ OUString SAL_CALL SmFilterDetect::getImplementationName() throw( RuntimeExceptio
/* XServiceInfo */ /* XServiceInfo */
sal_Bool SAL_CALL SmFilterDetect::supportsService( const OUString& sServiceName ) throw( RuntimeException ) sal_Bool SAL_CALL SmFilterDetect::supportsService( const OUString& sServiceName ) throw( RuntimeException )
{ {
Sequence< OUString > seqServiceNames = getSupportedServiceNames(); return cppu::supportsService(this, sServiceName);
const OUString* pArray = seqServiceNames.getConstArray();
for ( sal_Int32 nCounter=0; nCounter<seqServiceNames.getLength(); nCounter++ )
{
if ( pArray[nCounter] == sServiceName )
{
return sal_True ;
}
}
return sal_False ;
} }
/* XServiceInfo */ /* XServiceInfo */