Version 7.1.7.1, tag libreoffice-7.1.7.1
[LibreOffice.git] / sfx2 / source / appl / appquit.cxx
blob1fafb81ceb428367f0b8184e206808f76ca299cb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <config_features.h>
22 #include <basic/sbstar.hxx>
23 #include <tools/solar.h>
24 #include <tools/debug.hxx>
26 #include <sfx2/app.hxx>
27 #include <appdata.hxx>
28 #include <sfx2/viewsh.hxx>
29 #include <sfx2/dispatch.hxx>
30 #include <sfx2/msgpool.hxx>
31 #include <sfx2/fcontnr.hxx>
32 #include <nochaos.hxx>
33 #include <sfx2/doctempl.hxx>
34 #include <sfx2/viewfrm.hxx>
35 #include <sfx2/objsh.hxx>
36 #include <appbaslib.hxx>
37 #include <childwinimpl.hxx>
38 #include <ctrlfactoryimpl.hxx>
39 #include <shellimpl.hxx>
40 #include <basic/basicmanagerrepository.hxx>
42 using ::basic::BasicManagerRepository;
44 void SfxApplication::Deinitialize()
46 if (pImpl->bDowning)
47 return;
49 #if HAVE_FEATURE_SCRIPTING
50 StarBASIC::Stop();
52 SaveBasicAndDialogContainer();
53 #endif
55 pImpl->bDowning = true; // due to Timer from DecAliveCount and QueryExit
57 pImpl->pTemplates.reset();
59 // By definition there shouldn't be any open view frames when we reach
60 // this method. Therefore this call makes no sense and is the source of
61 // some stack traces, which we don't understand.
62 // For more information see:
63 pImpl->bDowning = false;
64 DBG_ASSERT(!SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute");
65 DBG_ASSERT(!SfxObjectShell::GetFirst(), "existing SfxObjectShell after Execute");
66 pImpl->pAppDispat->Pop(*this, SfxDispatcherPopFlags::POP_UNTIL);
67 pImpl->pAppDispat->Flush();
68 pImpl->bDowning = true;
69 pImpl->pAppDispat->DoDeactivate_Impl(true, nullptr);
71 // Release Controller and others
72 // then the remaining components should also disappear ( Beamer! )
74 #if HAVE_FEATURE_SCRIPTING
75 BasicManagerRepository::resetApplicationBasicManager();
76 pImpl->pBasicManager->reset(nullptr); // this will also delete pBasMgr
77 #endif
79 DBG_ASSERT(pImpl->pViewFrame == nullptr, "active foreign ViewFrame");
81 // free administration managers
82 pImpl->pAppDispat.reset();
84 // from here no SvObjects have to exists
85 pImpl->pMatcher.reset();
87 pImpl->pSlotPool.reset();
88 pImpl->pFactArr.reset();
90 pImpl->pTbxCtrlFac.reset();
91 pImpl->pStbCtrlFac.reset();
92 pImpl->pViewFrames.reset();
93 pImpl->pViewShells.reset();
94 pImpl->pObjShells.reset();
96 //TODO/CLEANUP
97 //ReleaseArgs could be used instead!
98 pImpl->pPool = nullptr;
99 NoChaos::ReleaseItemPool();
101 #if HAVE_FEATURE_SCRIPTING
102 pImpl->m_pSbxErrorHdl.reset();
103 #endif
104 pImpl->m_pSoErrorHdl.reset();
105 pImpl->m_pToolsErrorHdl.reset();
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */