1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/factory.hxx>
25 #include <cppuhelper/implementationentry.hxx>
26 #include <cppuhelper/implbase.hxx>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <com/sun/star/util/XJobManager.hpp>
29 #include <com/sun/star/frame/XTerminateListener2.hpp>
30 #include <osl/mutex.hxx>
33 class CancelJobsThread
;
34 class TerminateOfficeThread
;
35 class SwPauseThreadStarting
;
37 class FinalThreadManager
: public ::cppu::WeakImplHelper
< com::sun::star::lang::XServiceInfo
,
38 com::sun::star::util::XJobManager
,
39 com::sun::star::frame::XTerminateListener2
>
42 explicit FinalThreadManager(com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> const & context
);
44 // ::com::sun::star::lang::XServiceInfo:
45 virtual OUString SAL_CALL
getImplementationName() throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
46 virtual sal_Bool SAL_CALL
supportsService(const OUString
& ServiceName
) throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
47 virtual com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames() throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
49 // ::com::sun::star::util::XJobManager:
50 virtual void SAL_CALL
registerJob(const com::sun::star::uno::Reference
< com::sun::star::util::XCancellable
> & Job
) throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
51 virtual void SAL_CALL
releaseJob(const com::sun::star::uno::Reference
< com::sun::star::util::XCancellable
> & Job
) throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
52 virtual void SAL_CALL
cancelAllJobs() throw (com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
54 // ::com::sun::star::frame::XTerminateListener2
55 virtual void SAL_CALL
cancelTermination( const ::com::sun::star::lang::EventObject
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
57 // ::com::sun::star::frame::XTerminateListener (inherited via com::sun::star::frame::XTerminateListener2)
58 virtual void SAL_CALL
queryTermination( const ::com::sun::star::lang::EventObject
& Event
) throw (::com::sun::star::frame::TerminationVetoException
, ::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
59 virtual void SAL_CALL
notifyTermination( const ::com::sun::star::lang::EventObject
& Event
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
61 // ::com::sun:star::lang::XEventListener (inherited via com::sun::star::frame::XTerminateListener)
62 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& Source
) throw (::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
65 FinalThreadManager(FinalThreadManager
&) SAL_DELETED_FUNCTION
;
66 void operator =(FinalThreadManager
&) SAL_DELETED_FUNCTION
;
68 virtual ~FinalThreadManager();
70 void registerAsListenerAtDesktop();
72 com::sun::star::uno::Reference
< com::sun::star::uno::XComponentContext
> m_xContext
;
76 std::list
< com::sun::star::uno::Reference
< com::sun::star::util::XCancellable
> > maThreads
;
77 CancelJobsThread
* mpCancelJobsThread
;
78 TerminateOfficeThread
* mpTerminateOfficeThread
;
79 SwPauseThreadStarting
* mpPauseThreadStarting
;
81 bool mbRegisteredAtDesktop
;
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */