LibreOffice Module sd (master) 1
ConfigurationController.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/drawing/framework/XConfigurationController.hpp>
23#include <com/sun/star/lang/XInitialization.hpp>
24
27#include <rtl/ref.hxx>
28
29#include <memory>
30
31
32namespace com::sun::star::drawing::framework { class XConfiguration; }
33namespace com::sun::star::drawing::framework { class XConfigurationChangeRequest; }
34namespace com::sun::star::drawing::framework { class XResourceId; }
35namespace com::sun::star::drawing::framework { struct ConfigurationChangeEvent; }
36namespace com::sun::star::frame { class XController; }
37namespace sd { class DrawController; }
38
39namespace sd::framework {
40
41typedef ::cppu::WeakComponentImplHelper <
42 css::drawing::framework::XConfigurationController
44
52 : private cppu::BaseMutex,
54{
55public:
57 virtual ~ConfigurationController() noexcept override;
60
61 virtual void SAL_CALL disposing() override;
62
63 void ProcessEvent();
64
75
76 // XConfigurationController
77
78 virtual void SAL_CALL lock() override;
79
80 virtual void SAL_CALL unlock() override;
81
82 virtual void SAL_CALL requestResourceActivation (
83 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
84 css::drawing::framework::ResourceActivationMode eMode) override;
85
86 virtual void SAL_CALL requestResourceDeactivation (
87 const css::uno::Reference<css::drawing::framework::XResourceId>&
88 rxResourceId) override;
89
90 virtual css::uno::Reference<css::drawing::framework::XResource>
91 SAL_CALL getResource (
92 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId) override;
93
94 virtual void SAL_CALL update() override;
95
96 virtual css::uno::Reference<
97 css::drawing::framework::XConfiguration>
98 SAL_CALL getRequestedConfiguration() override;
99
100 virtual css::uno::Reference<
101 css::drawing::framework::XConfiguration>
102 SAL_CALL getCurrentConfiguration() override;
103
104 virtual void SAL_CALL restoreConfiguration (
105 const css::uno::Reference<css::drawing::framework::XConfiguration>&
106 rxConfiguration) override;
107
108 // XConfigurationControllerBroadcaster
109
110 virtual void SAL_CALL addConfigurationChangeListener (
111 const css::uno::Reference<
112 css::drawing::framework::XConfigurationChangeListener>& rxListener,
113 const OUString& rsEventType,
114 const css::uno::Any& rUserData) override;
115
116 virtual void SAL_CALL removeConfigurationChangeListener (
117 const css::uno::Reference<
118 css::drawing::framework::XConfigurationChangeListener>& rxListener) override;
119
120 virtual void SAL_CALL notifyEvent (
121 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
122
123 // XConfigurationRequestQueue
124
125 virtual sal_Bool SAL_CALL hasPendingRequests() override;
126
127 virtual void SAL_CALL postChangeRequest (
128 const css::uno::Reference<
129 css::drawing::framework::XConfigurationChangeRequest>& rxRequest) override;
130
131 // XResourceFactoryManager
132
133 virtual void SAL_CALL addResourceFactory(
134 const OUString& sResourceURL,
135 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override;
136
137 virtual void SAL_CALL removeResourceFactoryForURL(
138 const OUString& sResourceURL) override;
139
140 virtual void SAL_CALL removeResourceFactoryForReference(
141 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory) override;
142
143 virtual css::uno::Reference<css::drawing::framework::XResourceFactory>
144 SAL_CALL getResourceFactory (
145 const OUString& sResourceURL) override;
146
150 class Lock
151 {
152 public:
153 Lock (const css::uno::Reference<
154 css::drawing::framework::XConfigurationController>& rxController);
155 ~Lock();
156 private:
157 css::uno::Reference<
158 css::drawing::framework::XConfigurationController> mxController;
159 };
160
161private:
162 class Implementation;
163 std::unique_ptr<Implementation> mpImplementation;
165
172 void ThrowIfDisposed () const;
173};
174
175} // end of namespace sd::framework
176
177/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Use this class instead of calling lock() and unlock() directly in order to be exception safe.
Lock(const css::uno::Reference< css::drawing::framework::XConfigurationController > &rxController)
css::uno::Reference< css::drawing::framework::XConfigurationController > mxController
The configuration controller is responsible for maintaining the current configuration.
std::unique_ptr< Implementation > mpImplementation
virtual void SAL_CALL requestResourceDeactivation(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId) override
virtual void SAL_CALL addResourceFactory(const OUString &sResourceURL, const css::uno::Reference< css::drawing::framework::XResourceFactory > &rxResourceFactory) override
void ThrowIfDisposed() const
When the called object has already been disposed this method throws an exception and does not return.
void RequestSynchronousUpdate()
Normally the requested changes of the configuration are executed asynchronously.
virtual void SAL_CALL postChangeRequest(const css::uno::Reference< css::drawing::framework::XConfigurationChangeRequest > &rxRequest) override
virtual void SAL_CALL disposing() override
virtual css::uno::Reference< css::drawing::framework::XConfiguration > SAL_CALL getCurrentConfiguration() override
virtual css::uno::Reference< css::drawing::framework::XResourceFactory > SAL_CALL getResourceFactory(const OUString &sResourceURL) override
ConfigurationController(const rtl::Reference<::sd::DrawController > &rxController)
virtual ~ConfigurationController() noexcept override
virtual void SAL_CALL addConfigurationChangeListener(const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > &rxListener, const OUString &rsEventType, const css::uno::Any &rUserData) override
virtual void SAL_CALL restoreConfiguration(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration) override
The given configuration is restored by generating the appropriate set of activation and deactivation ...
virtual void SAL_CALL removeResourceFactoryForReference(const css::uno::Reference< css::drawing::framework::XResourceFactory > &rxResourceFactory) override
virtual void SAL_CALL removeResourceFactoryForURL(const OUString &sResourceURL) override
virtual css::uno::Reference< css::drawing::framework::XConfiguration > SAL_CALL getRequestedConfiguration() override
virtual void SAL_CALL removeConfigurationChangeListener(const css::uno::Reference< css::drawing::framework::XConfigurationChangeListener > &rxListener) override
virtual void SAL_CALL notifyEvent(const css::drawing::framework::ConfigurationChangeEvent &rEvent) override
ConfigurationController & operator=(const ConfigurationController &)=delete
virtual css::uno::Reference< css::drawing::framework::XResource > SAL_CALL getResource(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId) override
virtual sal_Bool SAL_CALL hasPendingRequests() override
ConfigurationController(const ConfigurationController &)=delete
virtual void SAL_CALL requestResourceActivation(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, css::drawing::framework::ResourceActivationMode eMode) override
::cppu::WeakComponentImplHelper< css::drawing::framework::XConfigurationController > ConfigurationControllerInterfaceBase
unsigned char sal_Bool