diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-02-13 00:23:50 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-05-22 08:52:44 +0200 |
commit | 0f2157cb1513371829d7f8c415324cffed28c377 (patch) | |
tree | d1df5164c2f8eb2fc40b6a47d9645a7f77ad516b /extensions | |
parent | 1091e786b420a964b899e9c0a9c399d07946536c (diff) |
Bin dead code
OleServer::provideService() was not called anywhere. That means the
ProviderOleWrapper class is unused, too. Which is good, as it seemed
to largely be identical to OneInstanceOleWrapper anyway.
Change-Id: If8782d56ed1ec1bb173cfc18be585be4c331f335
Reviewed-on: https://gerrit.libreoffice.org/54647
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/source/ole/servprov.cxx | 136 | ||||
-rw-r--r-- | extensions/source/ole/servprov.hxx | 45 |
2 files changed, 0 insertions, 181 deletions
diff --git a/extensions/source/ole/servprov.cxx b/extensions/source/ole/servprov.cxx index 78d59292368f..e7fcbb9823ef 100644 --- a/extensions/source/ole/servprov.cxx +++ b/extensions/source/ole/servprov.cxx @@ -43,132 +43,6 @@ using namespace com::sun::star::bridge::ModelDependent; // {82154420-0FBF-11d4-8313-005004526AB4} DEFINE_GUID(OID_ServiceManager, 0x82154420, 0xfbf, 0x11d4, 0x83, 0x13, 0x0, 0x50, 0x4, 0x52, 0x6a, 0xb4); -ProviderOleWrapper::ProviderOleWrapper(const Reference<XMultiServiceFactory>& smgr, - const Reference<XSingleServiceFactory>& xSFact) - : m_xSingleServiceFactory(xSFact), - m_smgr( smgr) -{ - Reference<XInterface> xInt = smgr->createInstance("com.sun.star.bridge.oleautomation.BridgeSupplier"); - - if (xInt.is()) - { - Any a= xInt->queryInterface( cppu::UnoType<XBridgeSupplier2>::get() ); - a >>= m_bridgeSupplier; - - } -} - -ProviderOleWrapper::~ProviderOleWrapper() -{ -} - -bool ProviderOleWrapper::registerClass(GUID const * pGuid) -{ - HRESULT hresult; - - o2u_attachCurrentThread(); - - hresult = CoRegisterClassObject( - *pGuid, - this, - CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER, - REGCLS_MULTIPLEUSE, - &m_factoryHandle); - - return (hresult == NOERROR); -} - -bool ProviderOleWrapper::deregisterClass() -{ - HRESULT hresult = CoRevokeClassObject(m_factoryHandle); - - return (hresult == NOERROR); -} - -STDMETHODIMP ProviderOleWrapper::QueryInterface(REFIID riid, void FAR* FAR* ppv) -{ - if(IsEqualIID(riid, IID_IUnknown)) - { - AddRef(); - *ppv = static_cast<IUnknown*>(static_cast<IClassFactory*>(this)); - return NOERROR; - } - else if (IsEqualIID(riid, IID_IClassFactory)) - { - AddRef(); - *ppv = static_cast<IClassFactory*>(this); - return NOERROR; - } - - *ppv = nullptr; - return ResultFromScode(E_NOINTERFACE); -} - -STDMETHODIMP_(ULONG) ProviderOleWrapper::AddRef() -{ - return osl_atomic_increment( &m_refCount); -} - -STDMETHODIMP_(ULONG) ProviderOleWrapper::Release() -{ - MutexGuard aGuard( Mutex::getGlobalMutex()); - ULONG refCount = --m_refCount; - if (m_refCount == 0) - { - delete this; - } - - return refCount; -} - -STDMETHODIMP ProviderOleWrapper::CreateInstance(IUnknown FAR* punkOuter, - REFIID riid, - void FAR* FAR* ppv) -{ - HRESULT ret = ResultFromScode(E_UNEXPECTED); - punkOuter = nullptr; - - Reference<XInterface> xInstance; - - if (m_xSingleServiceFactory.is()) - { - xInstance = m_xSingleServiceFactory->createInstance(); - - if (xInstance.is()) - { - Any usrAny(&xInstance, cppu::UnoType<decltype(xInstance)>::get()); - - sal_uInt8 arId[16]; - rtl_getGlobalProcessId( arId ); - Any oleAny = m_bridgeSupplier->createBridge(usrAny, - Sequence<sal_Int8>(reinterpret_cast<sal_Int8*>(arId), 16), - UNO, - OLE); - - - if (auto v = o3tl::tryAccess<sal_uIntPtr>(oleAny)) - { - VARIANT* pVariant = reinterpret_cast<VARIANT*>(*v); - - if (pVariant->vt == VT_DISPATCH) - { - ret = pVariant->pdispVal->QueryInterface(riid, ppv); - } - - VariantClear(pVariant); - CoTaskMemFree(pVariant); - } - } - } - - return ret; -} - -STDMETHODIMP ProviderOleWrapper::LockServer(int /*fLock*/) -{ - return NOERROR; -} - OneInstanceOleWrapper::OneInstanceOleWrapper( const Reference<XMultiServiceFactory>& smgr, const Reference<XInterface>& xInst ) : m_refCount(0) @@ -612,16 +486,6 @@ css::uno::Sequence<OUString> OleServer::getSupportedServiceNames() "com.sun.star.bridge.oleautomation.ApplicationRegistration"}; } -bool OleServer::provideService(const Reference<XSingleServiceFactory>& xSFact, GUID const * guid) -{ - IClassFactoryWrapper* pFac = new ProviderOleWrapper( m_smgr, xSFact ); - - pFac->AddRef(); - m_wrapperList.push_back(pFac); - - return pFac->registerClass(guid); -} - bool OleServer::provideInstance(const Reference<XInterface>& xInst, GUID const * guid) { IClassFactoryWrapper* pFac = new OneInstanceOleWrapper( m_smgr, xInst ); diff --git a/extensions/source/ole/servprov.hxx b/extensions/source/ole/servprov.hxx index f8b6ad75d2c3..2f4b8446f815 100644 --- a/extensions/source/ole/servprov.hxx +++ b/extensions/source/ole/servprov.hxx @@ -62,49 +62,6 @@ protected: /***************************************************************************** - ProviderOleWrapper - - Provides an UNO service provider as OLE class factory. Handle the - OLE registration by overriding the abstract methods from - IClassFactoryWrapper. - - Acts as a COM class factory. When IClassFactory::CreateInstance is being called - then it creates an service by help of the XSingleServiceFactory member and maps - maps it to a COM object. - -*****************************************************************************/ - -class ProviderOleWrapper : public IClassFactoryWrapper -{ -public: - - ProviderOleWrapper( const Reference<XMultiServiceFactory>& smgr, - const Reference<XSingleServiceFactory>& xSFactory); - virtual ~ProviderOleWrapper(); - - bool registerClass(GUID const * pGuid) override; - bool deregisterClass() override; - - /* IUnknown methods */ - STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj) override; - STDMETHOD_(ULONG, AddRef)() override; - STDMETHOD_(ULONG, Release)() override; - - /* IClassFactory methods */ - STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv) override; - STDMETHOD(LockServer)(int fLock) override; - -protected: - - oslInterlockedCount m_refCount; - Reference<XSingleServiceFactory> m_xSingleServiceFactory; - DWORD m_factoryHandle; - Reference<XBridgeSupplier2> m_bridgeSupplier; - Reference<XMultiServiceFactory> m_smgr; -}; - -/***************************************************************************** - OneInstanceOleWrapper Provides an single UNO object as OLE object. Handle the @@ -239,8 +196,6 @@ public: css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; protected: - - bool provideService(const Reference<XSingleServiceFactory>& xMulFact, GUID const * guid); bool provideInstance(const Reference<XInterface>& xInst, GUID const * guid); list< IClassFactoryWrapper* > m_wrapperList; |