LibreOffice Module sd (master) 1
ConfigurationUpdater.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
22#include <com/sun/star/uno/Reference.hxx>
23#include <rtl/ref.hxx>
24#include <vcl/timer.hxx>
25#include <memory>
26#include <vector>
27
29{
30class XConfiguration;
31}
33{
34class XControllerManager;
35}
37{
38class XResourceId;
39}
40namespace sd
41{
42class DrawController;
43}
44
45namespace sd::framework
46{
47class ConfigurationClassifier;
48class ConfigurationUpdaterLock;
49class ConfigurationControllerResourceManager;
50class ConfigurationControllerBroadcaster;
51
62{
63public:
67 ConfigurationUpdater(std::shared_ptr<ConfigurationControllerBroadcaster> pBroadcaster,
68 std::shared_ptr<ConfigurationControllerResourceManager> pResourceManager,
69 const rtl::Reference<::sd::DrawController>& xControllerManager);
71
78 void RequestUpdate(const css::uno::Reference<css::drawing::framework::XConfiguration>&
79 rxRequestedConfiguration);
80
81 const css::uno::Reference<css::drawing::framework::XConfiguration>&
83 {
85 }
86
92 std::shared_ptr<ConfigurationUpdaterLock> GetLock();
93
94private:
99
100 std::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
101
105 css::uno::Reference<css::drawing::framework::XConfiguration> mxCurrentConfiguration;
106
113 css::uno::Reference<css::drawing::framework::XConfiguration> mxRequestedConfiguration;
114
122
128
133 sal_Int32 mnLockCount;
134
142
148
149 std::shared_ptr<ConfigurationControllerResourceManager> mpResourceManager;
150
156 void UpdateConfiguration();
157
161 void UpdateCore(const ConfigurationClassifier& rClassifier);
162
167 void CheckPureAnchors(
168 const css::uno::Reference<css::drawing::framework::XConfiguration>& rxConfiguration,
169 ::std::vector<css::uno::Reference<css::drawing::framework::XResourceId>>&
170 rResourcesToDeactivate);
171
178
182 void CheckUpdateSuccess();
183
188 void SetUpdateBeingProcessed(bool bValue);
189
195 bool IsUpdatePossible() const;
196
200 void LockUpdates();
201
205 void UnlockUpdates();
206
207 DECL_LINK(TimeoutHandler, Timer*, void);
208};
209
210} // end of namespace sd::framework
211
212/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
A ConfigurationClassifier object compares two configurations of resources and gives access to the dif...
This is a helper class for the ConfigurationController.
ConfigurationUpdater(std::shared_ptr< ConfigurationControllerBroadcaster > pBroadcaster, std::shared_ptr< ConfigurationControllerResourceManager > pResourceManager, const rtl::Reference<::sd::DrawController > &xControllerManager)
Create a new ConfigurationUpdater object that notifies configuration changes and the start and end of...
Timer maUpdateTimer
This timer is used to check from time to time whether the requested configuration and the current con...
void RequestUpdate(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxRequestedConfiguration)
Request an update of the current configuration so that it looks like the given requested configuratio...
void UnlockUpdates()
When an update was requested since the last LockUpdates() call then RequestUpdate() is called.
bool IsUpdatePossible() const
Return whether it is possible to do an update of the configuration.
std::shared_ptr< ConfigurationUpdaterLock > GetLock()
Return a lock of the called ConfigurationUpdater.
void UpdateCore(const ConfigurationClassifier &rClassifier)
Basically calls UpdaterStart() andUpdateEnd() and makes some debug output.
sal_Int32 mnLockCount
The ConfigurationController is locked when this count has a value larger then zero.
void UpdateConfiguration()
This method does the main work of an update.
bool mbUpdatePending
This flag is set to </sal_True> when an update of the current configuration was requested (because th...
rtl::Reference<::sd::DrawController > mxControllerManager
A reference to the XControllerManager is kept so that UpdateConfiguration() has access to the other s...
css::uno::Reference< css::drawing::framework::XConfiguration > mxRequestedConfiguration
The requested configuration holds the resources that have been requested to activate or to deactivate...
void CheckPureAnchors(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration, ::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > &rResourcesToDeactivate)
Check for all pure anchors if they have at least one child.
std::shared_ptr< ConfigurationControllerResourceManager > mpResourceManager
bool mbUpdateBeingProcessed
This flag is set to </sal_True> while the UpdateConfiguration() method is running.
void LockUpdates()
Lock updates of the current configuration.
const css::uno::Reference< css::drawing::framework::XConfiguration > & GetCurrentConfiguration() const
DECL_LINK(TimeoutHandler, Timer *, void)
void SetUpdateBeingProcessed(bool bValue)
This method sets the mbUpdateBeingProcessed member that is used to prevent reentrance problems.
void CleanRequestedConfiguration()
Remove from the requested configuration all pure anchors that have no child.
css::uno::Reference< css::drawing::framework::XConfiguration > mxCurrentConfiguration
The current configuration holds the resources that are currently active.
sal_Int32 mnFailedUpdateCount
The number of failed updates (those after which the current configuration is not equivalent to the re...
std::shared_ptr< ConfigurationControllerBroadcaster > mpBroadcaster
void CheckUpdateSuccess()
Check the success of a recently executed configuration update.