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