diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-24 15:22:35 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-24 18:08:39 +0100 |
commit | c6dcd7b7f392ef47b2e66445239ce867e51d5adb (patch) | |
tree | 2eed08975ce69c4e00d4ab0530eb1222622edab4 /extensions/source | |
parent | f17568f9f3ea6cded3fe13437977ef841d56a7c1 (diff) |
Fix various Windows-only XServiceInfo implementations
...to match what is recorded in the .component files
Change-Id: Ibc5bb0575f3869317e4d14614cf1dad0af728ddc
Diffstat (limited to 'extensions/source')
-rw-r--r-- | extensions/source/ole/servprov.cxx | 90 | ||||
-rw-r--r-- | extensions/source/ole/servprov.hxx | 43 |
2 files changed, 84 insertions, 49 deletions
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 39f4c647326a..d49414d0bc9a 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -30,6 +30,7 @@ #include "unoobjw.hxx" #include "oleobjw.hxx" #include <cppuhelper/queryinterface.hxx> +#include <cppuhelper/supportsservice.hxx> using namespace cppu; using namespace osl; @@ -424,6 +425,30 @@ Any SAL_CALL OleConverter_Impl2::createBridge(const Any& modelDepObject, return ret; } +OUString OleConverter_Impl2::getImplementationName() + throw (css::uno::RuntimeException, std::exception) +{ + return m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL + ? OUString("com.sun.star.comp.ole.OleConverter2") + : OUString("com.sun.star.comp.ole.OleConverterVar1"); +} + +sal_Bool OleConverter_Impl2::supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) +{ + return cppu::supportsService(this, ServiceName); +} + +css::uno::Sequence<OUString> OleConverter_Impl2::getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) +{ + return m_nUnoWrapperClass == INTERFACE_OLE_WRAPPER_IMPL + ? css::uno::Sequence<OUString>{ + "com.sun.star.bridge.OleBridgeSupplier2", + "com.sun.star.bridge.oleautomation.BridgeSupplier"} + : css::uno::Sequence<OUString>{ + "com.sun.star.bridge.OleBridgeSupplierVar1"}; +} // XInitialize ------------------------------------------------------------------------------ // the first argument is an XMultiServiceFactory if at all @@ -496,10 +521,24 @@ Sequence< OUString > SAL_CALL OleClient_Impl::getAvailableServiceNames() thro return ret; } - OUString OleClient_Impl::getImplementationName() + throw (css::uno::RuntimeException, std::exception) +{ + return OUString("com.sun.star.comp.ole.OleClient"); +} + +sal_Bool OleClient_Impl::supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) +{ + return cppu::supportsService(this, ServiceName); +} + +css::uno::Sequence<OUString> OleClient_Impl::getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) { - return OUString(reinterpret_cast<const sal_Unicode*>(L"com.sun.star.comp.ole.OleClient")); + return css::uno::Sequence<OUString>{ + "com.sun.star.bridge.OleObjectFactory", + "com.sun.star.bridge.oleautomation.Factory"}; } Reference<XInterface> SAL_CALL OleClient_Impl::createInstance(const OUString& ServiceSpecifier) throw (Exception, RuntimeException ) @@ -612,48 +651,27 @@ OleServer_Impl::~OleServer_Impl() m_wrapperList.pop_front(); } } -// XInterface -------------------------------------------------- -Any SAL_CALL OleServer_Impl::queryInterface( const Type& aType ) throw(RuntimeException) -{ - Any a= ::cppu::queryInterface( aType, static_cast<XTypeProvider*>(this)); - if( a == Any()) - return OWeakObject::queryInterface( aType); - else - return a; -} -void SAL_CALL OleServer_Impl::acquire( ) throw() -{ - OWeakObject::acquire(); -} -void SAL_CALL OleServer_Impl::release( ) throw () + +OUString OleServer_Impl::getImplementationName() + throw (css::uno::RuntimeException, std::exception) { - OWeakObject::release(); + return OUString("com.sun.star.comp.ole.OleServer"); } - -// XTypeProvider -------------------------------------------------- -Sequence< Type > SAL_CALL OleServer_Impl::getTypes( ) throw(RuntimeException) +sal_Bool OleServer_Impl::supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) { - static OTypeCollection *pCollection = 0; - if( ! pCollection ) - { - MutexGuard guard( Mutex::getGlobalMutex() ); - if( ! pCollection ) - { - static OTypeCollection collection( - cppu::UnoType<XWeak>::get(), - cppu::UnoType<XTypeProvider>::get() ); - pCollection = &collection; - } - } - return (*pCollection).getTypes(); + return cppu::supportsService(this, ServiceName); } -Sequence< sal_Int8 > SAL_CALL OleServer_Impl::getImplementationId() throw(RuntimeException) + +css::uno::Sequence<OUString> OleServer_Impl::getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) { - return css::uno::Sequence<sal_Int8>(); + return css::uno::Sequence<OUString>{ + "com.sun.star.bridge.OleApplicationRegistration", + "com.sun.star.bridge.oleautomation.ApplicationRegistration"}; } - sal_Bool OleServer_Impl::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID* guid) { IClassFactoryWrapper* pFac = new ProviderOleWrapper_Impl( m_smgr, xSFact, guid); diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx index 24ab22f48f2b..9046a5a6d68d 100644 --- a/extensions/source/ole/servprov.hxx +++ b/extensions/source/ole/servprov.hxx @@ -21,7 +21,8 @@ #define INCLUDED_EXTENSIONS_SOURCE_OLE_SERVPROV_HXX #include <com/sun/star/lang/XInitialization.hpp> -#include <cppuhelper/implbase2.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <cppuhelper/implbase.hxx> #include "ole2uno.hxx" #include "unoconversionutilities.hxx" @@ -164,7 +165,7 @@ protected: // latter for OleBridgeSupplierVar1. // The m_nComWrapperClass specifies the class which is used as wrapper for COM interfaces. // Currently there is only one class available ( IUnknownWrapper_Impl). -class OleConverter_Impl2 : public WeakImplHelper2<XBridgeSupplier2, XInitialization>, +class OleConverter_Impl2 : public WeakImplHelper<XBridgeSupplier2, XInitialization, css::lang::XServiceInfo>, public UnoConversionUtilities<OleConverter_Impl2> { public: @@ -183,6 +184,15 @@ public: // XInitialization virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw(Exception, RuntimeException); + OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // Abstract struct UnoConversionUtilities virtual Reference< XInterface > createUnoWrapperInstance(); virtual Reference< XInterface > createComWrapperInstance(); @@ -200,7 +210,7 @@ protected: *****************************************************************************/ -class OleClient_Impl : public WeakImplHelper1<XMultiServiceFactory>, +class OleClient_Impl : public WeakImplHelper<XMultiServiceFactory, css::lang::XServiceInfo>, public UnoConversionUtilities<OleClient_Impl> { public: @@ -212,12 +222,19 @@ public: virtual Reference<XInterface> SAL_CALL createInstanceWithArguments(const OUString& ServiceSpecifier, const Sequence< Any >& Arguments) throw (Exception, RuntimeException); Sequence< OUString > SAL_CALL getAvailableServiceNames() throw (RuntimeException); + OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // Abstract struct UnoConversionUtilities virtual Reference< XInterface > createUnoWrapperInstance(); virtual Reference< XInterface > createComWrapperInstance(); - - OUString getImplementationName(); protected: Reference<XBridgeSupplier2> m_bridgeSupplier; }; @@ -233,20 +250,20 @@ protected: *****************************************************************************/ -class OleServer_Impl : public OWeakObject, XTypeProvider +class OleServer_Impl : public cppu::WeakImplHelper<css::lang::XServiceInfo> { public: OleServer_Impl( const Reference<XMultiServiceFactory> &smgr); ~OleServer_Impl(); - // XInterface - virtual Any SAL_CALL queryInterface( const Type& aType ) throw(RuntimeException); - virtual void SAL_CALL acquire( ) throw (); - virtual void SAL_CALL release( ) throw (); + OUString SAL_CALL getImplementationName() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + sal_Bool SAL_CALL supportsService(OUString const & ServiceName) + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; - // XTypeProvider - virtual Sequence< Type > SAL_CALL getTypes( ) throw(RuntimeException); - virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw(RuntimeException); + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() + throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE; protected: |