[Libreoffice-commits] core.git: animations/source avmedia/source basctl/source binaryurp/source bridges/test lingucomponent/source shell/source starmath/source

Marcos Paulo de Souza marcos.souza.org at gmail.com
Fri Oct 25 01:20:19 PDT 2013


 animations/source/animcore/animcore.cxx                            |   14 ---
 avmedia/source/framework/soundhandler.cxx                          |   41 +---------
 basctl/source/accessibility/accessibledialogcontrolshape.cxx       |   22 -----
 basctl/source/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 -
 lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx |   17 ----
 lingucomponent/source/languageguessing/guesslang.cxx               |   16 ---
 lingucomponent/source/spellcheck/macosxspell/macspellimp.mm        |   17 ----
 lingucomponent/source/spellcheck/spell/sspellimp.cxx               |   16 ---
 lingucomponent/source/thesaurus/libnth/nthesimp.cxx                |   16 ---
 shell/source/backends/localebe/localebackend.cxx                   |   17 ----
 shell/source/backends/macbe/macbackend.mm                          |   15 ---
 shell/source/backends/wininetbe/wininetbackend.cxx                 |   16 ---
 shell/source/cmdmail/cmdmailsuppl.cxx                              |   18 ----
 shell/source/unix/exec/shellexec.cxx                               |   19 ----
 shell/source/win32/SysShExec.cxx                                   |   18 ----
 shell/source/win32/simplemail/smplmailsuppl.cxx                    |    9 --
 starmath/source/smdetect.cxx                                       |   12 --
 20 files changed, 44 insertions(+), 288 deletions(-)

New commits:
commit 704f95e5255ff72bfb548d50d66d4da61dc483ef
Author: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date:   Wed Oct 23 14:35:10 2013 -0200

    fdo#54938: More uses of cppu::supportsService
    
    Change-Id: I90a7a07a43559b8d7e1d4b886b2624255200d46b
    Reviewed-on: https://gerrit.libreoffice.org/6406
    Tested-by: LibreOffice gerrit bot <gerrit at libreoffice.org>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx
index 90b5062..6678893 100644
--- a/animations/source/animcore/animcore.cxx
+++ b/animations/source/animcore/animcore.cxx
@@ -47,6 +47,7 @@
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/servicehelper.hxx>
 #include <cppuhelper/interfacecontainer.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <cppuhelper/weakref.hxx>
 
 #include <cppuhelper/implbase1.hxx>
@@ -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 bf70b6e..b9e76a2 100644
--- a/avmedia/source/framework/soundhandler.cxx
+++ b/avmedia/source/framework/soundhandler.cxx
@@ -29,6 +29,7 @@
 
 #include <cppuhelper/typeprovider.hxx>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 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 86738b6..c9dd46d 100644
--- a/basctl/source/accessibility/accessibledialogcontrolshape.cxx
+++ b/basctl/source/accessibility/accessibledialogcontrolshape.cxx
@@ -25,6 +25,7 @@
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <toolkit/awt/vclxfont.hxx>
@@ -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 21e9950..ee17047 100644
--- a/basctl/source/accessibility/accessibledialogwindow.cxx
+++ b/basctl/source/accessibility/accessibledialogwindow.cxx
@@ -29,6 +29,7 @@
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <toolkit/awt/vclxfont.hxx>
@@ -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 24105f3..34182b3 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 <cppuhelper/supportsservice.hxx>
 #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 e88be55..7a8de19 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 <cppuhelper/supportsservice.hxx>
 #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 a56e5b9..9124b75 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 <cppuhelper/supportsservice.hxx>
 #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 686704e..60f428f 100644
--- a/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
+++ b/lingucomponent/source/hyphenator/altlinuxhyph/hyphen/hyphenimp.cxx
@@ -21,6 +21,7 @@
 #include <com/sun/star/linguistic2/XSearchableDictionaryList.hpp>
 
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <i18nlangtag/languagetag.hxx>
 #include <tools/debug.hxx>
@@ -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 e6406d2..a65ec51 100644
--- a/lingucomponent/source/languageguessing/guesslang.cxx
+++ b/lingucomponent/source/languageguessing/guesslang.cxx
@@ -26,6 +26,7 @@
 #include <cppuhelper/factory.hxx>
 #include <cppuhelper/implementationentry.hxx>
 #include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <simpleguesser.hxx>
 #include <guess.hxx>
@@ -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<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames(  )
     throw(RuntimeException)
 {
@@ -375,16 +367,12 @@ Sequence<OUString> SAL_CALL LangGuess_Impl::getSupportedServiceNames(  )
     return getSupportedServiceNames_Static();
 }
 
-//*************************************************************************
 Sequence<OUString> 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 c862fcc..9bed126 100644
--- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
+++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm
@@ -22,6 +22,7 @@
 
 #include <com/sun/star/linguistic2/SpellFailure.hpp>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <tools/debug.hxx>
 #include <osl/mutex.hxx>
@@ -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 c0e8410..cec8535 100644
--- a/lingucomponent/source/spellcheck/spell/sspellimp.cxx
+++ b/lingucomponent/source/spellcheck/spell/sspellimp.cxx
@@ -23,6 +23,7 @@
 
 #include <com/sun/star/linguistic2/SpellFailure.hpp>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <tools/debug.hxx>
 #include <osl/mutex.hxx>
@@ -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 132f03d..e549e45 100644
--- a/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
+++ b/lingucomponent/source/thesaurus/libnth/nthesimp.cxx
@@ -20,6 +20,7 @@
 
 #include <com/sun/star/uno/Reference.h>
 #include <cppuhelper/factory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/registry/XRegistryKey.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/linguistic2/LinguServiceManager.hpp>
@@ -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 42405d7..35f43d4 100644
--- a/shell/source/backends/localebe/localebackend.cxx
+++ b/shell/source/backends/localebe/localebackend.cxx
@@ -20,6 +20,7 @@
 
 #include "localebackend.hxx"
 #include <com/sun/star/beans/Optional.hpp>
+#include <cppuhelper/supportsservice.hxx>
 #include <osl/time.h>
 
 #include <stdio.h>
@@ -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<OUString> SAL_CALL LocaleBackend::getBackendServiceNames(void)
 {
     uno::Sequence<OUString> aServiceNameList(1);
@@ -328,22 +325,12 @@ uno::Sequence<OUString> 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<OUString> 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 e57013e..4a095ff 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 <cppuhelper/supportsservice.hxx>
 #include "rtl/ustrbuf.hxx"
 #include "osl/file.h"
 
@@ -447,8 +448,6 @@ rtl::OUString SAL_CALL MacOSXBackend::getImplementationName(void)
     return getBackendName();
 }
 
-//------------------------------------------------------------------------------
-
 uno::Sequence<rtl::OUString> SAL_CALL MacOSXBackend::getBackendServiceNames(void)
 {
     uno::Sequence<rtl::OUString> aServiceNameList(1);
@@ -457,22 +456,12 @@ uno::Sequence<rtl::OUString> 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<rtl::OUString> 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 559eb0e..69b8f28 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 <cppuhelper/supportsservice.hxx>
 #include "rtl/ustrbuf.hxx"
 
 #include "wininetbackend.hxx"
@@ -374,8 +374,6 @@ OUString SAL_CALL WinInetBackend::getImplementationName(void)
     return getBackendName() ;
 }
 
-//------------------------------------------------------------------------------
-
 uno::Sequence<OUString> SAL_CALL WinInetBackend::getBackendServiceNames(void)
 {
     uno::Sequence<OUString> aServiceNameList(1);
@@ -384,22 +382,12 @@ uno::Sequence<OUString> 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<OUString> SAL_CALL WinInetBackend::getSupportedServiceNames(void)
     throw (uno::RuntimeException)
 {
diff --git a/shell/source/cmdmail/cmdmailsuppl.cxx b/shell/source/cmdmail/cmdmailsuppl.cxx
index 90f5e8a..ab670af 100644
--- a/shell/source/cmdmail/cmdmailsuppl.cxx
+++ b/shell/source/cmdmail/cmdmailsuppl.cxx
@@ -34,6 +34,7 @@
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/uno/XComponentContext.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #include <string.h>
 #include <errno.h>
@@ -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 3f97806..b313867 100644
--- a/shell/source/unix/exec/shellexec.cxx
+++ b/shell/source/unix/exec/shellexec.cxx
@@ -33,6 +33,7 @@
 #include <com/sun/star/uri/XExternalUriReferenceTranslator.hpp>
 #include <com/sun/star/uri/ExternalUriReferenceTranslator.hpp>
 #include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #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 b081607..1a39e9a 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -24,6 +24,7 @@
 
 #include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/uri/UriReferenceFactory.hpp>
+#include <cppuhelper/supportsservice.hxx>
 
 #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 6106994..6f530db 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 <cppuhelper/supportsservice.hxx>
 #include <osl/diagnose.h>
 #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 <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);
 }
 
 Sequence<OUString> SAL_CALL CSmplMailSuppl::getSupportedServiceNames()
diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index be21c53..ca9453a 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -26,6 +26,7 @@
 #include <com/sun/star/awt/XWindow.hpp>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <comphelper/processfactory.hxx>
+#include <cppuhelper/supportsservice.hxx>
 #include <com/sun/star/io/XInputStream.hpp>
 #include <com/sun/star/task/XInteractionHandler.hpp>
 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
@@ -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<seqServiceNames.getLength(); nCounter++ )
-    {
-        if ( pArray[nCounter] == sServiceName )
-        {
-            return sal_True ;
-        }
-    }
-    return sal_False ;
+    return cppu::supportsService(this, sServiceName);
 }
 
 /* XServiceInfo */


More information about the Libreoffice-commits mailing list