1*b1cdbd2cSJim Jagielski /************************************************************** 2*b1cdbd2cSJim Jagielski * 3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one 4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file 5*b1cdbd2cSJim Jagielski * distributed with this work for additional information 6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file 7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the 8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance 9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at 10*b1cdbd2cSJim Jagielski * 11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0 12*b1cdbd2cSJim Jagielski * 13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing, 14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an 15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the 17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations 18*b1cdbd2cSJim Jagielski * under the License. 19*b1cdbd2cSJim Jagielski * 20*b1cdbd2cSJim Jagielski *************************************************************/ 21*b1cdbd2cSJim Jagielski 22*b1cdbd2cSJim Jagielski 23*b1cdbd2cSJim Jagielski 24*b1cdbd2cSJim Jagielski // SOComWindowPeer.h: Definition of the SOComWindowPeer class 25*b1cdbd2cSJim Jagielski // 26*b1cdbd2cSJim Jagielski ////////////////////////////////////////////////////////////////////// 27*b1cdbd2cSJim Jagielski 28*b1cdbd2cSJim Jagielski #if !defined __SOCOMWINDOWPEER_H_ 29*b1cdbd2cSJim Jagielski #define __SOCOMWINDOWPEER_H_ 30*b1cdbd2cSJim Jagielski 31*b1cdbd2cSJim Jagielski #if _MSC_VER > 1000 32*b1cdbd2cSJim Jagielski #pragma once 33*b1cdbd2cSJim Jagielski #endif // _MSC_VER > 1000 34*b1cdbd2cSJim Jagielski 35*b1cdbd2cSJim Jagielski #include "resource.h" // main symbols 36*b1cdbd2cSJim Jagielski #include <ExDispID.h> 37*b1cdbd2cSJim Jagielski #include <ExDisp.h> 38*b1cdbd2cSJim Jagielski #include <shlguid.h> 39*b1cdbd2cSJim Jagielski #include <atlctl.h> 40*b1cdbd2cSJim Jagielski 41*b1cdbd2cSJim Jagielski #include "so_activex.h" 42*b1cdbd2cSJim Jagielski 43*b1cdbd2cSJim Jagielski ///////////////////////////////////////////////////////////////////////////// 44*b1cdbd2cSJim Jagielski // SOComWindowPeer 45*b1cdbd2cSJim Jagielski 46*b1cdbd2cSJim Jagielski class SOComWindowPeer : 47*b1cdbd2cSJim Jagielski public IDispatchImpl<ISOComWindowPeer, &IID_ISOComWindowPeer, &LIBID_SO_ACTIVEXLib>, 48*b1cdbd2cSJim Jagielski public ISupportErrorInfo, 49*b1cdbd2cSJim Jagielski public CComObjectRoot, 50*b1cdbd2cSJim Jagielski public CComCoClass<SOComWindowPeer,&CLSID_SOComWindowPeer> 51*b1cdbd2cSJim Jagielski { 52*b1cdbd2cSJim Jagielski HWND m_hwnd; 53*b1cdbd2cSJim Jagielski public: SOComWindowPeer()54*b1cdbd2cSJim Jagielski SOComWindowPeer() : m_hwnd( NULL ) {} 55*b1cdbd2cSJim Jagielski 56*b1cdbd2cSJim Jagielski BEGIN_COM_MAP(SOComWindowPeer) 57*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(IDispatch) 58*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(ISOComWindowPeer) 59*b1cdbd2cSJim Jagielski COM_INTERFACE_ENTRY(ISupportErrorInfo) 60*b1cdbd2cSJim Jagielski END_COM_MAP() 61*b1cdbd2cSJim Jagielski DECLARE_NOT_AGGREGATABLE(SOComWindowPeer) 62*b1cdbd2cSJim Jagielski // Remove the comment from the line above if you don't want your object to 63*b1cdbd2cSJim Jagielski // support aggregation. 64*b1cdbd2cSJim Jagielski 65*b1cdbd2cSJim Jagielski DECLARE_REGISTRY_RESOURCEID(IDR_SOCOMWINDOWPEER) 66*b1cdbd2cSJim Jagielski 67*b1cdbd2cSJim Jagielski // ISupportsErrorInfo 68*b1cdbd2cSJim Jagielski STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); 69*b1cdbd2cSJim Jagielski 70*b1cdbd2cSJim Jagielski // ISOComWindowPeer getWindowHandle(SAFEARRAY __RPC_FAR * procId,short s,long __RPC_FAR * ret)71*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getWindowHandle( 72*b1cdbd2cSJim Jagielski /* [in] */ SAFEARRAY __RPC_FAR * procId, 73*b1cdbd2cSJim Jagielski /* [in] */ short s, 74*b1cdbd2cSJim Jagielski /* [retval][out] */ long __RPC_FAR *ret) 75*b1cdbd2cSJim Jagielski { 76*b1cdbd2cSJim Jagielski *ret = (long) m_hwnd; 77*b1cdbd2cSJim Jagielski return S_OK; 78*b1cdbd2cSJim Jagielski } 79*b1cdbd2cSJim Jagielski getToolkit(IDispatch __RPC_FAR * __RPC_FAR * retVal)80*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getToolkit( 81*b1cdbd2cSJim Jagielski /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal) 82*b1cdbd2cSJim Jagielski { 83*b1cdbd2cSJim Jagielski *retVal = NULL; 84*b1cdbd2cSJim Jagielski return S_OK; 85*b1cdbd2cSJim Jagielski } 86*b1cdbd2cSJim Jagielski setPointer(IDispatch __RPC_FAR * xPointer)87*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setPointer( 88*b1cdbd2cSJim Jagielski /* [in] */ IDispatch __RPC_FAR *xPointer) 89*b1cdbd2cSJim Jagielski { 90*b1cdbd2cSJim Jagielski return S_OK; 91*b1cdbd2cSJim Jagielski } 92*b1cdbd2cSJim Jagielski setBackground(int nColor)93*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setBackground( 94*b1cdbd2cSJim Jagielski /* [in] */ int nColor) 95*b1cdbd2cSJim Jagielski { 96*b1cdbd2cSJim Jagielski return S_OK; 97*b1cdbd2cSJim Jagielski } 98*b1cdbd2cSJim Jagielski invalidate(short __MIDL_0015)99*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidate( 100*b1cdbd2cSJim Jagielski /* [in] */ short __MIDL_0015) 101*b1cdbd2cSJim Jagielski { 102*b1cdbd2cSJim Jagielski return S_OK; 103*b1cdbd2cSJim Jagielski } 104*b1cdbd2cSJim Jagielski invalidateRect(IDispatch __RPC_FAR * aRect,short nFlags)105*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE invalidateRect( 106*b1cdbd2cSJim Jagielski /* [in] */ IDispatch __RPC_FAR *aRect, 107*b1cdbd2cSJim Jagielski /* [in] */ short nFlags) 108*b1cdbd2cSJim Jagielski { 109*b1cdbd2cSJim Jagielski return S_OK; 110*b1cdbd2cSJim Jagielski } 111*b1cdbd2cSJim Jagielski dispose(void)112*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE dispose( void) 113*b1cdbd2cSJim Jagielski { 114*b1cdbd2cSJim Jagielski return S_OK; 115*b1cdbd2cSJim Jagielski } 116*b1cdbd2cSJim Jagielski addEventListener(IDispatch __RPC_FAR * xListener)117*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE addEventListener( 118*b1cdbd2cSJim Jagielski /* [in] */ IDispatch __RPC_FAR *xListener) 119*b1cdbd2cSJim Jagielski { 120*b1cdbd2cSJim Jagielski return S_OK; 121*b1cdbd2cSJim Jagielski } 122*b1cdbd2cSJim Jagielski removeEventListener(IDispatch __RPC_FAR * xListener)123*b1cdbd2cSJim Jagielski virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE removeEventListener( 124*b1cdbd2cSJim Jagielski /* [in] */ IDispatch __RPC_FAR *xListener) 125*b1cdbd2cSJim Jagielski { 126*b1cdbd2cSJim Jagielski return S_OK; 127*b1cdbd2cSJim Jagielski } 128*b1cdbd2cSJim Jagielski get_Bridge_implementedInterfaces(SAFEARRAY __RPC_FAR * __RPC_FAR * pVal)129*b1cdbd2cSJim Jagielski virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE get_Bridge_implementedInterfaces( 130*b1cdbd2cSJim Jagielski /* [retval][out] */ SAFEARRAY __RPC_FAR * __RPC_FAR *pVal) 131*b1cdbd2cSJim Jagielski { 132*b1cdbd2cSJim Jagielski *pVal = SafeArrayCreateVector( VT_BSTR, 0, 2 ); 133*b1cdbd2cSJim Jagielski 134*b1cdbd2cSJim Jagielski if( !*pVal ) 135*b1cdbd2cSJim Jagielski return E_FAIL; 136*b1cdbd2cSJim Jagielski 137*b1cdbd2cSJim Jagielski long ix = 0; 138*b1cdbd2cSJim Jagielski CComBSTR aInterface( OLESTR( "com.sun.star.awt.XSystemDependentWindowPeer" ) ); 139*b1cdbd2cSJim Jagielski SafeArrayPutElement( *pVal, &ix, aInterface ); 140*b1cdbd2cSJim Jagielski 141*b1cdbd2cSJim Jagielski ix = 1; 142*b1cdbd2cSJim Jagielski aInterface = CComBSTR( OLESTR( "com.sun.star.awt.XWindowPeer" ) ); 143*b1cdbd2cSJim Jagielski SafeArrayPutElement( *pVal, &ix, aInterface ); 144*b1cdbd2cSJim Jagielski 145*b1cdbd2cSJim Jagielski return S_OK; 146*b1cdbd2cSJim Jagielski } 147*b1cdbd2cSJim Jagielski SetHWNDInternally(HWND hwnd)148*b1cdbd2cSJim Jagielski void SetHWNDInternally( HWND hwnd ) { m_hwnd = hwnd; } 149*b1cdbd2cSJim Jagielski }; 150*b1cdbd2cSJim Jagielski 151*b1cdbd2cSJim Jagielski #endif // __SOCOMWINDOWPEER_H_ 152