1 // SODispatchInterceptor.h: Definition of the SODispatchInterceptor class
3 //////////////////////////////////////////////////////////////////////
5 #if !defined __SODISPATCHINTERCEPTOR_H_
6 #define __SODISPATCHINTERCEPTOR_H_
10 #endif // _MSC_VER > 1000
12 #include "resource.h" // main symbols
17 #if defined(_MSC_VER) && (_MSC_VER >= 1300)
22 #include "so_activex.h"
26 /////////////////////////////////////////////////////////////////////////////
27 // SODispatchInterceptor
29 class SODispatchInterceptor
:
30 public IDispatchImpl
<ISODispatchInterceptor
, &IID_ISODispatchInterceptor
, &LIBID_SO_ACTIVEXLib
>,
31 public ISupportErrorInfo
,
32 public CComObjectRoot
,
33 public CComCoClass
<SODispatchInterceptor
,&CLSID_SODispatchInterceptor
>
35 CComPtr
<IDispatch
> m_xMaster
;
36 CComPtr
<IDispatch
> m_xSlave
;
37 CSOActiveX
* m_xParentControl
;
38 CRITICAL_SECTION mMutex
;
40 SODispatchInterceptor() : m_xParentControl( NULL
) { InitializeCriticalSection(&mMutex
); }
41 virtual ~SODispatchInterceptor() { ATLASSERT( !m_xParentControl
); DeleteCriticalSection(&mMutex
); }
43 BEGIN_COM_MAP(SODispatchInterceptor
)
44 COM_INTERFACE_ENTRY(IDispatch
)
45 COM_INTERFACE_ENTRY(ISODispatchInterceptor
)
46 COM_INTERFACE_ENTRY(ISupportErrorInfo
)
48 DECLARE_NOT_AGGREGATABLE(SODispatchInterceptor
)
49 // Remove the comment from the line above if you don't want your object to
50 // support aggregation.
52 DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR
)
54 void SetParent( CSOActiveX
* pParent
)
56 ATLASSERT( !m_xParentControl
);
57 EnterCriticalSection( &mMutex
);
58 m_xParentControl
= pParent
;
59 LeaveCriticalSection( &mMutex
);
64 EnterCriticalSection( &mMutex
);
65 m_xParentControl
= NULL
;
66 LeaveCriticalSection( &mMutex
);
70 STDMETHOD(InterfaceSupportsErrorInfo
)(REFIID riid
);
72 // ISODispatchInterceptor
74 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getSlaveDispatchProvider(
75 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
)
81 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setSlaveDispatchProvider(
82 /* [in] */ IDispatch __RPC_FAR
*xNewDispatchProvider
)
84 m_xSlave
= xNewDispatchProvider
;
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getMasterDispatchProvider(
89 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
)
95 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setMasterDispatchProvider(
96 /* [in] */ IDispatch __RPC_FAR
*xNewSupplier
)
98 m_xMaster
= xNewSupplier
;
102 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatch(
103 /* [in] */ IDispatch __RPC_FAR
*aURL
,
104 /* [in] */ BSTR aTargetFrameName
,
105 /* [in] */ long nSearchFlags
,
106 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
);
108 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatches(
109 /* [in] */ SAFEARRAY __RPC_FAR
* aDescripts
,
110 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*retVal
);
112 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
dispatch(
113 /* [in] */ IDispatch __RPC_FAR
*aURL
,
114 /* [in] */ SAFEARRAY __RPC_FAR
* aArgs
);
116 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
addStatusListener(
117 /* [in] */ IDispatch __RPC_FAR
*xControl
,
118 /* [in] */ IDispatch __RPC_FAR
*aURL
);
120 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
removeStatusListener(
121 /* [in] */ IDispatch __RPC_FAR
*xControl
,
122 /* [in] */ IDispatch __RPC_FAR
*aURL
);
124 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getInterceptedURLs(
125 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
);
127 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE
get_Bridge_implementedInterfaces(
128 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
)
130 *pVal
= SafeArrayCreateVector( VT_BSTR
, 0, 4 );
136 CComBSTR
aInterface( OLESTR( "com.sun.star.frame.XDispatchProviderInterceptor" ) );
137 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
140 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatchProvider" ) );
141 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
144 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatch" ) );
145 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
148 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XInterceptorInfo" ) );
149 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
155 #endif // __SODISPATCHINTERCEPTOR_H_