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 <config_features.h>
21 :
22 : #include <basic/basmgr.hxx>
23 : #include <basic/sbstar.hxx>
24 :
25 : #include <svl/svdde.hxx>
26 : #include <vcl/layout.hxx>
27 : #include <svl/eitem.hxx>
28 :
29 : #include <unotools/saveopt.hxx>
30 : #include <unotools/misccfg.hxx>
31 :
32 : #include "app.hrc"
33 : #include <sfx2/app.hxx>
34 : #include <sfx2/evntconf.hxx>
35 : #include <sfx2/unoctitm.hxx>
36 : #include "appdata.hxx"
37 : #include <sfx2/viewsh.hxx>
38 : #include <sfx2/dispatch.hxx>
39 : #include <sfx2/printer.hxx>
40 : #include "arrdecl.hxx"
41 : #include <sfx2/sfxresid.hxx>
42 : #include <sfx2/event.hxx>
43 : #include <sfx2/mnumgr.hxx>
44 : #include <sfx2/templdlg.hxx>
45 : #include <sfx2/msgpool.hxx>
46 : #include <sfx2/docfile.hxx>
47 : #include "sfxtypes.hxx"
48 : #include "sfxlocal.hrc"
49 : #include <sfx2/fcontnr.hxx>
50 : #include "nochaos.hxx"
51 : #include <sfx2/doctempl.hxx>
52 : #include <sfx2/viewfrm.hxx>
53 : #include <sfx2/objsh.hxx>
54 : #include <sfx2/docfac.hxx>
55 : #include "appbaslib.hxx"
56 : #include <basic/basicmanagerrepository.hxx>
57 : #include <svtools/svtresid.hxx>
58 :
59 : using ::basic::BasicManagerRepository;
60 :
61 168 : void SfxApplication::Deinitialize()
62 : {
63 168 : if ( pAppData_Impl->bDowning )
64 168 : return;
65 :
66 : #if HAVE_FEATURE_SCRIPTING
67 168 : StarBASIC::Stop();
68 :
69 168 : SaveBasicAndDialogContainer();
70 : #endif
71 :
72 168 : pAppData_Impl->bDowning = true; // due to Timer from DecAliveCount and QueryExit
73 :
74 168 : DELETEZ( pAppData_Impl->pTemplates );
75 :
76 : // By definition there shouldn't be any open view frames when we reach
77 : // this method. Therefore this call makes no sense and is the source of
78 : // some stack traces, which we don't understand.
79 : // For more information see:
80 168 : pAppData_Impl->bDowning = false;
81 : DBG_ASSERT( !SfxViewFrame::GetFirst(),
82 : "existing SfxViewFrame after Execute" );
83 : DBG_ASSERT( !SfxObjectShell::GetFirst(),
84 : "existing SfxObjectShell after Execute" );
85 168 : pAppData_Impl->pAppDispat->Pop( *this, SFX_SHELL_POP_UNTIL );
86 168 : pAppData_Impl->pAppDispat->Flush();
87 168 : pAppData_Impl->bDowning = true;
88 168 : pAppData_Impl->pAppDispat->DoDeactivate_Impl( true, NULL );
89 :
90 : // call derived application-exit
91 168 : Exit();
92 :
93 : // Release Controller and others
94 : // then the remaining components should alse disapear ( Beamer! )
95 :
96 : #if HAVE_FEATURE_SCRIPTING
97 168 : BasicManagerRepository::resetApplicationBasicManager();
98 168 : pAppData_Impl->pBasicManager->reset( NULL );
99 : // this will also delete pBasMgr
100 : #endif
101 :
102 : DBG_ASSERT( pAppData_Impl->pViewFrame == 0, "active foreign ViewFrame" );
103 :
104 168 : delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = 0;
105 :
106 : // free administration managers
107 168 : DELETEZ(pAppData_Impl->pAppDispat);
108 168 : SfxResId::DeleteResMgr();
109 168 : SvtResId::DeleteResMgr();
110 168 : DELETEZ(pAppData_Impl->pOfaResMgr);
111 :
112 : // from here no SvObjects have to exists
113 168 : DELETEZ(pAppData_Impl->pMatcher);
114 :
115 168 : DELETEX(SfxSlotPool, pAppData_Impl->pSlotPool);
116 168 : DELETEX(SfxChildWinFactArr_Impl, pAppData_Impl->pFactArr);
117 :
118 168 : DELETEX(SfxTbxCtrlFactArr_Impl, pAppData_Impl->pTbxCtrlFac);
119 168 : DELETEX(SfxStbCtrlFactArr_Impl, pAppData_Impl->pStbCtrlFac);
120 168 : DELETEX(SfxMenuCtrlFactArr_Impl, pAppData_Impl->pMenuCtrlFac);
121 168 : DELETEX(SfxViewFrameArr_Impl, pAppData_Impl->pViewFrames);
122 168 : DELETEX(SfxViewShellArr_Impl, pAppData_Impl->pViewShells);
123 168 : DELETEX(SfxObjectShellArr_Impl, pAppData_Impl->pObjShells);
124 :
125 : //TODO/CLEANTUP
126 : //ReleaseArgs could be used instead!
127 168 : pAppData_Impl->pPool = NULL;
128 168 : NoChaos::ReleaseItemPool();
129 :
130 : #if HAVE_FEATURE_SCRIPTING
131 168 : DELETEZ(pAppData_Impl->pBasicResMgr);
132 : #endif
133 168 : DELETEZ(pAppData_Impl->pSvtResMgr);
134 :
135 : #if HAVE_FEATURE_SCRIPTING
136 168 : delete pAppData_Impl->m_pSbxErrorHdl;
137 : #endif
138 168 : delete pAppData_Impl->m_pSoErrorHdl;
139 168 : delete pAppData_Impl->m_pToolsErrorHdl;
140 951 : }
141 :
142 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|