Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sd / source / console / PresenterFrameworkObserver.hxx
blob6700ad0a23222562c63455c1cd622902a012d91b
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_SDEXT_SOURCE_PRESENTER_PRESENTERFRAMEWORKOBSERVER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERFRAMEWORKOBSERVER_HXX
23 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
24 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
25 #include <cppuhelper/basemutex.hxx>
26 #include <cppuhelper/compbase.hxx>
28 #include <functional>
30 namespace sdext::presenter {
32 typedef ::cppu::WeakComponentImplHelper <
33 css::drawing::framework::XConfigurationChangeListener
34 > PresenterFrameworkObserverInterfaceBase;
36 /** Watch the drawing framework for changes and run callbacks when a certain
37 change takes place.
39 class PresenterFrameworkObserver
40 : private ::cppu::BaseMutex,
41 public PresenterFrameworkObserverInterfaceBase
43 public:
44 typedef ::std::function<void (bool)> Action;
46 PresenterFrameworkObserver(const PresenterFrameworkObserver&) = delete;
47 PresenterFrameworkObserver& operator=(const PresenterFrameworkObserver&) = delete;
49 static void RunOnUpdateEnd (
50 const css::uno::Reference<css::drawing::framework::XConfigurationController>&rxController,
51 const Action& rAction);
53 virtual void SAL_CALL disposing() override;
54 virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent) override;
55 virtual void SAL_CALL notifyConfigurationChange (
56 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
58 private:
59 css::uno::Reference<css::drawing::framework::XConfigurationController> mxConfigurationController;
60 Action maAction;
62 /** Create a new PresenterFrameworkObserver object.
63 @param rPredicate
64 This functor tests whether the action is to be executed or not.
65 @param rAction
66 The functor to execute when the predicate returns true,
67 e.g. when some resource has been created.
69 PresenterFrameworkObserver (
70 css::uno::Reference<css::drawing::framework::XConfigurationController> xController,
71 const Action& rAction);
72 virtual ~PresenterFrameworkObserver() override;
74 void Shutdown();
77 } // end of namespace ::sdext::presenter
79 #endif
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */