1*a20fd023SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*a20fd023SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*a20fd023SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*a20fd023SAndrew Rist * distributed with this work for additional information 6*a20fd023SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*a20fd023SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*a20fd023SAndrew Rist * "License"); you may not use this file except in compliance 9*a20fd023SAndrew Rist * with the License. You may obtain a copy of the License at 10*a20fd023SAndrew Rist * 11*a20fd023SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*a20fd023SAndrew Rist * 13*a20fd023SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*a20fd023SAndrew Rist * software distributed under the License is distributed on an 15*a20fd023SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*a20fd023SAndrew Rist * KIND, either express or implied. See the License for the 17*a20fd023SAndrew Rist * specific language governing permissions and limitations 18*a20fd023SAndrew Rist * under the License. 19*a20fd023SAndrew Rist * 20*a20fd023SAndrew Rist *************************************************************/ 21*a20fd023SAndrew Rist 22*a20fd023SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SERVPROV_HXX 25cdf0e10cSrcweir #define _SERVPROV_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #if defined(_MSC_VER) && (_MSC_VER >= 1300) 28cdf0e10cSrcweir #undef _DEBUG 29cdf0e10cSrcweir #endif 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "common.h" 32cdf0e10cSrcweir #include <oleidl.h> 33cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 34cdf0e10cSrcweir #include <com/sun/star/uno/Sequence.h> 35cdf0e10cSrcweir #include <com/sun/star/uno/XInterface.hpp> 36cdf0e10cSrcweir #ifndef __COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_ 37cdf0e10cSrcweir #include <com/sun/star/lang/XTypeProvider.hpp> 38cdf0e10cSrcweir #endif 39cdf0e10cSrcweir #include <cppuhelper/weak.hxx> 40cdf0e10cSrcweir 41cdf0e10cSrcweir 42cdf0e10cSrcweir class EmbedProviderFactory_Impl; 43cdf0e10cSrcweir 44cdf0e10cSrcweir class EmbedServer_Impl : public ::cppu::OWeakObject, ::com::sun::star::lang::XTypeProvider 45cdf0e10cSrcweir { 46cdf0e10cSrcweir public: 47cdf0e10cSrcweir EmbedServer_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xFactory ); 48cdf0e10cSrcweir virtual ~EmbedServer_Impl(); 49cdf0e10cSrcweir 50cdf0e10cSrcweir // XInterface 51cdf0e10cSrcweir virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) 52cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 53cdf0e10cSrcweir virtual void SAL_CALL acquire() throw (); 54cdf0e10cSrcweir virtual void SAL_CALL release() throw (); 55cdf0e10cSrcweir 56cdf0e10cSrcweir // XTypeProvider 57cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) 58cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 59cdf0e10cSrcweir virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId() 60cdf0e10cSrcweir throw(::com::sun::star::uno::RuntimeException); 61cdf0e10cSrcweir 62cdf0e10cSrcweir protected: 63cdf0e10cSrcweir 64cdf0e10cSrcweir CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ]; 65cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 66cdf0e10cSrcweir }; 67cdf0e10cSrcweir 68cdf0e10cSrcweir class EmbedProviderFactory_Impl : public IClassFactory 69cdf0e10cSrcweir { 70cdf0e10cSrcweir public: 71cdf0e10cSrcweir 72cdf0e10cSrcweir EmbedProviderFactory_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid); 73cdf0e10cSrcweir virtual ~EmbedProviderFactory_Impl(); 74cdf0e10cSrcweir 75cdf0e10cSrcweir sal_Bool registerClass(); 76cdf0e10cSrcweir sal_Bool deregisterClass(); 77cdf0e10cSrcweir 78cdf0e10cSrcweir /* IUnknown methods */ 79cdf0e10cSrcweir STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj); 80cdf0e10cSrcweir STDMETHOD_(ULONG, AddRef)(); 81cdf0e10cSrcweir STDMETHOD_(ULONG, Release)(); 82cdf0e10cSrcweir 83cdf0e10cSrcweir /* IClassFactory methods */ 84cdf0e10cSrcweir STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv); 85cdf0e10cSrcweir STDMETHOD(LockServer)(int fLock); 86cdf0e10cSrcweir 87cdf0e10cSrcweir protected: 88cdf0e10cSrcweir 89cdf0e10cSrcweir oslInterlockedCount m_refCount; 90cdf0e10cSrcweir GUID m_guid; 91cdf0e10cSrcweir DWORD m_factoryHandle; 92cdf0e10cSrcweir 93cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory; 94cdf0e10cSrcweir }; 95cdf0e10cSrcweir 96cdf0e10cSrcweir #endif 97