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 #ifndef UNO_TYPE_WRAPPER_HXX
28 #define UNO_TYPE_WRAPPER_HXX
29 
30 #pragma warning (push,1)
31 #pragma warning (disable:4548)
32 
33 #include <tools/presys.h>
34 //#include "stdafx.h"
35 #define STRICT
36 #define _WIN32_WINNT 0x0400
37 #define _WIN32_DCOM
38 #if OSL_DEBUG_LEVEL > 0
39 //#define _ATL_DEBUG_INTERFACES
40 #endif
41 #include <atlbase.h>
42 extern CComModule _Module;
43 #include <atlcom.h>
44 #include <tools/postsys.h>
45 
46 #pragma warning (pop)
47 #pragma warning (disable:4505)
48     // disable "unreferenced local function has been removed" globally
49 
50 #include "comifaces.hxx"
51 
52 /* creates an UnoTypWrapper and sets the Name property to the value
53    specified by sTypeName.
54    Returns true if the object could be created and initialized.
55  */
56 bool createUnoTypeWrapper(BSTR sTypeName, VARIANT * pVariant);
57 bool createUnoTypeWrapper(const rtl::OUString& sTypeName, VARIANT * pVar);
58 
59 class UnoTypeWrapper:
60 	  public CComObjectRootEx<CComMultiThreadModel>,
61 	  public IUnoTypeWrapper,
62 	  public IDispatch
63 {
64 public:
65 	UnoTypeWrapper();
66 	virtual ~UnoTypeWrapper();
67 
68 	BEGIN_COM_MAP(UnoTypeWrapper)
69 		COM_INTERFACE_ENTRY(IDispatch)
70 		COM_INTERFACE_ENTRY(IUnoTypeWrapper)
71 	END_COM_MAP()
72 
73 	// IDispatch -------------------------------------------
74 	STDMETHOD( GetTypeInfoCount)(UINT *pctinfo);
75 
76 	STDMETHOD( GetTypeInfo)( UINT iTInfo,
77 							 LCID lcid,
78 							 ITypeInfo **ppTInfo);
79 
80 	STDMETHOD( GetIDsOfNames)( REFIID riid,
81 							   LPOLESTR *rgszNames,
82 							   UINT cNames,
83 							   LCID lcid,
84 							   DISPID *rgDispId);
85 
86 	STDMETHOD( Invoke)( DISPID dispIdMember,
87 						REFIID riid,
88 						LCID lcid,
89 						WORD wFlags,
90 						DISPPARAMS *pDispParams,
91 						VARIANT *pVarResult,
92 						EXCEPINFO *pExcepInfo,
93 						UINT *puArgErr);
94 	// IUnoTypeWrapper --------------------------------------
95     STDMETHOD(put_Name)(BSTR val);
96     STDMETHOD(get_Name)(BSTR* pVal);
97 
98 	CComBSTR m_sName;
99 };
100 
101 #endif
102