diff options
author | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-09 13:39:30 +0000 |
---|---|---|
committer | RĂ¼diger Timm <rt@openoffice.org> | 2008-12-09 13:39:30 +0000 |
commit | b3080b9a368685e5979b62a07f8579c0679ea4ed (patch) | |
tree | 14ce5873b38cf91bf624dadc1110b961165a6272 /extensions/source/activex | |
parent | db489c6713ed29def709c12c72058bb2c0c00de1 (diff) |
CWS-TOOLING: integrate CWS c24v001_DEV300
Diffstat (limited to 'extensions/source/activex')
-rw-r--r-- | extensions/source/activex/main/SOActiveX.cpp | 60 | ||||
-rw-r--r-- | extensions/source/activex/main/SOActiveX.h | 1 | ||||
-rw-r--r-- | extensions/source/activex/main/so_activex.cpp | 10 |
3 files changed, 70 insertions, 1 deletions
diff --git a/extensions/source/activex/main/SOActiveX.cpp b/extensions/source/activex/main/SOActiveX.cpp index e8c11b915f3d..73130b4fd6c2 100644 --- a/extensions/source/activex/main/SOActiveX.cpp +++ b/extensions/source/activex/main/SOActiveX.cpp @@ -235,9 +235,39 @@ HRESULT CSOActiveX::Cleanup() if( ::IsWindow( mOffWin ) ) ::DestroyWindow( mOffWin ); + TerminateOffice(); + return S_OK; } +HRESULT CSOActiveX::TerminateOffice() +{ + // create desktop + CComPtr<IDispatch> pdispDesktop; + HRESULT hr = GetIDispByFunc( mpDispFactory, L"createInstance", &CComVariant( L"com.sun.star.frame.Desktop" ), 1, pdispDesktop ); + if( !pdispDesktop || !SUCCEEDED( hr ) ) return hr; + + // create tree of frames + CComPtr<IDispatch> pdispChildren; + hr = GetIDispByFunc( pdispDesktop, L"getFrames", NULL, 0, pdispChildren ); + if( !pdispChildren || !SUCCEEDED( hr ) ) return hr; + + CComVariant aFrames; + hr = ExecuteFunc( pdispChildren, L"queryFrames", &CComVariant( 4 ), 1, &aFrames ); + if ( SUCCEEDED( hr ) ) + { + if ( ( aFrames.vt == ( VT_ARRAY | VT_DISPATCH ) || aFrames.vt == ( VT_ARRAY | VT_VARIANT ) ) + && ( !aFrames.parray || aFrames.parray->cDims == 1 && aFrames.parray->rgsabound[0].cElements == 0 ) ) + { + // there is no frames open + // TODO: check whether the frames are hidden if they are open? + CComVariant dummyResult; + hr = ExecuteFunc( pdispDesktop, L"terminate", NULL, 0, &dummyResult ); + } + } + + return hr; +} STDMETHODIMP CSOActiveX::InitNew () { @@ -752,6 +782,36 @@ HRESULT CSOActiveX::LoadURLToFrame( ) // does not work for some documents, but it is no error // if( !SUCCEEDED( hr ) ) return hr; + // try to get the model and set the presetation specific property, the setting will fail for other document formats + CComPtr<IDispatch> pdispController; + hr = GetIDispByFunc( mpDispFrame, L"getController", NULL, 0, pdispController ); + if ( SUCCEEDED( hr ) && pdispController ) + { + CComPtr<IDispatch> pdispModel; + hr = GetIDispByFunc( pdispController, L"getModel", NULL, 0, pdispModel ); + if ( SUCCEEDED( hr ) && pdispModel ) + { + CComPtr<IDispatch> pdispPres; + hr = GetIDispByFunc( pdispModel, L"getPresentation", NULL, 0, pdispPres ); + if ( SUCCEEDED( hr ) && pdispPres ) + { + // this is a presentation + // let the slide show be shown in the document window + OLECHAR* pPropName = L"IsFullScreen"; + CComVariant pPresProp; + pPresProp.vt = VT_BOOL; pPresProp.boolVal = VARIANT_FALSE ; + hr = PutPropertiesToIDisp( pdispPres, &pPropName, &pPresProp, 1 ); + + // start the slide show + if ( SUCCEEDED( hr ) ) + { + CComVariant dummyResult; + ExecuteFunc( pdispPres, L"Start", NULL, 0, &dummyResult ); + } + } + } + } + /* // create dispatch interceptor mpDispatchInterceptor = new CComObject< SODispatchInterceptor >(); diff --git a/extensions/source/activex/main/SOActiveX.h b/extensions/source/activex/main/SOActiveX.h index 87cce20f2e15..f7017d582be9 100644 --- a/extensions/source/activex/main/SOActiveX.h +++ b/extensions/source/activex/main/SOActiveX.h @@ -162,6 +162,7 @@ public: HRESULT CallLoadComponentFromURL1PBool( OLECHAR* sUrl, OLECHAR* sArgName, BOOL sArgVal ); HRESULT GetUrlStruct( OLECHAR* sUrl, CComPtr<IDispatch>& pdispUrl ); HRESULT Cleanup(); + HRESULT TerminateOffice(); HRESULT CSOActiveX::GetURL( const OLECHAR* url, const OLECHAR* target ); diff --git a/extensions/source/activex/main/so_activex.cpp b/extensions/source/activex/main/so_activex.cpp index 7ffc11b7bec0..057406a0f1f2 100644 --- a/extensions/source/activex/main/so_activex.cpp +++ b/extensions/source/activex/main/so_activex.cpp @@ -559,8 +559,14 @@ STDAPI DllRegisterServer( void ) if( aCurModule && GetModuleFileNameA( aCurModule, pActiveXPath, 1019 ) ) { aResult = DllRegisterServerNative( 31, TRUE, pActiveXPath ); - if( FAILED( aResult ) ) + if( SUCCEEDED( aResult ) ) + aResult = DllRegisterServerDoc( 31, TRUE ); + else + { aResult = DllRegisterServerNative( 31, FALSE, pActiveXPath ); + if( SUCCEEDED( aResult ) ) + aResult = DllRegisterServerDoc( 31, FALSE ); + } } return aResult; @@ -568,7 +574,9 @@ STDAPI DllRegisterServer( void ) STDAPI DllUnregisterServer( void ) { + DllUnregisterServerDoc( 63, FALSE ); DllUnregisterServerNative( 63, FALSE ); + DllUnregisterServerDoc( 63, TRUE ); return DllUnregisterServerNative( 63, TRUE ); } |