Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / extensions / source / activex / SOComWindowPeer.h
blob58136e8136377d99c9162cf51ab516fde23f4444
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 .
20 // SOComWindowPeer.h: Definition of the SOComWindowPeer class
22 #pragma once
24 #ifdef _MSC_VER
25 #pragma once
26 #endif
28 #include "resource.h"
29 #include <ExDispID.h>
30 #include <ExDisp.h>
31 #include <shlguid.h>
33 #include <atlctl.h>
35 #include <so_activex.h>
37 // SOComWindowPeer
39 class SOComWindowPeer :
40 public IDispatchImpl<ISOComWindowPeer, &IID_ISOComWindowPeer, &LIBID_SO_ACTIVEXLib>,
41 public ISupportErrorInfo,
42 public CComObjectRoot,
43 public CComCoClass<SOComWindowPeer,&CLSID_SOComWindowPeer>
45 HWND m_hwnd;
46 public:
47 SOComWindowPeer() : m_hwnd( nullptr ) {}
48 virtual ~SOComWindowPeer() { }
50 BEGIN_COM_MAP(SOComWindowPeer)
51 COM_INTERFACE_ENTRY(IDispatch)
52 COM_INTERFACE_ENTRY(ISOComWindowPeer)
53 COM_INTERFACE_ENTRY(ISupportErrorInfo)
54 #if defined __clang__
55 #pragma clang diagnostic push
56 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
57 #endif
58 END_COM_MAP()
59 #if defined __clang__
60 #pragma clang diagnostic pop
61 #endif
62 DECLARE_NOT_AGGREGATABLE(SOComWindowPeer)
63 // Remove the comment from the line above if you don't want your object to
64 // support aggregation.
66 DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER)
68 // ISupportsErrorInfo
69 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override;
71 // ISOComWindowPeer
72 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle(
73 /* [in] */ SAFEARRAY __RPC_FAR * /*procId*/,
74 /* [in] */ short /*s*/,
75 /* [retval][out] */ long __RPC_FAR *ret) override
77 *ret = HandleToLong( m_hwnd );
78 return S_OK;
81 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit(
82 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override
84 *retVal = nullptr;
85 return S_OK;
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer(
89 /* [in] */ IDispatch __RPC_FAR* /*xPointer*/) override
91 return S_OK;
94 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground(
95 /* [in] */ int /*nColor*/) override
97 return S_OK;
100 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate(
101 /* [in] */ short /*__MIDL_0015*/) override
103 return S_OK;
106 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect(
107 /* [in] */ IDispatch __RPC_FAR* /*aRect*/,
108 /* [in] */ short /*nFlags*/) override
110 return S_OK;
113 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) override
115 return S_OK;
118 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener(
119 /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override
121 return S_OK;
124 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener(
125 /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override
127 return S_OK;
130 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(
131 /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override
133 *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 );
135 if( !*pVal )
136 return E_FAIL;
138 LONG ix = 0;
139 CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) );
140 SafeArrayPutElement( *pVal, &ix, aInterface );
142 ix = 1;
143 aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) );
144 SafeArrayPutElement( *pVal, &ix, aInterface );
146 return S_OK;
149 void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; }
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */