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 #ifndef AUTOMATION_BRIDGE_WINDATA_HXX 24cdf0e10cSrcweir #define AUTOMATION_BRIDGE_WINDATA_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #pragma warning (push,1) 27cdf0e10cSrcweir #pragma warning (disable:4668) 28cdf0e10cSrcweir #pragma warning (disable:4548) 29cdf0e10cSrcweir #include "oleidl.h" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include <atlbase.h> 32cdf0e10cSrcweir #pragma warning (pop) 33cdf0e10cSrcweir #include "osl/diagnose.h" 34cdf0e10cSrcweir 35cdf0e10cSrcweir namespace ole_adapter 36cdf0e10cSrcweir { 37cdf0e10cSrcweir //Wrapper for VARDESC 38cdf0e10cSrcweir class VarDesc 39cdf0e10cSrcweir { 40cdf0e10cSrcweir VARDESC* operator = (const VarDesc*); 41cdf0e10cSrcweir VarDesc(const VarDesc&); 42cdf0e10cSrcweir // Construction 43cdf0e10cSrcweir public: 44cdf0e10cSrcweir CComPtr< ITypeInfo > m_pTypeInfo; 45cdf0e10cSrcweir VARDESC* m_pVarDesc; 46cdf0e10cSrcweir VarDesc(ITypeInfo * pTypeInfo)47cdf0e10cSrcweir VarDesc(ITypeInfo* pTypeInfo) : 48cdf0e10cSrcweir m_pVarDesc(NULL), 49cdf0e10cSrcweir m_pTypeInfo(pTypeInfo) 50cdf0e10cSrcweir { 51cdf0e10cSrcweir OSL_ASSERT(pTypeInfo); 52cdf0e10cSrcweir } ~VarDesc()53cdf0e10cSrcweir ~VarDesc() 54cdf0e10cSrcweir { 55cdf0e10cSrcweir if (m_pVarDesc != NULL) 56cdf0e10cSrcweir { 57cdf0e10cSrcweir m_pTypeInfo->ReleaseVarDesc(m_pVarDesc); 58cdf0e10cSrcweir } 59cdf0e10cSrcweir } 60cdf0e10cSrcweir operator ->()61cdf0e10cSrcweir VARDESC* operator->() 62cdf0e10cSrcweir { 63cdf0e10cSrcweir return m_pVarDesc; 64cdf0e10cSrcweir } 65cdf0e10cSrcweir operator &()66cdf0e10cSrcweir VARDESC** operator&() 67cdf0e10cSrcweir { 68cdf0e10cSrcweir return &m_pVarDesc; 69cdf0e10cSrcweir } 70cdf0e10cSrcweir operator VARDESC*()71cdf0e10cSrcweir operator VARDESC* () 72cdf0e10cSrcweir { 73cdf0e10cSrcweir return m_pVarDesc; 74cdf0e10cSrcweir } 75cdf0e10cSrcweir }; 76cdf0e10cSrcweir 77cdf0e10cSrcweir //Wrapper for FUNCDESC structure 78cdf0e10cSrcweir class FuncDesc 79cdf0e10cSrcweir { 80cdf0e10cSrcweir FUNCDESC* operator = (const FuncDesc &); 81cdf0e10cSrcweir FuncDesc(const FuncDesc&); 82cdf0e10cSrcweir CComPtr<ITypeInfo> m_pTypeInfo; 83cdf0e10cSrcweir FUNCDESC * m_pFuncDesc; 84cdf0e10cSrcweir 85cdf0e10cSrcweir public: 86cdf0e10cSrcweir FuncDesc(ITypeInfo * pTypeInfo)87cdf0e10cSrcweir FuncDesc(ITypeInfo * pTypeInfo) : 88cdf0e10cSrcweir m_pFuncDesc(NULL), 89cdf0e10cSrcweir m_pTypeInfo(pTypeInfo) 90cdf0e10cSrcweir { 91cdf0e10cSrcweir OSL_ASSERT(pTypeInfo); 92cdf0e10cSrcweir } ~FuncDesc()93cdf0e10cSrcweir ~FuncDesc() 94cdf0e10cSrcweir { 95cdf0e10cSrcweir ReleaseFUNCDESC(); 96cdf0e10cSrcweir } 97cdf0e10cSrcweir operator ->()98cdf0e10cSrcweir FUNCDESC* operator -> () 99cdf0e10cSrcweir { 100cdf0e10cSrcweir return m_pFuncDesc; 101cdf0e10cSrcweir } 102cdf0e10cSrcweir operator &()103cdf0e10cSrcweir FUNCDESC** operator & () 104cdf0e10cSrcweir { 105cdf0e10cSrcweir return & m_pFuncDesc; 106cdf0e10cSrcweir } 107cdf0e10cSrcweir operator FUNCDESC*()108cdf0e10cSrcweir operator FUNCDESC* () 109cdf0e10cSrcweir { 110cdf0e10cSrcweir return m_pFuncDesc; 111cdf0e10cSrcweir } 112cdf0e10cSrcweir operator =(FUNCDESC * pDesc)113cdf0e10cSrcweir FUNCDESC* operator = (FUNCDESC* pDesc) 114cdf0e10cSrcweir { 115cdf0e10cSrcweir ReleaseFUNCDESC(); 116cdf0e10cSrcweir m_pFuncDesc = pDesc; 117cdf0e10cSrcweir return m_pFuncDesc; 118cdf0e10cSrcweir } Detach()119cdf0e10cSrcweir FUNCDESC* Detach() 120cdf0e10cSrcweir { 121cdf0e10cSrcweir FUNCDESC* pDesc = m_pFuncDesc; 122cdf0e10cSrcweir m_pFuncDesc = NULL; 123cdf0e10cSrcweir return pDesc; 124cdf0e10cSrcweir } 125cdf0e10cSrcweir ReleaseFUNCDESC()126cdf0e10cSrcweir void ReleaseFUNCDESC() 127cdf0e10cSrcweir { 128cdf0e10cSrcweir if (m_pFuncDesc != NULL) 129cdf0e10cSrcweir { 130cdf0e10cSrcweir m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc); 131cdf0e10cSrcweir } 132cdf0e10cSrcweir m_pFuncDesc = NULL; 133cdf0e10cSrcweir } 134cdf0e10cSrcweir }; 135cdf0e10cSrcweir //Wrapper for EXCEPINFO structure 136cdf0e10cSrcweir class ExcepInfo : public EXCEPINFO 137cdf0e10cSrcweir { 138cdf0e10cSrcweir EXCEPINFO* operator = (const ExcepInfo& ); 139cdf0e10cSrcweir ExcepInfo(const ExcepInfo &); 140cdf0e10cSrcweir public: ExcepInfo()141cdf0e10cSrcweir ExcepInfo() 142cdf0e10cSrcweir { 143cdf0e10cSrcweir memset(this, 0, sizeof(ExcepInfo)); 144cdf0e10cSrcweir } ~ExcepInfo()145cdf0e10cSrcweir ~ExcepInfo() 146cdf0e10cSrcweir { 147cdf0e10cSrcweir if (bstrSource != NULL) 148cdf0e10cSrcweir ::SysFreeString(bstrSource); 149cdf0e10cSrcweir if (bstrDescription != NULL) 150cdf0e10cSrcweir ::SysFreeString(bstrDescription); 151cdf0e10cSrcweir if (bstrHelpFile != NULL) 152cdf0e10cSrcweir ::SysFreeString(bstrHelpFile); 153cdf0e10cSrcweir } 154cdf0e10cSrcweir }; 155cdf0e10cSrcweir 156cdf0e10cSrcweir //Wrapper for TYPEATTR 157cdf0e10cSrcweir class TypeAttr 158cdf0e10cSrcweir { 159cdf0e10cSrcweir TYPEATTR* operator = (const TypeAttr &); 160cdf0e10cSrcweir TypeAttr(const TypeAttr &); 161cdf0e10cSrcweir public: 162cdf0e10cSrcweir CComPtr< ITypeInfo > m_pTypeInfo; 163cdf0e10cSrcweir TYPEATTR* m_pTypeAttr; 164cdf0e10cSrcweir TypeAttr(ITypeInfo * pTypeInfo)165cdf0e10cSrcweir TypeAttr(ITypeInfo* pTypeInfo) : 166cdf0e10cSrcweir m_pTypeAttr( NULL ), 167cdf0e10cSrcweir m_pTypeInfo( pTypeInfo ) 168cdf0e10cSrcweir { 169cdf0e10cSrcweir OSL_ASSERT(pTypeInfo); 170cdf0e10cSrcweir } ~TypeAttr()171cdf0e10cSrcweir ~TypeAttr() throw() 172cdf0e10cSrcweir { 173cdf0e10cSrcweir if (m_pTypeAttr != NULL) 174cdf0e10cSrcweir { 175cdf0e10cSrcweir m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr); 176cdf0e10cSrcweir } 177cdf0e10cSrcweir } 178cdf0e10cSrcweir operator &()179cdf0e10cSrcweir TYPEATTR** operator&() throw() 180cdf0e10cSrcweir { 181cdf0e10cSrcweir return &m_pTypeAttr; 182cdf0e10cSrcweir } 183cdf0e10cSrcweir operator ->()184cdf0e10cSrcweir TYPEATTR* operator->() throw() 185cdf0e10cSrcweir { 186cdf0e10cSrcweir return m_pTypeAttr; 187cdf0e10cSrcweir } 188cdf0e10cSrcweir }; 189cdf0e10cSrcweir 190cdf0e10cSrcweir 191cdf0e10cSrcweir 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir #endif 195