diff options
29 files changed, 60 insertions, 259 deletions
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index 70e88d357292..fa71d3615b48 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -61,6 +61,7 @@ #include <com/sun/star/deployment/ExtensionManager.hpp> #include <comphelper/storagehelper.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/supportsservice.hxx> #include <basic/sbmod.hxx> #include <boost/scoped_ptr.hpp> @@ -2971,20 +2972,9 @@ sal_Bool SAL_CALL SfxLibraryContainer::supportsService( const OUString& _rServic throw (RuntimeException) { LibraryContainerMethodGuard aGuard( *this ); - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - const OUString* pSupportedServices = aSupportedServices.getConstArray(); - for ( sal_Int32 i=0; i<aSupportedServices.getLength(); ++i, ++pSupportedServices ) - { - if ( *pSupportedServices == _rServiceName ) - { - return sal_True; - } - } - return sal_False; + return cppu::supportsService(this, _rServiceName); } -//============================================================================ - // Implementation class SfxLibrary // Ctor diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index 1896a6059b59..87c863448c0f 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -32,6 +32,7 @@ #include <cppuhelper/compbase3.hxx> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/supportsservice.hxx> #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <typelib/typedescription.hxx> @@ -693,14 +694,9 @@ namespace comphelper return getImplementationName_static(); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL EnumerableMap::supportsService( const OUString& _serviceName ) throw (RuntimeException) { - Sequence< OUString > aServices( getSupportedServiceNames() ); - for ( sal_Int32 i=0; i<aServices.getLength(); ++i ) - if ( _serviceName == aServices[i] ) - return sal_True; - return sal_False; + return cppu::supportsService(this, _serviceName); } //-------------------------------------------------------------------- diff --git a/comphelper/source/misc/documentiologring.cxx b/comphelper/source/misc/documentiologring.cxx index 28df327710d9..5b943643bf2b 100644 --- a/comphelper/source/misc/documentiologring.cxx +++ b/comphelper/source/misc/documentiologring.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <comphelper_module.hxx> +#include <cppuhelper/supportsservice.hxx> #include "documentiologring.hxx" @@ -135,26 +136,16 @@ void SAL_CALL OSimpleLogRing::initialize( const uno::Sequence< uno::Any >& aArgu } // XServiceInfo -// ---------------------------------------------------------- OUString SAL_CALL OSimpleLogRing::getImplementationName() throw (uno::RuntimeException) { return getImplementationName_static(); } -// ---------------------------------------------------------- ::sal_Bool SAL_CALL OSimpleLogRing::supportsService( const OUString& aServiceName ) throw (uno::RuntimeException) { - const uno::Sequence< OUString > & aSupportedNames = getSupportedServiceNames_static(); - for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ ) - { - if ( aSupportedNames[ nInd ].equals( aServiceName ) ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, aServiceName); } -// ---------------------------------------------------------- uno::Sequence< OUString > SAL_CALL OSimpleLogRing::getSupportedServiceNames() throw (uno::RuntimeException) { return getSupportedServiceNames_static(); diff --git a/comphelper/source/misc/ihwrapnofilter.cxx b/comphelper/source/misc/ihwrapnofilter.cxx index 7999bbdcc835..f16fc51d9b72 100644 --- a/comphelper/source/misc/ihwrapnofilter.cxx +++ b/comphelper/source/misc/ihwrapnofilter.cxx @@ -19,6 +19,7 @@ #include "comphelper/ihwrapnofilter.hxx" +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/document/NoSuchFilterRequest.hpp> //......................................................................... @@ -98,10 +99,7 @@ namespace comphelper { } - //---------------------------------------------------------------------------------------------------- // XServiceInfo - //---------------------------------------------------------------------------------------------------- - OUString SAL_CALL OIHWrapNoFilterDialog::getImplementationName() throw ( uno::RuntimeException ) { @@ -111,13 +109,7 @@ namespace comphelper ::sal_Bool SAL_CALL OIHWrapNoFilterDialog::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName == aSeq[nInd] ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL OIHWrapNoFilterDialog::getSupportedServiceNames() diff --git a/comphelper/source/misc/instancelocker.cxx b/comphelper/source/misc/instancelocker.cxx index f14be18a0ba1..b25690829fcf 100644 --- a/comphelper/source/misc/instancelocker.cxx +++ b/comphelper/source/misc/instancelocker.cxx @@ -19,6 +19,7 @@ #include "comphelper_module.hxx" +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/util/XCloseBroadcaster.hpp> #include <com/sun/star/util/XCloseable.hpp> @@ -187,29 +188,19 @@ void SAL_CALL OInstanceLocker::initialize( const uno::Sequence< uno::Any >& aArg m_bInitialized = sal_True; } - // XServiceInfo -// -------------------------------------------------------- OUString SAL_CALL OInstanceLocker::getImplementationName( ) throw (uno::RuntimeException) { return getImplementationName_static(); } -// -------------------------------------------------------- ::sal_Bool SAL_CALL OInstanceLocker::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException) { - uno::Sequence< OUString > aSeq = getSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName == aSeq[nInd] ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -// -------------------------------------------------------- uno::Sequence< OUString > SAL_CALL OInstanceLocker::getSupportedServiceNames() throw (uno::RuntimeException) { diff --git a/comphelper/source/misc/officerestartmanager.cxx b/comphelper/source/misc/officerestartmanager.cxx index 8bde58a3b321..e3a03989b096 100644 --- a/comphelper/source/misc/officerestartmanager.cxx +++ b/comphelper/source/misc/officerestartmanager.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/beans/XPropertySet.hpp> #include <comphelper_module.hxx> +#include <cppuhelper/supportsservice.hxx> #include "officerestartmanager.hxx" using namespace ::com::sun::star; @@ -168,20 +169,11 @@ OUString SAL_CALL OOfficeRestartManager::getImplementationName() throw (uno::Run return getImplementationName_static(); } -// ---------------------------------------------------------- ::sal_Bool SAL_CALL OOfficeRestartManager::supportsService( const OUString& aServiceName ) throw (uno::RuntimeException) { - const uno::Sequence< OUString > & aSupportedNames = getSupportedServiceNames_static(); - for ( sal_Int32 nInd = 0; nInd < aSupportedNames.getLength(); nInd++ ) - { - if ( aSupportedNames[ nInd ].equals( aServiceName ) ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, aServiceName); } -// ---------------------------------------------------------- uno::Sequence< OUString > SAL_CALL OOfficeRestartManager::getSupportedServiceNames() throw (uno::RuntimeException) { return getSupportedServiceNames_static(); diff --git a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx index 43f38bca37e2..e5962c7c3973 100644 --- a/comphelper/source/officeinstdir/officeinstallationdirectories.cxx +++ b/comphelper/source/officeinstdir/officeinstallationdirectories.cxx @@ -20,6 +20,7 @@ #include <config_folders.h> #include "comphelper_module.hxx" +#include <cppuhelper/supportsservice.hxx> /************************************************************************** TODO @@ -216,25 +217,14 @@ OfficeInstallationDirectories::getImplementationName() return getImplementationName_static(); } -//========================================================================= // virtual sal_Bool SAL_CALL OfficeInstallationDirectories::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - const uno::Sequence< OUString > & aNames - = getSupportedServiceNames(); - const OUString * p = aNames.getConstArray(); - for ( sal_Int32 nPos = 0; nPos < aNames.getLength(); nPos++ ) - { - if ( p[ nPos ].equals( ServiceName ) ) - return sal_True; - } - return sal_False; - + return cppu::supportsService(this, ServiceName); } -//========================================================================= // virtual uno::Sequence< OUString > SAL_CALL OfficeInstallationDirectories::getSupportedServiceNames() diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index 831dc5908e00..fd052bbf9105 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -21,6 +21,7 @@ #include <com/sun/star/lang/XTypeProvider.hpp> #include <cppuhelper/weakagg.hxx> #include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/supportsservice.hxx> #include <comphelper/propertysethelper.hxx> #include <osl/mutex.hxx> #include <comphelper/genericpropertyset.hxx> @@ -252,17 +253,9 @@ uno::Sequence< sal_Int8 > SAL_CALL GenericPropertySet::getImplementationId() } // XServiceInfo - sal_Bool SAL_CALL GenericPropertySet::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - 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); } OUString SAL_CALL GenericPropertySet::getImplementationName() throw( RuntimeException ) diff --git a/comphelper/source/property/opropertybag.cxx b/comphelper/source/property/opropertybag.cxx index d54fdf3c2559..86cf28c7cb3d 100644 --- a/comphelper/source/property/opropertybag.cxx +++ b/comphelper/source/property/opropertybag.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/beans/Property.hpp> #include <comphelper/namedvaluecollection.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/exc_hlp.hxx> #include <osl/thread.h> @@ -142,13 +143,9 @@ namespace comphelper return getImplementationName_static(); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL OPropertyBag::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - Sequence< OUString > aServices( getSupportedServiceNames_static() ); - const OUString* pStart = aServices.getConstArray(); - const OUString* pEnd = aServices.getConstArray() + aServices.getLength(); - return ::std::find( pStart, pEnd, rServiceName ) != pEnd; + return cppu::supportsService(this, rServiceName); } //-------------------------------------------------------------------- diff --git a/comphelper/source/streaming/seqinputstreamserv.cxx b/comphelper/source/streaming/seqinputstreamserv.cxx index de10a03d686d..22986e58767e 100644 --- a/comphelper/source/streaming/seqinputstreamserv.cxx +++ b/comphelper/source/streaming/seqinputstreamserv.cxx @@ -26,6 +26,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implbase3.hxx> +#include <cppuhelper/supportsservice.hxx> #include <comphelper/seqstream.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/io/XSeekableInputStream.hpp> @@ -102,12 +103,7 @@ OUString SAL_CALL SequenceInputStreamService::getImplementationName_static() ::sal_Bool SAL_CALL SequenceInputStreamService::supportsService( OUString const & serviceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > serviceNames = getSupportedServiceNames(); - for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) { - if ( serviceNames[i] == serviceName ) - return sal_True; - } - return sal_False; + return cppu::supportsService(this, serviceName); } uno::Sequence< OUString > SAL_CALL SequenceInputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException ) diff --git a/comphelper/source/streaming/seqoutputstreamserv.cxx b/comphelper/source/streaming/seqoutputstreamserv.cxx index 1acb945f2e11..c5026f84d99b 100644 --- a/comphelper/source/streaming/seqoutputstreamserv.cxx +++ b/comphelper/source/streaming/seqoutputstreamserv.cxx @@ -25,6 +25,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/implementationentry.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <comphelper/seqstream.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/io/XSequenceOutputStream.hpp> @@ -88,12 +89,7 @@ OUString SAL_CALL SequenceOutputStreamService::getImplementationName_static() ::sal_Bool SAL_CALL SequenceOutputStreamService::supportsService( OUString const & serviceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > serviceNames = getSupportedServiceNames(); - for ( ::sal_Int32 i = 0; i < serviceNames.getLength(); ++i ) { - if ( serviceNames[i] == serviceName ) - return sal_True; - } - return sal_False; + return cppu::supportsService(this, serviceName); } uno::Sequence< OUString > SAL_CALL SequenceOutputStreamService::getSupportedServiceNames() throw ( uno::RuntimeException ) diff --git a/configmgr/source/access.cxx b/configmgr/source/access.cxx index a181d6216583..7ee8a033f32d 100644 --- a/configmgr/source/access.cxx +++ b/configmgr/source/access.cxx @@ -73,6 +73,7 @@ #include "cppu/unotype.hxx" #include "cppuhelper/queryinterface.hxx" #include "cppuhelper/weak.hxx" +#include <cppuhelper/supportsservice.hxx> #include "osl/interlck.h" #include "osl/mutex.hxx" #include "rtl/ref.hxx" @@ -224,13 +225,7 @@ sal_Bool Access::supportsService(OUString const & ServiceName) assert(thisIs(IS_ANY)); osl::MutexGuard g(*lock_); checkLocalizedPropertyAccess(); - css::uno::Sequence< OUString > names(getSupportedServiceNames()); - for (sal_Int32 i = 0; i < names.getLength(); ++i) { - if (names[i] == ServiceName) { - return true; - } - } - return false; + return cppu::supportsService(this, ServiceName); } css::uno::Sequence< OUString > Access::getSupportedServiceNames() diff --git a/dbaccess/source/core/misc/DatabaseDataProvider.cxx b/dbaccess/source/core/misc/DatabaseDataProvider.cxx index ec944266bbd6..0666f609a8cf 100644 --- a/dbaccess/source/core/misc/DatabaseDataProvider.cxx +++ b/dbaccess/source/core/misc/DatabaseDataProvider.cxx @@ -20,8 +20,10 @@ #include "DatabaseDataProvider.hxx" #include "dbastrings.hrc" #include "cppuhelper/implbase1.hxx" +#include <cppuhelper/supportsservice.hxx> #include <comphelper/types.hxx> #include <comphelper/namedvaluecollection.hxx> +#include <comphelper/namedvaluecollection.hxx> #include <connectivity/FValue.hxx> #include <connectivity/dbtools.hxx> #include <rtl/ustrbuf.hxx> @@ -119,7 +121,7 @@ OUString SAL_CALL DatabaseDataProvider::getImplementationName( ) throw(uno::Run sal_Bool SAL_CALL DatabaseDataProvider::supportsService( const OUString& _rServiceName ) throw(uno::RuntimeException) { - return ::comphelper::findValue(getSupportedServiceNames(), _rServiceName, sal_True).getLength() != 0; + return cppu::supportsService(this, _rServiceName); } uno::Sequence< OUString > DatabaseDataProvider::getSupportedServiceNames_Static( ) throw (uno::RuntimeException) diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index 9f4bc18c0e2d..3b38fffa2f14 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -59,6 +59,7 @@ #include <comphelper/storagehelper.hxx> #include <comphelper/types.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <osl/file.hxx> #include <sfx2/docfile.hxx> #include <unotools/moduleoptions.hxx> @@ -195,13 +196,7 @@ OUString SAL_CALL DBTypeDetection::getImplementationName() throw( ) // XServiceInfo sal_Bool SAL_CALL DBTypeDetection::supportsService(const OUString& ServiceName) throw( ) { - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pBegin = aSNL.getConstArray(); - const OUString * pEnd = pBegin + aSNL.getLength(); - for( ; pBegin != pEnd; ++pBegin) - if( *pBegin == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } // XServiceInfo diff --git a/dbaccess/source/sdbtools/connection/connectiontools.cxx b/dbaccess/source/sdbtools/connection/connectiontools.cxx index cc89afb70436..cd212eab1780 100644 --- a/dbaccess/source/sdbtools/connection/connectiontools.cxx +++ b/dbaccess/source/sdbtools/connection/connectiontools.cxx @@ -23,6 +23,7 @@ #include "datasourcemetadata.hxx" #include <comphelper/namedvaluecollection.hxx> +#include <cppuhelper/supportsservice.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/statementcomposer.hxx> @@ -102,10 +103,7 @@ namespace sdbtools ::sal_Bool SAL_CALL ConnectionTools::supportsService(const OUString & _ServiceName) throw (RuntimeException) { - Sequence< OUString > aSupported( getSupportedServiceNames() ); - const OUString* begin = aSupported.getConstArray(); - const OUString* end = aSupported.getConstArray() + aSupported.getLength(); - return ::std::find( begin, end, _ServiceName ) != end; + return cppu::supportsService(this, _ServiceName); } Sequence< OUString > SAL_CALL ConnectionTools::getSupportedServiceNames() throw (RuntimeException) diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 7f90c9260900..3b0b795a71e6 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -42,6 +42,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/awt/vclxwindow.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <tools/diagnose_ex.h> @@ -126,13 +127,7 @@ OUString SAL_CALL DBContentLoader::getImplementationName() throw( ) // XServiceInfo sal_Bool SAL_CALL DBContentLoader::supportsService(const OUString& ServiceName) throw( ) { - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pBegin = aSNL.getConstArray(); - const OUString * pEnd = pBegin + aSNL.getLength(); - for( ; pBegin != pEnd; ++pBegin) - if( *pBegin == ServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } // XServiceInfo diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 8a604022f7aa..5ea4421708f2 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -33,6 +33,7 @@ #include <framework/titlehelper.hxx> #include <comphelper/sequence.hxx> #include <comphelper/extract.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/sdbc/XDataSource.hpp> #include <com/sun/star/sdb/DatabaseContext.hpp> #include <com/sun/star/sdb/SQLContext.hpp> @@ -960,14 +961,7 @@ bool OGenericUnoController::isUserDefinedFeature( const OUString& _rFeatureURL ) sal_Bool SAL_CALL OGenericUnoController::supportsService(const OUString& ServiceName) throw(RuntimeException) { - Sequence< OUString > aSupported(getSupportedServiceNames()); - - const OUString* pArray = aSupported.getConstArray(); - const OUString* pArrayEnd = aSupported.getConstArray() + aSupported.getLength(); - - for ( ;( pArray != pArrayEnd ) && !pArray->equals( ServiceName ); ++pArray ) - ; - return pArray != pArrayEnd; + return cppu::supportsService(this, ServiceName); } void OGenericUnoController::startConnectionListening(const Reference< XConnection >& _rxConnection) diff --git a/oox/source/core/fasttokenhandler.cxx b/oox/source/core/fasttokenhandler.cxx index c71f966b587c..f57739c92d1c 100644 --- a/oox/source/core/fasttokenhandler.cxx +++ b/oox/source/core/fasttokenhandler.cxx @@ -22,17 +22,13 @@ #include <com/sun/star/uno/XComponentContext.hpp> #include "oox/helper/helper.hxx" #include "oox/token/tokenmap.hxx" +#include <cppuhelper/supportsservice.hxx> namespace oox { namespace core { -// ============================================================================ - using namespace ::com::sun::star::uno; - -// ============================================================================ - OUString SAL_CALL FastTokenHandler_getImplementationName() { return OUString( "com.sun.star.comp.oox.core.FastTokenHandler" ); @@ -50,8 +46,6 @@ Reference< XInterface > SAL_CALL FastTokenHandler_createInstance( const Referenc return static_cast< ::cppu::OWeakObject* >( new FastTokenHandler ); } -// ============================================================================ - FastTokenHandler::FastTokenHandler() : mrTokenMap( StaticTokenMap::get() ) { @@ -62,7 +56,6 @@ FastTokenHandler::~FastTokenHandler() } // XServiceInfo - OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeException) { return FastTokenHandler_getImplementationName(); @@ -70,11 +63,7 @@ OUString SAL_CALL FastTokenHandler::getImplementationName() throw (RuntimeExcept sal_Bool SAL_CALL FastTokenHandler::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - Sequence< OUString > aServiceNames = FastTokenHandler_getSupportedServiceNames(); - for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex ) - if( aServiceNames[ nIndex ] == rServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw (RuntimeException) @@ -83,7 +72,6 @@ Sequence< OUString > SAL_CALL FastTokenHandler::getSupportedServiceNames() throw } // XFastTokenHandler - sal_Int32 FastTokenHandler::getToken( const OUString& rIdentifier ) throw( RuntimeException ) { return mrTokenMap.getTokenFromUnicode( rIdentifier ); diff --git a/oox/source/core/filterdetect.cxx b/oox/source/core/filterdetect.cxx index 154cee0d8bde..ffa44a39c56f 100644 --- a/oox/source/core/filterdetect.cxx +++ b/oox/source/core/filterdetect.cxx @@ -23,6 +23,7 @@ #include <com/sun/star/io/XStream.hpp> #include <comphelper/docpasswordhelper.hxx> #include <comphelper/mediadescriptor.hxx> +#include <cppuhelper/supportsservice.hxx> #include "oox/core/fastparser.hxx" #include "oox/helper/attributelist.hxx" @@ -382,10 +383,7 @@ OUString SAL_CALL FilterDetect::getImplementationName() throw( RuntimeException sal_Bool SAL_CALL FilterDetect::supportsService( const OUString& rServiceName ) throw( RuntimeException ) { - const Sequence< OUString > aServices = FilterDetect_getSupportedServiceNames(); - const OUString* pArray = aServices.getConstArray(); - const OUString* pArrayEnd = pArray + aServices.getLength(); - return ::std::find( pArray, pArrayEnd, rServiceName ) != pArrayEnd; + return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL FilterDetect::getSupportedServiceNames() throw( RuntimeException ) diff --git a/oox/source/docprop/ooxmldocpropimport.cxx b/oox/source/docprop/ooxmldocpropimport.cxx index f4d3092e83ee..2361bd1ccd74 100644 --- a/oox/source/docprop/ooxmldocpropimport.cxx +++ b/oox/source/docprop/ooxmldocpropimport.cxx @@ -30,11 +30,11 @@ #include "oox/helper/helper.hxx" #include "docprophandler.hxx" +#include <cppuhelper/supportsservice.hxx> + namespace oox { namespace docprop { -// ============================================================================ - using namespace ::com::sun::star::beans; using namespace ::com::sun::star::document; using namespace ::com::sun::star::embed; @@ -43,9 +43,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; - -// ============================================================================ - OUString SAL_CALL DocumentPropertiesImport_getImplementationName() { return OUString( "com.sun.star.comp.oox.docprop.DocumentPropertiesImporter" ); @@ -63,8 +60,6 @@ Reference< XInterface > SAL_CALL DocumentPropertiesImport_createInstance( const return static_cast< ::cppu::OWeakObject* >( new DocumentPropertiesImport( rxContext ) ); } -// ============================================================================ - namespace { Sequence< InputSource > lclGetRelatedStreams( const Reference< XStorage >& rxStorage, const OUString& rStreamType ) throw (RuntimeException) @@ -103,15 +98,12 @@ Sequence< InputSource > lclGetRelatedStreams( const Reference< XStorage >& rxSto } // namespace -// ============================================================================ - DocumentPropertiesImport::DocumentPropertiesImport( const Reference< XComponentContext >& rxContext ) : mxContext( rxContext ) { } // XServiceInfo - OUString SAL_CALL DocumentPropertiesImport::getImplementationName() throw (RuntimeException) { return DocumentPropertiesImport_getImplementationName(); @@ -119,11 +111,7 @@ OUString SAL_CALL DocumentPropertiesImport::getImplementationName() throw (Runti sal_Bool SAL_CALL DocumentPropertiesImport::supportsService( const OUString& rServiceName ) throw (RuntimeException) { - Sequence< OUString > aServiceNames = DocumentPropertiesImport_getSupportedServiceNames(); - for( sal_Int32 nIndex = 0, nLength = aServiceNames.getLength(); nIndex < nLength; ++nIndex ) - if( aServiceNames[ nIndex ] == rServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, rServiceName); } Sequence< OUString > SAL_CALL DocumentPropertiesImport::getSupportedServiceNames() throw (RuntimeException) @@ -132,7 +120,6 @@ Sequence< OUString > SAL_CALL DocumentPropertiesImport::getSupportedServiceNames } // XOOXMLDocumentPropertiesImporter - void SAL_CALL DocumentPropertiesImport::importProperties( const Reference< XStorage >& rxSource, const Reference< XDocumentProperties >& rxDocumentProperties ) throw (RuntimeException, IllegalArgumentException, SAXException, Exception) diff --git a/svl/source/fsstor/fsfactory.cxx b/svl/source/fsstor/fsfactory.cxx index 2396bf0e3b99..c10b445495ff 100644 --- a/svl/source/fsstor/fsfactory.cxx +++ b/svl/source/fsstor/fsfactory.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/embed/ElementModes.hpp> #include <com/sun/star/io/XSeekable.hpp> #include <comphelper/processfactory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <ucbhelper/fileidentifierconverter.hxx> #include <ucbhelper/content.hxx> @@ -168,13 +169,7 @@ OUString SAL_CALL FSStorageFactory::getImplementationName() sal_Bool SAL_CALL FSStorageFactory::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName == aSeq[nInd] ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } uno::Sequence< OUString > SAL_CALL FSStorageFactory::getSupportedServiceNames() diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index 1f6515a5e143..16f3e507ff24 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -24,6 +24,7 @@ #include <vcl/graphicfilter.hxx> #include <svl/itemprop.hxx> #include <comphelper/servicehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/beans/PropertyState.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> @@ -245,19 +246,10 @@ OUString SAL_CALL GraphicDescriptor::getImplementationName() return getImplementationName_Static(); } -// ------------------------------------------------------------------------------ - sal_Bool SAL_CALL GraphicDescriptor::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString* pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/graphic/renderer.cxx b/svtools/source/graphic/renderer.cxx index 95097fbe7bd1..7d687ef96dce 100644 --- a/svtools/source/graphic/renderer.cxx +++ b/svtools/source/graphic/renderer.cxx @@ -25,6 +25,7 @@ #include <vcl/svapp.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <comphelper/propertysetinfo.hxx> +#include <cppuhelper/supportsservice.hxx> #include <svl/itemprop.hxx> #include <svtools/grfmgr.hxx> #include <comphelper/servicehelper.hxx> @@ -139,19 +140,10 @@ OUString SAL_CALL GraphicRendererVCL::getImplementationName() return getImplementationName_Static(); } -// ------------------------------------------------------------------------------ - sal_Bool SAL_CALL GraphicRendererVCL::supportsService( const OUString& ServiceName ) throw( uno::RuntimeException ) { - uno::Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString* pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } // ------------------------------------------------------------------------------ diff --git a/svtools/source/hatchwindow/documentcloser.cxx b/svtools/source/hatchwindow/documentcloser.cxx index e0de3c2ed98a..9bd174609642 100644 --- a/svtools/source/hatchwindow/documentcloser.cxx +++ b/svtools/source/hatchwindow/documentcloser.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp> #include <com/sun/star/awt/XVclWindowPeer.hpp> #include <comphelper/processfactory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <osl/thread.hxx> #include <vcl/svapp.hxx> @@ -220,29 +221,19 @@ void SAL_CALL ODocumentCloser::initialize( const uno::Sequence< uno::Any >& aArg m_bInitialized = sal_True; } - // XServiceInfo -// -------------------------------------------------------- OUString SAL_CALL ODocumentCloser::getImplementationName( ) throw (uno::RuntimeException) { return impl_staticGetImplementationName(); } -// -------------------------------------------------------- ::sal_Bool SAL_CALL ODocumentCloser::supportsService( const OUString& ServiceName ) throw (uno::RuntimeException) { - uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName == aSeq[nInd] ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -// -------------------------------------------------------- uno::Sequence< OUString > SAL_CALL ODocumentCloser::getSupportedServiceNames() throw (uno::RuntimeException) { @@ -250,14 +241,12 @@ uno::Sequence< OUString > SAL_CALL ODocumentCloser::getSupportedServiceNames() } // Static methods -// -------------------------------------------------------- uno::Sequence< OUString > SAL_CALL ODocumentCloser::impl_staticGetSupportedServiceNames() { const OUString aServiceName( "com.sun.star.embed.DocumentCloser" ); return uno::Sequence< OUString >( &aServiceName, 1 ); } -// -------------------------------------------------------- OUString SAL_CALL ODocumentCloser::impl_staticGetImplementationName() { return OUString( "com.sun.star.comp.embed.DocumentCloser" ); diff --git a/svtools/source/hatchwindow/hatchwindowfactory.cxx b/svtools/source/hatchwindow/hatchwindowfactory.cxx index 51566f408fba..b4bb86298104 100644 --- a/svtools/source/hatchwindow/hatchwindowfactory.cxx +++ b/svtools/source/hatchwindow/hatchwindowfactory.cxx @@ -21,6 +21,7 @@ #include "hatchwindowfactory.hxx" #include "hatchwindow.hxx" #include "cppuhelper/factory.hxx" +#include <cppuhelper/supportsservice.hxx> #include <vcl/svapp.hxx> #include "documentcloser.hxx" @@ -66,35 +67,24 @@ uno::Reference< embed::XHatchWindow > SAL_CALL OHatchWindowFactory::createHatchW return uno::Reference< embed::XHatchWindow >( static_cast< embed::XHatchWindow* >( pResult ) ); } -//------------------------------------------------------------------------- OUString SAL_CALL OHatchWindowFactory::getImplementationName() throw ( uno::RuntimeException ) { return impl_staticGetImplementationName(); } -//------------------------------------------------------------------------- sal_Bool SAL_CALL OHatchWindowFactory::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > aSeq = impl_staticGetSupportedServiceNames(); - - for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ ) - if ( ServiceName == aSeq[nInd] ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } -//------------------------------------------------------------------------- uno::Sequence< OUString > SAL_CALL OHatchWindowFactory::getSupportedServiceNames() throw ( uno::RuntimeException ) { return impl_staticGetSupportedServiceNames(); } -//------------------------------------------------------------------------- - extern "C" { diff --git a/svtools/source/uno/genericunodialog.cxx b/svtools/source/uno/genericunodialog.cxx index 22d4d52123f5..2e821bf42937 100644 --- a/svtools/source/uno/genericunodialog.cxx +++ b/svtools/source/uno/genericunodialog.cxx @@ -25,6 +25,7 @@ #include <toolkit/awt/vclxwindow.hxx> #include <comphelper/extract.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <comphelper/property.hxx> #include <osl/diagnose.h> @@ -97,15 +98,9 @@ Sequence<Type> SAL_CALL OGenericUnoDialog::getTypes( ) throw(RuntimeException) ); } -//------------------------------------------------------------------------- sal_Bool SAL_CALL OGenericUnoDialog::supportsService(const OUString& ServiceName) throw(RuntimeException) { - Sequence< OUString > aSupported(getSupportedServiceNames()); - const OUString* pArray = aSupported.getConstArray(); - for (sal_Int32 i = 0; i < aSupported.getLength(); ++i, ++pArray) - if (pArray->equals(ServiceName)) - return sal_True; - return sal_False; + return cppu::supportsService(this, ServiceName); } //------------------------------------------------------------------------- diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 952b304d79d8..06953fbfa8e9 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -31,12 +31,7 @@ #include <rtl/ustrbuf.hxx> #include <osl/mutex.hxx> #include <comphelper/processfactory.hxx> - -//_________________________________________________________________________________________________________________ -// Defines -//_________________________________________________________________________________________________________________ -// - +#include <cppuhelper/supportsservice.hxx> using namespace com::sun::star; using namespace com::sun::star::uno; @@ -97,17 +92,9 @@ void SAL_CALL PopupMenuControllerBase::disposing() } // XServiceInfo - sal_Bool SAL_CALL PopupMenuControllerBase::supportsService( const OUString& ServiceName ) throw (RuntimeException) { - const Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } // XEventListener diff --git a/svtools/source/uno/popupwindowcontroller.cxx b/svtools/source/uno/popupwindowcontroller.cxx index 87846819092a..772577aa4f25 100644 --- a/svtools/source/uno/popupwindowcontroller.cxx +++ b/svtools/source/uno/popupwindowcontroller.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <vcl/toolbox.hxx> @@ -169,14 +169,7 @@ void SAL_CALL PopupWindowController::release() throw () // XServiceInfo sal_Bool SAL_CALL PopupWindowController::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - const Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == ServiceName ) - return true; - - return false; + return cppu::supportsService(this, ServiceName); } // XInitialization diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 7071d86d5e77..02e0bf250782 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -31,6 +31,7 @@ #include <comphelper/propertysetinfo.hxx> #include <cppuhelper/weakagg.hxx> #include <cppuhelper/implbase3.hxx> +#include <cppuhelper/supportsservice.hxx> #include <list> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> @@ -383,18 +384,9 @@ uno::Sequence< sal_Int8 > SAL_CALL SvUnoImageMapObject::getImplementationId() } // XServiceInfo - sal_Bool SAL_CALL SvUnoImageMapObject::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - const Sequence< OUString > aSNL( getSupportedServiceNames() ); - const OUString * pArray = aSNL.getConstArray(); - - const sal_Int32 nCount = aSNL.getLength(); - for( sal_Int32 i = 0; i < nCount; i++ ) - if( pArray[i] == ServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, ServiceName); } Sequence< OUString > SAL_CALL SvUnoImageMapObject::getSupportedServiceNames() |