2000-09-18 16:07:07 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
2008-04-11 07:27:37 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 16:07:07 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 10:50:06 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_vcl.hxx"
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
#ifdef WNT
|
|
|
|
#include <tools/prewin.h>
|
|
|
|
#include <process.h> // for _beginthreadex
|
|
|
|
#include <ole2.h> // for _beginthreadex
|
|
|
|
#include <tools/postwin.h>
|
|
|
|
#endif
|
|
|
|
|
2002-08-27 11:06:11 +00:00
|
|
|
// [ed 5/14/02 Add in explicit check for quartz graphics. OS X will define
|
|
|
|
// unx for both quartz and X11 graphics, but we include svunx.h only if we're
|
|
|
|
// building X11 graphics layers.
|
|
|
|
|
|
|
|
#if defined UNX && ! defined QUARTZ
|
2009-02-17 10:33:03 +00:00
|
|
|
#include "svunx.h"
|
2001-02-23 17:02:50 +00:00
|
|
|
#endif
|
|
|
|
|
2009-02-17 10:33:03 +00:00
|
|
|
#include "svsys.h"
|
|
|
|
#include "vcl/salinst.hxx"
|
|
|
|
#include "vcl/salwtype.hxx"
|
|
|
|
#include "vos/signal.hxx"
|
|
|
|
#include "tools/tools.h"
|
|
|
|
#include "tools/debug.hxx"
|
|
|
|
#include "tools/unqid.hxx"
|
|
|
|
#include "vcl/svdata.hxx"
|
|
|
|
#include "vcl/dbggui.hxx"
|
|
|
|
#include "vcl/svapp.hxx"
|
|
|
|
#include "vcl/wrkwin.hxx"
|
|
|
|
#include "vcl/cvtgrf.hxx"
|
|
|
|
#include "vcl/image.hxx"
|
|
|
|
#include "tools/resmgr.hxx"
|
|
|
|
#include "vcl/accmgr.hxx"
|
|
|
|
#include "vcl/idlemgr.hxx"
|
|
|
|
#include "vcl/outdev.h"
|
|
|
|
#include "vcl/outfont.hxx"
|
|
|
|
#include "vcl/print.h"
|
|
|
|
#include "vcl/settings.hxx"
|
|
|
|
#include "vcl/unowrap.hxx"
|
|
|
|
#include "vcl/salsys.hxx"
|
|
|
|
#include "vcl/saltimer.hxx"
|
|
|
|
#include "vcl/salimestatus.hxx"
|
|
|
|
#include "vcl/impimagetree.hxx"
|
|
|
|
#include "vcl/xconnection.hxx"
|
|
|
|
|
|
|
|
#include "vos/process.hxx"
|
|
|
|
#include "osl/file.hxx"
|
|
|
|
#include "comphelper/processfactory.hxx"
|
|
|
|
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
|
|
|
|
#include "com/sun/star/lang/XComponent.hpp"
|
|
|
|
#include "rtl/logfile.hxx"
|
2009-10-16 00:05:16 +02:00
|
|
|
#include <unotools/syslocaleoptions.hxx>
|
2009-10-19 13:22:39 +02:00
|
|
|
#include "unotools/fontcfg.hxx"
|
2009-02-17 10:33:03 +00:00
|
|
|
#include "vcl/configsettings.hxx"
|
|
|
|
#include "vcl/lazydelete.hxx"
|
|
|
|
|
|
|
|
#include "cppuhelper/implbase1.hxx"
|
|
|
|
#include "uno/current_context.hxx"
|
2001-02-23 17:08:12 +00:00
|
|
|
|
2007-03-05 14:24:06 +00:00
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
|
|
|
#include <typeinfo>
|
2009-02-17 10:33:03 +00:00
|
|
|
#include "rtl/strbuf.hxx"
|
2007-03-05 14:24:06 +00:00
|
|
|
#endif
|
|
|
|
|
2001-06-21 10:14:28 +00:00
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
|
2003-12-01 12:08:21 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// =======================================================================
|
|
|
|
|
|
|
|
class ImplVCLExceptionHandler : public ::vos::OSignalHandler
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ::vos::OSignalHandler::TSignalAction SAL_CALL signal( ::vos::OSignalHandler::TSignalInfo* pInfo );
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
::vos::OSignalHandler::TSignalAction SAL_CALL ImplVCLExceptionHandler::signal( ::vos::OSignalHandler::TSignalInfo* pInfo )
|
|
|
|
{
|
|
|
|
static BOOL bIn = FALSE;
|
|
|
|
|
|
|
|
// Wenn wir nocheinmal abstuerzen, verabschieden wir uns gleich
|
|
|
|
if ( !bIn )
|
|
|
|
{
|
|
|
|
USHORT nVCLException = 0;
|
|
|
|
|
|
|
|
// UAE
|
2006-06-19 18:14:40 +00:00
|
|
|
if ( (pInfo->Signal == osl_Signal_AccessViolation) ||
|
|
|
|
(pInfo->Signal == osl_Signal_IntegerDivideByZero) ||
|
|
|
|
(pInfo->Signal == osl_Signal_FloatDivideByZero) ||
|
|
|
|
(pInfo->Signal == osl_Signal_DebugBreak) )
|
2000-09-18 16:07:07 +00:00
|
|
|
nVCLException = EXC_SYSTEM;
|
|
|
|
|
|
|
|
// RC
|
2006-06-19 18:14:40 +00:00
|
|
|
if ((pInfo->Signal == osl_Signal_User) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
(pInfo->UserSignal == OSL_SIGNAL_USER_RESOURCEFAILURE) )
|
|
|
|
nVCLException = EXC_RSCNOTLOADED;
|
|
|
|
|
|
|
|
// DISPLAY-Unix
|
2006-06-19 18:14:40 +00:00
|
|
|
if ((pInfo->Signal == osl_Signal_User) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
(pInfo->UserSignal == OSL_SIGNAL_USER_X11SUBSYSTEMERROR) )
|
|
|
|
nVCLException = EXC_DISPLAY;
|
|
|
|
|
|
|
|
// Remote-Client
|
2006-06-19 18:14:40 +00:00
|
|
|
if ((pInfo->Signal == osl_Signal_User) &&
|
2000-09-18 16:07:07 +00:00
|
|
|
(pInfo->UserSignal == OSL_SIGNAL_USER_RVPCONNECTIONERROR) )
|
|
|
|
nVCLException = EXC_REMOTE;
|
|
|
|
|
|
|
|
if ( nVCLException )
|
|
|
|
{
|
|
|
|
bIn = TRUE;
|
2007-04-19 08:19:06 +00:00
|
|
|
|
|
|
|
::vos::OGuard aLock(&Application::GetSolarMutex());
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Timer nicht mehr anhalten, da ansonsten die UAE-Box
|
|
|
|
// auch nicht mehr gepaintet wird
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
if ( pSVData->mpApp )
|
|
|
|
{
|
|
|
|
USHORT nOldMode = Application::GetSystemWindowMode();
|
|
|
|
Application::SetSystemWindowMode( nOldMode & ~SYSTEMWINDOW_MODE_NOAUTOMODE );
|
|
|
|
pSVData->mpApp->Exception( nVCLException );
|
|
|
|
Application::SetSystemWindowMode( nOldMode );
|
|
|
|
}
|
|
|
|
bIn = FALSE;
|
|
|
|
|
2001-03-20 09:36:58 +00:00
|
|
|
return vos::OSignalHandler::TAction_CallNextHandler;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-03-20 09:36:58 +00:00
|
|
|
return vos::OSignalHandler::TAction_CallNextHandler;
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
// =======================================================================
|
2005-10-13 08:36:37 +00:00
|
|
|
BOOL ImplSVMain()
|
2000-09-18 16:07:07 +00:00
|
|
|
{
|
2005-10-13 08:36:37 +00:00
|
|
|
// The 'real' SVMain()
|
2001-08-07 11:31:31 +00:00
|
|
|
RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::SVMain" );
|
2001-07-10 05:29:57 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
|
|
|
DBG_ASSERT( pSVData->mpApp, "no instance of class Application" );
|
|
|
|
|
2001-06-21 10:14:28 +00:00
|
|
|
Reference<XMultiServiceFactory> xMS;
|
2001-02-22 14:44:00 +00:00
|
|
|
|
2003-04-11 16:28:07 +00:00
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
BOOL bInit = InitVCL( xMS );
|
|
|
|
|
|
|
|
if( bInit )
|
|
|
|
{
|
|
|
|
// Application-Main rufen
|
|
|
|
pSVData->maAppData.mbInAppMain = TRUE;
|
|
|
|
pSVData->mpApp->Main();
|
|
|
|
pSVData->maAppData.mbInAppMain = FALSE;
|
|
|
|
}
|
|
|
|
|
2006-10-13 07:30:53 +00:00
|
|
|
if( pSVData->mxDisplayConnection.is() )
|
|
|
|
{
|
|
|
|
vcl::DisplayConnection* pConnection =
|
|
|
|
dynamic_cast<vcl::DisplayConnection*>(pSVData->mxDisplayConnection.get());
|
|
|
|
|
|
|
|
if( pConnection )
|
|
|
|
pConnection->dispatchDowningEvent();
|
|
|
|
pSVData->mxDisplayConnection.clear();
|
|
|
|
}
|
2006-07-10 15:34:23 +00:00
|
|
|
|
2005-03-29 11:56:21 +00:00
|
|
|
// This is a hack to work around the problem of the asynchronous nature
|
|
|
|
// of bridging accessibility through Java: on shutdown there might still
|
|
|
|
// be some events in the AWT EventQueue, which need the SolarMutex which
|
|
|
|
// - on the other hand - is destroyed in DeInitVCL(). So empty the queue
|
|
|
|
// here ..
|
|
|
|
Reference< XComponent > xComponent(pSVData->mxAccessBridge, UNO_QUERY);
|
|
|
|
if( xComponent.is() )
|
|
|
|
{
|
|
|
|
ULONG nCount = Application::ReleaseSolarMutex();
|
|
|
|
xComponent->dispose();
|
|
|
|
Application::AcquireSolarMutex(nCount);
|
|
|
|
pSVData->mxAccessBridge.clear();
|
|
|
|
}
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
DeInitVCL();
|
|
|
|
return bInit;
|
|
|
|
}
|
|
|
|
|
2005-10-13 08:36:37 +00:00
|
|
|
BOOL SVMain()
|
|
|
|
{
|
|
|
|
// #i47888# allow for alternative initialization as required for e.g. MacOSX
|
|
|
|
extern BOOL ImplSVMainHook( BOOL* );
|
|
|
|
|
|
|
|
BOOL bInit;
|
|
|
|
if( ImplSVMainHook( &bInit ) )
|
|
|
|
return bInit;
|
|
|
|
else
|
|
|
|
return ImplSVMain();
|
|
|
|
}
|
2001-02-22 14:44:00 +00:00
|
|
|
// This variable is set, when no Application object is instantiated
|
|
|
|
// before SVInit is called
|
|
|
|
static Application * pOwnSvApp = NULL;
|
|
|
|
// Exception handler. pExceptionHandler != NULL => VCL already inited
|
|
|
|
ImplVCLExceptionHandler * pExceptionHandler = NULL;
|
|
|
|
|
|
|
|
class Application_Impl : public Application
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
void Main(){};
|
|
|
|
};
|
|
|
|
|
2006-08-04 11:31:30 +00:00
|
|
|
class DesktopEnvironmentContext: public cppu::WeakImplHelper1< com::sun::star::uno::XCurrentContext >
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DesktopEnvironmentContext( const com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > & ctx)
|
|
|
|
: m_xNextContext( ctx ) {}
|
|
|
|
|
|
|
|
// XCurrentContext
|
|
|
|
virtual com::sun::star::uno::Any SAL_CALL getValueByName( const rtl::OUString& Name )
|
|
|
|
throw (com::sun::star::uno::RuntimeException);
|
|
|
|
|
|
|
|
private:
|
|
|
|
com::sun::star::uno::Reference< com::sun::star::uno::XCurrentContext > m_xNextContext;
|
|
|
|
};
|
|
|
|
|
|
|
|
Any SAL_CALL DesktopEnvironmentContext::getValueByName( const rtl::OUString& Name) throw (RuntimeException)
|
|
|
|
{
|
|
|
|
Any retVal;
|
|
|
|
|
|
|
|
if ( 0 == Name.compareToAscii( "system.desktop-environment" ) )
|
|
|
|
{
|
|
|
|
retVal = makeAny( Application::GetDesktopEnvironment() );
|
|
|
|
}
|
|
|
|
else if( m_xNextContext.is() )
|
|
|
|
{
|
|
|
|
// Call next context in chain if found
|
|
|
|
retVal = m_xNextContext->getValueByName( Name );
|
|
|
|
}
|
|
|
|
return retVal;
|
|
|
|
}
|
|
|
|
|
2001-02-23 17:08:12 +00:00
|
|
|
BOOL InitVCL( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr )
|
2001-02-22 14:44:00 +00:00
|
|
|
{
|
2001-08-07 11:31:31 +00:00
|
|
|
RTL_LOGFILE_CONTEXT( aLog, "vcl (ss112471) ::InitVCL" );
|
2001-07-10 05:29:57 +00:00
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
if( pExceptionHandler != NULL )
|
|
|
|
return FALSE;
|
|
|
|
|
2005-06-30 12:14:32 +00:00
|
|
|
if( ! ImplGetSVData() )
|
|
|
|
ImplInitSVData();
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
if( !ImplGetSVData()->mpApp )
|
|
|
|
{
|
|
|
|
pOwnSvApp = new Application_Impl();
|
|
|
|
}
|
2001-02-23 17:08:12 +00:00
|
|
|
InitSalMain();
|
2001-02-22 14:44:00 +00:00
|
|
|
|
|
|
|
/*AllSettings aAS;
|
|
|
|
Application::SetSettings( aAS );// ???
|
|
|
|
*/
|
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// SV bei den Tools anmelden
|
|
|
|
InitTools();
|
|
|
|
|
2008-11-10 15:06:12 +00:00
|
|
|
DBG_ASSERT( !pSVData->maAppData.mxMSF.is(), "VCL service factory already set" );
|
2001-06-21 10:14:28 +00:00
|
|
|
pSVData->maAppData.mxMSF = rSMgr;
|
2001-02-23 17:08:12 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Main-Thread-Id merken
|
|
|
|
pSVData->mnMainThreadId = ::vos::OThread::getCurrentIdentifier();
|
|
|
|
|
2001-03-20 09:36:58 +00:00
|
|
|
vos::OStartupInfo aStartInfo;
|
|
|
|
rtl::OUString aExeFileName;
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
|
2001-12-04 12:42:27 +00:00
|
|
|
// Sal initialisieren
|
|
|
|
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ ::CreateSalInstance" );
|
|
|
|
pSVData->mpDefInst = CreateSalInstance();
|
|
|
|
if ( !pSVData->mpDefInst )
|
|
|
|
return FALSE;
|
|
|
|
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} ::CreateSalInstance" );
|
|
|
|
|
2006-08-04 11:31:30 +00:00
|
|
|
// Desktop Environment context (to be able to get value of "system.desktop-environment" as soon as possible)
|
|
|
|
com::sun::star::uno::setCurrentContext(
|
|
|
|
new DesktopEnvironmentContext( com::sun::star::uno::getCurrentContext() ) );
|
|
|
|
|
2001-12-04 12:42:27 +00:00
|
|
|
// Initialize application instance (should be done after initialization of VCL SAL part)
|
2001-02-22 14:44:00 +00:00
|
|
|
if( pSVData->mpApp )
|
|
|
|
// call init to initialize application class
|
|
|
|
// soffice/sfx implementation creates the global service manager
|
|
|
|
pSVData->mpApp->Init();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Den AppFileName gleich holen und absolut machen, bevor das
|
|
|
|
// WorkingDirectory sich aendert...
|
|
|
|
aStartInfo.getExecutableFile( aExeFileName );
|
|
|
|
|
|
|
|
// convert path to native file format
|
|
|
|
rtl::OUString aNativeFileName;
|
2001-07-25 10:06:25 +00:00
|
|
|
osl::FileBase::getSystemPathFromFileURL( aExeFileName, aNativeFileName );
|
2000-09-18 16:07:07 +00:00
|
|
|
pSVData->maAppData.mpAppFileName = new String( aNativeFileName );
|
|
|
|
|
|
|
|
// Initialize global data
|
|
|
|
pSVData->maGDIData.mpScreenFontList = new ImplDevFontList;
|
|
|
|
pSVData->maGDIData.mpScreenFontCache = new ImplFontCache( FALSE );
|
|
|
|
pSVData->maGDIData.mpGrfConverter = new GraphicConverter;
|
|
|
|
|
|
|
|
// Exception-Handler setzen
|
2001-02-22 14:44:00 +00:00
|
|
|
pExceptionHandler = new ImplVCLExceptionHandler();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
// Debug-Daten initialisieren
|
|
|
|
DBGGUI_INIT();
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DeInitVCL()
|
|
|
|
{
|
2006-05-18 09:08:33 +00:00
|
|
|
ImplSVData* pSVData = ImplGetSVData();
|
|
|
|
pSVData->mbDeInit = TRUE;
|
|
|
|
|
2009-02-17 10:33:03 +00:00
|
|
|
vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit();
|
|
|
|
|
2007-03-05 14:24:06 +00:00
|
|
|
// give ime status a chance to destroy its own windows
|
|
|
|
delete pSVData->mpImeStatus;
|
|
|
|
pSVData->mpImeStatus = NULL;
|
|
|
|
|
|
|
|
#if OSL_DEBUG_LEVEL > 0
|
|
|
|
rtl::OStringBuffer aBuf( 256 );
|
|
|
|
aBuf.append( "DeInitVCL: some top Windows are still alive\n" );
|
|
|
|
long nTopWindowCount = Application::GetTopWindowCount();
|
|
|
|
long nBadTopWindows = nTopWindowCount;
|
|
|
|
for( long i = 0; i < nTopWindowCount; i++ )
|
|
|
|
{
|
|
|
|
Window* pWin = Application::GetTopWindow( i );
|
|
|
|
// default window will be destroyed further down
|
|
|
|
// but may still be useful during deinit up to that point
|
|
|
|
if( pWin == pSVData->mpDefaultWin )
|
|
|
|
nBadTopWindows--;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
aBuf.append( "text = \"" );
|
|
|
|
aBuf.append( rtl::OUStringToOString( pWin->GetText(), osl_getThreadTextEncoding() ) );
|
|
|
|
aBuf.append( "\" type = \"" );
|
|
|
|
aBuf.append( typeid(*pWin).name() );
|
|
|
|
aBuf.append( "\"\n" );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DBG_ASSERT( nBadTopWindows==0, aBuf.getStr() );
|
|
|
|
#endif
|
|
|
|
|
2009-02-12 09:18:09 +00:00
|
|
|
ImplImageTreeSingletonRef()->shutDown();
|
2004-05-28 12:33:19 +00:00
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
delete pExceptionHandler;
|
|
|
|
pExceptionHandler = NULL;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Debug Daten zuruecksetzen
|
|
|
|
DBGGUI_DEINIT();
|
|
|
|
|
|
|
|
// free global data
|
|
|
|
delete pSVData->maGDIData.mpGrfConverter;
|
|
|
|
|
2002-10-31 16:46:29 +00:00
|
|
|
if( pSVData->mpSettingsConfigItem )
|
|
|
|
delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = NULL;
|
2006-05-04 14:11:08 +00:00
|
|
|
if( pSVData->maGDIData.mpDefaultFontConfiguration )
|
|
|
|
delete pSVData->maGDIData.mpDefaultFontConfiguration, pSVData->maGDIData.mpDefaultFontConfiguration = NULL;
|
|
|
|
if( pSVData->maGDIData.mpFontSubstConfiguration )
|
|
|
|
delete pSVData->maGDIData.mpFontSubstConfiguration, pSVData->maGDIData.mpFontSubstConfiguration = NULL;
|
2002-10-31 16:46:29 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSVData->maAppData.mpIdleMgr )
|
|
|
|
delete pSVData->maAppData.mpIdleMgr;
|
2006-06-19 18:14:40 +00:00
|
|
|
Timer::ImplDeInitTimer();
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pSVData->maWinData.mpMsgBoxImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maWinData.mpMsgBoxImgList;
|
|
|
|
pSVData->maWinData.mpMsgBoxImgList = NULL;
|
|
|
|
}
|
2008-12-01 13:29:22 +00:00
|
|
|
if ( pSVData->maWinData.mpMsgBoxHCImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maWinData.mpMsgBoxHCImgList;
|
|
|
|
pSVData->maWinData.mpMsgBoxHCImgList = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSVData->maCtrlData.mpCheckImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpCheckImgList;
|
|
|
|
pSVData->maCtrlData.mpCheckImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpRadioImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpRadioImgList;
|
|
|
|
pSVData->maCtrlData.mpRadioImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpPinImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpPinImgList;
|
|
|
|
pSVData->maCtrlData.mpPinImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpSplitHPinImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpSplitHPinImgList;
|
|
|
|
pSVData->maCtrlData.mpSplitHPinImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpSplitVPinImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpSplitVPinImgList;
|
|
|
|
pSVData->maCtrlData.mpSplitVPinImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpSplitHArwImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpSplitHArwImgList;
|
|
|
|
pSVData->maCtrlData.mpSplitHArwImgList = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpSplitVArwImgList )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpSplitVArwImgList;
|
|
|
|
pSVData->maCtrlData.mpSplitVArwImgList = NULL;
|
|
|
|
}
|
2009-09-08 19:48:08 +00:00
|
|
|
if ( pSVData->maCtrlData.mpDisclosurePlus )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpDisclosurePlus;
|
|
|
|
pSVData->maCtrlData.mpDisclosurePlus = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpDisclosurePlusHC )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpDisclosurePlusHC;
|
|
|
|
pSVData->maCtrlData.mpDisclosurePlusHC = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpDisclosureMinus )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpDisclosureMinus;
|
|
|
|
pSVData->maCtrlData.mpDisclosureMinus = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maCtrlData.mpDisclosureMinusHC )
|
|
|
|
{
|
|
|
|
delete pSVData->maCtrlData.mpDisclosureMinusHC;
|
|
|
|
pSVData->maCtrlData.mpDisclosureMinusHC = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSVData->mpDefaultWin )
|
|
|
|
{
|
|
|
|
delete pSVData->mpDefaultWin;
|
|
|
|
pSVData->mpDefaultWin = NULL;
|
|
|
|
}
|
|
|
|
|
2008-07-07 13:33:11 +00:00
|
|
|
// #114285# Moved here from ImplDeInitSVData...
|
|
|
|
if ( pSVData->mpUnoWrapper )
|
|
|
|
{
|
|
|
|
pSVData->mpUnoWrapper->Destroy();
|
|
|
|
pSVData->mpUnoWrapper = NULL;
|
|
|
|
}
|
|
|
|
|
2006-03-24 12:47:42 +00:00
|
|
|
pSVData->maAppData.mxMSF.clear();
|
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
if( pSVData->mpApp )
|
|
|
|
// call deinit to deinitialize application class
|
|
|
|
// soffice/sfx implementation disposes the global service manager
|
|
|
|
// Warning: After this call you can't call uno services
|
|
|
|
pSVData->mpApp->DeInit();
|
2000-11-06 07:55:14 +00:00
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
if ( pSVData->maAppData.mpSettings )
|
|
|
|
{
|
2009-10-16 00:05:16 +02:00
|
|
|
if ( pSVData->maAppData.mpCfgListener )
|
|
|
|
{
|
|
|
|
pSVData->maAppData.mpSettings->GetSysLocale().GetOptions().RemoveListener( pSVData->maAppData.mpCfgListener );
|
|
|
|
delete pSVData->maAppData.mpCfgListener;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
delete pSVData->maAppData.mpSettings;
|
|
|
|
pSVData->maAppData.mpSettings = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maAppData.mpAccelMgr )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpAccelMgr;
|
|
|
|
pSVData->maAppData.mpAccelMgr = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maAppData.mpUniqueIdCont )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpUniqueIdCont;
|
|
|
|
pSVData->maAppData.mpUniqueIdCont = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maAppData.mpAppFileName )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpAppFileName;
|
|
|
|
pSVData->maAppData.mpAppFileName = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maAppData.mpAppName )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpAppName;
|
|
|
|
pSVData->maAppData.mpAppName = NULL;
|
|
|
|
}
|
|
|
|
if ( pSVData->maAppData.mpDisplayName )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpDisplayName;
|
|
|
|
pSVData->maAppData.mpDisplayName = NULL;
|
|
|
|
}
|
2002-07-17 08:43:42 +00:00
|
|
|
if ( pSVData->maAppData.mpEventListeners )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpEventListeners;
|
|
|
|
pSVData->maAppData.mpEventListeners = NULL;
|
|
|
|
}
|
2002-07-18 07:04:31 +00:00
|
|
|
if ( pSVData->maAppData.mpKeyListeners )
|
|
|
|
{
|
|
|
|
delete pSVData->maAppData.mpKeyListeners;
|
|
|
|
pSVData->maAppData.mpKeyListeners = NULL;
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
|
|
|
|
if ( pSVData->maAppData.mpFirstHotKey )
|
|
|
|
ImplFreeHotKeyData();
|
|
|
|
if ( pSVData->maAppData.mpFirstEventHook )
|
|
|
|
ImplFreeEventHookData();
|
|
|
|
|
|
|
|
ImplDeletePrnQueueList();
|
|
|
|
delete pSVData->maGDIData.mpScreenFontList;
|
|
|
|
pSVData->maGDIData.mpScreenFontList = NULL;
|
|
|
|
delete pSVData->maGDIData.mpScreenFontCache;
|
|
|
|
pSVData->maGDIData.mpScreenFontCache = NULL;
|
|
|
|
ImplFreeOutDevFontData();
|
|
|
|
|
2005-01-03 16:38:14 +00:00
|
|
|
if ( pSVData->mpResMgr )
|
|
|
|
{
|
|
|
|
delete pSVData->mpResMgr;
|
|
|
|
pSVData->mpResMgr = NULL;
|
|
|
|
}
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
ResMgr::DestroyAllResMgr();
|
|
|
|
|
2004-02-25 09:46:59 +00:00
|
|
|
// destroy all Sal interfaces before destorying the instance
|
|
|
|
// and thereby unloading the plugin
|
|
|
|
delete pSVData->mpSalSystem;
|
|
|
|
pSVData->mpSalSystem = NULL;
|
|
|
|
delete pSVData->mpSalTimer;
|
|
|
|
pSVData->mpSalTimer = NULL;
|
|
|
|
|
2000-09-18 16:07:07 +00:00
|
|
|
// Sal deinitialisieren
|
|
|
|
DestroySalInstance( pSVData->mpDefInst );
|
|
|
|
|
|
|
|
DeInitTools();
|
|
|
|
|
2001-02-23 17:08:12 +00:00
|
|
|
DeInitSalMain();
|
2004-05-10 14:45:45 +00:00
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
if( pOwnSvApp )
|
|
|
|
{
|
|
|
|
delete pOwnSvApp;
|
|
|
|
pOwnSvApp = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// only one call is allowed
|
|
|
|
struct WorkerThreadData
|
|
|
|
{
|
|
|
|
oslWorkerFunction pWorker;
|
|
|
|
void * pThreadData;
|
|
|
|
WorkerThreadData( oslWorkerFunction pWorker_, void * pThreadData_ )
|
|
|
|
: pWorker( pWorker_ )
|
|
|
|
, pThreadData( pThreadData_ )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef WNT
|
|
|
|
static HANDLE hThreadID = 0;
|
|
|
|
static unsigned __stdcall _threadmain( void *pArgs )
|
|
|
|
{
|
|
|
|
OleInitialize( NULL );
|
|
|
|
((WorkerThreadData*)pArgs)->pWorker( ((WorkerThreadData*)pArgs)->pThreadData );
|
|
|
|
delete (WorkerThreadData*)pArgs;
|
|
|
|
OleUninitialize();
|
|
|
|
hThreadID = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static oslThread hThreadID = 0;
|
2006-06-19 18:14:40 +00:00
|
|
|
extern "C"
|
|
|
|
{
|
2001-02-22 14:44:00 +00:00
|
|
|
static void SAL_CALL MainWorkerFunction( void* pArgs )
|
|
|
|
{
|
|
|
|
((WorkerThreadData*)pArgs)->pWorker( ((WorkerThreadData*)pArgs)->pThreadData );
|
|
|
|
delete (WorkerThreadData*)pArgs;
|
|
|
|
hThreadID = 0;
|
|
|
|
}
|
2006-06-19 18:14:40 +00:00
|
|
|
} // extern "C"
|
2001-02-22 14:44:00 +00:00
|
|
|
#endif
|
2000-09-18 16:07:07 +00:00
|
|
|
|
2001-02-22 14:44:00 +00:00
|
|
|
void CreateMainLoopThread( oslWorkerFunction pWorker, void * pThreadData )
|
|
|
|
{
|
|
|
|
#ifdef WNT
|
|
|
|
// sal thread alway call CoInitializeEx, so a sysdepen implementation is necessary
|
|
|
|
|
|
|
|
unsigned uThreadID;
|
|
|
|
hThreadID = (HANDLE)_beginthreadex(
|
|
|
|
NULL, // no security handle
|
|
|
|
0, // stacksize 0 means default
|
|
|
|
_threadmain, // thread worker function
|
|
|
|
new WorkerThreadData( pWorker, pThreadData ), // arguments for worker function
|
|
|
|
0, // 0 means: create immediatly otherwise use CREATE_SUSPENDED
|
|
|
|
&uThreadID ); // thread id to fill
|
|
|
|
#else
|
|
|
|
hThreadID = osl_createThread( MainWorkerFunction, new WorkerThreadData( pWorker, pThreadData ) );
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void JoinMainLoopThread()
|
|
|
|
{
|
|
|
|
if( hThreadID )
|
|
|
|
{
|
|
|
|
#ifdef WNT
|
|
|
|
WaitForSingleObject(hThreadID, INFINITE);
|
|
|
|
#else
|
|
|
|
osl_joinWithThread(hThreadID);
|
2001-06-08 15:24:19 +00:00
|
|
|
osl_destroyThread( hThreadID );
|
2001-02-22 14:44:00 +00:00
|
|
|
#endif
|
|
|
|
}
|
2000-09-18 16:07:07 +00:00
|
|
|
}
|