xref: /aoo41x/main/embedserv/source/inc/servprov.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _SERVPROV_HXX
29 #define _SERVPROV_HXX
30 
31 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
32 #undef _DEBUG
33 #endif
34 
35 #include "common.h"
36 #include <oleidl.h>
37 #include <com/sun/star/uno/Reference.h>
38 #include <com/sun/star/uno/Sequence.h>
39 #include <com/sun/star/uno/XInterface.hpp>
40 #ifndef __COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
41 #include <com/sun/star/lang/XTypeProvider.hpp>
42 #endif
43 #include <cppuhelper/weak.hxx>
44 
45 
46 class EmbedProviderFactory_Impl;
47 
48 class EmbedServer_Impl : public ::cppu::OWeakObject, ::com::sun::star::lang::XTypeProvider
49 {
50 public:
51 	EmbedServer_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xFactory );
52 	virtual ~EmbedServer_Impl();
53 
54 	// XInterface
55     virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType )
56 		throw(::com::sun::star::uno::RuntimeException);
57     virtual void SAL_CALL acquire() throw ();
58     virtual void SAL_CALL release() throw ();
59 
60 	// XTypeProvider
61     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
62 		throw(::com::sun::star::uno::RuntimeException);
63     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
64 		throw(::com::sun::star::uno::RuntimeException);
65 
66 protected:
67 
68 	CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ];
69 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
70 };
71 
72 class EmbedProviderFactory_Impl : public IClassFactory
73 {
74 public:
75 
76 	EmbedProviderFactory_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid);
77 	virtual ~EmbedProviderFactory_Impl();
78 
79 	sal_Bool registerClass();
80 	sal_Bool deregisterClass();
81 
82 	/* IUnknown methods */
83 	STDMETHOD(QueryInterface)(REFIID riid, LPVOID FAR * ppvObj);
84 	STDMETHOD_(ULONG, AddRef)();
85 	STDMETHOD_(ULONG, Release)();
86 
87 	/* IClassFactory methods */
88 	STDMETHOD(CreateInstance)(IUnknown FAR* punkOuter, REFIID riid, void FAR* FAR* ppv);
89 	STDMETHOD(LockServer)(int fLock);
90 
91 protected:
92 
93 	oslInterlockedCount m_refCount;
94 	GUID				m_guid;
95 	DWORD 				m_factoryHandle;
96 
97 	::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
98 };
99 
100 #endif
101