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 /sfx2 | |
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 'sfx2')
-rw-r--r-- | sfx2/source/appl/appinit.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/appl/appuno.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/appl/xpackcreator.cxx | 13 | ||||
-rw-r--r-- | sfx2/source/doc/SfxDocumentMetaData.cxx | 16 | ||||
-rw-r--r-- | sfx2/source/doc/ownsubfilterservice.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/doc/sfxmodelfactory.cxx | 14 | ||||
-rw-r--r-- | sfx2/source/view/frmload.cxx | 12 |
7 files changed, 15 insertions, 80 deletions
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 51f2b23896b1..e0f40c92b559 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -42,6 +42,7 @@ #include <unotools/historyoptions.hxx> #include <unotools/moduleoptions.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <vcl/edit.hxx> @@ -128,17 +129,7 @@ OUString SAL_CALL SfxTerminateListener_Impl::getImplementationName() throw (Runt ::sal_Bool SAL_CALL SfxTerminateListener_Impl::supportsService( const OUString& sServiceName ) throw (RuntimeException) { - Sequence< OUString > lNames = getSupportedServiceNames(); - ::sal_Int32 c = lNames.getLength(); - ::sal_Int32 i = 0; - - for (i=0; i<c; ++i) - { - if (lNames[i].equals(sServiceName)) - return sal_True; - } - - return sal_False; + return cppu::supportsService(this, sServiceName); } Sequence< OUString > SAL_CALL SfxTerminateListener_Impl::getSupportedServiceNames() throw (RuntimeException) diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index f8fa84a60016..7b466cac550d 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -111,6 +111,8 @@ #include <com/sun/star/task/XStatusIndicatorFactory.hpp> #include <com/sun/star/ucb/XContent.hpp> +#include <cppuhelper/supportsservice.hxx> + #include <boost/scoped_ptr.hpp> #define PROTOCOLHANDLER_SERVICENAME "com.sun.star.frame.ProtocolHandler" @@ -1992,16 +1994,7 @@ OUString SAL_CALL SfxAppDispatchProvider::getImplementationName() throw( css::un /* XServiceInfo */ sal_Bool SAL_CALL SfxAppDispatchProvider::supportsService( const OUString& sServiceName ) throw( css::uno::RuntimeException ) { - css::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); } /* XServiceInfo */ diff --git a/sfx2/source/appl/xpackcreator.cxx b/sfx2/source/appl/xpackcreator.cxx index c7fef6ec542c..0b7c70c49f3e 100644 --- a/sfx2/source/appl/xpackcreator.cxx +++ b/sfx2/source/appl/xpackcreator.cxx @@ -19,7 +19,7 @@ #include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/io/XOutputStream.hpp> - +#include <cppuhelper/supportsservice.hxx> #include "xpackcreator.hxx" @@ -164,27 +164,18 @@ void SAL_CALL OPackageStructureCreator::convertToPackage( const OUString& aFolde throw io::IOException(); // TODO/LATER: can't proceed with creation } -//------------------------------------------------------------------------- OUString SAL_CALL OPackageStructureCreator::getImplementationName() throw ( uno::RuntimeException ) { return impl_getStaticImplementationName(); } -//------------------------------------------------------------------------- sal_Bool SAL_CALL OPackageStructureCreator::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > aSeq = impl_getStaticSupportedServiceNames(); - - 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 OPackageStructureCreator::getSupportedServiceNames() throw ( uno::RuntimeException ) { diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx index 5bdcc7ec9a70..0c31186b20ad 100644 --- a/sfx2/source/doc/SfxDocumentMetaData.cxx +++ b/sfx2/source/doc/SfxDocumentMetaData.cxx @@ -80,6 +80,7 @@ #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/supportsservice.hxx> #include <com/sun/star/document/XCompatWriterDocProperties.hpp> #include <com/sun/star/beans/PropertyBag.hpp> @@ -382,20 +383,7 @@ public: virtual ::sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException) { - css::uno::Sequence< OUString > sServiceNames= getSupportedServiceNames(); - sal_Int32 nLen = sServiceNames.getLength(); - OUString* pIt = sServiceNames.getArray(); - OUString* pEnd = ( pIt + nLen ); - sal_Bool bRes = sal_False; - for ( ; pIt != pEnd; ++pIt ) - { - if ( pIt->equals( ServiceName ) ) - { - bRes = sal_True; - break; - } - } - return bRes; + return cppu::supportsService(this, ServiceName); } virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException) diff --git a/sfx2/source/doc/ownsubfilterservice.cxx b/sfx2/source/doc/ownsubfilterservice.cxx index 4a03b1a3151c..26926cef58f0 100644 --- a/sfx2/source/doc/ownsubfilterservice.cxx +++ b/sfx2/source/doc/ownsubfilterservice.cxx @@ -19,6 +19,7 @@ #include <com/sun/star/frame/DoubleInitializationException.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> +#include <cppuhelper/supportsservice.hxx> #include <ownsubfilterservice.hxx> #include <sfx2/objsh.hxx> @@ -121,30 +122,19 @@ void SAL_CALL OwnSubFilterService::initialize( const uno::Sequence< uno::Any >& throw lang::IllegalArgumentException(); } - // XServiceInfo - -//------------------------------------------------------------------------- OUString SAL_CALL OwnSubFilterService::getImplementationName() throw ( uno::RuntimeException ) { return impl_getStaticImplementationName(); } -//------------------------------------------------------------------------- sal_Bool SAL_CALL OwnSubFilterService::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException ) { - uno::Sequence< OUString > aSeq = impl_getStaticSupportedServiceNames(); - - 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 OwnSubFilterService::getSupportedServiceNames() throw ( uno::RuntimeException ) { diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index bb6b1d68745c..c5ff5c1240b8 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -25,6 +25,7 @@ #include <comphelper/namedvaluecollection.hxx> #include <cppuhelper/implbase2.hxx> +#include <cppuhelper/supportsservice.hxx> #include <algorithm> #include <functional> @@ -188,38 +189,27 @@ namespace sfx2 return xInstance; } - //-------------------------------------------------------------------- OUString SAL_CALL SfxModelFactory::getImplementationName( ) throw (RuntimeException) { return m_sImplementationName; } - //-------------------------------------------------------------------- ::sal_Bool SAL_CALL SfxModelFactory::supportsService( const OUString& _rServiceName ) throw (RuntimeException) { - return ::std::find( - m_aServiceNames.getConstArray(), - m_aServiceNames.getConstArray() + m_aServiceNames.getLength(), - _rServiceName - ) != m_aServiceNames.getConstArray() + m_aServiceNames.getLength(); + return cppu::supportsService(this, _rServiceName); } - //-------------------------------------------------------------------- Sequence< OUString > SAL_CALL SfxModelFactory::getSupportedServiceNames( ) throw (RuntimeException) { return m_aServiceNames; } - //-------------------------------------------------------------------- Reference< XSingleServiceFactory > createSfxModelFactory( const Reference< XMultiServiceFactory >& _rxServiceFactory, const OUString& _rImplementationName, const SfxModelFactoryFunc _pComponentFactoryFunc, const Sequence< OUString >& _rServiceNames ) { return new SfxModelFactory( _rxServiceFactory, _rImplementationName, _pComponentFactoryFunc, _rServiceNames ); } - -//........................................................................ } // namespace sfx2 -//........................................................................ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/source/view/frmload.cxx b/sfx2/source/view/frmload.cxx index fc47a787baf4..b7dfc24e7843 100644 --- a/sfx2/source/view/frmload.cxx +++ b/sfx2/source/view/frmload.cxx @@ -51,6 +51,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/processfactory.hxx> #include <cppuhelper/exc_hlp.hxx> +#include <cppuhelper/supportsservice.hxx> #include <framework/interaction.hxx> #include <rtl/ustring.h> #include <sot/storinfo.hxx> @@ -658,16 +659,7 @@ OUString SAL_CALL SfxFrameLoader_Impl::getImplementationName() throw( RuntimeExc /* XServiceInfo */ sal_Bool SAL_CALL SfxFrameLoader_Impl::supportsService( const OUString& sServiceName ) throw( RuntimeException ) { - 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); } /* XServiceInfo */ |