diff options
author | Marcos Paulo de Souza <marcos.souza.org@gmail.com> | 2013-10-21 19:04:05 -0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-10-22 10:28:10 +0000 |
commit | ee5661ecd3bbeae38b04cd3f582a320a231d11bd (patch) | |
tree | 381d9afa0c831145551ade40b6d68f22919baaf6 /toolkit | |
parent | c82a36f9c7d89fa434d3dff896c290964326f5bf (diff) |
fdo#54938: Adapt supportsService implementations..
to cppu::supportsService
Change-Id: I0b03d3910f094f2183bf9859db9d5bcaf35d1f14
Reviewed-on: https://gerrit.libreoffice.org/6370
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/source/awt/asynccallback.cxx | 8 | ||||
-rw-r--r-- | toolkit/source/awt/vclxaccessiblecomponent.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/awt/vclxmenu.cxx | 13 | ||||
-rw-r--r-- | toolkit/source/awt/vclxtoolkit.cxx | 12 | ||||
-rw-r--r-- | toolkit/source/controls/grid/defaultgridcolumnmodel.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/controls/grid/defaultgriddatamodel.cxx | 5 | ||||
-rw-r--r-- | toolkit/source/controls/grid/gridcolumn.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/controls/grid/sortablegriddatamodel.cxx | 9 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrol.cxx | 12 | ||||
-rw-r--r-- | toolkit/source/controls/unocontrolmodel.cxx | 10 |
10 files changed, 21 insertions, 75 deletions
diff --git a/toolkit/source/awt/asynccallback.cxx b/toolkit/source/awt/asynccallback.cxx index 1f30e8fd598a..8d041643508e 100644 --- a/toolkit/source/awt/asynccallback.cxx +++ b/toolkit/source/awt/asynccallback.cxx @@ -24,6 +24,7 @@ #include "cppuhelper/factory.hxx" #include "cppuhelper/implementationentry.hxx" #include "cppuhelper/implbase2.hxx" +#include <cppuhelper/supportsservice.hxx> #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/awt/XRequestCallback.hpp" @@ -92,12 +93,7 @@ OUString SAL_CALL AsyncCallback::getImplementationName() throw (css::uno::Runtim ::sal_Bool SAL_CALL AsyncCallback::supportsService(OUString const & serviceName) throw (css::uno::RuntimeException) { - const css::uno::Sequence< OUString > serviceNames = comp_AsyncCallback::_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); } css::uno::Sequence< OUString > SAL_CALL AsyncCallback::getSupportedServiceNames() throw (css::uno::RuntimeException) diff --git a/toolkit/source/awt/vclxaccessiblecomponent.cxx b/toolkit/source/awt/vclxaccessiblecomponent.cxx index 347ee5d96d8e..43bbd2e4a1b1 100644 --- a/toolkit/source/awt/vclxaccessiblecomponent.cxx +++ b/toolkit/source/awt/vclxaccessiblecomponent.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/accessibility/XAccessibleEventListener.hpp> #include <com/sun/star/accessibility/AccessibleRelationType.hpp> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/awt/vclxaccessiblecomponent.hxx> #include <toolkit/helper/externallock.hxx> #include <toolkit/awt/vclxwindow.hxx> @@ -96,13 +97,7 @@ OUString VCLXAccessibleComponent::getImplementationName() throw (uno::RuntimeExc sal_Bool VCLXAccessibleComponent::supportsService( const OUString& rServiceName ) throw (uno::RuntimeException) { - uno::Sequence< OUString > aNames( getSupportedServiceNames() ); - const OUString* pNames = aNames.getConstArray(); - const OUString* pEnd = pNames + aNames.getLength(); - for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) - ; - - return pNames != pEnd; + return cppu::supportsService(this, rServiceName); } uno::Sequence< OUString > VCLXAccessibleComponent::getSupportedServiceNames() throw (uno::RuntimeException) diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 74e5a277d933..75a99a5fce0d 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -23,6 +23,7 @@ #include <toolkit/helper/servicenames.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <rtl/uuid.h> #include <osl/mutex.hxx> @@ -204,20 +205,12 @@ throw (css::uno::RuntimeException) return aNames; } - -::sal_Bool SAL_CALL VCLXMenu::supportsService( - const OUString& rServiceName ) +::sal_Bool SAL_CALL VCLXMenu::supportsService(const OUString& rServiceName ) throw (css::uno::RuntimeException) { - css::uno::Sequence< OUString > aServiceNames( getSupportedServiceNames() ); - - if ( aServiceNames[ 0 ] == rServiceName ) - return sal_True; - - return sal_False; + return cppu::supportsService(this, rServiceName); } - css::uno::Any VCLXMenu::queryInterface( const css::uno::Type & rType ) throw(css::uno::RuntimeException) diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index e80f1bc8f664..707700f63bc7 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -43,6 +43,7 @@ #include <com/sun/star/uno/XInterface.hpp> #include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/datatransfer/clipboard/SystemClipboard.hpp> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <osl/conditn.hxx> #include <rtl/uuid.h> @@ -1381,16 +1382,7 @@ OUString VCLXToolkit::getImplementationName() throw(::com::sun::star::uno::Runti sal_Bool VCLXToolkit::supportsService( const OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::osl::MutexGuard aGuard( GetMutex() ); - - ::com::sun::star::uno::Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString* pArray = aSNL.getConstArray(); - const OUString* pArrayEnd = aSNL.getConstArray(); - for (; pArray != pArrayEnd; ++pArray ) - if( *pArray == rServiceName ) - break; - - return pArray != pArrayEnd; + return cppu::supportsService(this, rServiceName); } ::com::sun::star::uno::Sequence< OUString > VCLXToolkit::getSupportedServiceNames() throw(::com::sun::star::uno::RuntimeException) diff --git a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx index 26ef3b6940c6..558907fa7cd0 100644 --- a/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx +++ b/toolkit/source/controls/grid/defaultgridcolumnmodel.cxx @@ -26,6 +26,7 @@ #include <comphelper/sequence.hxx> #include <comphelper/componentguard.hxx> #include <comphelper/processfactory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/servicenames.hxx> #include <rtl/ustrbuf.hxx> #include <tools/diagnose_ex.h> @@ -301,17 +302,11 @@ namespace toolkit return OUString( "org.openoffice.comp.toolkit.DefaultGridColumnModel" ); } - //------------------------------------------------------------------------------------------------------------------ sal_Bool SAL_CALL DefaultGridColumnModel::supportsService( const OUString& i_serviceName ) throw (RuntimeException) { - const Sequence< OUString > aServiceNames( getSupportedServiceNames() ); - for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i ) - if ( aServiceNames[i] == i_serviceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, i_serviceName); } - //------------------------------------------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL DefaultGridColumnModel::getSupportedServiceNames( ) throw (RuntimeException) { const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridColumnModel ) ); diff --git a/toolkit/source/controls/grid/defaultgriddatamodel.cxx b/toolkit/source/controls/grid/defaultgriddatamodel.cxx index e59078e6374c..853eabb8c1b2 100644 --- a/toolkit/source/controls/grid/defaultgriddatamodel.cxx +++ b/toolkit/source/controls/grid/defaultgriddatamodel.cxx @@ -22,6 +22,7 @@ #include <comphelper/stlunosequence.hxx> #include <comphelper/componentguard.hxx> +#include <cppuhelper/supportsservice.hxx> #include <toolkit/helper/servicenames.hxx> #include <tools/diagnose_ex.h> #include <rtl/ref.hxx> @@ -427,13 +428,11 @@ namespace toolkit return aImplName; } - //------------------------------------------------------------------------------------------------------------------ sal_Bool SAL_CALL DefaultGridDataModel::supportsService( const OUString& ServiceName ) throw (RuntimeException) { - return ServiceName.equalsAscii( szServiceName_DefaultGridDataModel ); + return cppu::supportsService(this, ServiceName); } - //------------------------------------------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL DefaultGridDataModel::getSupportedServiceNames( ) throw (RuntimeException) { static const OUString aServiceName( OUString::createFromAscii( szServiceName_DefaultGridDataModel ) ); diff --git a/toolkit/source/controls/grid/gridcolumn.cxx b/toolkit/source/controls/grid/gridcolumn.cxx index 10c796b5f495..f08b89be6374 100644 --- a/toolkit/source/controls/grid/gridcolumn.cxx +++ b/toolkit/source/controls/grid/gridcolumn.cxx @@ -20,6 +20,7 @@ #include "gridcolumn.hxx" #include <comphelper/sequence.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <toolkit/helper/servicenames.hxx> @@ -264,17 +265,11 @@ namespace toolkit return OUString( "org.openoffice.comp.toolkit.GridColumn" ); } - //------------------------------------------------------------------------------------------------------------------ sal_Bool SAL_CALL GridColumn::supportsService( const OUString& i_serviceName ) throw (RuntimeException) { - const Sequence< OUString > aServiceNames( getSupportedServiceNames() ); - for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i ) - if ( aServiceNames[i] == i_serviceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, i_serviceName); } - //------------------------------------------------------------------------------------------------------------------ ::com::sun::star::uno::Sequence< OUString > SAL_CALL GridColumn::getSupportedServiceNames( ) throw (RuntimeException) { const OUString aServiceName( OUString::createFromAscii( szServiceName_GridColumn ) ); diff --git a/toolkit/source/controls/grid/sortablegriddatamodel.cxx b/toolkit/source/controls/grid/sortablegriddatamodel.cxx index d4a218c80172..252e6929b6f2 100644 --- a/toolkit/source/controls/grid/sortablegriddatamodel.cxx +++ b/toolkit/source/controls/grid/sortablegriddatamodel.cxx @@ -27,6 +27,7 @@ #include <comphelper/anycompare.hxx> #include <comphelper/processfactory.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <tools/diagnose_ex.h> #include <tools/debug.hxx> @@ -833,17 +834,11 @@ namespace toolkit return OUString( "org.openoffice.comp.toolkit.SortableGridDataModel" ); } - //------------------------------------------------------------------------------------------------------------------ ::sal_Bool SAL_CALL SortableGridDataModel::supportsService( const OUString& i_serviceName ) throw (RuntimeException) { - Sequence< OUString > const aServiceNames( getSupportedServiceNames() ); - for ( sal_Int32 i=0; i<aServiceNames.getLength(); ++i ) - if ( aServiceNames[i] == i_serviceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, i_serviceName); } - //------------------------------------------------------------------------------------------------------------------ Sequence< OUString > SAL_CALL SortableGridDataModel::getSupportedServiceNames( ) throw (RuntimeException) { Sequence< OUString > aServiceNames(1); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 5d6700e1d6dc..3830c24285fd 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -25,6 +25,7 @@ #include <com/sun/star/resource/XStringResourceResolver.hpp> #include <toolkit/controls/unocontrol.hxx> #include <toolkit/helper/vclunohelper.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <rtl/uuid.h> #include <osl/mutex.hxx> @@ -1433,16 +1434,7 @@ OUString UnoControl::getImplementationName( ) throw(RuntimeException) sal_Bool UnoControl::supportsService( const OUString& rServiceName ) throw(RuntimeException) { - ::osl::MutexGuard aGuard( GetMutex() ); - - Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString* pArray = aSNL.getConstArray(); - const OUString* pArrayEnd = aSNL.getConstArray() + aSNL.getLength(); - for (; pArray != pArrayEnd; ++pArray ) - if( *pArray == rServiceName ) - break; - - return pArray != pArrayEnd; + return cppu::supportsService(this, rServiceName); } Sequence< OUString > UnoControl::getSupportedServiceNames( ) throw(RuntimeException) diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 782922bb5464..79db937fc2a5 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -30,6 +30,7 @@ #include <com/sun/star/io/XMarkableStream.hpp> #include <toolkit/controls/unocontrolmodel.hxx> #include <toolkit/helper/macros.hxx> +#include <cppuhelper/supportsservice.hxx> #include <cppuhelper/typeprovider.hxx> #include <rtl/uuid.h> #include <tools/diagnose_ex.h> @@ -1030,14 +1031,7 @@ OUString UnoControlModel::getImplementationName( ) throw(::com::sun::star::uno: sal_Bool UnoControlModel::supportsService( const OUString& rServiceName ) throw(::com::sun::star::uno::RuntimeException) { - ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - - ::com::sun::star::uno::Sequence< OUString > aSNL = getSupportedServiceNames(); - const OUString * pArray = aSNL.getConstArray(); - for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) - if( pArray[i] == rServiceName ) - return sal_True; - return sal_False; + return cppu::supportsService(this, rServiceName); } ::com::sun::star::uno::Sequence< OUString > UnoControlModel::getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException) |