1*46dbaceeSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*46dbaceeSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*46dbaceeSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*46dbaceeSAndrew Rist * distributed with this work for additional information 6*46dbaceeSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*46dbaceeSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*46dbaceeSAndrew Rist * "License"); you may not use this file except in compliance 9*46dbaceeSAndrew Rist * with the License. You may obtain a copy of the License at 10*46dbaceeSAndrew Rist * 11*46dbaceeSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*46dbaceeSAndrew Rist * 13*46dbaceeSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*46dbaceeSAndrew Rist * software distributed under the License is distributed on an 15*46dbaceeSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*46dbaceeSAndrew Rist * KIND, either express or implied. See the License for the 17*46dbaceeSAndrew Rist * specific language governing permissions and limitations 18*46dbaceeSAndrew Rist * under the License. 19*46dbaceeSAndrew Rist * 20*46dbaceeSAndrew Rist *************************************************************/ 21*46dbaceeSAndrew Rist 22*46dbaceeSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _OLE2UNO_HXX 25cdf0e10cSrcweir #define _OLE2UNO_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir 28cdf0e10cSrcweir #if _MSC_VER > 1000 29cdf0e10cSrcweir #pragma once 30cdf0e10cSrcweir #endif // _MSC_VER > 1000 31cdf0e10cSrcweir 32cdf0e10cSrcweir #define STRICT 33cdf0e10cSrcweir #ifndef _WIN32_WINNT 34cdf0e10cSrcweir #define _WIN32_WINNT 0x0400 35cdf0e10cSrcweir #endif 36cdf0e10cSrcweir 37cdf0e10cSrcweir #define _WIN32_DCOM 38cdf0e10cSrcweir #if OSL_DEBUG_LEVEL > 0 39cdf0e10cSrcweir //#define _ATL_DEBUG_INTERFACES 40cdf0e10cSrcweir #endif 41cdf0e10cSrcweir 42cdf0e10cSrcweir #pragma warning (push,1) 43cdf0e10cSrcweir #pragma warning (disable:4917) 44cdf0e10cSrcweir #pragma warning (disable:4005) 45cdf0e10cSrcweir #pragma warning (disable:4548) 46cdf0e10cSrcweir 47cdf0e10cSrcweir #include <tools/prewin.h> 48cdf0e10cSrcweir #include <tchar.h> 49cdf0e10cSrcweir #if (_MSC_VER >= 1200) || defined(__MINGW32__) 50cdf0e10cSrcweir #include <dispex.h> 51cdf0e10cSrcweir #endif 52cdf0e10cSrcweir #include <tools/postwin.h> 53cdf0e10cSrcweir 54cdf0e10cSrcweir #include <tools/presys.h> 55cdf0e10cSrcweir #include <list> 56cdf0e10cSrcweir #include <tools/postsys.h> 57cdf0e10cSrcweir 58cdf0e10cSrcweir #pragma warning (pop) 59cdf0e10cSrcweir #include <com/sun/star/lang/XMultiServiceFactory.hpp> 60cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp> 61cdf0e10cSrcweir #include <com/sun/star/script/XInvocation.hpp> 62cdf0e10cSrcweir #include <com/sun/star/registry/XRegistryKey.hpp> 63cdf0e10cSrcweir #include <com/sun/star/bridge/XBridgeSupplier2.hpp> 64cdf0e10cSrcweir #include <com/sun/star/bridge/ModelDependent.hpp> 65cdf0e10cSrcweir #include <com/sun/star/reflection/InvocationTargetException.hpp> 66cdf0e10cSrcweir #include <com/sun/star/uno/Exception.hpp> 67cdf0e10cSrcweir #include <com/sun/star/beans/UnknownPropertyException.hpp> 68cdf0e10cSrcweir #include <cppuhelper/implbase2.hxx> 69cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 70cdf0e10cSrcweir #include <cppuhelper/typeprovider.hxx> 71cdf0e10cSrcweir #include <cppuhelper/factory.hxx> 72cdf0e10cSrcweir #include <sal/types.h> 73cdf0e10cSrcweir #include <typelib/typeclass.h> 74cdf0e10cSrcweir #include <osl/diagnose.h> 75cdf0e10cSrcweir #include <osl/mutex.hxx> 76cdf0e10cSrcweir #include <com/sun/star/uno/Reference.h> 77cdf0e10cSrcweir #include <rtl/process.h> 78cdf0e10cSrcweir #include <rtl/uuid.h> 79cdf0e10cSrcweir 80cdf0e10cSrcweir #define UNO_2_OLE_EXCEPTIONCODE 1001 81cdf0e10cSrcweir #define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) 82cdf0e10cSrcweir using namespace com::sun::star::uno; 83cdf0e10cSrcweir using namespace com::sun::star::lang; 84cdf0e10cSrcweir using namespace com::sun::star::script; 85cdf0e10cSrcweir using namespace com::sun::star::registry; 86cdf0e10cSrcweir using namespace com::sun::star::reflection; 87cdf0e10cSrcweir using namespace com::sun::star::beans; 88cdf0e10cSrcweir using namespace osl; 89cdf0e10cSrcweir using namespace rtl; 90cdf0e10cSrcweir using namespace std; 91cdf0e10cSrcweir 92cdf0e10cSrcweir 93cdf0e10cSrcweir 94cdf0e10cSrcweir namespace ole_adapter 95cdf0e10cSrcweir { 96cdf0e10cSrcweir 97cdf0e10cSrcweir const VARTYPE getVarType( const Any& val); 98cdf0e10cSrcweir /* creates a Type object for a given type name. 99cdf0e10cSrcweir 100cdf0e10cSrcweir The function returns false if the name does not represent 101cdf0e10cSrcweir a valid type. 102cdf0e10cSrcweir */ 103cdf0e10cSrcweir bool getType( BSTR name, Type & type); 104cdf0e10cSrcweir void o2u_attachCurrentThread(); 105cdf0e10cSrcweir 106cdf0e10cSrcweir struct equalOUString_Impl 107cdf0e10cSrcweir { operator ()ole_adapter::equalOUString_Impl108cdf0e10cSrcweir bool operator()(const OUString & s1, const OUString & s2) const 109cdf0e10cSrcweir { 110cdf0e10cSrcweir return s1 == s2; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir }; 113cdf0e10cSrcweir 114cdf0e10cSrcweir struct hashOUString_Impl 115cdf0e10cSrcweir { operator ()ole_adapter::hashOUString_Impl116cdf0e10cSrcweir size_t operator()(const OUString & rName) const 117cdf0e10cSrcweir { 118cdf0e10cSrcweir return rName.hashCode(); 119cdf0e10cSrcweir } 120cdf0e10cSrcweir }; 121cdf0e10cSrcweir 122cdf0e10cSrcweir 123cdf0e10cSrcweir class BridgeRuntimeError 124cdf0e10cSrcweir { 125cdf0e10cSrcweir public: BridgeRuntimeError(const OUString & sMessage)126cdf0e10cSrcweir BridgeRuntimeError(const OUString& sMessage) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir message = sMessage; 129cdf0e10cSrcweir } 130cdf0e10cSrcweir OUString message; 131cdf0e10cSrcweir }; 132cdf0e10cSrcweir 133cdf0e10cSrcweir 134cdf0e10cSrcweir Mutex* getBridgeMutex(); 135cdf0e10cSrcweir 136cdf0e10cSrcweir } // end namespace 137cdf0e10cSrcweir 138cdf0e10cSrcweir 139cdf0e10cSrcweir 140cdf0e10cSrcweir #endif // _OLE2UNO_HXX 141cdf0e10cSrcweir 142