Files
libreoffice/vcl/source/app/svmain.cxx

639 lines
19 KiB
C++
Raw Normal View History

2000-09-18 16:07:07 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2000-09-18 16:07:07 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2000-09-18 16:07:07 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2000-09-18 16:07:07 +00:00
*
* This file is part of OpenOffice.org.
2000-09-18 16:07:07 +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
*
* 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
*
* 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
*
************************************************************************/
// 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
// [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
CWS-TOOLING: integrate CWS vcl99 2009-01-29 15:34:04 +0100 hdu r267149 : #i77520# fix AquaSalGraphics::GetGlyphBoundRect() result y-sign 2009-01-29 10:14:23 +0100 hdu r267099 : #i77520# implement AquaSalGraphics::GetGlyphBoundRect() 2009-01-28 17:31:17 +0100 hdu r267071 : #i79046# restore MultiSalLayout components after drawing them 2009-01-28 12:02:19 +0100 tl r267050 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:54:21 +0100 tl r267049 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:43:44 +0100 tl r267047 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:17:42 +0100 tl r267041 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:14:30 +0100 tl r267038 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 10:33:03 +0100 tl r267032 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-28 09:26:00 +0100 tl r267027 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 09:25:31 +0100 tl r267026 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:55:14 +0100 tl r267009 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:54:46 +0100 tl r267008 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:52:23 +0100 tl r267007 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:46:52 +0100 tl r267006 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-27 11:53:53 +0100 pl r266975 : #i98515# fix a buffer overflow 2009-01-26 19:13:28 +0100 pl r266946 : #i98119# add static vcl object helper 2009-01-26 18:11:06 +0100 pl r266940 : #i94040# catch a corner case (thanks af) 2009-01-23 10:54:42 +0100 pl r266793 : #i92102# fix some RTL UI issues 2009-01-23 10:53:35 +0100 pl r266790 : #i98169# one more case of DrawWaveLine 2009-01-23 08:38:32 +0100 hdu r266768 : #i98139# prefer Tools->Options->FontSubstitution over PreMatchHook 2009-01-21 17:30:57 +0100 pl r266694 : #i92102# adjust spin buttons 2009-01-21 13:54:16 +0100 pl r266667 : #i97130# add Click handler 2009-01-21 13:32:47 +0100 os r266662 : #158646# set SwWrtShell in C'tor of SwIndexMarkDlg 2009-01-21 12:14:03 +0100 pl r266649 : #i98196# fix autospellchecking in writer 2009-01-19 14:25:28 +0100 pl r266497 : #i97130# implement functionality of ExplainButton
2009-02-17 10:33:03 +00:00
#include "svunx.h"
2001-02-23 17:02:50 +00:00
#endif
CWS-TOOLING: integrate CWS vcl99 2009-01-29 15:34:04 +0100 hdu r267149 : #i77520# fix AquaSalGraphics::GetGlyphBoundRect() result y-sign 2009-01-29 10:14:23 +0100 hdu r267099 : #i77520# implement AquaSalGraphics::GetGlyphBoundRect() 2009-01-28 17:31:17 +0100 hdu r267071 : #i79046# restore MultiSalLayout components after drawing them 2009-01-28 12:02:19 +0100 tl r267050 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:54:21 +0100 tl r267049 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:43:44 +0100 tl r267047 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:17:42 +0100 tl r267041 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:14:30 +0100 tl r267038 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 10:33:03 +0100 tl r267032 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-28 09:26:00 +0100 tl r267027 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 09:25:31 +0100 tl r267026 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:55:14 +0100 tl r267009 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:54:46 +0100 tl r267008 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:52:23 +0100 tl r267007 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:46:52 +0100 tl r267006 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-27 11:53:53 +0100 pl r266975 : #i98515# fix a buffer overflow 2009-01-26 19:13:28 +0100 pl r266946 : #i98119# add static vcl object helper 2009-01-26 18:11:06 +0100 pl r266940 : #i94040# catch a corner case (thanks af) 2009-01-23 10:54:42 +0100 pl r266793 : #i92102# fix some RTL UI issues 2009-01-23 10:53:35 +0100 pl r266790 : #i98169# one more case of DrawWaveLine 2009-01-23 08:38:32 +0100 hdu r266768 : #i98139# prefer Tools->Options->FontSubstitution over PreMatchHook 2009-01-21 17:30:57 +0100 pl r266694 : #i92102# adjust spin buttons 2009-01-21 13:54:16 +0100 pl r266667 : #i97130# add Click handler 2009-01-21 13:32:47 +0100 os r266662 : #158646# set SwWrtShell in C'tor of SwIndexMarkDlg 2009-01-21 12:14:03 +0100 pl r266649 : #i98196# fix autospellchecking in writer 2009-01-19 14:25:28 +0100 pl r266497 : #i97130# implement functionality of ExplainButton
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"
#include <unotools/syslocaleoptions.hxx>
#include "unotools/fontcfg.hxx"
CWS-TOOLING: integrate CWS vcl99 2009-01-29 15:34:04 +0100 hdu r267149 : #i77520# fix AquaSalGraphics::GetGlyphBoundRect() result y-sign 2009-01-29 10:14:23 +0100 hdu r267099 : #i77520# implement AquaSalGraphics::GetGlyphBoundRect() 2009-01-28 17:31:17 +0100 hdu r267071 : #i79046# restore MultiSalLayout components after drawing them 2009-01-28 12:02:19 +0100 tl r267050 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:54:21 +0100 tl r267049 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:43:44 +0100 tl r267047 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:17:42 +0100 tl r267041 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:14:30 +0100 tl r267038 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 10:33:03 +0100 tl r267032 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-28 09:26:00 +0100 tl r267027 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 09:25:31 +0100 tl r267026 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:55:14 +0100 tl r267009 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:54:46 +0100 tl r267008 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:52:23 +0100 tl r267007 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:46:52 +0100 tl r267006 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-27 11:53:53 +0100 pl r266975 : #i98515# fix a buffer overflow 2009-01-26 19:13:28 +0100 pl r266946 : #i98119# add static vcl object helper 2009-01-26 18:11:06 +0100 pl r266940 : #i94040# catch a corner case (thanks af) 2009-01-23 10:54:42 +0100 pl r266793 : #i92102# fix some RTL UI issues 2009-01-23 10:53:35 +0100 pl r266790 : #i98169# one more case of DrawWaveLine 2009-01-23 08:38:32 +0100 hdu r266768 : #i98139# prefer Tools->Options->FontSubstitution over PreMatchHook 2009-01-21 17:30:57 +0100 pl r266694 : #i92102# adjust spin buttons 2009-01-21 13:54:16 +0100 pl r266667 : #i97130# add Click handler 2009-01-21 13:32:47 +0100 os r266662 : #158646# set SwWrtShell in C'tor of SwIndexMarkDlg 2009-01-21 12:14:03 +0100 pl r266649 : #i98196# fix autospellchecking in writer 2009-01-19 14:25:28 +0100 pl r266497 : #i97130# implement functionality of ExplainButton
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
#if OSL_DEBUG_LEVEL > 0
#include <typeinfo>
CWS-TOOLING: integrate CWS vcl99 2009-01-29 15:34:04 +0100 hdu r267149 : #i77520# fix AquaSalGraphics::GetGlyphBoundRect() result y-sign 2009-01-29 10:14:23 +0100 hdu r267099 : #i77520# implement AquaSalGraphics::GetGlyphBoundRect() 2009-01-28 17:31:17 +0100 hdu r267071 : #i79046# restore MultiSalLayout components after drawing them 2009-01-28 12:02:19 +0100 tl r267050 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:54:21 +0100 tl r267049 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:43:44 +0100 tl r267047 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:17:42 +0100 tl r267041 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:14:30 +0100 tl r267038 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 10:33:03 +0100 tl r267032 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-28 09:26:00 +0100 tl r267027 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 09:25:31 +0100 tl r267026 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:55:14 +0100 tl r267009 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:54:46 +0100 tl r267008 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:52:23 +0100 tl r267007 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:46:52 +0100 tl r267006 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-27 11:53:53 +0100 pl r266975 : #i98515# fix a buffer overflow 2009-01-26 19:13:28 +0100 pl r266946 : #i98119# add static vcl object helper 2009-01-26 18:11:06 +0100 pl r266940 : #i94040# catch a corner case (thanks af) 2009-01-23 10:54:42 +0100 pl r266793 : #i92102# fix some RTL UI issues 2009-01-23 10:53:35 +0100 pl r266790 : #i98169# one more case of DrawWaveLine 2009-01-23 08:38:32 +0100 hdu r266768 : #i98139# prefer Tools->Options->FontSubstitution over PreMatchHook 2009-01-21 17:30:57 +0100 pl r266694 : #i92102# adjust spin buttons 2009-01-21 13:54:16 +0100 pl r266667 : #i97130# add Click handler 2009-01-21 13:32:47 +0100 os r266662 : #158646# set SwWrtShell in C'tor of SwIndexMarkDlg 2009-01-21 12:14:03 +0100 pl r266649 : #i98196# fix autospellchecking in writer 2009-01-19 14:25:28 +0100 pl r266497 : #i97130# implement functionality of ExplainButton
2009-02-17 10:33:03 +00:00
#include "rtl/strbuf.hxx"
#endif
using namespace ::rtl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
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
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
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
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
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;
::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
// =======================================================================
BOOL ImplSVMain()
2000-09-18 16:07:07 +00:00
{
// The 'real' SVMain()
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" );
Reference<XMultiServiceFactory> xMS;
2001-02-22 14:44:00 +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;
}
if( pSVData->mxDisplayConnection.is() )
{
vcl::DisplayConnection* pConnection =
dynamic_cast<vcl::DisplayConnection*>(pSVData->mxDisplayConnection.get());
if( pConnection )
pConnection->dispatchDowningEvent();
pSVData->mxDisplayConnection.clear();
}
// 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;
}
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(){};
};
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
{
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;
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();
DBG_ASSERT( !pSVData->maAppData.mxMSF.is(), "VCL service factory already set" );
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
// Sal initialisieren
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ ::CreateSalInstance" );
pSVData->mpDefInst = CreateSalInstance();
if ( !pSVData->mpDefInst )
return FALSE;
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} ::CreateSalInstance" );
// 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() ) );
// 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()
{
ImplSVData* pSVData = ImplGetSVData();
pSVData->mbDeInit = TRUE;
CWS-TOOLING: integrate CWS vcl99 2009-01-29 15:34:04 +0100 hdu r267149 : #i77520# fix AquaSalGraphics::GetGlyphBoundRect() result y-sign 2009-01-29 10:14:23 +0100 hdu r267099 : #i77520# implement AquaSalGraphics::GetGlyphBoundRect() 2009-01-28 17:31:17 +0100 hdu r267071 : #i79046# restore MultiSalLayout components after drawing them 2009-01-28 12:02:19 +0100 tl r267050 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:54:21 +0100 tl r267049 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:43:44 +0100 tl r267047 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:17:42 +0100 tl r267041 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 11:14:30 +0100 tl r267038 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 10:33:03 +0100 tl r267032 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-28 09:26:00 +0100 tl r267027 : #78466# default curreny listbox for Arabic builds fixed 2009-01-28 09:25:31 +0100 tl r267026 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:55:14 +0100 tl r267009 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:54:46 +0100 tl r267008 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:52:23 +0100 tl r267007 : #78466# default curreny listbox for Arabic builds fixed 2009-01-27 16:46:52 +0100 tl r267006 : #i72073# auto spellcheck markups in RTL context fixed 2009-01-27 11:53:53 +0100 pl r266975 : #i98515# fix a buffer overflow 2009-01-26 19:13:28 +0100 pl r266946 : #i98119# add static vcl object helper 2009-01-26 18:11:06 +0100 pl r266940 : #i94040# catch a corner case (thanks af) 2009-01-23 10:54:42 +0100 pl r266793 : #i92102# fix some RTL UI issues 2009-01-23 10:53:35 +0100 pl r266790 : #i98169# one more case of DrawWaveLine 2009-01-23 08:38:32 +0100 hdu r266768 : #i98139# prefer Tools->Options->FontSubstitution over PreMatchHook 2009-01-21 17:30:57 +0100 pl r266694 : #i92102# adjust spin buttons 2009-01-21 13:54:16 +0100 pl r266667 : #i97130# add Click handler 2009-01-21 13:32:47 +0100 os r266662 : #158646# set SwWrtShell in C'tor of SwIndexMarkDlg 2009-01-21 12:14:03 +0100 pl r266649 : #i98196# fix autospellchecking in writer 2009-01-19 14:25:28 +0100 pl r266497 : #i97130# implement functionality of ExplainButton
2009-02-17 10:33:03 +00:00
vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit();
// 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
CWS-TOOLING: integrate CWS sb103 2009-01-15 15:28:08 +0100 sb r266375 : #i97629# set UNO_PATH in python start program and use it in bootstrap function in officehelper.py (and do not erroneously encode a vnd.sun.star.pathname URE_BOOTSTRAP value in tools::extendApplicationEnvironment) 2009-01-15 10:40:17 +0100 sb r266338 : #i97424# explicit shut down of ImplImageTree singleton in DeInitVCL still required 2009-01-14 12:07:15 +0100 sb r266276 : CWS-TOOLING: rebase CWS sb103 to trunk@265758 (milestone: DEV300:m38) 2009-01-14 08:53:02 +0100 sb r266266 : #i96284# remove implementation of unused (but expensive) link feature; plus some general cleanup 2009-01-08 14:42:59 +0100 sb r266010 : #i96683# enable dlclose for GCC 3 (based on a patch by cmc) 2009-01-06 14:18:23 +0100 sb r265920 : #i97424# spurious unreferenced local variables 2008-12-19 15:33:39 +0100 sb r265727 : #i57359# no need for a special glibc 2.2.4 based libgcc_s.so.1 for URE any more as the general one used for OOo is guaranteed to be based on at least glibc 2.2.4, anyway 2008-12-19 13:54:37 +0100 sb r265724 : #i97424# clean up and speed up vcl ImplImageTree 2008-12-18 14:28:10 +0100 sb r265690 : #i97132# spread usage of the rtl::Static pattern (patch by cmc) 2008-12-15 14:33:00 +0100 sb r265499 : #i90492# generate UTF-8 encoded output (patch by tora) 2008-12-15 11:45:05 +0100 sb r265469 : #i95593# -Djava.library.path to find libtest_javauno_any.so 2008-12-15 11:23:14 +0100 sb r265468 : #i93769# it appears that Java nowadays expects file URIs in UTF-8, so ExternalUriReferenceTranslator.toExternal must not be called 2008-12-10 12:02:50 +0100 sb r265164 : #i93219# use (corrected) signal handling instead of forking again (to avoid unintended generation of core files)
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;
if( pSVData->mpSettingsConfigItem )
delete pSVData->mpSettingsConfigItem, pSVData->mpSettingsConfigItem = NULL;
if( pSVData->maGDIData.mpDefaultFontConfiguration )
delete pSVData->maGDIData.mpDefaultFontConfiguration, pSVData->maGDIData.mpDefaultFontConfiguration = NULL;
if( pSVData->maGDIData.mpFontSubstConfiguration )
delete pSVData->maGDIData.mpFontSubstConfiguration, pSVData->maGDIData.mpFontSubstConfiguration = NULL;
2000-09-18 16:07:07 +00:00
if ( pSVData->maAppData.mpIdleMgr )
delete pSVData->maAppData.mpIdleMgr;
Timer::ImplDeInitTimer();
2000-09-18 16:07:07 +00:00
if ( pSVData->maWinData.mpMsgBoxImgList )
{
delete pSVData->maWinData.mpMsgBoxImgList;
pSVData->maWinData.mpMsgBoxImgList = NULL;
}
CWS-TOOLING: integrate CWS vcl96 2008-11-27 15:56:56 +0100 pl r264499 : #i95488# fix a snafu 2008-11-17 12:05:23 +0100 pl r263713 : #158795# catch bad_alloc 2008-11-14 17:26:25 +0100 pl r263687 : #i93018# new msgbox images 2008-11-14 17:00:28 +0100 pl r263686 : #i95488# treat chinese font heights like korean 2008-11-14 14:59:17 +0100 pl r263677 : #i92102# RTL fixes: toolbox selection, popup menus 2008-11-14 11:40:22 +0100 pl r263669 : #i75035# move tear off panels correctly also in RTL case (thanks ayaniger) 2008-11-13 18:15:51 +0100 pl r263658 : #i93018# message box images, add hc version 2008-11-13 15:49:41 +0100 pl r263647 : #b6726794# add: UNC paths (windows specific) 2008-11-13 12:51:37 +0100 pl r263632 : #i95803# do not dereference empty interface 2008-11-12 18:13:55 +0100 pl r263609 : #b6727144# fix and speed up xor mode for special case invert on MacOSX 2008-11-12 15:07:47 +0100 pl r263599 : #i95392# add csv to calc mimetypes (thanks cmc) 2008-11-12 14:52:13 +0100 pl r263598 : #i87633# paste strings larger than 64k in the hope that each contained line is shorter 2008-11-12 13:37:29 +0100 pl r263594 : #i96141# fix if statement (thanks cmc) 2008-11-12 13:06:22 +0100 pl r263588 : #i93831# remove windows from static set again 2008-11-11 18:15:06 +0100 pl r263571 : #i96089# fix some wrong parentheses (thanks cmc) 2008-11-04 20:50:40 +0100 pl r263336 : #i95388# do not confuse imageable area and margin 2008-11-03 18:39:25 +0100 pl r263304 : CWS-TOOLING: rebase CWS vcl96 to trunk@263288 (milestone: DEV300:m35) 2008-11-03 16:18:48 +0100 pl r263290 : #i92701# truncation warning only on paste 2008-11-03 15:53:42 +0100 pl r263289 : #i95296# use gtk plugin in more cases 2008-10-31 11:15:34 +0100 pl r262858 : #i94258# fix some PDF/A compatibility issues (thanks beppec56) 2008-10-30 14:24:24 +0100 pl r262825 : #i62033# do not read imcomplete resources (again) 2008-10-29 17:21:29 +0100 pl r262821 : #i95536# do not use deprecated gtk_draw_expander function 2008-10-21 18:00:29 +0200 pl r262574 : #i95220# use large icons for nicer display on KDE as well as Gnome taskbar 2008-10-17 16:01:43 +0200 pl r262290 : #i92822# build warning free on MacOSX 10.5
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;
}
// #114285# Moved here from ImplDeInitSVData...
if ( pSVData->mpUnoWrapper )
{
pSVData->mpUnoWrapper->Destroy();
pSVData->mpUnoWrapper = NULL;
}
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 )
{
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;
}
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();
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();
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;
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;
}
} // 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);
osl_destroyThread( hThreadID );
2001-02-22 14:44:00 +00:00
#endif
}
2000-09-18 16:07:07 +00:00
}