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