Move setting of LD_LIBRARY_PATH closer to invocation of cppunittester
[LibreOffice.git] / sd / source / ui / framework / module / ShellStackGuard.hxx
blobfe94037816f9ebf5445baa8d53155601772a3a3e
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 #pragma once
22 #include <framework/ConfigurationController.hxx>
24 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
26 #include <rtl/ref.hxx>
27 #include <vcl/idle.hxx>
28 #include <comphelper/compbase.hxx>
29 #include <memory>
31 namespace com::sun::star::drawing::framework
33 class XConfigurationController;
35 namespace com::sun::star::frame
37 class XController;
40 namespace sd
42 class DrawController;
43 class ViewShellBase;
46 namespace sd::framework
48 typedef comphelper::WeakComponentImplHelper<css::drawing::framework::XConfigurationChangeListener>
49 ShellStackGuardInterfaceBase;
51 /** This module locks updates of the current configuration in situations
52 when the shell stack must not be modified.
54 On every start of a configuration update the ShellStackGuard checks the
55 printer. If it is printing the configuration update is locked. It then
56 polls the printer and unlocks updates when printing finishes.
58 When in the future there are no resources left that use shells then this
59 module can be removed.
61 class ShellStackGuard : public ShellStackGuardInterfaceBase
63 public:
64 explicit ShellStackGuard(rtl::Reference<sd::DrawController> const& rxController);
65 virtual ~ShellStackGuard() override;
67 virtual void disposing(std::unique_lock<std::mutex>&) override;
69 // XConfigurationChangeListener
71 virtual void SAL_CALL notifyConfigurationChange(
72 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
74 // XEventListener
76 virtual void SAL_CALL disposing(const css::lang::EventObject& rEvent) override;
78 private:
79 css::uno::Reference<css::drawing::framework::XConfigurationController>
80 mxConfigurationController;
81 ViewShellBase* mpBase;
82 std::unique_ptr<ConfigurationController::Lock> mpUpdateLock;
83 Idle maPrinterPollingIdle;
85 DECL_LINK(TimeoutHandler, Timer*, void);
87 /** Return <TRUE/> when the printer is printing. Return <FALSE/> when
88 the printer is not printing, or there is no printer, or something
89 else went wrong.
91 bool IsPrinting() const;
94 } // end of namespace sd::framework
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */