LibreOffice Module extensions (master) 1
SOComWindowPeer.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20// SOComWindowPeer.h: Definition of the SOComWindowPeer class
21
22#pragma once
23
24#ifdef _MSC_VER
25#pragma once
26#endif
27
28#include "resource.h"
29#include <ExDispID.h>
30#include <ExDisp.h>
31#include <shlguid.h>
32
33#include <atlctl.h>
34
35#include <so_activex.h>
36
37// SOComWindowPeer
38
40 public IDispatchImpl<ISOComWindowPeer, &IID_ISOComWindowPeer, &LIBID_SO_ACTIVEXLib>,
41 public ISupportErrorInfo,
42 public CComObjectRoot,
43 public CComCoClass<SOComWindowPeer,&CLSID_SOComWindowPeer>
44{
45 HWND m_hwnd;
46public:
47 SOComWindowPeer() : m_hwnd( nullptr ) {}
48 virtual ~SOComWindowPeer() { }
49
50BEGIN_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
58END_COM_MAP()
59#if defined __clang__
60#pragma clang diagnostic pop
61#endif
62DECLARE_NOT_AGGREGATABLE(SOComWindowPeer)
63// Remove the comment from the line above if you don't want your object to
64// support aggregation.
65
66DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER)
67
68// ISupportsErrorInfo
69 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid) override;
70
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
76 {
77 *ret = HandleToLong( m_hwnd );
78 return S_OK;
79 }
80
81 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit(
82 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) override
83 {
84 *retVal = nullptr;
85 return S_OK;
86 }
87
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer(
89 /* [in] */ IDispatch __RPC_FAR* /*xPointer*/) override
90 {
91 return S_OK;
92 }
93
94 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground(
95 /* [in] */ int /*nColor*/) override
96 {
97 return S_OK;
98 }
99
100 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate(
101 /* [in] */ short /*__MIDL_0015*/) override
102 {
103 return S_OK;
104 }
105
106 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect(
107 /* [in] */ IDispatch __RPC_FAR* /*aRect*/,
108 /* [in] */ short /*nFlags*/) override
109 {
110 return S_OK;
111 }
112
113 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) override
114 {
115 return S_OK;
116 }
117
118 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener(
119 /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override
120 {
121 return S_OK;
122 }
123
124 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener(
125 /* [in] */ IDispatch __RPC_FAR* /*xListener*/) override
126 {
127 return S_OK;
128 }
129
130 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(
131 /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) override
132 {
133 *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 );
134
135 if( !*pVal )
136 return E_FAIL;
137
138 LONG ix = 0;
139 CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) );
140 SafeArrayPutElement( *pVal, &ix, aInterface );
141
142 ix = 1;
143 aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) );
144 SafeArrayPutElement( *pVal, &ix, aInterface );
145
146 return S_OK;
147 }
148
149 void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; }
150};
151
152/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHOD() InterfaceSupportsErrorInfo(REFIID riid) override
virtual ~SOComWindowPeer()
virtual HRESULT STDMETHODCALLTYPE setBackground(int) override
virtual HRESULT STDMETHODCALLTYPE addEventListener(IDispatch __RPC_FAR *) override
void SetHWNDInternally(HWND hwnd)
virtual HRESULT STDMETHODCALLTYPE setPointer(IDispatch __RPC_FAR *) override
virtual HRESULT STDMETHODCALLTYPE getToolkit(IDispatch __RPC_FAR *__RPC_FAR *retVal) override
virtual HRESULT STDMETHODCALLTYPE removeEventListener(IDispatch __RPC_FAR *) override
virtual HRESULT STDMETHODCALLTYPE invalidate(short) override
virtual HRESULT STDMETHODCALLTYPE dispose(void) override
virtual HRESULT STDMETHODCALLTYPE invalidateRect(IDispatch __RPC_FAR *, short) override
virtual HRESULT STDMETHODCALLTYPE getWindowHandle(SAFEARRAY __RPC_FAR *, short, long __RPC_FAR *ret) override
virtual HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(SAFEARRAY __RPC_FAR *__RPC_FAR *pVal) override
#define VT_BSTR
LONG
#define IDR_SOCOMWINDOWPEER
Definition: resource.h:28