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