Update ooo320-m1
[ooovba.git] / odk / examples / OLE / activex / SOComWindowPeer.h
blob278f6316125c6f5e532b2e3f6fa198d9e6b948c9
1 /*************************************************************************
3 * $RCSfile: SOComWindowPeer.h,v $
5 * $Revision: 1.2 $
7 * last change: $Author: hr $ $Date: 2003-06-30 15:50:08 $
9 * The Contents of this file are made available subject to the terms of
10 * the BSD license.
12 * Copyright (c) 2003 by Sun Microsystems, Inc.
13 * All rights reserved.
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 * 3. Neither the name of Sun Microsystems, Inc. nor the names of its
24 * contributors may be used to endorse or promote products derived
25 * from this software without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
34 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
35 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
36 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
37 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *************************************************************************/
41 // SOComWindowPeer.h: Definition of the SOComWindowPeer class
43 //////////////////////////////////////////////////////////////////////
45 #if !defined __SOCOMWINDOWPEER_H_
46 #define __SOCOMWINDOWPEER_H_
48 #if _MSC_VER > 1000
49 #pragma once
50 #endif // _MSC_VER > 1000
52 #include "resource.h" // main symbols
53 #include <ExDispID.h>
54 #include <ExDisp.h>
55 #include <shlguid.h>
56 #include <atlctl.h>
58 #include "so_activex.h"
60 /////////////////////////////////////////////////////////////////////////////
61 // SOComWindowPeer
63 class SOComWindowPeer :
64 public IDispatchImpl<ISOComWindowPeer, &IID_ISOComWindowPeer, &LIBID_SO_ACTIVEXLib>,
65 public ISupportErrorInfo,
66 public CComObjectRoot,
67 public CComCoClass<SOComWindowPeer,&CLSID_SOComWindowPeer>
69 HWND m_hwnd;
70 public:
71 SOComWindowPeer() : m_hwnd( NULL ) {}
73 BEGIN_COM_MAP(SOComWindowPeer)
74 COM_INTERFACE_ENTRY(IDispatch)
75 COM_INTERFACE_ENTRY(ISOComWindowPeer)
76 COM_INTERFACE_ENTRY(ISupportErrorInfo)
77 END_COM_MAP()
78 DECLARE_NOT_AGGREGATABLE(SOComWindowPeer)
79 // Remove the comment from the line above if you don't want your object to
80 // support aggregation.
82 DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER)
84 // ISupportsErrorInfo
85 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
87 // ISOComWindowPeer
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle(
89 /* [in] */ SAFEARRAY __RPC_FAR * procId,
90 /* [in] */ short s,
91 /* [retval][out] */ long __RPC_FAR *ret)
93 *ret = (long) m_hwnd;
94 return S_OK;
97 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit(
98 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal)
100 *retVal = NULL;
101 return S_OK;
104 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer(
105 /* [in] */ IDispatch __RPC_FAR *xPointer)
107 return S_OK;
110 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground(
111 /* [in] */ int nColor)
113 return S_OK;
116 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate(
117 /* [in] */ short __MIDL_0015)
119 return S_OK;
122 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect(
123 /* [in] */ IDispatch __RPC_FAR *aRect,
124 /* [in] */ short nFlags)
126 return S_OK;
129 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void)
131 return S_OK;
134 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener(
135 /* [in] */ IDispatch __RPC_FAR *xListener)
137 return S_OK;
140 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener(
141 /* [in] */ IDispatch __RPC_FAR *xListener)
143 return S_OK;
146 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces(
147 /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal)
149 *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 );
151 if( !*pVal )
152 return E_FAIL;
154 long ix = 0;
155 CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) );
156 SafeArrayPutElement( *pVal, &ix, aInterface );
158 ix = 1;
159 aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) );
160 SafeArrayPutElement( *pVal, &ix, aInterface );
162 return S_OK;
165 void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; }
168 #endif // __SOCOMWINDOWPEER_H_