28#include <so_activex.h>
36 static const IID*
arr[] =
38 &IID_ISODispatchInterceptor,
41 for (
auto const &
i :
arr)
43 if (InlineIsEqualGUID(*
i,riid))
50 long nSearchFlags, IDispatch** retVal)
52 if ( !
aURL || !retVal )
return E_FAIL;
54 CComVariant aTargetUrl;
55 OLECHAR
const * sURLMemberName = L
"Complete";
57 HRESULT
hr =
aURL->GetIDsOfNames( IID_NULL,
const_cast<OLECHAR **
>(&sURLMemberName), 1, LOCALE_USER_DEFAULT, &nURLID );
58 if( !SUCCEEDED(
hr ) )
return hr;
60 hr = CComDispatchDriver::GetProperty(
aURL, nURLID, &aTargetUrl );
61 if( !SUCCEEDED(
hr ) )
return hr;
63 if( aTargetUrl.vt !=
VT_BSTR )
return E_FAIL;
65 if (!wcsncmp(aTargetUrl.bstrVal, L
".uno:OpenHyperlink", 18))
67 CComQIPtr< IDispatch, &IID_IDispatch > pIDisp(
this );
84 aArgs[0] = CComVariant( nSearchFlags );
85 aArgs[1] = CComVariant( aTargetFrameName );
86 aArgs[2] = CComVariant(
aURL );
89 if( !SUCCEEDED(
hr ) || aResult.vt != VT_DISPATCH || aResult.pdispVal ==
nullptr )
95 *retVal = aResult.pdispVal;
97 CComQIPtr< IUnknown, &IID_IUnknown > pIUnk( *retVal );
107 if ( !aDescripts || !retVal || SafeArrayGetDim( aDescripts ) != 1 )
112 HRESULT
hr = SafeArrayGetLBound( aDescripts, 1, &nLB );
113 if( !SUCCEEDED(
hr ) )
return hr;
115 hr = SafeArrayGetUBound( aDescripts, 1, &nUB );
116 if( !SUCCEEDED(
hr ) )
return hr;
117 if( nUB < nLB )
return E_FAIL;
119 *retVal = SafeArrayCreateVector( VT_DISPATCH, 0, nUB - nLB );
121 for (
LONG ind = nLB; ind <= nUB; ind ++ )
123 CComPtr<IDispatch> pElem;
124 SafeArrayGetElement( aDescripts, &ind, pElem );
127 OLECHAR
const * pMemberNames[3] = { L
"FeatureURL", L
"FrameName", L
"SearchFlags" };
130 if( !SUCCEEDED(
hr ) )
return hr;
131 if(
pValues[0].vt != VT_DISPATCH ||
pValues[0].pdispVal ==
nullptr
135 CComPtr<IDispatch> aRes;
137 SafeArrayPutElement( *retVal, &ind, aRes );
148 OLECHAR
const * pUrlName = L
"Complete";
151 if( !SUCCEEDED(
hr ) )
return hr;
152 if( pValue.vt !=
VT_BSTR || pValue.bstrVal ==
nullptr )
155 if (!wcsncmp(pValue.bstrVal, L
".uno:OpenHyperlink", 18))
157 LONG nLB = 0, nUB = 0;
160 hr = SafeArrayGetLBound( aArgs, 1, &nLB );
161 if( !SUCCEEDED(
hr ) )
return hr;
163 hr = SafeArrayGetUBound( aArgs, 1, &nUB );
164 if( !SUCCEEDED(
hr ) )
return hr;
165 if( nUB < nLB )
return E_FAIL;
167 for (
LONG ind = nLB; ind <= nUB; ind ++ )
169 CComVariant pVarElem;
170 SafeArrayGetElement( aArgs, &ind, &pVarElem );
171 if( pVarElem.vt == VT_DISPATCH && pVarElem.pdispVal !=
nullptr )
173 OLECHAR
const * pMemberNames[2] = { L
"Name", L
"Value" };
176 if( !SUCCEEDED(
hr ) )
return hr;
180 if (!wcsncmp(
pValues[0].bstrVal, L
"URL", 3))
182 EnterCriticalSection( &
mMutex );
188 LeaveCriticalSection( &
mMutex );
215 *pVal = SafeArrayCreateVector(
VT_BSTR, 0, 3 );
221 CComBSTR aPattern( OLESTR(
"ftp://*" ) );
222 SafeArrayPutElement( *pVal, &ix, aPattern );
225 aPattern = CComBSTR( OLESTR(
"http://*" ) );
226 SafeArrayPutElement( *pVal, &ix, aPattern );
229 aPattern = CComBSTR( OLESTR(
"file://*" ) );
230 SafeArrayPutElement( *pVal, &ix, aPattern );
const PropertyValue * pValues
HRESULT GetURL(const OLECHAR *url, const OLECHAR *target)
virtual HRESULT STDMETHODCALLTYPE dispatch(IDispatch __RPC_FAR *aURL, SAFEARRAY __RPC_FAR *aArgs) override
virtual HRESULT STDMETHODCALLTYPE removeStatusListener(IDispatch __RPC_FAR *xControl, IDispatch __RPC_FAR *aURL) override
CSOActiveX * m_xParentControl
virtual HRESULT STDMETHODCALLTYPE addStatusListener(IDispatch __RPC_FAR *xControl, IDispatch __RPC_FAR *aURL) override
STDMETHOD() InterfaceSupportsErrorInfo(REFIID riid) override
virtual HRESULT STDMETHODCALLTYPE getInterceptedURLs(SAFEARRAY __RPC_FAR *__RPC_FAR *pVal) override
CComPtr< IDispatch > m_xSlave
virtual HRESULT STDMETHODCALLTYPE queryDispatch(IDispatch __RPC_FAR *aURL, BSTR aTargetFrameName, long nSearchFlags, IDispatch __RPC_FAR *__RPC_FAR *retVal) override
virtual HRESULT STDMETHODCALLTYPE queryDispatches(SAFEARRAY __RPC_FAR *aDescripts, SAFEARRAY __RPC_FAR *__RPC_FAR *retVal) override
HRESULT ExecuteFunc(IDispatch *idispUnoObject, OLECHAR const *sFuncName, CComVariant *params, unsigned int count, CComVariant *pResult)
HRESULT GetPropertiesFromIDisp(IDispatch *pdispObject, OLECHAR const **sMemberNames, CComVariant *pVariant, unsigned int count)