Branch libreoffice-5-0-4
[LibreOffice.git] / odk / examples / OLE / activex / SOComWindowPeer.h
blobcd58571592eba93dabd92b3ebc664e7ed0d09103
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * The Contents of this file are made available subject to the terms of
5 * the BSD license.
7 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
19 * contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
25 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
26 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
28 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
29 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
31 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
32 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 *************************************************************************/
36 // SOComWindowPeer.h: Definition of the SOComWindowPeer class
38 #ifndef INCLUDED_EXAMPLES_ACTIVEX_SOCOMWINDOWPEER_H
39 #define INCLUDED_EXAMPLES_ACTIVEX_SOCOMWINDOWPEER_H
41 #include "resource.h"
42 #include <ExDispID.h>
43 #include <ExDisp.h>
44 #include <shlguid.h>
45 #include <atlctl.h>
47 #include "so_activex.h"
49 class SOComWindowPeer :
50 public IDispatchImpl<ISOComWindowPeer, &IID_ISOComWindowPeer, &LIBID_SO_ACTIVEXLib>,
51 public ISupportErrorInfo,
52 public CComObjectRoot,
53 public CComCoClass<SOComWindowPeer,&CLSID_SOComWindowPeer>
55 HWND m_hwnd;
56 public:
57 SOComWindowPeer() : m_hwnd( NULL ) {}
59 BEGIN_COM_MAP(SOComWindowPeer)
60 COM_INTERFACE_ENTRY(IDispatch)
61 COM_INTERFACE_ENTRY(ISOComWindowPeer)
62 COM_INTERFACE_ENTRY(ISupportErrorInfo)
63 END_COM_MAP()
64 DECLARE_NOT_AGGREGATABLE(SOComWindowPeer)
65 // Remove the comment from the line above if you don't want your object to
66 // support aggregation.
68 DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER)
70 // ISupportsErrorInfo
71 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
73 // ISOComWindowPeer
74 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle(
75 /* [in] */ SAFEARRAY __RPC_FAR * procId,
76 /* [in] */ short s,
77 /* [retval][out] */ long __RPC_FAR *ret)
79 *ret = (long) m_hwnd;
80 return S_OK;
83 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit(
84 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal)
86 *retVal = NULL;
87 return S_OK;
90 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer(
91 /* [in] */ IDispatch __RPC_FAR *xPointer)
93 return S_OK;
96 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground(
97 /* [in] */ int nColor)
99 return S_OK;
102 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate(
103 /* [in] */ short __MIDL_0015)
105 return S_OK;
108 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect(
109 /* [in] */ IDispatch __RPC_FAR *aRect,
110 /* [in] */ short nFlags)
112 return S_OK;
115 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void)
117 return S_OK;
120 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener(
121 /* [in] */ IDispatch __RPC_FAR *xListener)
123 return S_OK;
126 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener(
127 /* [in] */ IDispatch __RPC_FAR *xListener)
129 return S_OK;
132 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(
133 /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal)
135 *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 );
137 if( !*pVal )
138 return E_FAIL;
140 long ix = 0;
141 CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) );
142 SafeArrayPutElement( *pVal, &ix, aInterface );
144 ix = 1;
145 aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) );
146 SafeArrayPutElement( *pVal, &ix, aInterface );
148 return S_OK;
151 void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; }
154 #endif // INCLUDED_EXAMPLES_ACTIVEX_SOCOMWINDOWPEER_H
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */