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
35 #include <so_activex.h>
40 // SODispatchInterceptor
42 class SODispatchInterceptor
:
43 public IDispatchImpl
<ISODispatchInterceptor
, &IID_ISODispatchInterceptor
, &LIBID_SO_ACTIVEXLib
>,
44 public ISupportErrorInfo
,
45 public CComObjectRoot
,
46 public CComCoClass
<SODispatchInterceptor
,&CLSID_SODispatchInterceptor
>
48 CComPtr
<IDispatch
> m_xMaster
;
49 CComPtr
<IDispatch
> m_xSlave
;
50 CSOActiveX
* m_xParentControl
;
51 CRITICAL_SECTION mMutex
;
53 SODispatchInterceptor() : m_xParentControl( nullptr ) { InitializeCriticalSection(&mMutex
); }
54 virtual ~SODispatchInterceptor() { ATLASSERT( !m_xParentControl
); DeleteCriticalSection(&mMutex
); }
56 BEGIN_COM_MAP(SODispatchInterceptor
)
57 COM_INTERFACE_ENTRY(IDispatch
)
58 COM_INTERFACE_ENTRY(ISODispatchInterceptor
)
59 COM_INTERFACE_ENTRY(ISupportErrorInfo
)
61 #pragma clang diagnostic push
62 #pragma clang diagnostic ignored "-Winconsistent-missing-override"
66 #pragma clang diagnostic pop
68 DECLARE_NOT_AGGREGATABLE(SODispatchInterceptor
)
69 // Remove the comment from the line above if you don't want your object to
70 // support aggregation.
72 DECLARE_REGISTRY_RESOURCEID(IDR_SODISPATCHINTERCEPTOR
)
74 void SetParent( CSOActiveX
* pParent
)
76 ATLASSERT( !m_xParentControl
);
77 EnterCriticalSection( &mMutex
);
78 m_xParentControl
= pParent
;
79 LeaveCriticalSection( &mMutex
);
84 EnterCriticalSection( &mMutex
);
85 m_xParentControl
= nullptr;
86 LeaveCriticalSection( &mMutex
);
90 STDMETHOD(InterfaceSupportsErrorInfo
)(REFIID riid
) override
;
92 // ISODispatchInterceptor
94 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getSlaveDispatchProvider(
95 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
) override
101 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setSlaveDispatchProvider(
102 /* [in] */ IDispatch __RPC_FAR
*xNewDispatchProvider
) override
104 m_xSlave
= xNewDispatchProvider
;
108 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getMasterDispatchProvider(
109 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
) override
115 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
setMasterDispatchProvider(
116 /* [in] */ IDispatch __RPC_FAR
*xNewSupplier
) override
118 m_xMaster
= xNewSupplier
;
122 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatch(
123 /* [in] */ IDispatch __RPC_FAR
*aURL
,
124 /* [in] */ BSTR aTargetFrameName
,
125 /* [in] */ long nSearchFlags
,
126 /* [retval][out] */ IDispatch __RPC_FAR
*__RPC_FAR
*retVal
) override
;
128 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
queryDispatches(
129 /* [in] */ SAFEARRAY __RPC_FAR
* aDescripts
,
130 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*retVal
) override
;
132 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
dispatch(
133 /* [in] */ IDispatch __RPC_FAR
*aURL
,
134 /* [in] */ SAFEARRAY __RPC_FAR
* aArgs
) override
;
136 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
addStatusListener(
137 /* [in] */ IDispatch __RPC_FAR
*xControl
,
138 /* [in] */ IDispatch __RPC_FAR
*aURL
) override
;
140 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
removeStatusListener(
141 /* [in] */ IDispatch __RPC_FAR
*xControl
,
142 /* [in] */ IDispatch __RPC_FAR
*aURL
) override
;
144 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE
getInterceptedURLs(
145 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
) override
;
147 virtual /* [helpstring][id][propget] */ HRESULT STDMETHODCALLTYPE
get_Bridge_implementedInterfaces(
148 /* [retval][out] */ SAFEARRAY __RPC_FAR
* __RPC_FAR
*pVal
) override
150 *pVal
= SafeArrayCreateVector( VT_BSTR
, 0, 4 );
156 CComBSTR
aInterface( OLESTR( "com.sun.star.frame.XDispatchProviderInterceptor" ) );
157 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
160 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatchProvider" ) );
161 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
164 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XDispatch" ) );
165 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
168 aInterface
= CComBSTR( OLESTR( "com.sun.star.frame.XInterceptorInfo" ) );
169 SafeArrayPutElement( *pVal
, &ix
, aInterface
);
175 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */