From da5449da0c056a3a0da239eff2e2b8b66cfd6224 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Thu, 24 Oct 2013 14:55:08 -0200 Subject: fdo#54938: More uses of cppu::supportsService Change-Id: Id6bed78d92eba52283a17ab3ca66e751c225e48d Reviewed-on: https://gerrit.libreoffice.org/6423 Tested-by: LibreOffice gerrit bot Reviewed-by: Stephan Bergmann Tested-by: Stephan Bergmann --- forms/source/component/DatabaseForm.cxx | 14 ++------------ forms/source/component/Filter.cxx | 13 ++----------- forms/source/component/FormComponent.cxx | 25 +++---------------------- forms/source/component/FormsCollection.cxx | 12 ++---------- forms/source/runtime/formoperations.cxx | 11 ++--------- 5 files changed, 11 insertions(+), 64 deletions(-) (limited to 'forms') 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 #include #include +#include #include #include #include @@ -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& _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 #include #include +#include #include #include #include @@ -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 #include #include +#include #include #include #include @@ -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 aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; iequals(_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 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 aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; iequals(_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 SAL_CALL OControlModel::getSupportedServiceNames() throw(RuntimeException) { return ::comphelper::concatSequences( @@ -773,7 +755,6 @@ Sequence 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 #include +#include #include #include @@ -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 aSupported = getSupportedServiceNames(); - const OUString* pSupported = aSupported.getConstArray(); - for (sal_Int32 i=0; iequals(_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 #include #include +#include #include #include @@ -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 ); -- cgit