1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <basic/basmgr.hxx>
21 #include <basic/sbstar.hxx>
23 #include <svl/svdde.hxx>
24 #include <vcl/msgbox.hxx>
25 #include <svl/eitem.hxx>
27 #include <unotools/saveopt.hxx>
28 #include <unotools/misccfg.hxx>
31 #include <sfx2/app.hxx>
32 #include <sfx2/evntconf.hxx>
33 #include <sfx2/unoctitm.hxx>
34 #include "appdata.hxx"
35 #include <sfx2/viewsh.hxx>
36 #include <sfx2/dispatch.hxx>
37 #include <sfx2/printer.hxx>
38 #include "arrdecl.hxx"
39 #include <sfx2/sfxresid.hxx>
40 #include <sfx2/event.hxx>
41 #include <sfx2/mnumgr.hxx>
42 #include <sfx2/templdlg.hxx>
43 #include <sfx2/msgpool.hxx>
44 #include <sfx2/docfile.hxx>
45 #include "sfxtypes.hxx"
46 #include "sfxlocal.hrc"
47 #include <sfx2/fcontnr.hxx>
48 #include "nochaos.hxx"
49 #include <sfx2/appuno.hxx>
50 #include <sfx2/doctempl.hxx>
51 #include <sfx2/viewfrm.hxx>
52 #include <sfx2/objsh.hxx>
53 #include <sfx2/docfac.hxx>
54 #include "appbaslib.hxx"
55 #include <basic/basicmanagerrepository.hxx>
56 #include <svtools/svtresid.hxx>
58 using ::basic::BasicManagerRepository
;
60 //===================================================================
61 sal_Bool
SfxApplication::QueryExit_Impl()
63 sal_Bool bQuit
= sal_True
;
65 // Does some instance, that can not be shut down, still require the app?
68 // Not really exit, only minimize
69 InfoBox
aInfoBox( NULL
, SfxResId(MSG_CANT_QUIT
) );
71 OSL_TRACE( "QueryExit => sal_False (in use)" );
78 //-------------------------------------------------------------------------
80 void SfxApplication::Deinitialize()
82 if ( pAppData_Impl
->bDowning
)
85 #ifndef DISABLE_SCRIPTING
88 SaveBasicAndDialogContainer();
91 pAppData_Impl
->bDowning
= sal_True
; // due to Timer from DecAliveCount and QueryExit
93 DELETEZ( pAppData_Impl
->pTemplates
);
95 // By definition there shouldn't be any open view frames when we reach
96 // this method. Therefore this call makes no sense and is the source of
97 // some stack traces, which we don't understand.
98 // For more information see:
99 pAppData_Impl
->bDowning
= sal_False
;
100 DBG_ASSERT( !SfxViewFrame::GetFirst(),
101 "existing SfxViewFrame after Execute" );
102 DBG_ASSERT( !SfxObjectShell::GetFirst(),
103 "existing SfxObjectShell after Execute" );
104 pAppData_Impl
->pAppDispat
->Pop( *this, SFX_SHELL_POP_UNTIL
);
105 pAppData_Impl
->pAppDispat
->Flush();
106 pAppData_Impl
->bDowning
= sal_True
;
107 pAppData_Impl
->pAppDispat
->DoDeactivate_Impl( sal_True
, NULL
);
109 // call derived application-exit
112 // Release Controller and others
113 // then the remaining components should alse disapear ( Beamer! )
115 #ifndef DISABLE_SCRIPTING
116 BasicManagerRepository::resetApplicationBasicManager();
117 pAppData_Impl
->pBasicManager
->reset( NULL
);
118 // this will also delete pBasMgr
121 DBG_ASSERT( pAppData_Impl
->pViewFrame
== 0, "active foreign ViewFrame" );
123 delete[] pAppData_Impl
->pInterfaces
, pAppData_Impl
->pInterfaces
= 0;
125 // free administration managers
126 DELETEZ(pAppData_Impl
->pAppDispat
);
127 SfxResId::DeleteResMgr();
128 SvtResId::DeleteResMgr();
129 DELETEZ(pAppData_Impl
->pOfaResMgr
);
131 // from here no SvObjects have to exists
132 DELETEZ(pAppData_Impl
->pMatcher
);
134 DELETEX(SfxSlotPool
, pAppData_Impl
->pSlotPool
);
135 DELETEX(SfxChildWinFactArr_Impl
, pAppData_Impl
->pFactArr
);
137 DELETEX(SfxTbxCtrlFactArr_Impl
, pAppData_Impl
->pTbxCtrlFac
);
138 DELETEX(SfxStbCtrlFactArr_Impl
, pAppData_Impl
->pStbCtrlFac
);
139 DELETEX(SfxMenuCtrlFactArr_Impl
, pAppData_Impl
->pMenuCtrlFac
);
140 DELETEX(SfxViewFrameArr_Impl
, pAppData_Impl
->pViewFrames
);
141 DELETEX(SfxViewShellArr_Impl
, pAppData_Impl
->pViewShells
);
142 DELETEX(SfxObjectShellArr_Impl
, pAppData_Impl
->pObjShells
);
145 //ReleaseArgs could be used instead!
146 pAppData_Impl
->pPool
= NULL
;
147 NoChaos::ReleaseItemPool();
149 #ifndef DISABLE_SCRIPTING
150 DELETEZ(pAppData_Impl
->pBasicResMgr
);
152 DELETEZ(pAppData_Impl
->pSvtResMgr
);
154 #ifndef DISABLE_SCRIPTING
155 delete pAppData_Impl
->m_pSbxErrorHdl
;
157 delete pAppData_Impl
->m_pSoErrorHdl
;
158 delete pAppData_Impl
->m_pToolsErrorHdl
;
160 delete pAppData_Impl
->m_pSimpleErrorHdl
;
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */