33#include <com/sun/star/drawing/framework/XControllerManager.hpp>
34#include <com/sun/star/frame/XController.hpp>
37#include <osl/mutex.hxx>
44using ::sd::framework::FrameworkHelper;
89 : mxController(rxController)
99 if (mxController.is())
100 mxController->unlock();
125 SAL_INFO(
"sd.fwk", __func__ <<
": ConfigurationController::disposing");
126 SAL_INFO(
"sd.fwk", __func__ <<
": requesting empty configuration");
132 SAL_INFO(
"sd.fwk", __func__ <<
": all requests processed");
174 const Reference<XConfigurationChangeListener>& rxListener,
175 const OUString& rsEventType,
176 const Any& rUserData)
178 ::osl::MutexGuard aGuard (
m_aMutex);
182 mpImplementation->mpBroadcaster->AddListener(rxListener, rsEventType, rUserData);
186 const Reference<XConfigurationChangeListener>& rxListener)
188 ::osl::MutexGuard aGuard (
m_aMutex);
195 const ConfigurationChangeEvent& rEvent)
208 ::osl::MutexGuard aGuard (
m_aMutex);
219 ::osl::MutexGuard aGuard (
m_aMutex);
223 if (rBHelper.bDisposed)
233 const Reference<XResourceId>& rxResourceId,
234 ResourceActivationMode eMode)
236 ::osl::MutexGuard aGuard (
m_aMutex);
244 if (rBHelper.bInDispose)
246 SAL_INFO(
"sd.fwk", __func__ <<
": ConfigurationController::requestResourceActivation(): ignoring " <<
251 SAL_INFO(
"sd.fwk", __func__ <<
": ConfigurationController::requestResourceActivation() " <<
254 if (!rxResourceId.is())
257 if (
eMode == ResourceActivationMode_REPLACE)
261 const Sequence<Reference<XResourceId> > aResourceList (
263 rxResourceId->getAnchor(),
264 rxResourceId->getResourceTypePrefix(),
265 AnchorBindingMode_DIRECT));
267 for (
const auto& rResource : aResourceList)
272 if (rxResourceId->compareTo(rResource) == 0)
281 Reference<XConfigurationChangeRequest> xRequest(
289 const Reference<XResourceId>& rxResourceId)
291 ::osl::MutexGuard aGuard (
m_aMutex);
294 SAL_INFO(
"sd.fwk", __func__ <<
": ConfigurationController::requestResourceDeactivation() " <<
297 if (!rxResourceId.is())
302 const Sequence<Reference<XResourceId> > aLinkedResources (
306 AnchorBindingMode_DIRECT));
307 for (
const auto& rLinkedResource : aLinkedResources)
316 Reference<XConfigurationChangeRequest> xRequest(
324 const Reference<XResourceId>& rxResourceId)
326 ::osl::MutexGuard aGuard (
m_aMutex);
336 ::osl::MutexGuard aGuard (
m_aMutex);
354 ::osl::MutexGuard aGuard (
m_aMutex);
361 const Reference<XConfigurationChangeRequest>& rxRequest)
363 ::osl::MutexGuard aGuard (
m_aMutex);
371 ::osl::MutexGuard aGuard (
m_aMutex);
375 return Reference<XConfiguration>(
378 return Reference<XConfiguration>();
383 ::osl::MutexGuard aGuard (
m_aMutex);
386 Reference<XConfiguration> xCurrentConfiguration(
388 if (xCurrentConfiguration.is())
389 return Reference<XConfiguration>(xCurrentConfiguration->createClone(), UNO_QUERY);
391 return Reference<XConfiguration>();
398 const Reference<XConfiguration>& rxNewConfiguration)
400 ::osl::MutexGuard aGuard (
m_aMutex);
406 std::shared_ptr<ConfigurationUpdaterLock> pLock (
410 Reference<XConfiguration> xCurrentConfiguration (
mpImplementation->mxRequestedConfiguration);
411#if OSL_DEBUG_LEVEL >=1
412 SAL_INFO(
"sd.fwk", __func__ <<
": ConfigurationController::restoreConfiguration(");
418#if DEBUG_SD_CONFIGURATION_TRACE
419 aClassifier.TraceResourceIdVector(
420 "requested but not current resources:\n", aClassifier.
GetC1minusC2());
421 aClassifier.TraceResourceIdVector(
422 "current but not requested resources:\n", aClassifier.
GetC2minusC1());
423 aClassifier.TraceResourceIdVector(
424 "requested and current resources:\n", aClassifier.GetC1andC2());
431 for (
const auto& rxResource : rResourcesToDeactivate)
440 for (
const auto& rxResource : rResourcesToActivate)
451 const OUString& sResourceURL,
452 const Reference<XResourceFactory>& rxResourceFactory)
454 ::osl::MutexGuard aGuard (
m_aMutex);
456 mpImplementation->mpResourceFactoryContainer->AddFactory(sResourceURL, rxResourceFactory);
460 const OUString& sResourceURL)
462 ::osl::MutexGuard aGuard (
m_aMutex);
464 mpImplementation->mpResourceFactoryContainer->RemoveFactoryForURL(sResourceURL);
468 const Reference<XResourceFactory>& rxResourceFactory)
470 ::osl::MutexGuard aGuard (
m_aMutex);
472 mpImplementation->mpResourceFactoryContainer->RemoveFactoryForReference(rxResourceFactory);
476 const OUString& sResourceURL)
478 ::osl::MutexGuard aGuard (
m_aMutex);
481 return mpImplementation->mpResourceFactoryContainer->GetFactory(sResourceURL);
488 throw lang::DisposedException (
"ConfigurationController object has already been disposed",
489 const_cast<uno::XWeak*
>(
static_cast<const uno::XWeak*
>(
this)));
496 const_cast<uno::XWeak*
>(
static_cast<const uno::XWeak*
>(
this)));
505 : mxControllerManager(rxController, UNO_QUERY_THROW),
507 mxRequestedConfiguration(new
Configuration(&rController, true)),
511 mpConfigurationUpdater(
mutable::osl::Mutex m_aMutex
The ChangeRequestQueueProcessor owns the ChangeRequestQueue and processes the configuration change re...
A ConfigurationClassifier object compares two configurations of resources and gives access to the dif...
const ResourceIdVector & GetC2minusC1() const
Return the resources that belong to the configuration given as rxConfiguration2 to the constructor bu...
const ResourceIdVector & GetC1minusC2() const
Return the resources that belong to the configuration given as rxConfiguration1 to the constructor bu...
bool Partition()
Calculate three lists of resource ids.
::std::vector< css::uno::Reference< css::drawing::framework::XResourceId > > ResourceIdVector
This class manages the set of XConfigurationChangeListeners and calls them when the ConfigurationCont...
For every active resource both the resource itself as well as its creating factory are remembered,...
css::uno::Reference< css::drawing::framework::XResource > mxResource
Manage the set of active resources.
std::shared_ptr< ConfigurationControllerResourceManager > mpResourceManager
std::shared_ptr< ConfigurationUpdater > mpConfigurationUpdater
rtl::Reference<::sd::DrawController > mxControllerManager
css::uno::Reference< css::drawing::framework::XConfiguration > mxRequestedConfiguration
The requested configuration which is modified (asynchronously) by calls to requestResourceActivation(...
std::shared_ptr< ConfigurationControllerBroadcaster > mpBroadcaster
The Broadcaster class implements storing and calling of listeners.
std::shared_ptr< ConfigurationUpdaterLock > mpConfigurationUpdaterLock
std::unique_ptr< ChangeRequestQueueProcessor > mpQueueProcessor
The queue processor owns the queue of configuration change request objects and processes the objects.
Implementation(ConfigurationController &rController, const rtl::Reference<::sd::DrawController > &rxController)
std::shared_ptr< ResourceFactoryManager > mpResourceFactoryContainer
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 update() override
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 void SAL_CALL lock() override
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
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
virtual void SAL_CALL unlock() override
virtual void SAL_CALL requestResourceActivation(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId, css::drawing::framework::ResourceActivationMode eMode) override
static void TraceConfiguration(const css::uno::Reference< css::drawing::framework::XConfiguration > &rxConfiguration, const char *pMessage)
This is a helper class for the ConfigurationController.
A configuration describes the resources of an application like panes, views, and tool bars and their ...
static OUString ResourceIdToString(const css::uno::Reference< css::drawing::framework::XResourceId > &rxResourceId)
Return a string representation of the given XResourceId object.
This implementation of the XConfigurationChangeRequest interface represents a single explicit request...
Container of resource factories of the drawing framework.
This update request is used to request configuration updates asynchronous when no other requests are ...
#define SAL_INFO(area, stream)
std::shared_ptr< T > make_shared(Args &&... args)
::cppu::WeakComponentImplHelper< css::drawing::framework::XConfigurationController > ConfigurationControllerInterfaceBase