Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <basic/basmgr.hxx>
21 : #include <basic/sbstar.hxx>
22 :
23 : #include <svl/svdde.hxx>
24 : #include <vcl/msgbox.hxx>
25 : #include <svl/eitem.hxx>
26 :
27 : #include <unotools/saveopt.hxx>
28 : #include <unotools/misccfg.hxx>
29 :
30 : #include "app.hrc"
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/doctempl.hxx>
50 : #include <sfx2/viewfrm.hxx>
51 : #include <sfx2/objsh.hxx>
52 : #include <sfx2/docfac.hxx>
53 : #include "appbaslib.hxx"
54 : #include <basic/basicmanagerrepository.hxx>
55 : #include <svtools/svtresid.hxx>
56 :
57 : using ::basic::BasicManagerRepository;
58 :
59 :
60 0 : bool SfxApplication::QueryExit_Impl()
61 : {
62 0 : bool bQuit = true;
63 :
64 : // Does some instance, that can not be shut down, still require the app?
65 0 : if ( !bQuit )
66 : {
67 : // Not really exit, only minimize
68 0 : InfoBox aInfoBox( NULL, SfxResId(MSG_CANT_QUIT) );
69 0 : aInfoBox.Execute();
70 : OSL_TRACE( "QueryExit => sal_False (in use)" );
71 0 : return false;
72 : }
73 :
74 0 : return true;
75 : }
76 :
77 :
78 :
79 0 : void SfxApplication::Deinitialize()
80 : {
81 0 : if ( pAppData_Impl->bDowning )
82 0 : return;
83 :
84 : #ifndef DISABLE_SCRIPTING
85 0 : StarBASIC::Stop();
86 :
87 0 : SaveBasicAndDialogContainer();
88 : #endif
89 :
90 0 : pAppData_Impl->bDowning = true; // due to Timer from DecAliveCount and QueryExit
91 :
92 0 : DELETEZ( pAppData_Impl->pTemplates );
93 :
94 : // By definition there shouldn't be any open view frames when we reach
95 : // this method. Therefore this call makes no sense and is the source of
96 : // some stack traces, which we don't understand.
97 : // For more information see:
98 0 : pAppData_Impl->bDowning = false;
99 : DBG_ASSERT( !SfxViewFrame::GetFirst(),
100 : "existing SfxViewFrame after Execute" );
101 : DBG_ASSERT( !SfxObjectShell::GetFirst(),
102 : "existing SfxObjectShell after Execute" );
103 0 : pAppData_Impl->pAppDispat->Pop( *this, SFX_SHELL_POP_UNTIL );
104 0 : pAppData_Impl->pAppDispat->Flush();
105 0 : pAppData_Impl->bDowning = true;
106 0 : pAppData_Impl->pAppDispat->DoDeactivate_Impl( true, NULL );
107 :
108 : // call derived application-exit
109 0 : Exit();
110 :
111 : // Release Controller and others
112 : // then the remaining components should alse disapear ( Beamer! )
113 :
114 : #ifndef DISABLE_SCRIPTING
115 0 : BasicManagerRepository::resetApplicationBasicManager();
116 0 : pAppData_Impl->pBasicManager->reset( NULL );
117 : // this will also delete pBasMgr
118 : #endif
119 :
120 : DBG_ASSERT( pAppData_Impl->pViewFrame == 0, "active foreign ViewFrame" );
121 :
122 0 : delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = 0;
123 :
124 : // free administration managers
125 0 : DELETEZ(pAppData_Impl->pAppDispat);
126 0 : SfxResId::DeleteResMgr();
127 0 : SvtResId::DeleteResMgr();
128 0 : DELETEZ(pAppData_Impl->pOfaResMgr);
129 :
130 : // from here no SvObjects have to exists
131 0 : DELETEZ(pAppData_Impl->pMatcher);
132 :
133 0 : DELETEX(SfxSlotPool, pAppData_Impl->pSlotPool);
134 0 : DELETEX(SfxChildWinFactArr_Impl, pAppData_Impl->pFactArr);
135 :
136 0 : DELETEX(SfxTbxCtrlFactArr_Impl, pAppData_Impl->pTbxCtrlFac);
137 0 : DELETEX(SfxStbCtrlFactArr_Impl, pAppData_Impl->pStbCtrlFac);
138 0 : DELETEX(SfxMenuCtrlFactArr_Impl, pAppData_Impl->pMenuCtrlFac);
139 0 : DELETEX(SfxViewFrameArr_Impl, pAppData_Impl->pViewFrames);
140 0 : DELETEX(SfxViewShellArr_Impl, pAppData_Impl->pViewShells);
141 0 : DELETEX(SfxObjectShellArr_Impl, pAppData_Impl->pObjShells);
142 :
143 : //TODO/CLEANTUP
144 : //ReleaseArgs could be used instead!
145 0 : pAppData_Impl->pPool = NULL;
146 0 : NoChaos::ReleaseItemPool();
147 :
148 : #ifndef DISABLE_SCRIPTING
149 0 : DELETEZ(pAppData_Impl->pBasicResMgr);
150 : #endif
151 0 : DELETEZ(pAppData_Impl->pSvtResMgr);
152 :
153 : #ifndef DISABLE_SCRIPTING
154 0 : delete pAppData_Impl->m_pSbxErrorHdl;
155 : #endif
156 0 : delete pAppData_Impl->m_pSoErrorHdl;
157 0 : delete pAppData_Impl->m_pToolsErrorHdl;
158 : }
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|