diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-10-16 19:25:05 -0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-17 14:43:28 +0200 |
commit | 3d3293144b0e0d2d28136b1b2c7154d6352463b8 (patch) | |
tree | 1ef57838dc7fa88515a69dce12612e6071bc08b9 /comphelper/source | |
parent | 6fe26facd06d4d1e5e37384d25d83209209229fa (diff) |
fdo#54938: Adapt svtools and comphelper module ...
to use cppu::supportsService and other pieces.
Change-Id: I16893b3d31a8055acd214ff23d01e63d38fe0826
Signed-off-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'comphelper/source')
-rw-r--r-- | comphelper/source/container/enumerablemap.cxx | 8 | ||||
-rw-r--r-- | comphelper/source/misc/documentiologring.cxx | 13 | ||||
-rw-r--r-- | comphelper/source/misc/ihwrapnofilter.cxx | 12 | ||||
-rw-r--r-- | comphelper/source/misc/instancelocker.cxx | 13 | ||||
-rw-r--r-- | comphelper/source/misc/officerestartmanager.cxx | 12 | ||||
-rw-r--r-- | comphelper/source/officeinstdir/officeinstallationdirectories.cxx | 14 | ||||
-rw-r--r-- | comphelper/source/property/genericpropertyset.cxx | 11 | ||||
-rw-r--r-- | comphelper/source/property/opropertybag.cxx | 7 | ||||
-rw-r--r-- | comphelper/source/streaming/seqinputstreamserv.cxx | 8 | ||||
-rw-r--r-- | comphelper/source/streaming/seqoutputstreamserv.cxx | 8 |
10 files changed, 20 insertions, 86 deletions
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 ) |