LCOV - code coverage report
Current view: top level - sd/source/ui/framework/configuration - ConfigurationController.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 171 204 83.8 %
Date: 2014-11-03 Functions: 30 35 85.7 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "framework/ConfigurationController.hxx"
      21             : #include "framework/Configuration.hxx"
      22             : #include "framework/FrameworkHelper.hxx"
      23             : #include "ConfigurationUpdater.hxx"
      24             : #include "ConfigurationControllerBroadcaster.hxx"
      25             : #include "ConfigurationTracer.hxx"
      26             : #include "GenericConfigurationChangeRequest.hxx"
      27             : #include "ResourceFactoryManager.hxx"
      28             : #include "UpdateRequest.hxx"
      29             : #include "ChangeRequestQueueProcessor.hxx"
      30             : #include "ConfigurationClassifier.hxx"
      31             : #include "ViewShellBase.hxx"
      32             : #include "DrawController.hxx"
      33             : #include "facreg.hxx"
      34             : #include <com/sun/star/drawing/framework/XControllerManager.hpp>
      35             : #include <com/sun/star/util/XURLTransformer.hpp>
      36             : 
      37             : #include <osl/mutex.hxx>
      38             : #include <vcl/svapp.hxx>
      39             : 
      40             : using namespace ::com::sun::star;
      41             : using namespace ::com::sun::star::uno;
      42             : using namespace ::com::sun::star::drawing::framework;
      43             : using ::sd::framework::FrameworkHelper;
      44             : 
      45             : namespace sd { namespace framework {
      46             : 
      47         212 : Reference<XInterface> SAL_CALL ConfigurationController_createInstance (
      48             :     const Reference<XComponentContext>& rxContext) throw (css::uno::Exception)
      49             : {
      50             :     (void)rxContext;
      51         212 :     return static_cast<XWeak*>(new ConfigurationController());
      52             : }
      53             : 
      54          56 : OUString ConfigurationController_getImplementationName (void) throw(RuntimeException)
      55             : {
      56          56 :     return OUString("com.sun.star.comp.Draw.framework.configuration.ConfigurationController");
      57             : }
      58             : 
      59          22 : Sequence<OUString> SAL_CALL ConfigurationController_getSupportedServiceNames (void)
      60             :     throw (RuntimeException)
      61             : {
      62          22 :     static const OUString sServiceName("com.sun.star.drawing.framework.ConfigurationController");
      63          22 :     return Sequence<OUString>(&sServiceName, 1);
      64             : }
      65             : 
      66             : //----- ConfigurationController::Implementation -------------------------------
      67             : 
      68             : class ConfigurationController::Implementation
      69             : {
      70             : public:
      71             :     Implementation (
      72             :         ConfigurationController& rController,
      73             :         const Reference<frame::XController>& rxController);
      74             :     ~Implementation (void);
      75             : 
      76             :     Reference<XControllerManager> mxControllerManager;
      77             : 
      78             :     /** The Broadcaster class implements storing and calling of listeners.
      79             :     */
      80             :     ::boost::shared_ptr<ConfigurationControllerBroadcaster> mpBroadcaster;
      81             : 
      82             :     /** The requested configuration which is modified (asynchronously) by
      83             :         calls to requestResourceActivation() and
      84             :         requestResourceDeactivation().  The mpConfigurationUpdater makes the
      85             :         current configuration reflect the content of this one.
      86             :     */
      87             :     ::com::sun::star::uno::Reference<
      88             :         ::com::sun::star::drawing::framework::XConfiguration> mxRequestedConfiguration;
      89             : 
      90             :     ViewShellBase* mpBase;
      91             : 
      92             :     ::boost::shared_ptr<ResourceFactoryManager> mpResourceFactoryContainer;
      93             : 
      94             :     ::boost::shared_ptr<ConfigurationControllerResourceManager> mpResourceManager;
      95             : 
      96             :     ::boost::shared_ptr<ConfigurationUpdater> mpConfigurationUpdater;
      97             : 
      98             :     /** The queue processor ownes the queue of configuration change request
      99             :         objects and processes the objects.
     100             :     */
     101             :     ::boost::scoped_ptr<ChangeRequestQueueProcessor> mpQueueProcessor;
     102             : 
     103             :     ::boost::shared_ptr<ConfigurationUpdaterLock> mpConfigurationUpdaterLock;
     104             : 
     105             :     sal_Int32 mnLockCount;
     106             : };
     107             : 
     108             : //===== ConfigurationController::Lock =========================================
     109             : 
     110         264 : ConfigurationController::Lock::Lock (const Reference<XConfigurationController>& rxController)
     111         264 :     : mxController(rxController)
     112             : {
     113             :     OSL_ASSERT(mxController.is());
     114             : 
     115         264 :     if (mxController.is())
     116         264 :         mxController->lock();
     117         264 : }
     118             : 
     119         528 : ConfigurationController::Lock::~Lock (void)
     120             : {
     121         264 :     if (mxController.is())
     122         264 :         mxController->unlock();
     123         264 : }
     124             : 
     125             : //===== ConfigurationController ===============================================
     126             : 
     127         212 : ConfigurationController::ConfigurationController (void) throw()
     128             :     : ConfigurationControllerInterfaceBase(MutexOwner::maMutex)
     129             :     , mpImplementation()
     130         212 :     , mbIsDisposed(false)
     131             : {
     132         212 : }
     133             : 
     134         284 : ConfigurationController::~ConfigurationController (void) throw()
     135             : {
     136         284 : }
     137             : 
     138         212 : void SAL_CALL ConfigurationController::disposing (void)
     139             : {
     140         212 :     if (mpImplementation.get() == NULL)
     141         212 :         return;
     142             : 
     143             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::disposing");
     144             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ":     requesting empty configuration");
     145             :     // To destroy all resources an empty configuration is requested and then,
     146             :     // synchronously, all resulting requests are processed.
     147         212 :     mpImplementation->mpQueueProcessor->Clear();
     148         212 :     restoreConfiguration(new Configuration(this,false));
     149         212 :     mpImplementation->mpQueueProcessor->ProcessUntilEmpty();
     150             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ":     all requests processed");
     151             : 
     152             :     // Now that all resources have been deactivated, mark the controller as
     153             :     // disposed.
     154         212 :     mbIsDisposed = true;
     155             : 
     156             :     // Release the listeners.
     157         212 :     lang::EventObject aEvent;
     158         212 :     aEvent.Source = uno::Reference<uno::XInterface>((cppu::OWeakObject*)this);
     159             : 
     160             :     {
     161         212 :         const SolarMutexGuard aSolarGuard;
     162         212 :         mpImplementation->mpBroadcaster->DisposeAndClear();
     163             :     }
     164             : 
     165         212 :     mpImplementation->mpQueueProcessor.reset();
     166         212 :     mpImplementation->mxRequestedConfiguration = NULL;
     167         212 :     mpImplementation.reset();
     168             : }
     169             : 
     170        1004 : void ConfigurationController::ProcessEvent (void)
     171             : {
     172        1004 :     if (mpImplementation.get() != NULL)
     173             :     {
     174             :         OSL_ASSERT(mpImplementation->mpQueueProcessor.get()!=NULL);
     175             : 
     176        1004 :         mpImplementation->mpQueueProcessor->ProcessOneEvent();
     177             :     }
     178        1004 : }
     179             : 
     180           0 : void ConfigurationController::RequestSynchronousUpdate (void)
     181             : {
     182           0 :     if (mpImplementation.get() == NULL)
     183           0 :         return;
     184           0 :     if (mpImplementation->mpQueueProcessor.get() == 0)
     185           0 :         return;
     186           0 :     mpImplementation->mpQueueProcessor->ProcessUntilEmpty();
     187             : }
     188             : 
     189             : //----- XConfigurationControllerBroadcaster -----------------------------------
     190             : 
     191        3384 : void SAL_CALL ConfigurationController::addConfigurationChangeListener (
     192             :     const Reference<XConfigurationChangeListener>& rxListener,
     193             :     const OUString& rsEventType,
     194             :     const Any& rUserData)
     195             :     throw (RuntimeException, std::exception)
     196             : {
     197        3384 :     ::osl::MutexGuard aGuard (maMutex);
     198             : 
     199        3384 :     ThrowIfDisposed();
     200             :     OSL_ASSERT(mpImplementation.get()!=NULL);
     201        3384 :     mpImplementation->mpBroadcaster->AddListener(rxListener, rsEventType, rUserData);
     202        3384 : }
     203             : 
     204          52 : void SAL_CALL ConfigurationController::removeConfigurationChangeListener (
     205             :     const Reference<XConfigurationChangeListener>& rxListener)
     206             :     throw (RuntimeException, std::exception)
     207             : {
     208          52 :     ::osl::MutexGuard aGuard (maMutex);
     209             : 
     210          52 :     ThrowIfDisposed();
     211          52 :     mpImplementation->mpBroadcaster->RemoveListener(rxListener);
     212          52 : }
     213             : 
     214        2008 : void SAL_CALL ConfigurationController::notifyEvent (
     215             :     const ConfigurationChangeEvent& rEvent)
     216             :     throw (RuntimeException, std::exception)
     217             : {
     218        2008 :     ThrowIfDisposed();
     219        2008 :     mpImplementation->mpBroadcaster->NotifyListeners(rEvent);
     220        2008 : }
     221             : 
     222             : //----- XConfigurationController ----------------------------------------------
     223             : 
     224         264 : void SAL_CALL ConfigurationController::lock()
     225             :     throw (RuntimeException, std::exception)
     226             : {
     227             :     OSL_ASSERT(mpImplementation.get()!=NULL);
     228             :     OSL_ASSERT(mpImplementation->mpConfigurationUpdater.get()!=NULL);
     229             : 
     230         264 :     ::osl::MutexGuard aGuard (maMutex);
     231         264 :     ThrowIfDisposed();
     232             : 
     233         264 :     ++mpImplementation->mnLockCount;
     234         264 :     if (mpImplementation->mpConfigurationUpdaterLock.get()==NULL)
     235         264 :         mpImplementation->mpConfigurationUpdaterLock
     236         528 :             = mpImplementation->mpConfigurationUpdater->GetLock();
     237         264 : }
     238             : 
     239         264 : void SAL_CALL ConfigurationController::unlock (void)
     240             :     throw (RuntimeException, std::exception)
     241             : {
     242         264 :     ::osl::MutexGuard aGuard (maMutex);
     243             : 
     244             :     // Allow unlocking while the ConfigurationController is being disposed
     245             :     // (but not when that is done and the controller is disposed.)
     246         264 :     if (rBHelper.bDisposed)
     247           0 :         ThrowIfDisposed();
     248             : 
     249             :     OSL_ASSERT(mpImplementation->mnLockCount>0);
     250         264 :     --mpImplementation->mnLockCount;
     251         264 :     if (mpImplementation->mnLockCount == 0)
     252         264 :         mpImplementation->mpConfigurationUpdaterLock.reset();
     253         264 : }
     254             : 
     255        1108 : void SAL_CALL ConfigurationController::requestResourceActivation (
     256             :     const Reference<XResourceId>& rxResourceId,
     257             :     ResourceActivationMode eMode)
     258             :     throw (RuntimeException, std::exception)
     259             : {
     260        1108 :     ::osl::MutexGuard aGuard (maMutex);
     261        1108 :        ThrowIfDisposed();
     262             : 
     263             :     // Check whether we are being disposed.  This is handled differently
     264             :     // then being completely disposed because the first thing disposing()
     265             :     // does is to deactivate all remaining resources.  This is done via
     266             :     // regular methods which must not throw DisposedExceptions.  Therefore
     267             :     // we just return silently during that stage.
     268        1108 :     if (rBHelper.bInDispose)
     269             :     {
     270             :         SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::requestResourceActivation(): ignoring " <<
     271             :             OUStringToOString(
     272             :                 FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
     273        1108 :         return;
     274             :     }
     275             : 
     276             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::requestResourceActivation() " <<
     277             :         OUStringToOString(
     278             :             FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
     279             : 
     280        1108 :     if (rxResourceId.is())
     281             :     {
     282        1108 :         if (eMode == ResourceActivationMode_REPLACE)
     283             :         {
     284             :             // Get a list of the matching resources and create deactivation
     285             :             // requests for them.
     286             :             Sequence<Reference<XResourceId> > aResourceList (
     287         528 :                 mpImplementation->mxRequestedConfiguration->getResources(
     288         528 :                     rxResourceId->getAnchor(),
     289         528 :                     rxResourceId->getResourceTypePrefix(),
     290        1584 :                     AnchorBindingMode_DIRECT));
     291             : 
     292         580 :             for (sal_Int32 nIndex=0; nIndex<aResourceList.getLength(); ++nIndex)
     293             :             {
     294             :                 // Do not request the deactivation of the resource for which
     295             :                 // this method was called.  Doing it would not change the
     296             :                 // outcome but would result in unnecessary work.
     297          52 :                 if (rxResourceId->compareTo(aResourceList[nIndex]) == 0)
     298          52 :                     continue;
     299             : 
     300             :                 // Request the deactivation of a resource and all resources
     301             :                 // linked to it.
     302           0 :                 requestResourceDeactivation(aResourceList[nIndex]);
     303         528 :             }
     304             :         }
     305             : 
     306             :         Reference<XConfigurationChangeRequest> xRequest(
     307             :             new GenericConfigurationChangeRequest(
     308             :                 rxResourceId,
     309        1108 :                 GenericConfigurationChangeRequest::Activation));
     310        1108 :         postChangeRequest(xRequest);
     311        1108 :     }
     312             : }
     313             : 
     314        1584 : void SAL_CALL ConfigurationController::requestResourceDeactivation (
     315             :     const Reference<XResourceId>& rxResourceId)
     316             :     throw (RuntimeException, std::exception)
     317             : {
     318        1584 :     ::osl::MutexGuard aGuard (maMutex);
     319        1584 :     ThrowIfDisposed();
     320             : 
     321             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::requestResourceDeactivation() " <<
     322             :             OUStringToOString(
     323             :                 FrameworkHelper::ResourceIdToString(rxResourceId), RTL_TEXTENCODING_UTF8).getStr());
     324             : 
     325        1584 :     if (rxResourceId.is())
     326             :     {
     327             :         // Request deactivation of all resources linked to the specified one
     328             :         // as well.
     329             :         const Sequence<Reference<XResourceId> > aLinkedResources (
     330        1584 :             mpImplementation->mxRequestedConfiguration->getResources(
     331             :                 rxResourceId,
     332             :                 OUString(),
     333        1584 :                 AnchorBindingMode_DIRECT));
     334        1584 :         const sal_Int32 nCount (aLinkedResources.getLength());
     335        2112 :         for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
     336             :         {
     337             :             // We do not add deactivation requests directly but call this
     338             :             // method recursively, so that when one time there are resources
     339             :             // linked to linked resources, these are handled correctly, too.
     340         528 :             requestResourceDeactivation(aLinkedResources[nIndex]);
     341             :         }
     342             : 
     343             :         // Add a deactivation request for the specified resource.
     344             :         Reference<XConfigurationChangeRequest> xRequest(
     345             :             new GenericConfigurationChangeRequest(
     346             :                 rxResourceId,
     347        3168 :                 GenericConfigurationChangeRequest::Deactivation));
     348        3168 :         postChangeRequest(xRequest);
     349        1584 :     }
     350        1584 : }
     351             : 
     352       11966 : Reference<XResource> SAL_CALL ConfigurationController::getResource (
     353             :     const Reference<XResourceId>& rxResourceId)
     354             :     throw (RuntimeException, std::exception)
     355             : {
     356       11966 :     ::osl::MutexGuard aGuard (maMutex);
     357       11966 :     ThrowIfDisposed();
     358             : 
     359             :     ConfigurationControllerResourceManager::ResourceDescriptor aDescriptor (
     360       23932 :         mpImplementation->mpResourceManager->GetResource(rxResourceId));
     361       23932 :     return aDescriptor.mxResource;
     362             : }
     363             : 
     364         464 : void SAL_CALL ConfigurationController::update (void)
     365             :     throw (RuntimeException, std::exception)
     366             : {
     367         464 :     ::osl::MutexGuard aGuard (maMutex);
     368         464 :     ThrowIfDisposed();
     369             : 
     370         464 :     if (mpImplementation->mpQueueProcessor->IsEmpty())
     371             :     {
     372             :         // The queue is empty.  Add another request that does nothing but
     373             :         // asynchronously trigger a request for an update.
     374         358 :         mpImplementation->mpQueueProcessor->AddRequest(new UpdateRequest());
     375             :     }
     376             :     else
     377             :     {
     378             :         // The queue is not empty, so we rely on the queue processor to
     379             :         // request an update automatically when the queue becomes empty.
     380         464 :     }
     381         464 : }
     382             : 
     383        1004 : sal_Bool SAL_CALL ConfigurationController::hasPendingRequests (void)
     384             :     throw (RuntimeException, std::exception)
     385             : {
     386        1004 :     ::osl::MutexGuard aGuard (maMutex);
     387        1004 :     ThrowIfDisposed();
     388             : 
     389        1004 :     return ! mpImplementation->mpQueueProcessor->IsEmpty();
     390             : }
     391             : 
     392        2692 : void SAL_CALL ConfigurationController::postChangeRequest (
     393             :     const Reference<XConfigurationChangeRequest>& rxRequest)
     394             :     throw (RuntimeException, std::exception)
     395             : {
     396        2692 :     ::osl::MutexGuard aGuard (maMutex);
     397        2692 :     ThrowIfDisposed();
     398             : 
     399        2692 :     mpImplementation->mpQueueProcessor->AddRequest(rxRequest);
     400        2692 : }
     401             : 
     402       10234 : Reference<XConfiguration> SAL_CALL ConfigurationController::getRequestedConfiguration (void)
     403             :     throw (RuntimeException, std::exception)
     404             : {
     405       10234 :     ::osl::MutexGuard aGuard (maMutex);
     406       10234 :     ThrowIfDisposed();
     407             : 
     408       10234 :     if (mpImplementation->mxRequestedConfiguration.is())
     409             :         return Reference<XConfiguration>(
     410       10234 :             mpImplementation->mxRequestedConfiguration->createClone(), UNO_QUERY);
     411             :     else
     412           0 :         return Reference<XConfiguration>();
     413             : }
     414             : 
     415           0 : Reference<XConfiguration> SAL_CALL ConfigurationController::getCurrentConfiguration (void)
     416             :     throw (RuntimeException, std::exception)
     417             : {
     418           0 :     ::osl::MutexGuard aGuard (maMutex);
     419           0 :     ThrowIfDisposed();
     420             : 
     421             :     Reference<XConfiguration> xCurrentConfiguration(
     422           0 :         mpImplementation->mpConfigurationUpdater->GetCurrentConfiguration());
     423           0 :     if (xCurrentConfiguration.is())
     424           0 :         return Reference<XConfiguration>(xCurrentConfiguration->createClone(), UNO_QUERY);
     425             :     else
     426           0 :         return Reference<XConfiguration>();
     427             : }
     428             : 
     429             : /** The given configuration is restored by generating the appropriate set of
     430             :     activation and deactivation requests.
     431             : */
     432         212 : void SAL_CALL ConfigurationController::restoreConfiguration (
     433             :     const Reference<XConfiguration>& rxNewConfiguration)
     434             :     throw (RuntimeException, std::exception)
     435             : {
     436         212 :     ::osl::MutexGuard aGuard (maMutex);
     437         212 :     ThrowIfDisposed();
     438             : 
     439             :     // We will probably be making a couple of activation and deactivation
     440             :     // requests so lock the configuration controller and let it later update
     441             :     // all changes at once.
     442             :     ::boost::shared_ptr<ConfigurationUpdaterLock> pLock (
     443         424 :         mpImplementation->mpConfigurationUpdater->GetLock());
     444             : 
     445             :     // Get lists of resources that are to be activated or deactivated.
     446         424 :     Reference<XConfiguration> xCurrentConfiguration (mpImplementation->mxRequestedConfiguration);
     447             : #if OSL_DEBUG_LEVEL >=1
     448             :     SAL_INFO("sd.fwk", OSL_THIS_FUNC << ": ConfigurationController::restoreConfiguration(");
     449             :     ConfigurationTracer::TraceConfiguration(rxNewConfiguration, "requested configuration");
     450             :     ConfigurationTracer::TraceConfiguration(xCurrentConfiguration, "current configuration");
     451             : #endif
     452         424 :     ConfigurationClassifier aClassifier (rxNewConfiguration, xCurrentConfiguration);
     453         212 :     aClassifier.Partition();
     454             : #if OSL_DEBUG_LEVEL >=2
     455             :     aClassifier.TraceResourceIdVector(
     456             :         "requested but not current resources:\n", aClassifier.GetC1minusC2());
     457             :     aClassifier.TraceResourceIdVector(
     458             :         "current but not requested resources:\n", aClassifier.GetC2minusC1());
     459             :     aClassifier.TraceResourceIdVector(
     460             :         "requested and current resources:\n", aClassifier.GetC1andC2());
     461             : #endif
     462             : 
     463         212 :     ConfigurationClassifier::ResourceIdVector::const_iterator iResource;
     464             : 
     465             :     // Request the deactivation of resources that are not requested in the
     466             :     // new configuration.
     467             :     const ConfigurationClassifier::ResourceIdVector& rResourcesToDeactivate (
     468         212 :         aClassifier.GetC2minusC1());
     469        3648 :     for (iResource=rResourcesToDeactivate.begin();
     470        2432 :          iResource!=rResourcesToDeactivate.end();
     471             :          ++iResource)
     472             :     {
     473        1004 :         requestResourceDeactivation(*iResource);
     474             :     }
     475             : 
     476             :     // Request the activation of resources that are requested in the
     477             :     // new configuration but are not part of the current configuration.
     478             :     const ConfigurationClassifier::ResourceIdVector& rResourcesToActivate (
     479         212 :         aClassifier.GetC1minusC2());
     480         636 :     for (iResource=rResourcesToActivate.begin();
     481         424 :          iResource!=rResourcesToActivate.end();
     482             :          ++iResource)
     483             :     {
     484           0 :         requestResourceActivation(*iResource, ResourceActivationMode_ADD);
     485             :     }
     486             : 
     487         424 :     pLock.reset();
     488         212 : }
     489             : 
     490             : //----- XResourceFactoryManager -----------------------------------------------
     491             : 
     492        2596 : void SAL_CALL ConfigurationController::addResourceFactory(
     493             :     const OUString& sResourceURL,
     494             :     const Reference<XResourceFactory>& rxResourceFactory)
     495             :     throw (RuntimeException, std::exception)
     496             : {
     497        2596 :     ::osl::MutexGuard aGuard (maMutex);
     498        2596 :     ThrowIfDisposed();
     499        2596 :     mpImplementation->mpResourceFactoryContainer->AddFactory(sResourceURL, rxResourceFactory);
     500        2596 : }
     501             : 
     502           0 : void SAL_CALL ConfigurationController::removeResourceFactoryForURL(
     503             :     const OUString& sResourceURL)
     504             :     throw (RuntimeException, std::exception)
     505             : {
     506           0 :     ::osl::MutexGuard aGuard (maMutex);
     507           0 :     ThrowIfDisposed();
     508           0 :     mpImplementation->mpResourceFactoryContainer->RemoveFactoryForURL(sResourceURL);
     509           0 : }
     510             : 
     511           0 : void SAL_CALL ConfigurationController::removeResourceFactoryForReference(
     512             :     const Reference<XResourceFactory>& rxResourceFactory)
     513             :     throw (RuntimeException, std::exception)
     514             : {
     515           0 :     ::osl::MutexGuard aGuard (maMutex);
     516           0 :     ThrowIfDisposed();
     517           0 :     mpImplementation->mpResourceFactoryContainer->RemoveFactoryForReference(rxResourceFactory);
     518           0 : }
     519             : 
     520           0 : Reference<XResourceFactory> SAL_CALL ConfigurationController::getResourceFactory (
     521             :     const OUString& sResourceURL)
     522             :     throw (RuntimeException, std::exception)
     523             : {
     524           0 :     ::osl::MutexGuard aGuard (maMutex);
     525           0 :     ThrowIfDisposed();
     526             : 
     527           0 :     return mpImplementation->mpResourceFactoryContainer->GetFactory(sResourceURL);
     528             : }
     529             : 
     530             : //----- XInitialization -------------------------------------------------------
     531             : 
     532         212 : void SAL_CALL ConfigurationController::initialize (const Sequence<Any>& aArguments)
     533             :     throw (Exception, RuntimeException, std::exception)
     534             : {
     535         212 :     ::osl::MutexGuard aGuard (maMutex);
     536             : 
     537         212 :     if (aArguments.getLength() == 1)
     538             :     {
     539         212 :         const SolarMutexGuard aSolarGuard;
     540             : 
     541             :         mpImplementation.reset(new Implementation(
     542             :             *this,
     543         212 :             Reference<frame::XController>(aArguments[0], UNO_QUERY_THROW)));
     544         212 :     }
     545         212 : }
     546             : 
     547       37568 : void ConfigurationController::ThrowIfDisposed () const
     548             :     throw (css::lang::DisposedException, css::uno::RuntimeException)
     549             : {
     550       37568 :     if (mbIsDisposed)
     551             :     {
     552             :         throw lang::DisposedException ("ConfigurationController object has already been disposed",
     553           0 :             const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
     554             :     }
     555             : 
     556       37568 :     if (mpImplementation.get() == NULL)
     557             :     {
     558             :         OSL_ASSERT(mpImplementation.get() != NULL);
     559             :         throw RuntimeException("ConfigurationController not initialized",
     560           0 :             const_cast<uno::XWeak*>(static_cast<const uno::XWeak*>(this)));
     561             :     }
     562       37568 : }
     563             : 
     564             : //===== ConfigurationController::Implementation ===============================
     565             : 
     566         212 : ConfigurationController::Implementation::Implementation (
     567             :     ConfigurationController& rController,
     568             :     const Reference<frame::XController>& rxController)
     569             :     : mxControllerManager(rxController, UNO_QUERY_THROW),
     570         212 :       mpBroadcaster(new ConfigurationControllerBroadcaster(&rController)),
     571         212 :       mxRequestedConfiguration(new Configuration(&rController, true)),
     572             :       mpBase(NULL),
     573         212 :       mpResourceFactoryContainer(new ResourceFactoryManager(mxControllerManager)),
     574             :       mpResourceManager(
     575         212 :           new ConfigurationControllerResourceManager(mpResourceFactoryContainer,mpBroadcaster)),
     576             :       mpConfigurationUpdater(
     577         212 :           new ConfigurationUpdater(mpBroadcaster, mpResourceManager,mxControllerManager)),
     578         212 :       mpQueueProcessor(new ChangeRequestQueueProcessor(&rController,mpConfigurationUpdater)),
     579             :       mpConfigurationUpdaterLock(),
     580        1484 :       mnLockCount(0)
     581             : {
     582         212 :     mpQueueProcessor->SetConfiguration(mxRequestedConfiguration);
     583         212 : }
     584             : 
     585         212 : ConfigurationController::Implementation::~Implementation (void)
     586             : {
     587         212 : }
     588             : 
     589         114 : } } // end of namespace sd::framework
     590             : 
     591             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10