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/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>
57 :
58 : using ::basic::BasicManagerRepository;
59 :
60 : //===================================================================
61 0 : sal_Bool SfxApplication::QueryExit_Impl()
62 : {
63 0 : sal_Bool bQuit = sal_True;
64 :
65 : // Does some instance, that can not be shut down, still require the app?
66 0 : if ( !bQuit )
67 : {
68 : // Not really exit, only minimize
69 0 : InfoBox aInfoBox( NULL, SfxResId(MSG_CANT_QUIT) );
70 0 : aInfoBox.Execute();
71 : OSL_TRACE( "QueryExit => sal_False (in use)" );
72 0 : return sal_False;
73 : }
74 :
75 0 : return sal_True;
76 : }
77 :
78 : //-------------------------------------------------------------------------
79 :
80 0 : void SfxApplication::Deinitialize()
81 : {
82 0 : if ( pAppData_Impl->bDowning )
83 0 : return;
84 :
85 : #ifndef DISABLE_SCRIPTING
86 0 : StarBASIC::Stop();
87 :
88 0 : SaveBasicAndDialogContainer();
89 : #endif
90 :
91 0 : pAppData_Impl->bDowning = sal_True; // due to Timer from DecAliveCount and QueryExit
92 :
93 0 : DELETEZ( pAppData_Impl->pTemplates );
94 :
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 0 : 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 0 : pAppData_Impl->pAppDispat->Pop( *this, SFX_SHELL_POP_UNTIL );
105 0 : pAppData_Impl->pAppDispat->Flush();
106 0 : pAppData_Impl->bDowning = sal_True;
107 0 : pAppData_Impl->pAppDispat->DoDeactivate_Impl( sal_True, NULL );
108 :
109 : // call derived application-exit
110 0 : Exit();
111 :
112 : // Release Controller and others
113 : // then the remaining components should alse disapear ( Beamer! )
114 :
115 : #ifndef DISABLE_SCRIPTING
116 0 : BasicManagerRepository::resetApplicationBasicManager();
117 0 : pAppData_Impl->pBasicManager->reset( NULL );
118 : // this will also delete pBasMgr
119 : #endif
120 :
121 : DBG_ASSERT( pAppData_Impl->pViewFrame == 0, "active foreign ViewFrame" );
122 :
123 0 : delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = 0;
124 :
125 : // free administration managers
126 0 : DELETEZ(pAppData_Impl->pAppDispat);
127 0 : SfxResId::DeleteResMgr();
128 0 : SvtResId::DeleteResMgr();
129 0 : DELETEZ(pAppData_Impl->pOfaResMgr);
130 :
131 : // from here no SvObjects have to exists
132 0 : DELETEZ(pAppData_Impl->pMatcher);
133 :
134 0 : DELETEX(pAppData_Impl->pSlotPool);
135 0 : DELETEX(pAppData_Impl->pFactArr);
136 :
137 0 : DELETEX(pAppData_Impl->pTbxCtrlFac);
138 0 : DELETEX(pAppData_Impl->pStbCtrlFac);
139 0 : DELETEX(pAppData_Impl->pMenuCtrlFac);
140 0 : DELETEX(pAppData_Impl->pViewFrames);
141 0 : DELETEX(pAppData_Impl->pViewShells);
142 0 : DELETEX(pAppData_Impl->pObjShells);
143 :
144 : //TODO/CLEANTUP
145 : //ReleaseArgs could be used instead!
146 0 : pAppData_Impl->pPool = NULL;
147 0 : NoChaos::ReleaseItemPool();
148 :
149 0 : DELETEZ(pAppData_Impl->pBasicResMgr);
150 0 : DELETEZ(pAppData_Impl->pSvtResMgr);
151 :
152 0 : delete pAppData_Impl->m_pSbxErrorHdl;
153 0 : delete pAppData_Impl->m_pSoErrorHdl;
154 0 : delete pAppData_Impl->m_pToolsErrorHdl;
155 : #ifdef DBG_UTIL
156 : delete pAppData_Impl->m_pSimpleErrorHdl;
157 : #endif
158 : }
159 :
160 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|