1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ConfigurationController.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX
32 #define SD_FRAMEWORK_CONFIGURATION_CONTROLLER_HXX
34 #include "MutexOwner.hxx"
36 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
37 #include <com/sun/star/drawing/framework/XConfigurationChangeRequest.hpp>
38 #include <com/sun/star/drawing/framework/XConfiguration.hpp>
39 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
40 #include <com/sun/star/drawing/framework/XResourceFactoryManager.hpp>
41 #include <com/sun/star/drawing/framework/XResourceId.hpp>
42 #include <com/sun/star/drawing/framework/ConfigurationChangeEvent.hpp>
43 #include <com/sun/star/lang/XInitialization.hpp>
44 #include <com/sun/star/uno/XComponentContext.hpp>
46 #include <cppuhelper/compbase2.hxx>
47 #include <tools/link.hxx>
48 #include <rtl/ref.hxx>
50 #include <boost/scoped_ptr.hpp>
51 #include <boost/shared_ptr.hpp>
52 #include <boost/noncopyable.hpp>
54 namespace css
= ::com::sun::star
;
58 typedef ::cppu::WeakComponentImplHelper2
<
59 ::css::drawing::framework::XConfigurationController
,
60 ::css::lang::XInitialization
61 > ConfigurationControllerInterfaceBase
;
63 } // end of anonymous namespace.
66 namespace sd
{ class ViewShellBase
; }
69 namespace sd
{ namespace framework
{
71 class ChangeRequestQueueProcessor
;
72 class ConfigurationControllerBroadcaster
;
73 class ConfigurationUpdater
;
74 class ConfigurationUpdaterLock
;
76 /** The configuration controller is responsible for maintaining the current
79 @see css::drawing::framework::XConfigurationController
80 for an extended documentation.
82 class ConfigurationController
83 : private sd::MutexOwner
,
84 private boost::noncopyable
,
85 public ConfigurationControllerInterfaceBase
88 ConfigurationController (void) throw();
89 virtual ~ConfigurationController (void) throw();
91 virtual void SAL_CALL
disposing (void);
93 void ProcessEvent (void);
95 /** Normally the requested changes of the configuration are executed
96 asynchronously. However, there is at least one situation (searching
97 with the Outliner) where the surrounding code does not cope with
98 this. So, instead of calling Reschedule until the global event loop
99 executes the configuration update, this method does (almost) the
100 same without the reschedules.
102 Do not use this method until there is absolutely no other way.
104 void RequestSynchronousUpdate (void);
106 // XConfigurationController
108 virtual void SAL_CALL
lock (void)
109 throw (css::uno::RuntimeException
);
111 virtual void SAL_CALL
unlock (void)
112 throw (css::uno::RuntimeException
);
114 virtual void SAL_CALL
requestResourceActivation (
115 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxResourceId
,
116 css::drawing::framework::ResourceActivationMode eMode
)
117 throw (css::uno::RuntimeException
);
119 virtual void SAL_CALL
requestResourceDeactivation (
120 const css::uno::Reference
<css::drawing::framework::XResourceId
>&
122 throw (css::uno::RuntimeException
);
124 virtual css::uno::Reference
<css::drawing::framework::XResource
>
125 SAL_CALL
getResource (
126 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxResourceId
)
127 throw (css::uno::RuntimeException
);
129 virtual void SAL_CALL
update (void)
130 throw (css::uno::RuntimeException
);
132 virtual css::uno::Reference
<
133 css::drawing::framework::XConfiguration
>
134 SAL_CALL
getRequestedConfiguration (void)
135 throw (css::uno::RuntimeException
);
137 virtual css::uno::Reference
<
138 css::drawing::framework::XConfiguration
>
139 SAL_CALL
getCurrentConfiguration (void)
140 throw (css::uno::RuntimeException
);
142 virtual void SAL_CALL
restoreConfiguration (
143 const css::uno::Reference
<css::drawing::framework::XConfiguration
>&
145 throw (css::uno::RuntimeException
);
148 // XConfigurationControllerBroadcaster
150 virtual void SAL_CALL
addConfigurationChangeListener (
151 const css::uno::Reference
<
152 css::drawing::framework::XConfigurationChangeListener
>& rxListener
,
153 const ::rtl::OUString
& rsEventType
,
154 const css::uno::Any
& rUserData
)
155 throw (css::uno::RuntimeException
);
157 virtual void SAL_CALL
removeConfigurationChangeListener (
158 const css::uno::Reference
<
159 css::drawing::framework::XConfigurationChangeListener
>& rxListener
)
160 throw (css::uno::RuntimeException
);
162 virtual void SAL_CALL
notifyEvent (
163 const css::drawing::framework::ConfigurationChangeEvent
& rEvent
)
164 throw (css::uno::RuntimeException
);
167 // XConfigurationRequestQueue
169 virtual sal_Bool SAL_CALL
hasPendingRequests (void)
170 throw (css::uno::RuntimeException
);
172 virtual void SAL_CALL
postChangeRequest (
173 const css::uno::Reference
<
174 css::drawing::framework::XConfigurationChangeRequest
>& rxRequest
)
175 throw (css::uno::RuntimeException
);
178 // XResourceFactoryManager
180 virtual void SAL_CALL
addResourceFactory(
181 const ::rtl::OUString
& sResourceURL
,
182 const css::uno::Reference
<css::drawing::framework::XResourceFactory
>& rxResourceFactory
)
183 throw (css::uno::RuntimeException
);
185 virtual void SAL_CALL
removeResourceFactoryForURL(
186 const ::rtl::OUString
& sResourceURL
)
187 throw (css::uno::RuntimeException
);
189 virtual void SAL_CALL
removeResourceFactoryForReference(
190 const css::uno::Reference
<css::drawing::framework::XResourceFactory
>& rxResourceFactory
)
191 throw (css::uno::RuntimeException
);
193 virtual css::uno::Reference
<css::drawing::framework::XResourceFactory
>
194 SAL_CALL
getResourceFactory (
195 const ::rtl::OUString
& sResourceURL
)
196 throw (css::uno::RuntimeException
);
201 virtual void SAL_CALL
initialize(
202 const css::uno::Sequence
<css::uno::Any
>& rArguments
)
203 throw (css::uno::Exception
, css::uno::RuntimeException
);
206 /** Use this class instead of calling lock() and unlock() directly in
207 order to be exception safe.
212 Lock (const css::uno::Reference
<
213 css::drawing::framework::XConfigurationController
>& rxController
);
217 css::drawing::framework::XConfigurationController
> mxController
;
221 class Implementation
;
222 ::boost::scoped_ptr
<Implementation
> mpImplementation
;
225 /** When the called object has already been disposed this method throws
226 an exception and does not return.
228 void ThrowIfDisposed (void) const
229 throw (css::lang::DisposedException
);
232 } } // end of namespace sd::framework