vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / presenter / PresenterScreen.cxx
bloba0ddd7fe9b4d942386d5a156782afd43ed1f3399
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #include "PresenterScreen.hxx"
21 #include "PresenterConfigurationAccess.hxx"
22 #include "PresenterController.hxx"
23 #include "PresenterFrameworkObserver.hxx"
24 #include "PresenterHelper.hxx"
25 #include "PresenterPaneContainer.hxx"
26 #include "PresenterPaneFactory.hxx"
27 #include "PresenterViewFactory.hxx"
28 #include "PresenterWindowManager.hxx"
29 #include <com/sun/star/frame/XController.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/drawing/framework/XControllerManager.hpp>
32 #include <com/sun/star/drawing/framework/ResourceId.hpp>
33 #include <com/sun/star/drawing/framework/ResourceActivationMode.hpp>
34 #include <com/sun/star/presentation/XPresentation2.hpp>
35 #include <com/sun/star/presentation/XPresentationSupplier.hpp>
36 #include <com/sun/star/document/XEventBroadcaster.hpp>
37 #include <cppuhelper/compbase.hxx>
39 #include <vcl/svapp.hxx>
40 #include <sal/log.hxx>
42 using namespace ::com::sun::star;
43 using namespace ::com::sun::star::uno;
44 using namespace ::com::sun::star::lang;
45 using namespace ::com::sun::star::presentation;
46 using namespace ::com::sun::star::drawing::framework;
48 namespace sdext { namespace presenter {
50 namespace {
51 typedef ::cppu::WeakComponentImplHelper <
52 css::document::XEventListener
53 > PresenterScreenListenerInterfaceBase;
55 /** One instance of a PresenterScreenListener is registered per Impress
56 document and waits for the full screen slide show to start and to
57 end.
59 class PresenterScreenListener
60 : private ::cppu::BaseMutex,
61 public PresenterScreenListenerInterfaceBase
63 public:
64 PresenterScreenListener (
65 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
66 const css::uno::Reference<css::frame::XModel2>& rxModel);
67 PresenterScreenListener(const PresenterScreenListener&) = delete;
68 PresenterScreenListener& operator=(const PresenterScreenListener&) = delete;
70 void Initialize();
71 virtual void SAL_CALL disposing() override;
73 // document::XEventListener
75 virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
77 // XEventListener
79 virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
81 private:
82 css::uno::Reference<css::frame::XModel2 > mxModel;
83 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
84 rtl::Reference<PresenterScreen> mpPresenterScreen;
88 //----- Service ---------------------------------------------------------------
90 OUString PresenterScreenJob::getImplementationName_static()
92 return "org.libreoffice.comp.PresenterScreenJob";
95 Sequence<OUString> PresenterScreenJob::getSupportedServiceNames_static()
97 return Sequence<OUString>();
100 Reference<XInterface> PresenterScreenJob::Create (const Reference<uno::XComponentContext>& rxContext)
102 return Reference<XInterface>(static_cast<XWeak*>(new PresenterScreenJob(rxContext)));
105 //===== PresenterScreenJob ====================================================
107 PresenterScreenJob::PresenterScreenJob (const Reference<XComponentContext>& rxContext)
108 : PresenterScreenJobInterfaceBase(m_aMutex),
109 mxComponentContext(rxContext)
113 PresenterScreenJob::~PresenterScreenJob()
117 void SAL_CALL PresenterScreenJob::disposing()
119 mxComponentContext = nullptr;
122 //----- XJob -----------------------------------------------------------
124 Any SAL_CALL PresenterScreenJob::execute(
125 const Sequence< beans::NamedValue >& Arguments )
127 Sequence< beans::NamedValue > lEnv;
128 auto pArg = std::find_if(Arguments.begin(), Arguments.end(),
129 [](const beans::NamedValue& rArg) { return rArg.Name == "Environment"; });
130 if (pArg != Arguments.end())
131 pArg->Value >>= lEnv;
133 Reference<frame::XModel2> xModel;
134 auto pProp = std::find_if(lEnv.begin(), lEnv.end(),
135 [](const beans::NamedValue& rProp) { return rProp.Name == "Model"; });
136 if (pProp != lEnv.end())
137 pProp->Value >>= xModel;
139 Reference< XServiceInfo > xInfo( xModel, UNO_QUERY );
140 if( xInfo.is() && xInfo->supportsService("com.sun.star.presentation.PresentationDocument") )
142 // Create a new listener that waits for the full screen presentation
143 // to start and to end. It takes care of its own lifetime.
144 ::rtl::Reference<PresenterScreenListener> pListener (
145 new PresenterScreenListener(mxComponentContext, xModel));
146 pListener->Initialize();
149 return Any();
152 //===== PresenterScreenListener ===============================================
154 namespace {
156 PresenterScreenListener::PresenterScreenListener (
157 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
158 const css::uno::Reference<css::frame::XModel2>& rxModel)
159 : PresenterScreenListenerInterfaceBase(m_aMutex),
160 mxModel(rxModel),
161 mxComponentContext(rxContext),
162 mpPresenterScreen()
166 void PresenterScreenListener::Initialize()
168 Reference< document::XEventListener > xDocListener(
169 static_cast< document::XEventListener* >(this), UNO_QUERY);
170 Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY );
171 if( xDocBroadcaster.is() )
172 xDocBroadcaster->addEventListener(xDocListener);
175 void SAL_CALL PresenterScreenListener::disposing()
177 Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY );
178 if( xDocBroadcaster.is() )
179 xDocBroadcaster->removeEventListener(
180 Reference<document::XEventListener>(
181 static_cast<document::XEventListener*>(this), UNO_QUERY));
183 if (mpPresenterScreen.is())
185 mpPresenterScreen->RequestShutdownPresenterScreen();
186 mpPresenterScreen = nullptr;
190 // document::XEventListener
192 void SAL_CALL PresenterScreenListener::notifyEvent( const css::document::EventObject& Event )
194 if (rBHelper.bDisposed || rBHelper.bInDispose)
196 throw lang::DisposedException (
197 "PresenterScreenListener object has already been disposed",
198 static_cast<uno::XWeak*>(this));
201 if ( Event.EventName == "OnStartPresentation" )
203 mpPresenterScreen = new PresenterScreen(mxComponentContext, mxModel);
204 if(PresenterScreen::isPresenterScreenEnabled(mxComponentContext))
205 mpPresenterScreen->InitializePresenterScreen();
207 else if ( Event.EventName == "OnEndPresentation" )
209 if (mpPresenterScreen.is())
211 mpPresenterScreen->RequestShutdownPresenterScreen();
212 mpPresenterScreen = nullptr;
217 // XEventListener
219 void SAL_CALL PresenterScreenListener::disposing (const css::lang::EventObject&)
221 if (mpPresenterScreen.is())
223 mpPresenterScreen->RequestShutdownPresenterScreen();
224 mpPresenterScreen = nullptr;
228 } // end of anonymous namespace
230 //===== PresenterScreen =======================================================
232 PresenterScreen::PresenterScreen (
233 const Reference<XComponentContext>& rxContext,
234 const css::uno::Reference<css::frame::XModel2>& rxModel)
235 : PresenterScreenInterfaceBase(m_aMutex),
236 mxModel(rxModel),
237 mxController(),
238 mxConfigurationControllerWeak(),
239 mxContextWeak(rxContext),
240 mpPresenterController(),
241 mxSavedConfiguration(),
242 mpPaneContainer(),
243 mxPaneFactory(),
244 mxViewFactory(),
245 maViewDescriptors()
249 PresenterScreen::~PresenterScreen()
253 bool PresenterScreen::isPresenterScreenEnabled(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
255 bool dEnablePresenterScreen=true;
256 PresenterConfigurationAccess aConfiguration (
257 rxContext,
258 "/org.openoffice.Office.Impress/",
259 PresenterConfigurationAccess::READ_ONLY);
260 aConfiguration.GetConfigurationNode("Misc/Start/EnablePresenterScreen")
261 >>= dEnablePresenterScreen;
262 return dEnablePresenterScreen;
264 void SAL_CALL PresenterScreen::disposing()
266 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
267 if (xCC.is() && mxSavedConfiguration.is())
269 xCC->restoreConfiguration(mxSavedConfiguration);
271 mxConfigurationControllerWeak = Reference<XConfigurationController>(nullptr);
273 Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, UNO_QUERY);
274 if (xViewFactoryComponent.is())
275 xViewFactoryComponent->dispose();
276 Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, UNO_QUERY);
277 if (xPaneFactoryComponent.is())
278 xPaneFactoryComponent->dispose();
280 mxModel = nullptr;
283 //----- XEventListener --------------------------------------------------------
285 void SAL_CALL PresenterScreen::disposing (const lang::EventObject& /*rEvent*/)
287 RequestShutdownPresenterScreen();
291 void PresenterScreen::InitializePresenterScreen()
295 Reference<XComponentContext> xContext (mxContextWeak);
296 mpPaneContainer = new PresenterPaneContainer(xContext);
298 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
299 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
300 Reference<presentation::XSlideShowController> xSlideShowController( xPresentation->getController() );
302 if( !xSlideShowController.is() || !xSlideShowController->isFullScreen() )
303 return;
305 // find first controller that is not the current controller (the one with the slideshow
306 mxController = mxModel->getCurrentController();
307 Reference< container::XEnumeration > xEnum( mxModel->getControllers() );
308 if( xEnum.is() )
310 while( xEnum->hasMoreElements() )
312 Reference< frame::XController > xC( xEnum->nextElement(), UNO_QUERY );
313 if( xC.is() && (xC != mxController) )
315 mxController = xC;
316 break;
320 // Get the XController from the first argument.
321 Reference<XControllerManager> xCM(mxController, UNO_QUERY_THROW);
323 Reference<XConfigurationController> xCC( xCM->getConfigurationController());
324 mxConfigurationControllerWeak = xCC;
326 Reference<drawing::framework::XResourceId> xMainPaneId(
327 GetMainPaneId(xPresentation));
328 // An empty reference means that the presenter screen can
329 // not or must not be displayed.
330 if ( ! xMainPaneId.is())
331 return;
333 if (xCC.is() && xContext.is())
335 // Store the current configuration so that we can restore it when
336 // the presenter view is deactivated.
337 mxSavedConfiguration = xCC->getRequestedConfiguration();
338 xCC->lock();
342 // At the moment the presenter controller is displayed in its
343 // own full screen window that is controlled by the same
344 // configuration controller as the Impress document from
345 // which the presentation was started. Therefore the main
346 // pane is activated additionally to the already existing
347 // panes and does not replace them.
348 xCC->requestResourceActivation(
349 xMainPaneId,
350 ResourceActivationMode_ADD);
351 SetupConfiguration(xContext, xMainPaneId);
353 mpPresenterController = new PresenterController(
354 css::uno::WeakReference<css::lang::XEventListener>(this),
355 xContext,
356 mxController,
357 xSlideShowController,
358 mpPaneContainer,
359 xMainPaneId);
361 // Create pane and view factories and integrate them into the
362 // drawing framework.
363 SetupPaneFactory(xContext);
364 SetupViewFactory(xContext);
366 mpPresenterController->GetWindowManager()->RestoreViewMode();
368 catch (const RuntimeException&)
370 xCC->restoreConfiguration(mxSavedConfiguration);
372 xCC->unlock();
375 catch (const Exception&)
380 void PresenterScreen::SwitchMonitors()
382 try {
383 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
384 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
386 // Get the existing presenter console screen, we want to switch the
387 // presentation to use that instead.
388 sal_Int32 nNewScreen = GetPresenterScreenNumber (xPresentation);
389 if (nNewScreen < 0)
390 return;
392 // Adapt that display number to be the 'default' setting of 0 if it matches
393 sal_Int32 nExternalDisplay = Application::GetDisplayExternalScreen();
395 if (nNewScreen == nExternalDisplay)
396 nNewScreen = 0; // screen zero is best == the primary display
397 else
398 nNewScreen++; // otherwise we store screens offset by one.
400 // Set the new presentation display
401 Reference<beans::XPropertySet> xProperties (xPresentation, UNO_QUERY_THROW);
402 xProperties->setPropertyValue("Display", Any(nNewScreen));
403 } catch (const uno::Exception &) {
408 * Return the real VCL screen number to show the presenter console
409 * on or -1 to not show anything.
411 sal_Int32 PresenterScreen::GetPresenterScreenNumber (
412 const Reference<presentation::XPresentation2>& rxPresentation) const
414 sal_Int32 nScreenNumber (0);
415 sal_Int32 nScreenCount (1);
418 if ( ! rxPresentation.is())
419 return -1;
421 // Determine the screen on which the full screen presentation is being
422 // displayed.
423 sal_Int32 nDisplayNumber (-1);
424 if ( ! (rxPresentation->getPropertyValue("Display") >>= nDisplayNumber))
425 return -1;
426 if (nDisplayNumber == -1)
428 // The special value -1 indicates that the slide show
429 // spans all available displays. That leaves no room for
430 // the presenter screen.
431 return -1;
434 SAL_INFO("sdext.presenter", "Display number is " << nDisplayNumber);
436 if (nDisplayNumber > 0)
438 nScreenNumber = nDisplayNumber - 1;
440 else if (nDisplayNumber == 0)
442 // A display number value of 0 indicates the primary screen.
443 // Find out which screen number that is.
444 nScreenNumber = Application::GetDisplayExternalScreen();
447 // We still have to determine the number of screens to decide
448 // whether the presenter screen may be shown at all.
449 nScreenCount = Application::GetScreenCount();
451 if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
453 // There is either only one screen or the full screen
454 // presentation spans all available screens. The presenter
455 // screen is shown only when a special flag in the configuration
456 // is set.
457 Reference<XComponentContext> xContext (mxContextWeak);
458 PresenterConfigurationAccess aConfiguration (
459 xContext,
460 "/org.openoffice.Office.PresenterScreen/",
461 PresenterConfigurationAccess::READ_ONLY);
462 bool bStartAlways (false);
463 if (aConfiguration.GetConfigurationNode(
464 "Presenter/StartAlways") >>= bStartAlways)
466 if (bStartAlways)
467 return GetPresenterScreenFromScreen(nScreenNumber);
469 return -1;
472 catch (const beans::UnknownPropertyException&)
474 OSL_ASSERT(false);
475 // For some reason we can not access the screen number. Use
476 // the default instead.
478 SAL_INFO("sdext.presenter", "Get presenter screen for screen " << nScreenNumber);
479 return GetPresenterScreenFromScreen(nScreenNumber);
482 sal_Int32 PresenterScreen::GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen )
484 // Setup the resource id of the full screen background pane so that
485 // it is displayed on another screen than the presentation.
486 sal_Int32 nPresenterScreenNumber (1);
487 switch (nPresentationScreen)
489 case 0:
490 nPresenterScreenNumber = 1;
491 break;
493 case 1:
494 nPresenterScreenNumber = 0;
495 break;
497 default:
498 SAL_INFO("sdext.presenter", "Warning unexpected, out of bound screen "
499 "mapped to 0" << nPresentationScreen);
500 // When the full screen presentation is displayed on a screen
501 // other than 0 or 1 then place the presenter on the first
502 // available screen.
503 nPresenterScreenNumber = 0;
504 break;
506 return nPresenterScreenNumber;
509 Reference<drawing::framework::XResourceId> PresenterScreen::GetMainPaneId (
510 const Reference<presentation::XPresentation2>& rxPresentation) const
512 // A negative value means that the presentation spans all available
513 // displays. That leaves no room for the presenter.
514 const sal_Int32 nScreen(GetPresenterScreenNumber(rxPresentation));
515 if (nScreen < 0)
516 return nullptr;
518 return ResourceId::create(
519 Reference<XComponentContext>(mxContextWeak),
520 PresenterHelper::msFullScreenPaneURL
521 + "?FullScreen=true&ScreenNumber="
522 + OUString::number(nScreen));
525 void PresenterScreen::RequestShutdownPresenterScreen()
527 // Restore the configuration that was active before the presenter screen
528 // has been activated. Now, that the presenter screen is displayed in
529 // its own top level window this probably not necessary, but one never knows.
530 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
531 if (xCC.is() && mxSavedConfiguration.is())
533 xCC->restoreConfiguration(mxSavedConfiguration);
534 mxSavedConfiguration = nullptr;
537 if (xCC.is())
539 // The actual restoration of the configuration takes place
540 // asynchronously. The view and pane factories can only by disposed
541 // after that. Therefore, set up a listener and wait for the
542 // restoration.
543 rtl::Reference<PresenterScreen> pSelf (this);
544 PresenterFrameworkObserver::RunOnUpdateEnd(
545 xCC,
546 [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); });
547 xCC->update();
551 void PresenterScreen::ShutdownPresenterScreen()
553 Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, UNO_QUERY);
554 if (xViewFactoryComponent.is())
555 xViewFactoryComponent->dispose();
556 mxViewFactory = nullptr;
558 Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, UNO_QUERY);
559 if (xPaneFactoryComponent.is())
560 xPaneFactoryComponent->dispose();
561 mxPaneFactory = nullptr;
563 if (mpPresenterController.get() != nullptr)
565 mpPresenterController->dispose();
566 mpPresenterController.clear();
568 mpPaneContainer = new PresenterPaneContainer(Reference<XComponentContext>(mxContextWeak));
571 void PresenterScreen::SetupPaneFactory (const Reference<XComponentContext>& rxContext)
575 if ( ! mxPaneFactory.is())
576 mxPaneFactory = PresenterPaneFactory::Create(
577 rxContext,
578 mxController,
579 mpPresenterController);
581 catch (const RuntimeException&)
583 OSL_ASSERT(false);
587 void PresenterScreen::SetupViewFactory (const Reference<XComponentContext>& rxContext)
591 if ( ! mxViewFactory.is())
592 mxViewFactory = PresenterViewFactory::Create(
593 rxContext,
594 mxController,
595 mpPresenterController);
597 catch (const RuntimeException&)
599 OSL_ASSERT(false);
603 void PresenterScreen::SetupConfiguration (
604 const Reference<XComponentContext>& rxContext,
605 const Reference<XResourceId>& rxAnchorId)
609 PresenterConfigurationAccess aConfiguration (
610 rxContext,
611 "org.openoffice.Office.PresenterScreen",
612 PresenterConfigurationAccess::READ_ONLY);
613 maViewDescriptors.clear();
614 ProcessViewDescriptions(aConfiguration);
615 OUString sLayoutName ("DefaultLayout");
616 aConfiguration.GetConfigurationNode(
617 "Presenter/CurrentLayout") >>= sLayoutName;
618 ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
620 catch (const RuntimeException&)
625 void PresenterScreen::ProcessLayout (
626 PresenterConfigurationAccess& rConfiguration,
627 const OUString& rsLayoutName,
628 const Reference<XComponentContext>& rxContext,
629 const Reference<XResourceId>& rxAnchorId)
633 Reference<container::XHierarchicalNameAccess> xLayoutNode (
634 rConfiguration.GetConfigurationNode(
635 "Presenter/Layouts/"+rsLayoutName),
636 UNO_QUERY_THROW);
638 // Read the parent layout first, if one is referenced.
639 OUString sParentLayout;
640 PresenterConfigurationAccess::GetConfigurationNode(
641 xLayoutNode,
642 "ParentLayout") >>= sParentLayout;
643 if (!sParentLayout.isEmpty())
645 // Prevent infinite recursion.
646 if (rsLayoutName != sParentLayout)
647 ProcessLayout(rConfiguration, sParentLayout, rxContext, rxAnchorId);
650 // Process the actual layout list.
651 Reference<container::XNameAccess> xList (
652 PresenterConfigurationAccess::GetConfigurationNode(
653 xLayoutNode,
654 "Layout"),
655 UNO_QUERY_THROW);
657 ::std::vector<OUString> aProperties (6);
658 aProperties[0] = "PaneURL";
659 aProperties[1] = "ViewURL";
660 aProperties[2] = "RelativeX";
661 aProperties[3] = "RelativeY";
662 aProperties[4] = "RelativeWidth";
663 aProperties[5] = "RelativeHeight";
664 PresenterConfigurationAccess::ForAll(
665 xList,
666 aProperties,
667 [this, rxContext, rxAnchorId](std::vector<uno::Any> const& rArgs)
669 this->ProcessComponent(rArgs, rxContext, rxAnchorId);
672 catch (const RuntimeException&)
677 void PresenterScreen::ProcessViewDescriptions (
678 PresenterConfigurationAccess& rConfiguration)
682 Reference<container::XNameAccess> xViewDescriptionsNode (
683 rConfiguration.GetConfigurationNode("Presenter/Views"),
684 UNO_QUERY_THROW);
686 ::std::vector<OUString> aProperties (4);
687 aProperties[0] = "ViewURL";
688 aProperties[1] = "Title";
689 aProperties[2] = "AccessibleTitle";
690 aProperties[3] = "IsOpaque";
691 PresenterConfigurationAccess::ForAll(
692 xViewDescriptionsNode,
693 aProperties,
694 [this](std::vector<uno::Any> const& rArgs)
696 return this->ProcessViewDescription(rArgs);
699 catch (const RuntimeException&)
701 OSL_ASSERT(false);
705 void PresenterScreen::ProcessComponent (
706 const ::std::vector<Any>& rValues,
707 const Reference<XComponentContext>& rxContext,
708 const Reference<XResourceId>& rxAnchorId)
710 if (rValues.size() != 6)
711 return;
715 OUString sPaneURL;
716 OUString sViewURL;
717 double nX = 0;
718 double nY = 0;
719 double nWidth = 0;
720 double nHeight = 0;
721 rValues[0] >>= sPaneURL;
722 rValues[1] >>= sViewURL;
723 rValues[2] >>= nX;
724 rValues[3] >>= nY;
725 rValues[4] >>= nWidth;
726 rValues[5] >>= nHeight;
728 if (nX>=0 && nY>=0 && nWidth>0 && nHeight>0)
730 SetupView(
731 rxContext,
732 rxAnchorId,
733 sPaneURL,
734 sViewURL,
735 PresenterPaneContainer::ViewInitializationFunction());
738 catch (const Exception&)
740 OSL_ASSERT(false);
744 void PresenterScreen::ProcessViewDescription (
745 const ::std::vector<Any>& rValues)
747 if (rValues.size() != 4)
748 return;
752 ViewDescriptor aViewDescriptor;
753 OUString sViewURL;
754 rValues[0] >>= sViewURL;
755 rValues[1] >>= aViewDescriptor.msTitle;
756 rValues[2] >>= aViewDescriptor.msAccessibleTitle;
757 rValues[3] >>= aViewDescriptor.mbIsOpaque;
758 if (aViewDescriptor.msAccessibleTitle.isEmpty())
759 aViewDescriptor.msAccessibleTitle = aViewDescriptor.msTitle;
760 maViewDescriptors[sViewURL] = aViewDescriptor;
762 catch (const Exception&)
764 OSL_ASSERT(false);
768 void PresenterScreen::SetupView(
769 const Reference<XComponentContext>& rxContext,
770 const Reference<XResourceId>& rxAnchorId,
771 const OUString& rsPaneURL,
772 const OUString& rsViewURL,
773 const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization)
775 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
776 if (!xCC.is())
777 return;
779 Reference<XResourceId> xPaneId (ResourceId::createWithAnchor(rxContext,rsPaneURL,rxAnchorId));
780 // Look up the view descriptor.
781 ViewDescriptor aViewDescriptor;
782 ViewDescriptorContainer::const_iterator iDescriptor (maViewDescriptors.find(rsViewURL));
783 if (iDescriptor != maViewDescriptors.end())
784 aViewDescriptor = iDescriptor->second;
786 // Prepare the pane.
787 OSL_ASSERT(mpPaneContainer.get() != nullptr);
788 mpPaneContainer->PreparePane(
789 xPaneId,
790 rsViewURL,
791 aViewDescriptor.msTitle,
792 aViewDescriptor.msAccessibleTitle,
793 aViewDescriptor.mbIsOpaque,
794 rViewInitialization);
797 } } // end of namespace ::sdext::presenter
799 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */