Kaydet (Commit) b3080b9a authored tarafından Rüdiger Timm's avatar Rüdiger Timm

CWS-TOOLING: integrate CWS c24v001_DEV300

üst db489c67
......@@ -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 >();
......
......@@ -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 );
......
......@@ -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 );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment