bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / framework / module / ShellStackGuard.hxx
blobc9033eadb56817d217d78b5ec3b4bf3929c961e6
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_SD_SOURCE_UI_FRAMEWORK_MODULE_SHELLSTACKGUARD_HXX
21 #define INCLUDED_SD_SOURCE_UI_FRAMEWORK_MODULE_SHELLSTACKGUARD_HXX
23 #include <cppuhelper/basemutex.hxx>
25 #include "framework/ConfigurationController.hxx"
27 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
28 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
29 #include <com/sun/star/frame/XController.hpp>
31 #include <vcl/timer.hxx>
32 #include <vcl/idle.hxx>
33 #include <cppuhelper/compbase1.hxx>
34 #include <boost/scoped_ptr.hpp>
36 namespace {
38 typedef ::cppu::WeakComponentImplHelper1 <
39 css::drawing::framework::XConfigurationChangeListener
40 > ShellStackGuardInterfaceBase;
42 } // end of anonymous namespace.
44 namespace sd {
46 class ViewShellBase;
50 namespace sd { namespace framework {
52 /** This module locks updates of the current configuration in situations
53 when the shell stack must not be modified.
55 On every start of a configuration update the ShellStackGuard checks the
56 printer. If it is printing the configuration update is locked. It then
57 polls the printer and unlocks updates when printing finishes.
59 When in the future there are no resources left that use shells then this
60 module can be removed.
62 class ShellStackGuard
63 : private ::cppu::BaseMutex,
64 public ShellStackGuardInterfaceBase
66 public:
67 ShellStackGuard (css::uno::Reference<css::frame::XController>& rxController);
68 virtual ~ShellStackGuard();
70 virtual void SAL_CALL disposing() SAL_OVERRIDE;
72 // XConfigurationChangeListener
74 virtual void SAL_CALL notifyConfigurationChange (
75 const css::drawing::framework::ConfigurationChangeEvent& rEvent)
76 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 // XEventListener
80 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
81 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
83 private:
84 css::uno::Reference<css::drawing::framework::XConfigurationController>
85 mxConfigurationController;
86 ViewShellBase* mpBase;
87 ::boost::scoped_ptr<ConfigurationController::Lock> mpUpdateLock;
88 Idle maPrinterPollingIdle;
90 DECL_LINK_TYPED(TimeoutHandler, Idle*, void);
92 /** Return <TRUE/> when the printer is printing. Return <FALSE/> when
93 the printer is not printing, or there is no printer, or something
94 else went wrong.
96 bool IsPrinting() const;
99 } } // end of namespace sd::framework
101 #endif
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */