bump product version to 5.0.4.1
[LibreOffice.git] / extensions / source / activex / SODispatchInterceptor.h
blobf0ec8c47b64d8c25c734733c259d90f1a4a69625
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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
25 #ifdef _MSC_VER
26 #pragma once
27 #endif
29 #include "resource.h"
30 #include <ExDispID.h>
31 #include <ExDisp.h>
32 #include <shlguid.h>
34 #include <atlctl.h>
36 #include "so_activex.h"
38 class CSOActiveX;
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;
53 public:
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)
61 END_COM_MAP()
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 );
76 void ClearParent()
78 EnterCriticalSection( &mMutex );
79 m_xParentControl = NULL;
80 LeaveCriticalSection( &mMutex );
83 // ISupportsErrorInfo
84 STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
86 // ISODispatchInterceptor
88 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getSlaveDispatchProvider(
89 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal)
91 *retVal = m_xSlave;
92 return S_OK;
95 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setSlaveDispatchProvider(
96 /* [in] */ IDispatch __RPC_FAR *xNewDispatchProvider)
98 m_xSlave = xNewDispatchProvider;
99 return S_OK;
102 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE getMasterDispatchProvider(
103 /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *retVal)
105 *retVal = m_xMaster;
106 return S_OK;
109 virtual /* [helpstring][id] */ HRESULT STDMETHODCALLTYPE setMasterDispatchProvider(
110 /* [in] */ IDispatch __RPC_FAR *xNewSupplier)
112 m_xMaster = xNewSupplier;
113 return S_OK;
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 );
146 if( !*pVal )
147 return E_FAIL;
149 long ix = 0;
150 CComBSTR aInterface( OLESTR( "com.sun.star.frame.XDispatchProviderInterceptor" ) );
151 SafeArrayPutElement( *pVal, &ix, aInterface );
153 ix = 1;
154 aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XDispatchProvider" ) );
155 SafeArrayPutElement( *pVal, &ix, aInterface );
157 ix = 2;
158 aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XDispatch" ) );
159 SafeArrayPutElement( *pVal, &ix, aInterface );
161 ix = 3;
162 aInterface = CComBSTR( OLESTR( "com.sun.star.frame.XInterceptorInfo" ) );
163 SafeArrayPutElement( *pVal, &ix, aInterface );
165 return S_OK;
169 #endif // INCLUDED_EXTENSIONS_SOURCE_ACTIVEX_SODISPATCHINTERCEPTOR_H
171 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */