bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / ole / windata.hxx
blobfd907d882984b0c9b29b795177555c9d7873d6ab
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_EXTENSIONS_SOURCE_OLE_WINDATA_HXX
20 #define INCLUDED_EXTENSIONS_SOURCE_OLE_WINDATA_HXX
22 #pragma warning (push,1)
23 #pragma warning (disable:4668)
24 #pragma warning (disable:4548)
25 #include "oleidl.h"
27 #include <atlbase.h>
28 #pragma warning (pop)
29 #include "osl/diagnose.h"
31 namespace ole_adapter
33 //Wrapper for VARDESC
34 class VarDesc
36 VARDESC* operator = (const VarDesc*);
37 VarDesc(const VarDesc&);
38 // Construction
39 public:
40 CComPtr< ITypeInfo > m_pTypeInfo;
41 VARDESC* m_pVarDesc;
43 VarDesc(ITypeInfo* pTypeInfo) :
44 m_pVarDesc(NULL),
45 m_pTypeInfo(pTypeInfo)
47 OSL_ASSERT(pTypeInfo);
49 ~VarDesc()
51 if (m_pVarDesc != NULL)
53 m_pTypeInfo->ReleaseVarDesc(m_pVarDesc);
57 VARDESC* operator->()
59 return m_pVarDesc;
62 VARDESC** operator&()
64 return &m_pVarDesc;
67 operator VARDESC* ()
69 return m_pVarDesc;
73 //Wrapper for FUNCDESC structure
74 class FuncDesc
76 FUNCDESC* operator = (const FuncDesc &);
77 FuncDesc(const FuncDesc&);
78 CComPtr<ITypeInfo> m_pTypeInfo;
79 FUNCDESC * m_pFuncDesc;
81 public:
83 FuncDesc(ITypeInfo * pTypeInfo) :
84 m_pFuncDesc(NULL),
85 m_pTypeInfo(pTypeInfo)
87 OSL_ASSERT(pTypeInfo);
89 ~FuncDesc()
91 ReleaseFUNCDESC();
94 FUNCDESC* operator -> ()
96 return m_pFuncDesc;
99 FUNCDESC** operator & ()
101 return & m_pFuncDesc;
104 operator FUNCDESC* ()
106 return m_pFuncDesc;
109 FUNCDESC* operator = (FUNCDESC* pDesc)
111 ReleaseFUNCDESC();
112 m_pFuncDesc = pDesc;
113 return m_pFuncDesc;
115 FUNCDESC* Detach()
117 FUNCDESC* pDesc = m_pFuncDesc;
118 m_pFuncDesc = NULL;
119 return pDesc;
122 void ReleaseFUNCDESC()
124 if (m_pFuncDesc != NULL)
126 m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc);
128 m_pFuncDesc = NULL;
131 //Wrapper for EXCEPINFO structure
132 class ExcepInfo : public EXCEPINFO
134 EXCEPINFO* operator = (const ExcepInfo& );
135 ExcepInfo(const ExcepInfo &);
136 public:
137 ExcepInfo()
139 memset(this, 0, sizeof(ExcepInfo));
141 ~ExcepInfo()
143 if (bstrSource != NULL)
144 ::SysFreeString(bstrSource);
145 if (bstrDescription != NULL)
146 ::SysFreeString(bstrDescription);
147 if (bstrHelpFile != NULL)
148 ::SysFreeString(bstrHelpFile);
152 //Wrapper for TYPEATTR
153 class TypeAttr
155 TYPEATTR* operator = (const TypeAttr &);
156 TypeAttr(const TypeAttr &);
157 public:
158 CComPtr< ITypeInfo > m_pTypeInfo;
159 TYPEATTR* m_pTypeAttr;
161 TypeAttr(ITypeInfo* pTypeInfo) :
162 m_pTypeAttr( NULL ),
163 m_pTypeInfo( pTypeInfo )
165 OSL_ASSERT(pTypeInfo);
167 ~TypeAttr() throw()
169 if (m_pTypeAttr != NULL)
171 m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr);
175 TYPEATTR** operator&() throw()
177 return &m_pTypeAttr;
180 TYPEATTR* operator->() throw()
182 return m_pTypeAttr;
190 #endif
192 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */