bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / inc / framework / ConfigurationController.hxx
blob45f82cfe41273ff9e0272eae1508581485128b50
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_INC_FRAMEWORK_CONFIGURATIONCONTROLLER_HXX
21 #define INCLUDED_SD_SOURCE_UI_INC_FRAMEWORK_CONFIGURATIONCONTROLLER_HXX
23 #include "MutexOwner.hxx"
25 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
26 #include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
27 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
28 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
29 #include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
30 #include <com/sun/star/drawing/framework/XResourceId.hpp>
31 #include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <cppuhelper/compbase2.hxx>
36 #include <rtl/ref.hxx>
38 #include <boost/scoped_ptr.hpp>
39 #include <boost/shared_ptr.hpp>
40 #include <boost/noncopyable.hpp>
42 namespace {
44 typedef ::cppu::WeakComponentImplHelper2 <
45 css::drawing::framework::XConfigurationController,
46 css::lang::XInitialization
47 > ConfigurationControllerInterfaceBase;
49 } // end of anonymous namespace.
51 namespace sd { class ViewShellBase; }
53 namespace sd { namespace framework {
55 /** The configuration controller is responsible for maintaining the current
56 configuration.
58 @see css::drawing::framework::XConfigurationController
59 for an extended documentation.
61 class ConfigurationController
62 : private sd::MutexOwner,
63 private boost::noncopyable,
64 public ConfigurationControllerInterfaceBase
66 public:
67 ConfigurationController() throw();
68 virtual ~ConfigurationController() throw();
70 virtual void SAL_CALL disposing() SAL_OVERRIDE;
72 void ProcessEvent();
74 /** Normally the requested changes of the configuration are executed
75 asynchronously. However, there is at least one situation (searching
76 with the Outliner) where the surrounding code does not cope with
77 this. So, instead of calling Reschedule until the global event loop
78 executes the configuration update, this method does (almost) the
79 same without the reschedules.
81 Do not use this method until there is absolutely no other way.
83 void RequestSynchronousUpdate();
85 // XConfigurationController
87 virtual void SAL_CALL lock()
88 throw (css::uno::RuntimeException,
89 std::exception) SAL_OVERRIDE;
91 virtual void SAL_CALL unlock()
92 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
94 virtual void SAL_CALL requestResourceActivation (
95 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId,
96 css::drawing::framework::ResourceActivationMode eMode)
97 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
99 virtual void SAL_CALL requestResourceDeactivation (
100 const css::uno::Reference<css::drawing::framework::XResourceId>&
101 rxResourceId)
102 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
104 virtual css::uno::Reference<css::drawing::framework::XResource>
105 SAL_CALL getResource (
106 const css::uno::Reference<css::drawing::framework::XResourceId>& rxResourceId)
107 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
109 virtual void SAL_CALL update()
110 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
112 virtual css::uno::Reference<
113 css::drawing::framework::XConfiguration>
114 SAL_CALL getRequestedConfiguration()
115 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 virtual css::uno::Reference<
118 css::drawing::framework::XConfiguration>
119 SAL_CALL getCurrentConfiguration()
120 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
122 virtual void SAL_CALL restoreConfiguration (
123 const css::uno::Reference<css::drawing::framework::XConfiguration>&
124 rxConfiguration)
125 throw (css::uno::RuntimeException,
126 std::exception) SAL_OVERRIDE;
128 // XConfigurationControllerBroadcaster
130 virtual void SAL_CALL addConfigurationChangeListener (
131 const css::uno::Reference<
132 css::drawing::framework::XConfigurationChangeListener>& rxListener,
133 const OUString& rsEventType,
134 const css::uno::Any& rUserData)
135 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
137 virtual void SAL_CALL removeConfigurationChangeListener (
138 const css::uno::Reference<
139 css::drawing::framework::XConfigurationChangeListener>& rxListener)
140 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
142 virtual void SAL_CALL notifyEvent (
143 const css::drawing::framework::ConfigurationChangeEvent& rEvent)
144 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
146 // XConfigurationRequestQueue
148 virtual sal_Bool SAL_CALL hasPendingRequests()
149 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
151 virtual void SAL_CALL postChangeRequest (
152 const css::uno::Reference<
153 css::drawing::framework::XConfigurationChangeRequest>& rxRequest)
154 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
156 // XResourceFactoryManager
158 virtual void SAL_CALL addResourceFactory(
159 const OUString& sResourceURL,
160 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory)
161 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
163 virtual void SAL_CALL removeResourceFactoryForURL(
164 const OUString& sResourceURL)
165 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
167 virtual void SAL_CALL removeResourceFactoryForReference(
168 const css::uno::Reference<css::drawing::framework::XResourceFactory>& rxResourceFactory)
169 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
171 virtual css::uno::Reference<css::drawing::framework::XResourceFactory>
172 SAL_CALL getResourceFactory (
173 const OUString& sResourceURL)
174 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
176 // XInitialization
178 virtual void SAL_CALL initialize(
179 const css::uno::Sequence<css::uno::Any>& rArguments)
180 throw (css::uno::Exception, css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
182 /** Use this class instead of calling lock() and unlock() directly in
183 order to be exception safe.
185 class Lock
187 public:
188 Lock (const css::uno::Reference<
189 css::drawing::framework::XConfigurationController>& rxController);
190 ~Lock();
191 private:
192 css::uno::Reference<
193 css::drawing::framework::XConfigurationController> mxController;
196 private:
197 class Implementation;
198 ::boost::scoped_ptr<Implementation> mpImplementation;
199 bool mbIsDisposed;
201 /** When the called object has already been disposed this method throws
202 an exception and does not return.
204 void ThrowIfDisposed () const
205 throw (css::lang::DisposedException, css::uno::RuntimeException);
208 } } // end of namespace sd::framework
210 #endif
212 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */