xref: /aoo41x/main/extensions/source/ole/ole2uno.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 _OLE2UNO_HXX
29 #define _OLE2UNO_HXX
30 
31 
32 #if _MSC_VER > 1000
33 #pragma once
34 #endif // _MSC_VER > 1000
35 
36 #define STRICT
37 #ifndef _WIN32_WINNT
38 #define _WIN32_WINNT 0x0400
39 #endif
40 
41 #define _WIN32_DCOM
42 #if OSL_DEBUG_LEVEL > 0
43 //#define _ATL_DEBUG_INTERFACES
44 #endif
45 
46 #pragma warning (push,1)
47 #pragma warning (disable:4917)
48 #pragma warning (disable:4005)
49 #pragma warning (disable:4548)
50 
51 #include <tools/prewin.h>
52 #include <tchar.h>
53 #if (_MSC_VER >= 1200) || defined(__MINGW32__)
54 #include <dispex.h>
55 #endif
56 #include <tools/postwin.h>
57 
58 #include <tools/presys.h>
59 #include <list>
60 #include <tools/postsys.h>
61 
62 #pragma warning (pop)
63 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
64 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
65 #include <com/sun/star/script/XInvocation.hpp>
66 #include <com/sun/star/registry/XRegistryKey.hpp>
67 #include <com/sun/star/bridge/XBridgeSupplier2.hpp>
68 #include <com/sun/star/bridge/ModelDependent.hpp>
69 #include <com/sun/star/reflection/InvocationTargetException.hpp>
70 #include <com/sun/star/uno/Exception.hpp>
71 #include <com/sun/star/beans/UnknownPropertyException.hpp>
72 #include <cppuhelper/implbase2.hxx>
73 #include <cppuhelper/implbase1.hxx>
74 #include <cppuhelper/typeprovider.hxx>
75 #include <cppuhelper/factory.hxx>
76 #include <sal/types.h>
77 #include <typelib/typeclass.h>
78 #include <osl/diagnose.h>
79 #include <osl/mutex.hxx>
80 #include <com/sun/star/uno/Reference.h>
81 #include <rtl/process.h>
82 #include <rtl/uuid.h>
83 
84 #define UNO_2_OLE_EXCEPTIONCODE 1001
85 #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
86 using namespace com::sun::star::uno;
87 using namespace com::sun::star::lang;
88 using namespace com::sun::star::script;
89 using namespace com::sun::star::registry;
90 using namespace com::sun::star::reflection;
91 using namespace com::sun::star::beans;
92 using namespace osl;
93 using namespace rtl;
94 using namespace std;
95 
96 
97 
98 namespace ole_adapter
99 {
100 
101 const VARTYPE getVarType( const Any& val);
102 /* creates a Type object for a given type name.
103 
104 	The function returns false if the name does not represent
105 	a valid type.
106 */
107 bool getType( BSTR name, Type & type);
108 void o2u_attachCurrentThread();
109 
110 struct equalOUString_Impl
111 {
112   bool operator()(const OUString & s1, const OUString & s2) const
113   {
114     return s1 == s2;
115   }
116 };
117 
118 struct hashOUString_Impl
119 {
120 	size_t operator()(const OUString & rName) const
121 	{
122 		return rName.hashCode();
123 	}
124 };
125 
126 
127 class BridgeRuntimeError
128 {
129 public:
130     BridgeRuntimeError(const OUString& sMessage)
131     {
132         message = sMessage;
133     }
134     OUString message;
135 };
136 
137 
138 Mutex* getBridgeMutex();
139 
140 } // end namespace
141 
142 
143 
144 #endif // _OLE2UNO_HXX
145 
146