1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 // SODispatchInterceptor.h: Definition of the SODispatchInterceptor class
22 #ifndef INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H
23 #define INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H
36 #include "so_activex.h"
41 // SODispatchInterceptor
43 class SODispatchInterceptor
:
44 public IDispatchImpl
<ISODispatchInterceptor
, &IID_ISODispatchInterceptor
, &LIBID_SO_ACTIVEXLib
>,
45 public ISupportErrorInfo
,
46 public CComObjectRoot
,
47 public CComCoClass
<SODispatchInterceptor
,&CLSID_SODispatchInterceptor
>
49 CComPtr
<IDispatch
> m_xMaster
;
50 CComPtr
<IDispatch
> m_xSlave
;
51 CSOActiveX
* m_xParentControl
;
52 CRITICAL_SECTION mMutex
;
54 SODispatchInterceptor() : m_xParentControl( NULL
) { InitializeCriticalSection(&mMutex
); }
55 virtual ~SODispatchInterceptor() { ATLASSERT( !m_xParentControl
); DeleteCriticalSection(&mMutex
); }
57 BEGIN_COM_MAP(SODispatchInterceptor
)
58 COM_INTERFACE_ENTRY(IDispatch
)
59 COM_INTERFACE_ENTRY(ISODispatchInterceptor
)
60 COM_INTERFACE_ENTRY(ISupportErrorInfo
)
62 DECLARE_NOT_AGGREGATABLE(SODispatchInterceptor
)
63 // Remove the comment from the line above if you don't want your object to
64 // support aggregation.
66 DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR
)
68 void SetParent( CSOActiveX
* pParent
)
70 ATLASSERT( !m_xParentControl
);
71 EnterCriticalSection( &mMutex
);
72 m_xParentControl
= pParent
;
73 LeaveCriticalSection( &mMutex
);
78 EnterCriticalSection( &mMutex
);
79 m_xParentControl
= NULL
;
80 LeaveCriticalSection( &mMutex
);
84 STDMETHOD(InterfaceSupportsErrorInfo
)(REFIID riid
);
86 // ISODispatchInterceptor
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getSlaveDispatchProvider(
89 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
)
95 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setSlaveDispatchProvider(
96 /* [in] */ IDispatch __RPC_FAR
*xNewDispatchProvider
)
98 m_xSlave
= xNewDispatchProvider
;
102 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getMasterDispatchProvider(
103 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
)
109 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setMasterDispatchProvider(
110 /* [in] */ IDispatch __RPC_FAR
*xNewSupplier
)
112 m_xMaster
= xNewSupplier
;
116 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatch(
117 /* [in] */ IDispatch __RPC_FAR
*aURL
,
118 /* [in] */ BSTR aTargetFrameName
,
119 /* [in] */ long nSearchFlags
,
120 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
);
122 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatches(
123 /* [in] */ SAFEARRAY __RPC_FAR
* aDescripts
,
124 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*retVal
);
126 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
dispatch(
127 /* [in] */ IDispatch __RPC_FAR
*aURL
,
128 /* [in] */ SAFEARRAY __RPC_FAR
* aArgs
);
130 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
addStatusListener(
131 /* [in] */ IDispatch __RPC_FAR
*xControl
,
132 /* [in] */ IDispatch __RPC_FAR
*aURL
);
134 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
removeStatusListener(
135 /* [in] */ IDispatch __RPC_FAR
*xControl
,
136 /* [in] */ IDispatch __RPC_FAR
*aURL
);
138 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getInterceptedURLs(
139 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
);
141 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE
get_Bridge_implementedInterfaces(
142 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
)
144 *pVal
= SafeArrayCreateVector( VT_BSTR
, 0, 4 );
150 CComBSTR
aInterface( OLESTR( "com.sun.star.frame.XDispatchProviderInterceptor" ) );
151 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
154 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatchProvider" ) );
155 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
158 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatch" ) );
159 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
162 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XInterceptorInfo" ) );
163 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
169 #endif // INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */