tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / extensions / source / ole / windata.hxx
blobd9c4cb31436d99a98219227a0cadbd40f0e39d61
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 #pragma once
21 #include <oleidl.h>
23 #if defined __clang__
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wall"
26 #pragma clang diagnostic ignored "-Wextra"
27 #pragma clang diagnostic ignored "-Wignored-attributes"
28 #pragma clang diagnostic ignored "-Wint-to-pointer-cast"
29 #pragma clang diagnostic ignored "-Winvalid-noreturn"
30 #pragma clang diagnostic ignored "-Wmicrosoft"
31 #pragma clang diagnostic ignored "-Wnon-pod-varargs"
32 #endif
34 #include <atlbase.h>
36 #if defined __clang__
37 #pragma clang diagnostic pop
38 #endif
40 #include <osl/diagnose.h>
42 //Wrapper for VARDESC
43 class VarDesc
45 VARDESC* operator = (const VarDesc*);
46 VarDesc(const VarDesc&);
47 // Construction
48 public:
49 CComPtr< ITypeInfo > m_pTypeInfo;
50 VARDESC* m_pVarDesc;
52 explicit VarDesc(ITypeInfo* pTypeInfo) :
53 m_pTypeInfo(pTypeInfo),
54 m_pVarDesc(nullptr)
56 OSL_ASSERT(pTypeInfo);
58 ~VarDesc()
60 if (m_pVarDesc != nullptr)
62 m_pTypeInfo->ReleaseVarDesc(m_pVarDesc);
66 VARDESC* operator->()
68 return m_pVarDesc;
71 VARDESC** operator&()
73 return &m_pVarDesc;
76 operator VARDESC* ()
78 return m_pVarDesc;
82 //Wrapper for FUNCDESC structure
83 class FuncDesc
85 FUNCDESC* operator = (const FuncDesc &);
86 FuncDesc(const FuncDesc&);
87 CComPtr<ITypeInfo> m_pTypeInfo;
88 FUNCDESC * m_pFuncDesc;
90 public:
92 explicit FuncDesc(ITypeInfo * pTypeInfo) :
93 m_pTypeInfo(pTypeInfo),
94 m_pFuncDesc(nullptr)
96 OSL_ASSERT(pTypeInfo);
98 ~FuncDesc()
100 ReleaseFUNCDESC();
103 FUNCDESC* operator -> ()
105 return m_pFuncDesc;
108 FUNCDESC** operator & ()
110 return & m_pFuncDesc;
113 operator FUNCDESC* ()
115 return m_pFuncDesc;
118 FUNCDESC* operator = (FUNCDESC* pDesc)
120 ReleaseFUNCDESC();
121 m_pFuncDesc = pDesc;
122 return m_pFuncDesc;
124 FUNCDESC* Detach()
126 FUNCDESC* pDesc = m_pFuncDesc;
127 m_pFuncDesc = nullptr;
128 return pDesc;
131 void ReleaseFUNCDESC()
133 if (m_pFuncDesc != nullptr)
135 m_pTypeInfo->ReleaseFuncDesc(m_pFuncDesc);
137 m_pFuncDesc = nullptr;
140 //Wrapper for EXCEPINFO structure
141 class ExcepInfo : public EXCEPINFO
143 EXCEPINFO* operator = (const ExcepInfo& );
144 ExcepInfo(const ExcepInfo &);
145 public:
146 ExcepInfo()
147 : EXCEPINFO{}
150 ~ExcepInfo()
152 if (bstrSource != nullptr)
153 ::SysFreeString(bstrSource);
154 if (bstrDescription != nullptr)
155 ::SysFreeString(bstrDescription);
156 if (bstrHelpFile != nullptr)
157 ::SysFreeString(bstrHelpFile);
161 //Wrapper for TYPEATTR
162 class TypeAttr
164 TYPEATTR* operator = (const TypeAttr &);
165 TypeAttr(const TypeAttr &);
166 public:
167 CComPtr< ITypeInfo > m_pTypeInfo;
168 TYPEATTR* m_pTypeAttr;
170 explicit TypeAttr(ITypeInfo* pTypeInfo) :
171 m_pTypeInfo( pTypeInfo ),
172 m_pTypeAttr( nullptr )
174 OSL_ASSERT(pTypeInfo);
176 ~TypeAttr() noexcept
178 if (m_pTypeAttr != nullptr)
180 m_pTypeInfo->ReleaseTypeAttr(m_pTypeAttr);
184 TYPEATTR** operator&() noexcept
186 return &m_pTypeAttr;
189 TYPEATTR* operator->() noexcept
191 return m_pTypeAttr;
195 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */