diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-10-24 14:55:08 -0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-25 08:07:04 +0000 |
commit | da5449da0c056a3a0da239eff2e2b8b66cfd6224 (patch) | |
tree | 6f6698e676726bd8a07f281a9707e448a711d983 /forms/source/component | |
parent | 01a13519e2a12e1e9b61bab1437d340e389e44bf (diff) |
fdo#54938: More uses of cppu::supportsService
Change-Id: Id6bed78d92eba52283a17ab3ca66e751c225e48d
Reviewed-on: https://gerrit.libreoffice.org/6423
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms/source/component')
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 14 | ||||
-rw-r--r-- | forms/source/component/Filter.cxx | 13 | ||||
-rw-r--r-- | forms/source/component/FormComponent.cxx | 25 | ||||
-rw-r--r-- | forms/source/component/FormsCollection.cxx | 12 |
4 files changed, 9 insertions, 55 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 ); |