From 4d6560f5066d143552cba861aaadc2f49b4357d4 Mon Sep 17 00:00:00 2001 From: Marcos Paulo de Souza Date: Tue, 4 Mar 2014 08:41:53 -0300 Subject: fdo#54938: Convert some places to use cppu::supportsService The last cases are non obvious, so it's pratically done Change-Id: Icae1da8e238f516eaed0f7fbdf96fff778eac547 Reviewed-on: https://gerrit.libreoffice.org/8445 Reviewed-by: Marcos Paulo de Souza Tested-by: Marcos Paulo de Souza --- chart2/source/model/main/PageBackground.hxx | 8 +++-- .../source/accessibility/AccessibleContextBase.cxx | 24 ++------------ extensions/source/bibliography/framectr.cxx | 5 +-- extensions/source/plugin/base/manager.cxx | 9 ++---- extensions/source/plugin/inc/plugin/impl.hxx | 3 +- .../source/uielement/popuptoolbarcontroller.cxx | 37 ++++++++++------------ include/ucbhelper/macros.hxx | 12 ++----- mysqlc/source/mysqlc_driver.cxx | 2 -- mysqlc/source/mysqlc_resultset.cxx | 2 -- reportdesign/source/core/api/Shape.cxx | 1 - sccomp/source/solver/solver.cxx | 10 ++---- scripting/source/provider/URIHelper.cxx | 10 ++---- svx/source/unodraw/unoshape.cxx | 2 +- ucb/source/ucp/file/bc.cxx | 20 ++---------- ucb/source/ucp/file/prov.cxx | 14 +++----- xmlhelp/source/treeview/tvfactory.cxx | 9 ++---- .../source/component/certificatecontainer.cxx | 6 ++-- .../xmlsec/mscrypt/seinitializer_mscryptimpl.cxx | 9 ++---- .../source/xmlsec/nss/seinitializer_nssimpl.cxx | 12 ++----- .../xmlsec/xmldocumentwrapper_xmlsecimpl.cxx | 14 ++------ .../source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx | 13 ++------ 21 files changed, 62 insertions(+), 160 deletions(-) diff --git a/chart2/source/model/main/PageBackground.hxx b/chart2/source/model/main/PageBackground.hxx index 7070037b7f71..f4b0b589b149 100644 --- a/chart2/source/model/main/PageBackground.hxx +++ b/chart2/source/model/main/PageBackground.hxx @@ -19,11 +19,12 @@ #ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_PAGEBACKGROUND_HXX #define INCLUDED_CHART2_SOURCE_MODEL_MAIN_PAGEBACKGROUND_HXX +#include #include #include #include "MutexContainer.hxx" #include "OPropertySet.hxx" -#include +#include #include "ServiceMacros.hxx" #include "ModifyListenerHelper.hxx" @@ -34,10 +35,11 @@ namespace chart namespace impl { -typedef ::cppu::WeakImplHelper3< +typedef ::cppu::WeakImplHelper4< ::com::sun::star::util::XCloneable, ::com::sun::star::util::XModifyBroadcaster, - ::com::sun::star::util::XModifyListener > + ::com::sun::star::util::XModifyListener, + ::com::sun::star::lang::XServiceInfo > PageBackground_Base; } diff --git a/editeng/source/accessibility/AccessibleContextBase.cxx b/editeng/source/accessibility/AccessibleContextBase.cxx index 15958e9776b1..e0ff20c837c0 100644 --- a/editeng/source/accessibility/AccessibleContextBase.cxx +++ b/editeng/source/accessibility/AccessibleContextBase.cxx @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -465,11 +466,7 @@ void SAL_CALL AccessibleContextBase::removeAccessibleEventListener ( } } - - - //===== XServiceInfo ======================================================== - OUString SAL_CALL AccessibleContextBase::getImplementationName (void) throw (::com::sun::star::uno::RuntimeException, std::exception) { @@ -477,27 +474,12 @@ OUString SAL_CALL AccessibleContextBase::getImplementationName (void) return OUString("AccessibleContextBase"); } - - - -sal_Bool SAL_CALL - AccessibleContextBase::supportsService (const OUString& sServiceName) +sal_Bool SAL_CALL AccessibleContextBase::supportsService (const OUString& sServiceName) throw (::com::sun::star::uno::RuntimeException, std::exception) { - ThrowIfDisposed (); - // Iterate over all supported service names and return true if on of them - // matches the given name. - uno::Sequence< OUString > aSupportedServices ( - getSupportedServiceNames ()); - for (int i=0; i SAL_CALL AccessibleContextBase::getSupportedServiceNames (void) throw (::com::sun::star::uno::RuntimeException, std::exception) diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index 45e6faf44050..440d19bcfdc4 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -18,7 +18,6 @@ */ #include -#include #include #include #include @@ -46,6 +45,8 @@ #include #include #include +#include +#include #include #include #include @@ -208,7 +209,7 @@ OUString SAL_CALL BibFrameController_Impl::getImplementationName() throw (::com: sal_Bool SAL_CALL BibFrameController_Impl::supportsService( const OUString& sServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) { - return ( sServiceName == "com.sun.star.frame.Bibliography" || sServiceName == "com.sun.star.frame.Controller" ); + return cppu::supportsService( this, sServiceName ); } ::com::sun::star::uno::Sequence< OUString > SAL_CALL BibFrameController_Impl::getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException, std::exception) diff --git a/extensions/source/plugin/base/manager.cxx b/extensions/source/plugin/base/manager.cxx index b5039b1096dd..a83c4b9b96ff 100644 --- a/extensions/source/plugin/base/manager.cxx +++ b/extensions/source/plugin/base/manager.cxx @@ -57,6 +57,8 @@ #include "com/sun/star/container/XIndexAccess.hpp" #include "com/sun/star/loader/XImplementationLoader.hpp" +#include + PluginManager* PluginManager::pManager = NULL; PluginManager& PluginManager::get() @@ -115,12 +117,7 @@ OUString XPluginManager_Impl::getImplementationName() throw( ) // ::com::sun::star::lang::XServiceInfo sal_Bool XPluginManager_Impl::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); } // ::com::sun::star::lang::XServiceInfo diff --git a/extensions/source/plugin/inc/plugin/impl.hxx b/extensions/source/plugin/inc/plugin/impl.hxx index 57620f49e760..85be9c80653b 100644 --- a/extensions/source/plugin/inc/plugin/impl.hxx +++ b/extensions/source/plugin/inc/plugin/impl.hxx @@ -288,7 +288,8 @@ public: }; class XPluginManager_Impl : - public cppu::WeakAggImplHelper1< com::sun::star::plugin::XPluginManager > + public cppu::WeakAggImplHelper2< com::sun::star::plugin::XPluginManager, + com::sun::star::lang::XServiceInfo > { Reference< com::sun::star::uno::XComponentContext > m_xContext; public: diff --git a/framework/source/uielement/popuptoolbarcontroller.cxx b/framework/source/uielement/popuptoolbarcontroller.cxx index e0ce22aba52e..51274af905bc 100644 --- a/framework/source/uielement/popuptoolbarcontroller.cxx +++ b/framework/source/uielement/popuptoolbarcontroller.cxx @@ -18,6 +18,7 @@ */ #include +#include #include #include #include @@ -46,7 +47,11 @@ using namespace framework; namespace { -class PopupMenuToolbarController : public svt::ToolboxController +typedef cppu::ImplInheritanceHelper1< svt::ToolboxController, + css::lang::XServiceInfo > + ToolBarBase; + +class PopupMenuToolbarController : public ToolBarBase { public: virtual ~PopupMenuToolbarController(); @@ -80,8 +85,7 @@ private: PopupMenuToolbarController::PopupMenuToolbarController( const css::uno::Reference< css::uno::XComponentContext >& xContext, const OUString &rPopupCommand ) - : svt::ToolboxController() - , m_xContext( xContext ) + : m_xContext( xContext ) , m_bHasController( sal_False ) , m_aPopupCommand( rPopupCommand ) { @@ -249,14 +253,11 @@ public: WizardsToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); // XServiceInfo - OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException); - sal_Bool SAL_CALL supportsService(OUString const & rServiceName) - throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException); - css::uno::Sequence SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException); + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException); private: sal_uInt16 getDropDownStyle() const; @@ -277,7 +278,7 @@ OUString WizardsToolbarController::getImplementationName() sal_Bool WizardsToolbarController::supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException) { - return rServiceName == "com.sun.star.frame.ToolbarController"; + return cppu::supportsService( this, rServiceName ); } css::uno::Sequence WizardsToolbarController::getSupportedServiceNames() @@ -300,14 +301,11 @@ public: OpenToolbarController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); // XServiceInfo - OUString SAL_CALL getImplementationName() - throw (css::uno::RuntimeException); + virtual OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException); - sal_Bool SAL_CALL supportsService(OUString const & rServiceName) - throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException); - css::uno::Sequence SAL_CALL getSupportedServiceNames() - throw (css::uno::RuntimeException); + virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException); }; OpenToolbarController::OpenToolbarController( @@ -325,7 +323,7 @@ OUString OpenToolbarController::getImplementationName() sal_Bool OpenToolbarController::supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException) { - return rServiceName == "com.sun.star.frame.ToolbarController"; + return cppu::supportsService( this, rServiceName ); } css::uno::Sequence OpenToolbarController::getSupportedServiceNames() @@ -346,8 +344,7 @@ public: OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException); - sal_Bool SAL_CALL supportsService(OUString const & rServiceName) - throw (css::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException); css::uno::Sequence SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException); @@ -378,7 +375,7 @@ OUString NewToolbarController::getImplementationName() sal_Bool NewToolbarController::supportsService(OUString const & rServiceName) throw (css::uno::RuntimeException) { - return rServiceName == "com.sun.star.frame.ToolbarController"; + return cppu::supportsService( this, rServiceName ); } css::uno::Sequence NewToolbarController::getSupportedServiceNames() diff --git a/include/ucbhelper/macros.hxx b/include/ucbhelper/macros.hxx index 3c6b395f4ef8..e8b8cee3a8f8 100644 --- a/include/ucbhelper/macros.hxx +++ b/include/ucbhelper/macros.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -625,16 +626,7 @@ sal_Bool SAL_CALL \ Class::supportsService( const OUString& ServiceName ) \ throw( com::sun::star::uno::RuntimeException, std::exception ) \ { \ - com::sun::star::uno::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 ); \ } \ \ com::sun::star::uno::Sequence< OUString > SAL_CALL \ diff --git a/mysqlc/source/mysqlc_driver.cxx b/mysqlc/source/mysqlc_driver.cxx index 05cd9e0e4fff..850d47fd6be8 100644 --- a/mysqlc/source/mysqlc_driver.cxx +++ b/mysqlc/source/mysqlc_driver.cxx @@ -108,11 +108,9 @@ OUString SAL_CALL MysqlCDriver::getImplementationName() } /* }}} */ -/* {{{ MysqlCDriver::supportsService() -I- */ sal_Bool SAL_CALL MysqlCDriver::supportsService(const OUString& _rServiceName) throw(RuntimeException, std::exception) { - OSL_TRACE("MysqlCDriver::supportsService"); return cppu::supportsService(this, _rServiceName); } /* }}} */ diff --git a/mysqlc/source/mysqlc_resultset.cxx b/mysqlc/source/mysqlc_resultset.cxx index cafcd8e2aa17..aa602f631be2 100644 --- a/mysqlc/source/mysqlc_resultset.cxx +++ b/mysqlc/source/mysqlc_resultset.cxx @@ -70,11 +70,9 @@ Sequence< OUString > SAL_CALL OResultSet::getSupportedServiceNames() } /* }}} */ -/* {{{ OResultSet::supportsService() -I- */ sal_Bool SAL_CALL OResultSet::supportsService(const OUString& _rServiceName) throw(RuntimeException, std::exception) { - OSL_TRACE("OResultSet::supportsService"); return cppu::supportsService(this, _rServiceName); } /* }}} */ diff --git a/reportdesign/source/core/api/Shape.cxx b/reportdesign/source/core/api/Shape.cxx index dfddf410e9ff..9f024d2be654 100644 --- a/reportdesign/source/core/api/Shape.cxx +++ b/reportdesign/source/core/api/Shape.cxx @@ -157,7 +157,6 @@ uno::Sequence< OUString > SAL_CALL OShape::getSupportedServiceNames( ) throw(un sal_Bool SAL_CALL OShape::supportsService(const OUString& ServiceName) throw( uno::RuntimeException, std::exception ) { - return cppu::supportsService(this, ServiceName); } diff --git a/sccomp/source/solver/solver.cxx b/sccomp/source/solver/solver.cxx index be2153563a5e..128e8773be9a 100644 --- a/sccomp/source/solver/solver.cxx +++ b/sccomp/source/solver/solver.cxx @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -577,8 +578,6 @@ void SAL_CALL SolverComponent::solve() throw(uno::RuntimeException, std::excepti CoinUnloadProblem( hProb ); } -// ------------------------------------------------------------------------- - // XServiceInfo uno::Sequence< OUString > SolverComponent_getSupportedServiceNames() @@ -600,10 +599,7 @@ OUString SAL_CALL SolverComponent::getImplementationName() throw(uno::RuntimeExc sal_Bool SAL_CALL SolverComponent::supportsService( const OUString& rServiceName ) throw(uno::RuntimeException, std::exception) { - 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 SAL_CALL SolverComponent::getSupportedServiceNames() throw(uno::RuntimeException, std::exception) @@ -617,8 +613,6 @@ uno::Reference 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/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 9343aa329f27..b6f1103986c4 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include "URIHelper.hxx" @@ -272,14 +273,7 @@ sal_Bool SAL_CALL ScriptingFrameworkURIHelper::supportsService( const OUString& serviceName ) throw( uno::RuntimeException, std::exception ) { - OUString m_sServiceName( - "com.sun.star.script.provider.ScriptURIHelper" ); - - if ( serviceName.equals( m_sServiceName ) ) - { - return sal_True; - } - return sal_False; + return cppu::supportsService( this, serviceName ); } uno::Sequence< OUString > SAL_CALL diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 3aa5515ae61f..71a82eb9ed7e 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -4071,7 +4071,7 @@ uno::Sequence< OUString > SAL_CALL SvxShapeText::getSupportedServiceNames() thro sal_Bool SAL_CALL SvxShapeText::supportsService( const OUString& ServiceName ) throw ( uno::RuntimeException, std::exception ) { - return SvxShape::supportsService(ServiceName); + return cppu::supportsService(static_cast(this), ServiceName); } // XTypeProvider diff --git a/ucb/source/ucp/file/bc.cxx b/ucb/source/ucp/file/bc.cxx index 06ea3a994bb5..9723918069e7 100644 --- a/ucb/source/ucp/file/bc.cxx +++ b/ucb/source/ucp/file/bc.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include "filglob.hxx" #include "filid.hxx" #include "filrow.hxx" @@ -251,12 +252,7 @@ BaseContent::dispose() delete pPropertySetInfoChangeListeners; } - - - // XServiceInfo - - OUString SAL_CALL BaseContent::getImplementationName() throw( RuntimeException, std::exception) @@ -264,20 +260,13 @@ BaseContent::getImplementationName() return OUString("com.sun.star.comp.ucb.FileContent"); } - - sal_Bool SAL_CALL BaseContent::supportsService( const OUString& ServiceName ) throw( RuntimeException, std::exception) { - if ( ServiceName == "com.sun.star.ucb.FileContent" ) - return true; - else - return false; + return cppu::supportsService( this, ServiceName ); } - - Sequence< OUString > SAL_CALL BaseContent::getSupportedServiceNames() throw( RuntimeException, std::exception ) @@ -287,12 +276,7 @@ BaseContent::getSupportedServiceNames() return ret; } - - - // XTypeProvider - - XTYPEPROVIDER_IMPL_10( BaseContent, lang::XComponent, lang::XTypeProvider, diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 56c579ce3297..1510a77a2422 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -21,10 +21,11 @@ #include #include #include -#include #include #include #include +#include +#include #include "filglob.hxx" #include "filid.hxx" #include "shell.hxx" @@ -183,7 +184,6 @@ XTYPEPROVIDER_IMPL_7( FileProvider, // XServiceInfo methods. - OUString SAL_CALL FileProvider::getImplementationName() throw( RuntimeException, std::exception ) @@ -191,16 +191,12 @@ FileProvider::getImplementationName() return fileaccess::shell::getImplementationName_static(); } - -sal_Bool SAL_CALL -FileProvider::supportsService( - const OUString& ServiceName ) +sal_Bool SAL_CALL FileProvider::supportsService(const OUString& ServiceName ) throw( RuntimeException, std::exception ) { - return ServiceName == "com.sun.star.ucb.FileContentProvider"; + return cppu::supportsService(this, ServiceName); } - Sequence< OUString > SAL_CALL FileProvider::getSupportedServiceNames( void ) @@ -209,8 +205,6 @@ FileProvider::getSupportedServiceNames( return fileaccess::shell::getSupportedServiceNames_static(); } - - Reference< XSingleServiceFactory > SAL_CALL FileProvider::createServiceFactory( const Reference< XMultiServiceFactory >& rxServiceMgr ) diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx index 12f455f8488f..288d542daea4 100644 --- a/xmlhelp/source/treeview/tvfactory.cxx +++ b/xmlhelp/source/treeview/tvfactory.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include "tvfactory.hxx" #include "tvread.hxx" @@ -87,14 +88,10 @@ TVFactory::getImplementationName() return TVFactory::getImplementationName_static(); } -sal_Bool SAL_CALL -TVFactory::supportsService( - const OUString& ServiceName ) +sal_Bool SAL_CALL TVFactory::supportsService( const OUString& ServiceName ) throw( RuntimeException, std::exception ) { - return - ServiceName.equalsAscii( "com.sun.star.help.TreeView" ) || - ServiceName.equalsAscii( "com.sun.star.ucb.HiearchyDataSource" ); + return cppu::supportsService( this, ServiceName ); } Sequence< OUString > SAL_CALL diff --git a/xmlsecurity/source/component/certificatecontainer.cxx b/xmlsecurity/source/component/certificatecontainer.cxx index c021e3060e10..c65202d8e053 100644 --- a/xmlsecurity/source/component/certificatecontainer.cxx +++ b/xmlsecurity/source/component/certificatecontainer.cxx @@ -18,6 +18,7 @@ */ #include +#include #include @@ -96,10 +97,7 @@ sal_Bool SAL_CALL CertificateContainer::supportsService( const OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException, std::exception) { - if ( ServiceName.equalsAscii("com.sun.star.security.CertificateContainer") ) - return sal_True; - else - return sal_False; + return cppu::supportsService( this, ServiceName ); } Sequence< OUString > SAL_CALL diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx index 277222caa128..411b48246db9 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx @@ -27,6 +27,7 @@ #include "com/sun/star/xml/crypto/SecurityEnvironment.hpp" #include "com/sun/star/xml/crypto/XMLSecurityContext.hpp" #include "comphelper/processfactory.hxx" +#include namespace cssu = com::sun::star::uno; namespace cssl = com::sun::star::lang; @@ -152,12 +153,6 @@ OUString SEInitializer_MSCryptImpl_getImplementationName() return OUString( "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_MSCryptImpl" ); } -sal_Bool SAL_CALL SEInitializer_MSCryptImpl_supportsService( const OUString& rServiceName ) - throw (cssu::RuntimeException) -{ - return rServiceName == "com.sun.star.xml.crypto.SEInitializer"; -} - cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl_getSupportedServiceNames() throw (cssu::RuntimeException) { @@ -183,7 +178,7 @@ OUString SAL_CALL SEInitializer_MSCryptImpl::getImplementationName() sal_Bool SAL_CALL SEInitializer_MSCryptImpl::supportsService( const OUString& rServiceName ) throw (cssu::RuntimeException) { - return SEInitializer_MSCryptImpl_supportsService( rServiceName ); + return cppu::supportsService( this, rServiceName ); } cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl::getSupportedServiceNames() diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 6e5ead471df7..bac83e4050be 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -34,6 +34,7 @@ #include #include #include +#include #include "seinitializer_nssimpl.hxx" #include "securityenvironment_nssimpl.hxx" @@ -51,7 +52,6 @@ namespace cssxc = css::xml::crypto; using namespace com::sun::star; -#define SE_SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer" SEInitializer_NssImpl::SEInitializer_NssImpl( const css::uno::Reference< css::uno::XComponentContext > &rxContext ) { @@ -117,18 +117,12 @@ OUString SEInitializer_NssImpl_getImplementationName () return OUString ("com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl" ); } -sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const OUString& ServiceName ) - throw (uno::RuntimeException) -{ - return ( ServiceName == SE_SERVICE_NAME || ServiceName == NSS_SERVICE_NAME ); -} - uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( ) throw (uno::RuntimeException) { uno::Sequence < OUString > aRet(2); OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( SE_SERVICE_NAME ); + pArray[0] = "com.sun.star.xml.crypto.SEInitializer"; pArray[1] = OUString ( NSS_SERVICE_NAME ); return aRet; } @@ -148,7 +142,7 @@ OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( ) sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const OUString& rServiceName ) throw (uno::RuntimeException, std::exception) { - return SEInitializer_NssImpl_supportsService( rServiceName ); + return cppu::supportsService( this, rServiceName ); } uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( ) throw (uno::RuntimeException, std::exception) diff --git a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx index 1e6e8cbc365e..02f9d9b0883b 100644 --- a/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmldocumentwrapper_xmlsecimpl.cxx @@ -17,7 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ - +#include #include "xmldocumentwrapper_xmlsecimpl.hxx" #include @@ -43,7 +43,6 @@ namespace cssxcsax = com::sun::star::xml::csax; namespace cssxs = com::sun::star::xml::sax; namespace cssxw = com::sun::star::xml::wrapper; -#define SERVICE_NAME "com.sun.star.xml.wrapper.XMLDocumentWrapper" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLDocumentWrapper_XmlSecImpl" #define STRXMLNS "xmlns" @@ -1061,21 +1060,14 @@ OUString XMLDocumentWrapper_XmlSecImpl_getImplementationName () return OUString ( IMPLEMENTATION_NAME ); } -sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl_supportsService( const OUString& ServiceName ) - throw (cssu::RuntimeException) -{ - return ServiceName == SERVICE_NAME; -} - cssu::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < OUString > aRet(1); OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( SERVICE_NAME ); + pArray[0] = "com.sun.star.xml.wrapper.XMLDocumentWrapper"; return aRet; } -#undef SERVICE_NAME cssu::Reference< cssu::XInterface > SAL_CALL XMLDocumentWrapper_XmlSecImpl_createInstance( const cssu::Reference< cssu::XComponentContext > &) @@ -1093,7 +1085,7 @@ OUString SAL_CALL XMLDocumentWrapper_XmlSecImpl::getImplementationName( ) sal_Bool SAL_CALL XMLDocumentWrapper_XmlSecImpl::supportsService( const OUString& rServiceName ) throw (cssu::RuntimeException, std::exception) { - return XMLDocumentWrapper_XmlSecImpl_supportsService( rServiceName ); + return cppu::supportsService( this, rServiceName ); } cssu::Sequence< OUString > SAL_CALL XMLDocumentWrapper_XmlSecImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException, std::exception) diff --git a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx index afaf1efde62d..fb4a35f85fa9 100644 --- a/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx +++ b/xmlsecurity/source/xmlsec/xmlelementwrapper_xmlsecimpl.cxx @@ -20,11 +20,11 @@ #include #include "xmlelementwrapper_xmlsecimpl.hxx" +#include #include namespace cssu = com::sun::star::uno; -#define SERVICE_NAME "com.sun.star.xml.wrapper.XMLElementWrapper" #define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.XMLElementWrapper_XmlSecImpl" XMLElementWrapper_XmlSecImpl::XMLElementWrapper_XmlSecImpl(const xmlNodePtr pNode) @@ -76,21 +76,14 @@ OUString XMLElementWrapper_XmlSecImpl_getImplementationName () return OUString ( IMPLEMENTATION_NAME ); } -sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl_supportsService( const OUString& ServiceName ) - throw (cssu::RuntimeException) -{ - return ServiceName == SERVICE_NAME; -} - cssu::Sequence< OUString > SAL_CALL XMLElementWrapper_XmlSecImpl_getSupportedServiceNames( ) throw (cssu::RuntimeException) { cssu::Sequence < OUString > aRet(1); OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( SERVICE_NAME ); + pArray[0] = "com.sun.star.xml.wrapper.XMLElementWrapper"; return aRet; } -#undef SERVICE_NAME cssu::Reference< cssu::XInterface > SAL_CALL XMLElementWrapper_XmlSecImpl_createInstance( @@ -109,7 +102,7 @@ OUString SAL_CALL XMLElementWrapper_XmlSecImpl::getImplementationName( ) sal_Bool SAL_CALL XMLElementWrapper_XmlSecImpl::supportsService( const OUString& rServiceName ) throw (cssu::RuntimeException, std::exception) { - return XMLElementWrapper_XmlSecImpl_supportsService( rServiceName ); + return cppu::supportsService( this, rServiceName ); } cssu::Sequence< OUString > SAL_CALL XMLElementWrapper_XmlSecImpl::getSupportedServiceNames( ) throw (cssu::RuntimeException, std::exception) -- cgit