diff options
19 files changed, 44 insertions, 220 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index fc33131b6f14..e1eb01f90847 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -67,6 +67,7 @@ #include <connectivity/dbtools.hxx> #include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <rtl/math.hxx> #include <rtl/tencinfo.h> #include <svl/inettype.hxx> @@ -3841,31 +3842,20 @@ Sequence< OUString > SAL_CALL ODatabaseForm::getSupportedServiceNames() throw( R // better solution _may_ be to return the compatible names at runtime, too } -//------------------------------------------------------------------------------ sal_Bool SAL_CALL ODatabaseForm::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); } -//============================================================================== // com::sun::star::io::XPersistObject -//------------------------------------------------------------------------------ - const sal_uInt16 CYCLE = 0x0001; const sal_uInt16 DONTAPPLYFILTER = 0x0002; -//------------------------------------------------------------------------------ OUString ODatabaseForm::getServiceName() throw( RuntimeException ) { return OUString(FRM_COMPONENT_FORM); // old (non-sun) name for compatibility ! } -//------------------------------------------------------------------------------ void SAL_CALL ODatabaseForm::write(const Reference<XObjectOutputStream>& _rxOutStream) throw( IOException, RuntimeException ) { DBG_ASSERT(m_xAggregateSet.is(), "ODatabaseForm::write : only to be called if the aggregate exists !"); diff --git a/forms/source/component/Filter.cxx b/forms/source/component/Filter.cxx index cfe14515fa8c..fa620deafb59 100644 --- a/forms/source/component/Filter.cxx +++ b/forms/source/component/Filter.cxx @@ -51,6 +51,7 @@ #include <comphelper/numbers.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/property.hxx> +#include <cppuhelper/supportsservice.hxx> #include <connectivity/dbconversion.hxx> #include <connectivity/dbtools.hxx> #include <connectivity/formattedcolumnvalue.hxx> @@ -873,36 +874,26 @@ namespace frm OSL_ENSURE( m_xConnection.is(), "OFilterControl::initialize: unable to determine the form's connection!" ); } - //--------------------------------------------------------------------- OUString SAL_CALL OFilterControl::getImplementationName( ) throw (RuntimeException) { return getImplementationName_Static(); } - //--------------------------------------------------------------------- sal_Bool SAL_CALL OFilterControl::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); } - //--------------------------------------------------------------------- Sequence< OUString > SAL_CALL OFilterControl::getSupportedServiceNames( ) throw (RuntimeException) { return getSupportedServiceNames_Static(); } - //--------------------------------------------------------------------- OUString SAL_CALL OFilterControl::getImplementationName_Static() { return OUString( "com.sun.star.comp.forms.OFilterControl" ); } - //--------------------------------------------------------------------- Sequence< OUString > SAL_CALL OFilterControl::getSupportedServiceNames_Static() { Sequence< OUString > aNames( 2 ); diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 1bd3acd35db6..7a23644b173a 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -44,6 +44,7 @@ #include <comphelper/property.hxx> #include <connectivity/dbtools.hxx> #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/emptyfontdescriptor.hxx> #include <tools/debug.hxx> #include <tools/diagnose_ex.h> @@ -226,7 +227,6 @@ void OControl::initFormControlPeer( const Reference< XWindowPeer >& /*_rxPeer*/ } // OComponentHelper -//------------------------------------------------------------------------------ void OControl::disposing() { OComponentHelper::disposing(); @@ -239,18 +239,11 @@ void OControl::disposing() } // XServiceInfo -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OControl::supportsService(const OUString& _rsServiceName) throw ( RuntimeException) { - Sequence<OUString> aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rsServiceName)) - return sal_True; - return sal_False; + return cppu::supportsService(this, _rsServiceName); } -//------------------------------------------------------------------------------ Sequence< OUString > OControl::getAggregateServiceNames() { Sequence< OUString > aAggServices; @@ -260,7 +253,6 @@ Sequence< OUString > OControl::getAggregateServiceNames() return aAggServices; } -//------------------------------------------------------------------------------ Sequence<OUString> SAL_CALL OControl::getSupportedServiceNames() throw(RuntimeException) { return ::comphelper::concatSequences( @@ -728,7 +720,6 @@ void SAL_CALL OControlModel::setParent(const Reference< XInterface >& _rxParent) } // XNamed -//------------------------------------------------------------------------------ OUString SAL_CALL OControlModel::getName() throw(RuntimeException) { OUString aReturn; @@ -736,25 +727,17 @@ OUString SAL_CALL OControlModel::getName() throw(RuntimeException) return aReturn; } -//------------------------------------------------------------------------------ void SAL_CALL OControlModel::setName(const OUString& _rName) throw(RuntimeException) { setFastPropertyValue(PROPERTY_ID_NAME, makeAny(_rName)); } // XServiceInfo -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OControlModel::supportsService(const OUString& _rServiceName) throw ( RuntimeException) { - Sequence<OUString> aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; - return sal_False; + return cppu::supportsService(this, _rServiceName); } -//------------------------------------------------------------------------------ Sequence< OUString > OControlModel::getAggregateServiceNames() { Sequence< OUString > aAggServices; @@ -764,7 +747,6 @@ Sequence< OUString > OControlModel::getAggregateServiceNames() return aAggServices; } -//------------------------------------------------------------------------------ Sequence<OUString> SAL_CALL OControlModel::getSupportedServiceNames() throw(RuntimeException) { return ::comphelper::concatSequences( @@ -773,7 +755,6 @@ Sequence<OUString> SAL_CALL OControlModel::getSupportedServiceNames() throw(Runt ); } -//------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL OControlModel::getSupportedServiceNames_Static() throw( RuntimeException ) { Sequence< OUString > aServiceNames( 2 ); diff --git a/forms/source/component/FormsCollection.cxx b/forms/source/component/FormsCollection.cxx index e4e0c06e0ad7..ad941fe790e4 100644 --- a/forms/source/component/FormsCollection.cxx +++ b/forms/source/component/FormsCollection.cxx @@ -22,6 +22,7 @@ #include "services.hxx" #include <comphelper/sequence.hxx> #include <comphelper/processfactory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <tools/debug.hxx> #include <com/sun/star/form/XForm.hpp> @@ -105,24 +106,16 @@ Any SAL_CALL OFormsCollection::queryAggregation(const Type& _rType) throw(Runtim return aReturn; } -//------------------------------------------------------------------------------ OUString SAL_CALL OFormsCollection::getImplementationName() throw(RuntimeException) { return OUString("com.sun.star.comp.forms.OFormsCollection"); } -//------------------------------------------------------------------------------ sal_Bool SAL_CALL OFormsCollection::supportsService( const OUString& _rServiceName ) throw(RuntimeException) { - Sequence<OUString> aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; i<aSupported.getLength(); ++i, ++pSupported) - if (pSupported->equals(_rServiceName)) - return sal_True; - return sal_False; + return cppu::supportsService(this, _rServiceName); } -//------------------------------------------------------------------------------ StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(RuntimeException) { StringSequence aReturn(2); @@ -134,7 +127,6 @@ StringSequence SAL_CALL OFormsCollection::getSupportedServiceNames() throw(Runti } // XCloneable -//------------------------------------------------------------------------------ Reference< XCloneable > SAL_CALL OFormsCollection::createClone( ) throw (RuntimeException) { OFormsCollection* pClone = new OFormsCollection( *this ); diff --git a/forms/source/runtime/formoperations.cxx b/forms/source/runtime/formoperations.cxx index 539026476279..e1b8acbe1cba 100644 --- a/forms/source/runtime/formoperations.cxx +++ b/forms/source/runtime/formoperations.cxx @@ -57,6 +57,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/supportsservice.hxx> #include <osl/mutex.hxx> #include <sal/macros.h> @@ -183,35 +184,27 @@ namespace frm throw IllegalArgumentException( OUString(), *this, 0 ); } - //-------------------------------------------------------------------- OUString SAL_CALL FormOperations::getImplementationName( ) throw (RuntimeException) { return getImplementationName_Static(); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL FormOperations::supportsService( const OUString& _ServiceName ) throw (RuntimeException) { - Sequence< OUString > aSupportedServiceNames( getSupportedServiceNames() ); - const OUString* pBegin = aSupportedServiceNames.getConstArray(); - const OUString* pEnd = aSupportedServiceNames.getConstArray() + aSupportedServiceNames.getLength(); - return ::std::find( pBegin, pEnd, _ServiceName ) != pEnd; + return cppu::supportsService(this, _ServiceName); } - //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL FormOperations::getSupportedServiceNames( ) throw (RuntimeException) { return getSupportedServiceNames_Static(); } - //-------------------------------------------------------------------- Reference< XRowSet > SAL_CALL FormOperations::getCursor() throw (RuntimeException) { MethodGuard aGuard( *this ); return m_xCursor; } - //-------------------------------------------------------------------- Reference< XResultSetUpdate > SAL_CALL FormOperations::getUpdateCursor() throw (RuntimeException) { MethodGuard aGuard( *this ); diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx index 762453bbb9eb..78d8145f8cd5 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SDriver.cxx @@ -33,6 +33,7 @@ * *************************************************************************/ +#include <cppuhelper/supportsservice.hxx> #include "SDriver.hxx" #include "SConnection.hxx" @@ -46,7 +47,6 @@ namespace connectivity { namespace skeleton { - //------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL SkeletonDriver_CreateInstance(const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxFactory) throw( ::com::sun::star::uno::Exception ) { return *(new SkeletonDriver()); @@ -83,7 +83,7 @@ rtl::OUString SkeletonDriver::getImplementationName_Static( ) throw(RuntimeExce // this name is referenced in the configuration and in the skeleton.xml // Please take care when changing it. } -//------------------------------------------------------------------------------ + Sequence< ::rtl::OUString > SkeletonDriver::getSupportedServiceNames_Static( ) throw (RuntimeException) { // which service is supported @@ -93,31 +93,21 @@ Sequence< ::rtl::OUString > SkeletonDriver::getSupportedServiceNames_Static( ) return aSNS; } -//------------------------------------------------------------------ ::rtl::OUString SAL_CALL SkeletonDriver::getImplementationName( ) throw(RuntimeException) { return getImplementationName_Static(); } -//------------------------------------------------------------------ sal_Bool SAL_CALL SkeletonDriver::supportsService( const ::rtl::OUString& _rServiceName ) throw(RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; + return cppu::supportsService(this, _rServiceName); } -//------------------------------------------------------------------ Sequence< ::rtl::OUString > SAL_CALL SkeletonDriver::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); } -// -------------------------------------------------------------------------------- Reference< XConnection > SAL_CALL SkeletonDriver::connect( const ::rtl::OUString& url, const Sequence< PropertyValue >& info ) throw(SQLException, RuntimeException) { // create a new connection with the given properties and append it to our vector diff --git a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx index 196f06182f17..63a029438b57 100644 --- a/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx +++ b/odk/examples/DevelopersGuide/Database/DriverSkeleton/SResultSet.cxx @@ -39,6 +39,7 @@ #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/sdbcx/CompareBookmark.hpp> #include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/supportsService.hxx> #include <com/sun/star/lang/DisposedException.hpp> #include "propertyids.hxx" @@ -53,13 +54,12 @@ using namespace com::sun::star::container; using namespace com::sun::star::io; using namespace com::sun::star::util; -//------------------------------------------------------------------------------ // IMPLEMENT_SERVICE_INFO(OResultSet,"com.sun.star.sdbcx.OResultSet","com.sun.star.sdbc.ResultSet"); ::rtl::OUString SAL_CALL OResultSet::getImplementationName( ) throw ( RuntimeException) \ { return ::rtl::OUString("com.sun.star.sdbcx.skeleton.ResultSet"); } -// ------------------------------------------------------------------------- + Sequence< ::rtl::OUString > SAL_CALL OResultSet::getSupportedServiceNames( ) throw( RuntimeException) { Sequence< ::rtl::OUString > aSupported(2); @@ -67,19 +67,12 @@ using namespace com::sun::star::util; aSupported[1] = ::rtl::OUString("com.sun.star.sdbcx.ResultSet"); return aSupported; } -// ------------------------------------------------------------------------- + sal_Bool SAL_CALL OResultSet::supportsService( const ::rtl::OUString& _rServiceName ) throw( RuntimeException) { - Sequence< ::rtl::OUString > aSupported(getSupportedServiceNames()); - const ::rtl::OUString* pSupported = aSupported.getConstArray(); - const ::rtl::OUString* pEnd = pSupported + aSupported.getLength(); - for (;pSupported != pEnd && !pSupported->equals(_rServiceName); ++pSupported) - ; - - return pSupported != pEnd; + return cppu::supportsService(this, _rServiceName); } -// ------------------------------------------------------------------------- OResultSet::OResultSet(OStatement_Base* pStmt) : OResultSet_BASE(m_aMutex) ,OPropertySetHelper(OResultSet_BASE::rBHelper) @@ -90,11 +83,11 @@ OResultSet::OResultSet(OStatement_Base* pStmt) ,m_bWasNull(sal_True) { } -// ------------------------------------------------------------------------- + OResultSet::~OResultSet() { } -// ------------------------------------------------------------------------- + void OResultSet::disposing(void) { OPropertySetHelper::disposing(); diff --git a/odk/examples/cpp/counter/counter.cxx b/odk/examples/cpp/counter/counter.cxx index 9dd008e06762..c539d66494b3 100644 --- a/odk/examples/cpp/counter/counter.cxx +++ b/odk/examples/cpp/counter/counter.cxx @@ -48,6 +48,7 @@ #include <rtl/ustring.hxx> #include <cppuhelper/queryinterface.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/supportsservice.hxx> // generated c++ interfaces #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> @@ -66,8 +67,6 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; using namespace ::foo; - -//======================================================================== class MyCounterImpl : public XCountable , public XServiceInfo @@ -113,42 +112,30 @@ public: { return (--m_nCount); } }; -//************************************************************************* OUString SAL_CALL MyCounterImpl::getImplementationName( ) throw(RuntimeException) { return OUString( IMPLNAME ); } -//************************************************************************* sal_Bool SAL_CALL MyCounterImpl::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - 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 MyCounterImpl::getSupportedServiceNames( ) throw(RuntimeException) { return getSupportedServiceNames_Static(); } -//************************************************************************* Sequence<OUString> SAL_CALL MyCounterImpl::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/odk/examples/cpp/custompanel/ctp_factory.cxx b/odk/examples/cpp/custompanel/ctp_factory.cxx index 581e13135479..e2829029f168 100644 --- a/odk/examples/cpp/custompanel/ctp_factory.cxx +++ b/odk/examples/cpp/custompanel/ctp_factory.cxx @@ -24,12 +24,10 @@ #include <com/sun/star/lang/NotInitializedException.hpp> #include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XComponent.hpp> +#include <cppuhelper/supportsservice.hxx> -//...................................................................................................................... namespace sd { namespace colortoolpanel { -//...................................................................................................................... - using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::XInterface; using ::com::sun::star::uno::UNO_QUERY; @@ -102,40 +100,26 @@ namespace sd { namespace colortoolpanel return xUIElement; } - //------------------------------------------------------------------------------------------------------------------ OUString SAL_CALL ToolPanelFactory::getImplementationName( ) throw (RuntimeException) { return getImplementationName_static(); } - //------------------------------------------------------------------------------------------------------------------ OUString SAL_CALL ToolPanelFactory::getImplementationName_static( ) throw (RuntimeException) { return OUString( "org.openoffice.comp.example.custompanel.ToolPanelFactory" ); } - //------------------------------------------------------------------------------------------------------------------ ::sal_Bool SAL_CALL ToolPanelFactory::supportsService( const OUString& i_rServiceName ) throw (RuntimeException) { - const Sequence< OUString > aServiceNames( getSupportedServiceNames() ); - for ( const OUString* serviceName = aServiceNames.getConstArray(); - serviceName != aServiceNames.getConstArray() + aServiceNames.getLength(); - ++serviceName - ) - { - if ( i_rServiceName == *serviceName ) - return sal_True; - } - return sal_False; + return cppu::supportsService(this, i_rServiceName); } - //------------------------------------------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames() throw (RuntimeException) { return getSupportedServiceNames_static(); } - //------------------------------------------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL ToolPanelFactory::getSupportedServiceNames_static() throw (RuntimeException) { Sequence< OUString > aServiceNames(1); diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index db339ae1f315..0b5978551569 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -26,6 +26,7 @@ #include <comphelper/processfactory.hxx> #include <comphelper/storagehelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include "xfactory.hxx" #include "xstorage.hxx" @@ -282,13 +283,7 @@ OUString SAL_CALL OStorageFactory::getImplementationName() sal_Bool SAL_CALL OStorageFactory::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 OStorageFactory::getSupportedServiceNames() diff --git a/sax/source/expatwrap/sax_expat.cxx b/sax/source/expatwrap/sax_expat.cxx index 47812e80f06f..d61ac44d872d 100644 --- a/sax/source/expatwrap/sax_expat.cxx +++ b/sax/source/expatwrap/sax_expat.cxx @@ -33,6 +33,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase3.hxx> +#include <cppuhelper/supportsservice.hxx> #include <expat.h> @@ -629,14 +630,7 @@ OUString SaxExpatParser::getImplementationName() throw () // XServiceInfo sal_Bool SaxExpatParser::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 diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx index 567b2380b40d..34338731aa41 100644 --- a/sax/source/expatwrap/saxwriter.cxx +++ b/sax/source/expatwrap/saxwriter.cxx @@ -34,6 +34,7 @@ #include <cppuhelper/factory.hxx> #include <cppuhelper/weak.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <rtl/strbuf.hxx> #include <rtl/byteseq.hxx> @@ -1014,7 +1015,6 @@ static inline sal_Bool isFirstCharWhitespace( const sal_Unicode *p ) throw() return *p == ' '; } - // XServiceInfo OUString SAXWriter::getImplementationName() throw() { @@ -1024,14 +1024,7 @@ OUString SAXWriter::getImplementationName() throw() // XServiceInfo sal_Bool SAXWriter::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 @@ -1042,8 +1035,6 @@ Sequence< OUString > SAXWriter::getSupportedServiceNames(void) throw () return seq; } - - void SAXWriter::startDocument() throw(SAXException, RuntimeException ) { if( m_bDocStarted || ! m_out.is() || !mp_SaxWriterHelper ) { diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index 7ddfcff29e33..ddade744ddaf 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/xml/sax/SAXParseException.hpp> #include <com/sun/star/xml/sax/FastToken.hpp> +#include <cppuhelper/supportsservice.hxx> #include "fastparser.hxx" @@ -706,14 +707,7 @@ OUString FastSaxParser::getImplementationName() throw (RuntimeException) // XServiceInfo sal_Bool FastSaxParser::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); } // XServiceInfo diff --git a/sccomp/source/solver/solver.cxx b/sccomp/source/solver/solver.cxx index a9dac3c4a63b..a7809f3dee1d 100644 --- a/sccomp/source/solver/solver.cxx +++ b/sccomp/source/solver/solver.cxx @@ -68,6 +68,7 @@ #include <rtl/math.hxx> #include <rtl/ustrbuf.hxx> #include <cppuhelper/factory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <vector> #include <boost/unordered_map.hpp> @@ -320,8 +321,6 @@ uno::Sequence<double> SAL_CALL SolverComponent::getSolution() throw(uno::Runtime return maSolution; } -// ------------------------------------------------------------------------- - void SAL_CALL SolverComponent::solve() throw(uno::RuntimeException) { uno::Reference<frame::XModel> xModel( mxDoc, uno::UNO_QUERY ); @@ -568,8 +567,6 @@ void SAL_CALL SolverComponent::solve() throw(uno::RuntimeException) delete_lp( lp ); } -// ------------------------------------------------------------------------- - // XServiceInfo uno::Sequence< OUString > SolverComponent_getSupportedServiceNames() @@ -591,10 +588,7 @@ OUString SAL_CALL SolverComponent::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL SolverComponent::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException) { - const uno::Sequence< OUString > aServices = SolverComponent_getSupportedServiceNames(); - const OUString* pArray = aServices.getConstArray(); - const OUString* pArrayEnd = pArray + aServices.getLength(); - return ::std::find( pArray, pArrayEnd, rServiceName ) != pArrayEnd; + return cppu::supportsService(this, rServiceName); } uno::Sequence<OUString> SAL_CALL SolverComponent::getSupportedServiceNames() throw(uno::RuntimeException) @@ -608,8 +602,6 @@ uno::Reference<uno::XInterface> SolverComponent_createInstance( const uno::Refer return (cppu::OWeakObject*) new SolverComponent( rSMgr ); } -// ------------------------------------------------------------------------- - extern "C" { SAL_DLLPUBLIC_EXPORT void* SAL_CALL solver_component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ ) diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 0044f50a6cd2..10781c5930f7 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -27,6 +27,7 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/i18n/XForbiddenCharacters.hpp> #include <cppuhelper/implbase3.hxx> +#include <cppuhelper/supportsservice.hxx> #include <comphelper/propertysethelper.hxx> #include <comphelper/propertysetinfo.hxx> #include <tools/urlobj.hxx> @@ -1255,16 +1256,7 @@ OUString SAL_CALL DocumentSettings::getImplementationName( ) sal_Bool SAL_CALL DocumentSettings::supportsService( const OUString& ServiceName ) throw(RuntimeException) { - const Sequence< OUString > aSeq( getSupportedServiceNames() ); - sal_Int32 nCount = aSeq.getLength(); - const OUString* pServices = aSeq.getConstArray(); - while( nCount-- ) - { - if( *pServices++ == ServiceName ) - return sal_True; - } - - return sal_True; + return cppu::supportsService(this, ServiceName); } Sequence< OUString > SAL_CALL DocumentSettings::getSupportedServiceNames( ) diff --git a/sd/source/ui/unoidl/unomodule.cxx b/sd/source/ui/unoidl/unomodule.cxx index 7abf2d499bc8..23518f444cc3 100644 --- a/sd/source/ui/unoidl/unomodule.cxx +++ b/sd/source/ui/unoidl/unomodule.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/frame/DispatchResultState.hpp> +#include <cppuhelper/supportsservice.hxx> #include "sddll.hxx" #include "sdmod.hxx" @@ -133,16 +134,7 @@ OUString SAL_CALL SdUnoModule::getImplementationName( ) throw(uno::RuntimeExcep sal_Bool SAL_CALL SdUnoModule::supportsService( const OUString& sServiceName ) throw(uno::RuntimeException) { - uno::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); } uno::Sequence< OUString > SAL_CALL SdUnoModule::getSupportedServiceNames( ) throw(uno::RuntimeException) diff --git a/svl/source/numbers/supservs.cxx b/svl/source/numbers/supservs.cxx index 70cce53830b0..eb56ebc5c3ed 100644 --- a/svl/source/numbers/supservs.cxx +++ b/svl/source/numbers/supservs.cxx @@ -20,6 +20,7 @@ #include "supservs.hxx" #include <com/sun/star/lang/Locale.hpp> #include <comphelper/sharedmutex.hxx> +#include <cppuhelper/supportsservice.hxx> #include <i18nlangtag/mslangid.hxx> #include <tools/debug.hxx> #include <osl/mutex.hxx> @@ -118,13 +119,7 @@ OUString SAL_CALL SvNumberFormatsSupplierServiceObject::getImplementationName( sal_Bool SAL_CALL SvNumberFormatsSupplierServiceObject::supportsService( const OUString& _rServiceName ) throw(RuntimeException) { - Sequence< OUString > aServices = getSupportedServiceNames(); - const OUString* pServices = aServices.getConstArray(); - for (sal_Int32 i=0; i<aServices.getLength(); ++i, ++pServices) - if (pServices->equals(_rServiceName)) - return sal_True; - - return sal_False; + return cppu::supportsService(this, _rServiceName); } Sequence< OUString > SAL_CALL SvNumberFormatsSupplierServiceObject::getSupportedServiceNames( ) throw(RuntimeException) diff --git a/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/svx/source/accessibility/svxrectctaccessiblecontext.cxx index 6c9fa05354e8..da7239296197 100644 --- a/svx/source/accessibility/svxrectctaccessiblecontext.cxx +++ b/svx/source/accessibility/svxrectctaccessiblecontext.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/awt/XWindow.hpp> #include <cppuhelper/typeprovider.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/vclunohelper.hxx> #include <toolkit/helper/convert.hxx> #include <vcl/svapp.hxx> @@ -500,7 +501,6 @@ sal_Int32 SvxRectCtlAccessibleContext::getBackground( ) } //===== XServiceInfo ======================================================== - OUString SAL_CALL SvxRectCtlAccessibleContext::getImplementationName( void ) throw( RuntimeException ) { return OUString( "com.sun.star.comp.ui.SvxRectCtlAccessibleContext" ); @@ -508,20 +508,7 @@ OUString SAL_CALL SvxRectCtlAccessibleContext::getImplementationName( void ) thr sal_Bool SAL_CALL SvxRectCtlAccessibleContext::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - ::osl::MutexGuard aGuard( m_aMutex ); - // Iterate over all supported service names and return true if on of them - // matches the given name. - Sequence< OUString > aSupportedServices( getSupportedServiceNames() ); - int nLength = aSupportedServices.getLength(); - const OUString* pStr = aSupportedServices.getConstArray(); - - for( int i = nLength ; i ; --i, ++pStr ) - { - if( sServiceName == *pStr ) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, sServiceName); } Sequence< OUString > SAL_CALL SvxRectCtlAccessibleContext::getSupportedServiceNames( void ) throw( RuntimeException ) diff --git a/svx/source/form/legacyformcontroller.cxx b/svx/source/form/legacyformcontroller.cxx index ac6279ea72b3..df97d8fe57d7 100644 --- a/svx/source/form/legacyformcontroller.cxx +++ b/svx/source/form/legacyformcontroller.cxx @@ -26,6 +26,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <comphelper/processfactory.hxx> //........................................................................ @@ -183,18 +184,11 @@ namespace svxform return OUString( "org.openoffice.comp.svx.LegacyFormController" ); } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL LegacyFormController::supportsService( const OUString& _serviceName ) throw (RuntimeException) { - Sequence< OUString > aServices( getSupportedServiceNames() ); - const OUString* pServices = aServices.getConstArray(); - for ( sal_Int32 i = 0; i < aServices.getLength(); ++i, ++pServices ) - if( pServices->equals( _serviceName ) ) - return sal_True; - return sal_False; + return cppu::supportsService(this, _serviceName); } - //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL LegacyFormController::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< OUString > aServices(2); @@ -203,11 +197,8 @@ namespace svxform return aServices; } -//........................................................................ } // namespace svxform -//........................................................................ -//------------------------------------------------------------------ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL LegacyFormController_NewInstance_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & _rxORB ) { |