LibreOffice Module sfx2 (master) 1
appquit.cxx
Go to the documentation of this file.
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/sbstar.hxx>
23#include <tools/debug.hxx>
24
25#include <sfx2/app.hxx>
26#include <appdata.hxx>
27#include <sfx2/stbitem.hxx>
28#include <sfx2/tbxctrl.hxx>
29#include <sfx2/childwin.hxx>
30#include <sfx2/dispatch.hxx>
31#include <nochaos.hxx>
32#include <sfx2/viewfrm.hxx>
33#include <sfx2/objsh.hxx>
34#include <appbaslib.hxx>
36
37using ::basic::BasicManagerRepository;
38
40{
41 if (pImpl->bDowning)
42 return;
43
44#if HAVE_FEATURE_SCRIPTING
46
48#endif
49
50 pImpl->bDowning = true; // due to Timer from DecAliveCount and QueryExit
51
52 pImpl->pTemplates.reset();
53
54 // By definition there shouldn't be any open view frames when we reach
55 // this method. Therefore this call makes no sense and is the source of
56 // some stack traces, which we don't understand.
57 // For more information see:
58 pImpl->bDowning = false;
59 DBG_ASSERT(!SfxViewFrame::GetFirst(), "existing SfxViewFrame after Execute");
60 DBG_ASSERT(!SfxObjectShell::GetFirst(), "existing SfxObjectShell after Execute");
61 pImpl->pAppDispat->Pop(*this, SfxDispatcherPopFlags::POP_UNTIL);
62 pImpl->pAppDispat->Flush();
63 pImpl->bDowning = true;
64 pImpl->pAppDispat->DoDeactivate_Impl(true, nullptr);
65
66 // Release Controller and others
67 // then the remaining components should also disappear ( Beamer! )
68
69#if HAVE_FEATURE_SCRIPTING
70 BasicManagerRepository::resetApplicationBasicManager();
71 pImpl->pBasicManager->reset(nullptr); // this will also delete pBasMgr
72#endif
73
74 DBG_ASSERT(pImpl->pViewFrame == nullptr, "active foreign ViewFrame");
75
76 // free administration managers
77 pImpl->pAppDispat.reset();
78
79 // from here no SvObjects have to exists
80 pImpl->pMatcher.reset();
81
82 pImpl->pSlotPool.reset();
83 pImpl->maFactories.clear();
84
85 pImpl->maTbxCtrlFactories.clear();
86 pImpl->maStbCtrlFactories.clear();
87 pImpl->maViewFrames.clear();
88 pImpl->maViewShells.clear();
89 pImpl->maObjShells.clear();
90
91 //TODO/CLEANUP
92 //ReleaseArgs could be used instead!
93 pImpl->pPool = nullptr;
95
96#if HAVE_FEATURE_SCRIPTING
97 pImpl->m_pSbxErrorHdl.reset();
98#endif
99 pImpl->m_pSoErrorHdl.reset();
100 pImpl->m_pToolsErrorHdl.reset();
101}
102
103/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static sal_uInt16 ReleaseItemPool()
Definition: nochaos.cxx:81
void Deinitialize()
Definition: appquit.cxx:39
std::unique_ptr< SfxAppData_Impl > pImpl
Definition: app.hxx:97
void SaveBasicAndDialogContainer() const
Definition: appbas.cxx:56
static SAL_WARN_UNUSED_RESULT SfxObjectShell * GetFirst(const std::function< bool(const SfxObjectShell *)> &isObjectShell=nullptr, bool bOnlyVisible=true)
Definition: objxtor.cxx:427
static SAL_WARN_UNUSED_RESULT SfxViewFrame * GetFirst(const SfxObjectShell *pDoc=nullptr, bool bOnlyVisible=true)
Definition: viewfrm.cxx:1983
static void Stop()
#define DBG_ASSERT(sCon, aError)