Bump version to 21.06.18.1
[LibreOffice.git] / sw / inc / finalthreadmanager.hxx
blobbe73781e71b36b30b758c5264f0921bbc97b1cd9
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_FINALTHREADMANAGER_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_FINALTHREADMANAGER_HXX
23 #include <sal/config.h>
24 #include <cppuhelper/implbase.hxx>
25 #include <com/sun/star/lang/XServiceInfo.hpp>
26 #include <com/sun/star/util/XJobManager.hpp>
27 #include <com/sun/star/frame/XTerminateListener2.hpp>
28 #include <o3tl/deleter.hxx>
29 #include <osl/mutex.hxx>
30 #include <list>
31 #include <memory>
33 namespace com::sun::star::uno { class XComponentContext; }
35 class CancelJobsThread;
36 class TerminateOfficeThread;
37 class SwPauseThreadStarting;
39 class FinalThreadManager final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo,
40 css::util::XJobManager,
41 css::frame::XTerminateListener2 >
43 public:
44 explicit FinalThreadManager(css::uno::Reference< css::uno::XComponentContext > const & context);
46 // css::lang::XServiceInfo:
47 virtual OUString SAL_CALL getImplementationName() override;
48 virtual sal_Bool SAL_CALL supportsService(const OUString & ServiceName) override;
49 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
51 // css::util::XJobManager:
52 virtual void SAL_CALL registerJob(const css::uno::Reference< css::util::XCancellable > & Job) override;
53 virtual void SAL_CALL releaseJob(const css::uno::Reference< css::util::XCancellable > & Job) override;
54 virtual void SAL_CALL cancelAllJobs() override;
56 // css::frame::XTerminateListener2
57 virtual void SAL_CALL cancelTermination( const css::lang::EventObject& Event ) override;
59 // css::frame::XTerminateListener (inherited via css::frame::XTerminateListener2)
60 virtual void SAL_CALL queryTermination( const css::lang::EventObject& Event ) override;
61 virtual void SAL_CALL notifyTermination( const css::lang::EventObject& Event ) override;
63 // ::com::sun:star::lang::XEventListener (inherited via css::frame::XTerminateListener)
64 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
66 private:
67 FinalThreadManager(FinalThreadManager const &) = delete;
68 void operator =(FinalThreadManager const &) = delete;
70 virtual ~FinalThreadManager() override;
72 void registerAsListenerAtDesktop();
74 css::uno::Reference< css::uno::XComponentContext > m_xContext;
76 osl::Mutex maMutex;
78 std::list< css::uno::Reference< css::util::XCancellable > > maThreads;
79 std::unique_ptr<CancelJobsThread> mpCancelJobsThread;
80 TerminateOfficeThread* mpTerminateOfficeThread;
81 std::unique_ptr<SwPauseThreadStarting, o3tl::default_delete<SwPauseThreadStarting>> mpPauseThreadStarting;
83 bool mbRegisteredAtDesktop;
85 #endif
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */