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 "childwinimpl.hxx"
57 : #include <ctrlfactoryimpl.hxx>
58 : #include <shellimpl.hxx>
59 : #include <basic/basicmanagerrepository.hxx>
60 : #include <svtools/svtresid.hxx>
61 :
62 : using ::basic::BasicManagerRepository;
63 :
64 119 : void SfxApplication::Deinitialize()
65 : {
66 119 : if ( pAppData_Impl->bDowning )
67 119 : return;
68 :
69 : #if HAVE_FEATURE_SCRIPTING
70 119 : StarBASIC::Stop();
71 :
72 119 : SaveBasicAndDialogContainer();
73 : #endif
74 :
75 119 : pAppData_Impl->bDowning = true; // due to Timer from DecAliveCount and QueryExit
76 :
77 119 : DELETEZ( pAppData_Impl->pTemplates );
78 :
79 : // By definition there shouldn't be any open view frames when we reach
80 : // this method. Therefore this call makes no sense and is the source of
81 : // some stack traces, which we don't understand.
82 : // For more information see:
83 119 : pAppData_Impl->bDowning = false;
84 : DBG_ASSERT( !SfxViewFrame::GetFirst(),
85 : "existing SfxViewFrame after Execute" );
86 : DBG_ASSERT( !SfxObjectShell::GetFirst(),
87 : "existing SfxObjectShell after Execute" );
88 119 : pAppData_Impl->pAppDispat->Pop( *this, SfxDispatcherPopFlags::POP_UNTIL );
89 119 : pAppData_Impl->pAppDispat->Flush();
90 119 : pAppData_Impl->bDowning = true;
91 119 : pAppData_Impl->pAppDispat->DoDeactivate_Impl( true, NULL );
92 :
93 : // Release Controller and others
94 : // then the remaining components should also disappear ( Beamer! )
95 :
96 : #if HAVE_FEATURE_SCRIPTING
97 119 : BasicManagerRepository::resetApplicationBasicManager();
98 119 : 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 119 : delete[] pAppData_Impl->pInterfaces, pAppData_Impl->pInterfaces = 0;
105 :
106 : // free administration managers
107 119 : DELETEZ(pAppData_Impl->pAppDispat);
108 119 : SfxResId::DeleteResMgr();
109 119 : SvtResId::DeleteResMgr();
110 :
111 : // from here no SvObjects have to exists
112 119 : DELETEZ(pAppData_Impl->pMatcher);
113 :
114 119 : DELETEX(SfxSlotPool, pAppData_Impl->pSlotPool);
115 119 : DELETEX(SfxChildWinFactArr_Impl, pAppData_Impl->pFactArr);
116 :
117 119 : DELETEX(SfxTbxCtrlFactArr_Impl, pAppData_Impl->pTbxCtrlFac);
118 119 : DELETEX(SfxStbCtrlFactArr_Impl, pAppData_Impl->pStbCtrlFac);
119 119 : DELETEX(SfxMenuCtrlFactArr_Impl, pAppData_Impl->pMenuCtrlFac);
120 119 : DELETEX(SfxViewFrameArr_Impl, pAppData_Impl->pViewFrames);
121 119 : DELETEX(SfxViewShellArr_Impl, pAppData_Impl->pViewShells);
122 119 : DELETEX(SfxObjectShellArr_Impl, pAppData_Impl->pObjShells);
123 :
124 : //TODO/CLEANTUP
125 : //ReleaseArgs could be used instead!
126 119 : pAppData_Impl->pPool = NULL;
127 119 : NoChaos::ReleaseItemPool();
128 :
129 : #if HAVE_FEATURE_SCRIPTING
130 119 : DELETEZ(pAppData_Impl->pBasicResMgr);
131 : #endif
132 119 : DELETEZ(pAppData_Impl->pSvtResMgr);
133 :
134 : #if HAVE_FEATURE_SCRIPTING
135 119 : delete pAppData_Impl->m_pSbxErrorHdl;
136 : #endif
137 119 : delete pAppData_Impl->m_pSoErrorHdl;
138 119 : delete pAppData_Impl->m_pToolsErrorHdl;
139 648 : }
140 :
141 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|