summaryrefslogtreecommitdiff
path: root/extensions/source/activex/main
diff options
context:
space:
mode:
authorMikhail Voitenko <mav@openoffice.org>2002-09-16 13:10:29 +0000
committerMikhail Voitenko <mav@openoffice.org>2002-09-16 13:10:29 +0000
commitaa317f022618d1f297770886989c0f6144cc8bab (patch)
tree90f8ca8f8d7a32a0fc1983c0afec3c0cde980e5c /extensions/source/activex/main
parent49d40e947d2aa5505a258269b7003fe6d6f47cab (diff)
#102831# use ViewOnly mode
Diffstat (limited to 'extensions/source/activex/main')
-rw-r--r--extensions/source/activex/main/SOActiveX.cpp47
-rw-r--r--extensions/source/activex/main/SOActiveX.h2
2 files changed, 29 insertions, 20 deletions
diff --git a/extensions/source/activex/main/SOActiveX.cpp b/extensions/source/activex/main/SOActiveX.cpp
index b50a5be581c3..34a38bfa83b3 100644
--- a/extensions/source/activex/main/SOActiveX.cpp
+++ b/extensions/source/activex/main/SOActiveX.cpp
@@ -431,7 +431,10 @@ HRESULT CSOActiveX::CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArg
return S_OK;
}
-HRESULT CSOActiveX::CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal )
+HRESULT CSOActiveX::CallDispatchMethod( OLECHAR* sUrl,
+ CComVariant* aArgNames,
+ CComVariant* aArgVals,
+ unsigned int count )
{
CComPtr<IDispatch> pdispURL;
HRESULT hr = GetUrlStruct( sUrl, pdispURL );
@@ -449,25 +452,27 @@ HRESULT CSOActiveX::CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL s
pdispXDispatch );
if( !SUCCEEDED( hr ) ) return hr;
- SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, 1 );
- long ix = 0;
- CComPtr<IDispatch> pdispPropVal;
- hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal );
- if( !SUCCEEDED( hr ) ) return hr;
+ SAFEARRAY FAR* pPropVals = SafeArrayCreateVector( VT_DISPATCH, 0, count );
+ for( long ix = 0; ix < (long)count; ix ++ )
+ {
+ CComPtr<IDispatch> pdispPropVal;
+ hr = GetUnoStruct( L"com.sun.star.beans.PropertyValue", pdispPropVal );
+ if( !SUCCEEDED( hr ) ) return hr;
- OLECHAR* sPropMemberNames[2] = { L"Name", L"Value" };
- CComVariant pPropVar[2];
- pPropVar[0] = CComVariant( sArgName );
- pPropVar[1] = CComVariant(); pPropVar[1].vt = VT_BOOL; pPropVar[1].boolVal = sArgVal ? VARIANT_TRUE : VARIANT_FALSE ;
- hr = PutPropertiesToIDisp( pdispPropVal, sPropMemberNames, pPropVar, 2 );
- if( !SUCCEEDED( hr ) ) return hr;
+ OLECHAR* sPropMemberNames[2] = { L"Name", L"Value" };
+ CComVariant pPropVar[2];
+ pPropVar[0] = aArgNames[ix];
+ pPropVar[1] = aArgVals[ix];
+ hr = PutPropertiesToIDisp( pdispPropVal, sPropMemberNames, pPropVar, 2 );
+ if( !SUCCEEDED( hr ) ) return hr;
- SafeArrayPutElement( pPropVals, &ix, pdispPropVal );
+ SafeArrayPutElement( pPropVals, &ix, pdispPropVal );
+ }
CComVariant aDispArgs[2];
aDispArgs[1] = CComVariant( pdispURL );
// aDispArgs[0] = CComVariant( pPropVals ); such constructor is not defined ??!
- aDispArgs[0] = CComVariant(); aDispArgs[0].vt = VT_ARRAY | VT_DISPATCH; aDispArgs[0].parray = pPropVals;
+ aDispArgs[0].vt = VT_ARRAY | VT_DISPATCH; aDispArgs[0].parray = pPropVals;
CComVariant dummyResult;
hr = ExecuteFunc( pdispXDispatch, L"dispatch", aDispArgs, 2, &dummyResult );
@@ -478,13 +483,17 @@ HRESULT CSOActiveX::CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL s
HRESULT CSOActiveX::LoadURLToFrame( )
{
- HRESULT hr = CallDispatch1PBool( mCurFileUrl, L"ReadOnly", mbViewOnly );
-
- // can be used later
- // HRESULT hr = CallLoadComponentFromURL1PBool( mCurFileUrl, L"ReadOnly", mbViewOnly );
+ CComVariant aArgNames[2] = { L"ReadOnly", L"ViewOnly" };
+ CComVariant aArgVals[2];
+ aArgVals[0] = CComVariant(); aArgVals[0].vt = VT_BOOL; aArgVals[0].boolVal = mbViewOnly ? VARIANT_TRUE : VARIANT_FALSE;
+ aArgVals[1] = CComVariant(); aArgVals[1].vt = VT_BOOL; aArgVals[1].boolVal = mbViewOnly ? VARIANT_TRUE : VARIANT_FALSE;
+ HRESULT hr = CallDispatchMethod( mCurFileUrl, aArgNames, aArgVals, 2 );
if( !SUCCEEDED( hr ) ) return hr;
- hr = CallDispatch1PBool( L"slot:6661", L"MenuBarVisible", FALSE );
+ CComVariant aBarName( L"MenuBarVisible" );
+ CComVariant aBarVis;
+ aBarVis.vt = VT_BOOL; aBarVis.boolVal = VARIANT_FALSE;
+ hr = CallDispatchMethod( L"slot:6661", &aBarName, &aBarVis, 1 );
if( !SUCCEEDED( hr ) ) return hr;
/*
diff --git a/extensions/source/activex/main/SOActiveX.h b/extensions/source/activex/main/SOActiveX.h
index 89e2c88b43c5..aee8e3ccd0be 100644
--- a/extensions/source/activex/main/SOActiveX.h
+++ b/extensions/source/activex/main/SOActiveX.h
@@ -125,7 +125,7 @@ public:
HRESULT CreateFrameOldWay( HWND hwnd, int width, int height );
HRESULT GetUnoStruct( OLECHAR* sStructName, CComPtr<IDispatch>& pdispResult );
HRESULT LoadURLToFrame();
- HRESULT CallDispatch1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal );
+ HRESULT CallDispatchMethod( OLECHAR* sUrl, CComVariant* sArgNames, CComVariant* sArgVal, unsigned int count );
HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal );
HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl );
HRESULT Cleanup();