1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sfx2.hxx" 30*cdf0e10cSrcweir #include <basic/basmgr.hxx> 31*cdf0e10cSrcweir #include <basic/sbstar.hxx> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include <svl/svdde.hxx> 34*cdf0e10cSrcweir #ifndef _MSGBOX_HXX //autogen 35*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 36*cdf0e10cSrcweir #endif 37*cdf0e10cSrcweir #include <svl/eitem.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir #include <unotools/saveopt.hxx> 40*cdf0e10cSrcweir #include <unotools/misccfg.hxx> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #ifndef GCC 43*cdf0e10cSrcweir #endif 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir #include "app.hrc" 46*cdf0e10cSrcweir #include <sfx2/app.hxx> 47*cdf0e10cSrcweir #include <sfx2/evntconf.hxx> 48*cdf0e10cSrcweir #include <sfx2/unoctitm.hxx> 49*cdf0e10cSrcweir #include "appdata.hxx" 50*cdf0e10cSrcweir #include <sfx2/viewsh.hxx> 51*cdf0e10cSrcweir #include <sfx2/dispatch.hxx> 52*cdf0e10cSrcweir #include <sfx2/printer.hxx> 53*cdf0e10cSrcweir #include "arrdecl.hxx" 54*cdf0e10cSrcweir #include "sfx2/sfxresid.hxx" 55*cdf0e10cSrcweir #include <sfx2/event.hxx> 56*cdf0e10cSrcweir #include <sfx2/mnumgr.hxx> 57*cdf0e10cSrcweir #include <sfx2/templdlg.hxx> 58*cdf0e10cSrcweir #include <sfx2/msgpool.hxx> 59*cdf0e10cSrcweir #include <sfx2/docfile.hxx> 60*cdf0e10cSrcweir #include "sfxtypes.hxx" 61*cdf0e10cSrcweir #include "sfxlocal.hrc" 62*cdf0e10cSrcweir #include <sfx2/fcontnr.hxx> 63*cdf0e10cSrcweir #include "nochaos.hxx" 64*cdf0e10cSrcweir #include <sfx2/appuno.hxx> 65*cdf0e10cSrcweir #include <sfx2/doctempl.hxx> 66*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 67*cdf0e10cSrcweir #include <sfx2/objsh.hxx> 68*cdf0e10cSrcweir #include <sfx2/docfac.hxx> 69*cdf0e10cSrcweir #include "appbaslib.hxx" 70*cdf0e10cSrcweir #include <basic/basicmanagerrepository.hxx> 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir using ::basic::BasicManagerRepository; 73*cdf0e10cSrcweir 74*cdf0e10cSrcweir //=================================================================== 75*cdf0e10cSrcweir sal_Bool SfxApplication::QueryExit_Impl() 76*cdf0e10cSrcweir { 77*cdf0e10cSrcweir sal_Bool bQuit = sal_True; 78*cdf0e10cSrcweir 79*cdf0e10cSrcweir // will trotzdem noch jemand, den man nicht abschiessen kann, die App haben? 80*cdf0e10cSrcweir if ( !bQuit ) 81*cdf0e10cSrcweir { 82*cdf0e10cSrcweir // nicht wirklich beenden, nur minimieren 83*cdf0e10cSrcweir InfoBox aInfoBox( NULL, SfxResId(MSG_CANT_QUIT) ); 84*cdf0e10cSrcweir aInfoBox.Execute(); 85*cdf0e10cSrcweir DBG_TRACE( "QueryExit => FALSE (in use)" ); 86*cdf0e10cSrcweir return sal_False; 87*cdf0e10cSrcweir } 88*cdf0e10cSrcweir 89*cdf0e10cSrcweir return sal_True; 90*cdf0e10cSrcweir } 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir //------------------------------------------------------------------------- 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir void SfxApplication::Deinitialize() 95*cdf0e10cSrcweir { 96*cdf0e10cSrcweir if ( pAppData_Impl->bDowning ) 97*cdf0e10cSrcweir return; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir StarBASIC::Stop(); 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir // ggf. BASIC speichern 102*cdf0e10cSrcweir BasicManager* pBasMgr = BasicManagerRepository::getApplicationBasicManager( false ); 103*cdf0e10cSrcweir if ( pBasMgr && pBasMgr->IsModified() ) 104*cdf0e10cSrcweir SaveBasicManager(); 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir SaveBasicAndDialogContainer(); 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir pAppData_Impl->bDowning = sal_True; // wegen Timer aus DecAliveCount und QueryExit 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir DELETEZ( pAppData_Impl->pTemplates ); 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir // By definition there shouldn't be any open view frames when we reach 113*cdf0e10cSrcweir // this method. Therefore this call makes no sense and is the source of 114*cdf0e10cSrcweir // some stack traces, which we don't understand. 115*cdf0e10cSrcweir // For more information see: 116*cdf0e10cSrcweir // #123501# 117*cdf0e10cSrcweir //SetViewFrame(0); 118*cdf0e10cSrcweir pAppData_Impl->bDowning = sal_False; 119*cdf0e10cSrcweir DBG_ASSERT( !SfxViewFrame::GetFirst(), 120*cdf0e10cSrcweir "existing SfxViewFrame after Execute" ); 121*cdf0e10cSrcweir DBG_ASSERT( !SfxObjectShell::GetFirst(), 122*cdf0e10cSrcweir "existing SfxObjectShell after Execute" ); 123*cdf0e10cSrcweir pAppData_Impl->pAppDispat->Pop( *this, SFX_SHELL_POP_UNTIL ); 124*cdf0e10cSrcweir pAppData_Impl->pAppDispat->Flush(); 125*cdf0e10cSrcweir pAppData_Impl->bDowning = sal_True; 126*cdf0e10cSrcweir pAppData_Impl->pAppDispat->DoDeactivate_Impl( sal_True, NULL ); 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir // call derived application-exit 129*cdf0e10cSrcweir Exit(); 130*cdf0e10cSrcweir 131*cdf0e10cSrcweir // Controller u."a. freigeben 132*cdf0e10cSrcweir // dabei sollten auch restliche Komponenten ( Beamer! ) verschwinden 133*cdf0e10cSrcweir BasicManagerRepository::resetApplicationBasicManager(); 134*cdf0e10cSrcweir pAppData_Impl->pBasicManager->reset( NULL ); 135*cdf0e10cSrcweir // this will also delete pBasMgr 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir DBG_ASSERT( pAppData_Impl->pViewFrame == 0, "active foreign ViewFrame" ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = 0; 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir // free administration managers 142*cdf0e10cSrcweir DELETEZ(pAppData_Impl->pAppDispat); 143*cdf0e10cSrcweir SfxResId::DeleteResMgr(); 144*cdf0e10cSrcweir DELETEZ(pAppData_Impl->pOfaResMgr); 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir // ab hier d"urfen keine SvObjects mehr existieren 147*cdf0e10cSrcweir DELETEZ(pAppData_Impl->pMatcher); 148*cdf0e10cSrcweir 149*cdf0e10cSrcweir DELETEX(pAppData_Impl->pSlotPool); 150*cdf0e10cSrcweir DELETEX(pAppData_Impl->pFactArr); 151*cdf0e10cSrcweir DELETEX(pAppData_Impl->pInitLinkList); 152*cdf0e10cSrcweir 153*cdf0e10cSrcweir DELETEX(pAppData_Impl->pTbxCtrlFac); 154*cdf0e10cSrcweir DELETEX(pAppData_Impl->pStbCtrlFac); 155*cdf0e10cSrcweir DELETEX(pAppData_Impl->pMenuCtrlFac); 156*cdf0e10cSrcweir DELETEX(pAppData_Impl->pViewFrames); 157*cdf0e10cSrcweir DELETEX(pAppData_Impl->pViewShells); 158*cdf0e10cSrcweir DELETEX(pAppData_Impl->pObjShells); 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir //TODO/CLEANTUP 161*cdf0e10cSrcweir //ReleaseArgs could be used instead! 162*cdf0e10cSrcweir /* This leak is intended ! 163*cdf0e10cSrcweir Otherwise the TestTool cant use .uno:QuitApp ... 164*cdf0e10cSrcweir because every destructed ItemSet work's on an already 165*cdf0e10cSrcweir released pool pointer .-) 166*cdf0e10cSrcweir 167*cdf0e10cSrcweir NoChaos::ReleaseItemPool(); 168*cdf0e10cSrcweir */ 169*cdf0e10cSrcweir pAppData_Impl->pPool = NULL; 170*cdf0e10cSrcweir DELETEZ(pAppData_Impl->pBasicResMgr); 171*cdf0e10cSrcweir DELETEZ(pAppData_Impl->pSvtResMgr); 172*cdf0e10cSrcweir } 173