1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX
21 #define SD_FRAMEWORK_CONFIGURATION_CONTROLLER_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>
44 typedef ::cppu::WeakComponentImplHelper2
<
45 css::drawing::framework::XConfigurationController
,
46 css::lang::XInitialization
47 > ConfigurationControllerInterfaceBase
;
49 } // end of anonymous namespace.
52 namespace sd
{ class ViewShellBase
; }
55 namespace sd
{ namespace framework
{
57 /** The configuration controller is responsible for maintaining the current
60 @see css::drawing::framework::XConfigurationController
61 for an extended documentation.
63 class ConfigurationController
64 : private sd::MutexOwner
,
65 private boost::noncopyable
,
66 public ConfigurationControllerInterfaceBase
69 ConfigurationController (void) throw();
70 virtual ~ConfigurationController (void) throw();
72 virtual void SAL_CALL
disposing (void);
74 void ProcessEvent (void);
76 /** Normally the requested changes of the configuration are executed
77 asynchronously. However, there is at least one situation (searching
78 with the Outliner) where the surrounding code does not cope with
79 this. So, instead of calling Reschedule until the global event loop
80 executes the configuration update, this method does (almost) the
81 same without the reschedules.
83 Do not use this method until there is absolutely no other way.
85 void RequestSynchronousUpdate (void);
87 // XConfigurationController
89 virtual void SAL_CALL
lock (void)
90 throw (css::uno::RuntimeException
);
92 virtual void SAL_CALL
unlock (void)
93 throw (css::uno::RuntimeException
);
95 virtual void SAL_CALL
requestResourceActivation (
96 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxResourceId
,
97 css::drawing::framework::ResourceActivationMode eMode
)
98 throw (css::uno::RuntimeException
);
100 virtual void SAL_CALL
requestResourceDeactivation (
101 const css::uno::Reference
<css::drawing::framework::XResourceId
>&
103 throw (css::uno::RuntimeException
);
105 virtual css::uno::Reference
<css::drawing::framework::XResource
>
106 SAL_CALL
getResource (
107 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxResourceId
)
108 throw (css::uno::RuntimeException
);
110 virtual void SAL_CALL
update (void)
111 throw (css::uno::RuntimeException
);
113 virtual css::uno::Reference
<
114 css::drawing::framework::XConfiguration
>
115 SAL_CALL
getRequestedConfiguration (void)
116 throw (css::uno::RuntimeException
);
118 virtual css::uno::Reference
<
119 css::drawing::framework::XConfiguration
>
120 SAL_CALL
getCurrentConfiguration (void)
121 throw (css::uno::RuntimeException
);
123 virtual void SAL_CALL
restoreConfiguration (
124 const css::uno::Reference
<css::drawing::framework::XConfiguration
>&
126 throw (css::uno::RuntimeException
);
129 // XConfigurationControllerBroadcaster
131 virtual void SAL_CALL
addConfigurationChangeListener (
132 const css::uno::Reference
<
133 css::drawing::framework::XConfigurationChangeListener
>& rxListener
,
134 const OUString
& rsEventType
,
135 const css::uno::Any
& rUserData
)
136 throw (css::uno::RuntimeException
);
138 virtual void SAL_CALL
removeConfigurationChangeListener (
139 const css::uno::Reference
<
140 css::drawing::framework::XConfigurationChangeListener
>& rxListener
)
141 throw (css::uno::RuntimeException
);
143 virtual void SAL_CALL
notifyEvent (
144 const css::drawing::framework::ConfigurationChangeEvent
& rEvent
)
145 throw (css::uno::RuntimeException
);
148 // XConfigurationRequestQueue
150 virtual sal_Bool SAL_CALL
hasPendingRequests (void)
151 throw (css::uno::RuntimeException
);
153 virtual void SAL_CALL
postChangeRequest (
154 const css::uno::Reference
<
155 css::drawing::framework::XConfigurationChangeRequest
>& rxRequest
)
156 throw (css::uno::RuntimeException
);
159 // XResourceFactoryManager
161 virtual void SAL_CALL
addResourceFactory(
162 const OUString
& sResourceURL
,
163 const css::uno::Reference
<css::drawing::framework::XResourceFactory
>& rxResourceFactory
)
164 throw (css::uno::RuntimeException
);
166 virtual void SAL_CALL
removeResourceFactoryForURL(
167 const OUString
& sResourceURL
)
168 throw (css::uno::RuntimeException
);
170 virtual void SAL_CALL
removeResourceFactoryForReference(
171 const css::uno::Reference
<css::drawing::framework::XResourceFactory
>& rxResourceFactory
)
172 throw (css::uno::RuntimeException
);
174 virtual css::uno::Reference
<css::drawing::framework::XResourceFactory
>
175 SAL_CALL
getResourceFactory (
176 const OUString
& sResourceURL
)
177 throw (css::uno::RuntimeException
);
182 virtual void SAL_CALL
initialize(
183 const css::uno::Sequence
<css::uno::Any
>& rArguments
)
184 throw (css::uno::Exception
, css::uno::RuntimeException
);
187 /** Use this class instead of calling lock() and unlock() directly in
188 order to be exception safe.
193 Lock (const css::uno::Reference
<
194 css::drawing::framework::XConfigurationController
>& rxController
);
198 css::drawing::framework::XConfigurationController
> mxController
;
202 class Implementation
;
203 ::boost::scoped_ptr
<Implementation
> mpImplementation
;
206 /** When the called object has already been disposed this method throws
207 an exception and does not return.
209 void ThrowIfDisposed (void) const
210 throw (css::lang::DisposedException
);
213 } } // end of namespace sd::framework
217 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */