LibreOffice Module sd (master) 1
PresenterScreen.cxx
Go to the documentation of this file.
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 "PresenterScreen.hxx"
24#include "PresenterHelper.hxx"
29#include <DrawController.hxx>
30#include <com/sun/star/frame/XController.hpp>
31#include <com/sun/star/lang/XServiceInfo.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>
39
40#include <utility>
41#include <vcl/svapp.hxx>
42#include <sal/log.hxx>
43
44using namespace ::com::sun::star;
45using namespace ::com::sun::star::uno;
46using namespace ::com::sun::star::lang;
47using namespace ::com::sun::star::presentation;
49
50namespace sdext::presenter {
51
52namespace {
53 typedef ::cppu::WeakComponentImplHelper <
54 css::document::XEventListener
55 > PresenterScreenListenerInterfaceBase;
56
61 class PresenterScreenListener
62 : private ::cppu::BaseMutex,
63 public PresenterScreenListenerInterfaceBase
64 {
65 public:
66 PresenterScreenListener (
67 css::uno::Reference<css::uno::XComponentContext> xContext,
68 css::uno::Reference<css::frame::XModel2> xModel);
69 PresenterScreenListener(const PresenterScreenListener&) = delete;
70 PresenterScreenListener& operator=(const PresenterScreenListener&) = delete;
71
72 void Initialize();
73 virtual void SAL_CALL disposing() override;
74
75 // document::XEventListener
76
77 virtual void SAL_CALL notifyEvent( const css::document::EventObject& Event ) override;
78
79 // XEventListener
80
81 virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
82
83 private:
84 css::uno::Reference<css::frame::XModel2 > mxModel;
85 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
87 };
88}
89
90//----- XServiceInfo ---------------------------------------------------------------
91
92Sequence< OUString > SAL_CALL PresenterScreenJob::getSupportedServiceNames()
93{
94 return { };
95}
96
98{
99 return "org.libreoffice.comp.PresenterScreenJob";
100}
101
102sal_Bool SAL_CALL PresenterScreenJob::supportsService(const OUString& aServiceName)
103{
104 return cppu::supportsService(this, aServiceName);
105}
106
107
108extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
110 css::uno::XComponentContext* context , css::uno::Sequence<css::uno::Any> const&)
111{
112 return cppu::acquire(new PresenterScreenJob(context));
113}
114
115
116//===== PresenterScreenJob ====================================================
117
118PresenterScreenJob::PresenterScreenJob (const Reference<XComponentContext>& rxContext)
120 mxComponentContext(rxContext)
121{
122}
123
124PresenterScreenJob::~PresenterScreenJob()
125{
126}
127
128void SAL_CALL PresenterScreenJob::disposing()
129{
130 mxComponentContext = nullptr;
131}
132
133//----- XJob -----------------------------------------------------------
134
135Any SAL_CALL PresenterScreenJob::execute(
136 const Sequence< beans::NamedValue >& Arguments )
137{
138 Sequence< beans::NamedValue > lEnv;
139 auto pArg = std::find_if(Arguments.begin(), Arguments.end(),
140 [](const beans::NamedValue& rArg) { return rArg.Name == "Environment"; });
141 if (pArg != Arguments.end())
142 pArg->Value >>= lEnv;
143
144 Reference<frame::XModel2> xModel;
145 auto pProp = std::find_if(std::cbegin(lEnv), std::cend(lEnv),
146 [](const beans::NamedValue& rProp) { return rProp.Name == "Model"; });
147 if (pProp != std::cend(lEnv))
148 pProp->Value >>= xModel;
149
150 Reference< XServiceInfo > xInfo( xModel, UNO_QUERY );
151 if( xInfo.is() && xInfo->supportsService("com.sun.star.presentation.PresentationDocument") )
152 {
153 // Create a new listener that waits for the full screen presentation
154 // to start and to end. It takes care of its own lifetime.
156 new PresenterScreenListener(mxComponentContext, xModel));
157 pListener->Initialize();
158 }
159
160 return Any();
161}
162
163//===== PresenterScreenListener ===============================================
164
165namespace {
166
167PresenterScreenListener::PresenterScreenListener (
168 css::uno::Reference<css::uno::XComponentContext> xContext,
169 css::uno::Reference<css::frame::XModel2> xModel)
170 : PresenterScreenListenerInterfaceBase(m_aMutex),
171 mxModel(std::move(xModel)),
172 mxComponentContext(std::move(xContext))
173{
174}
175
176void PresenterScreenListener::Initialize()
177{
178 Reference< document::XEventListener > xDocListener(this);
179 Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY );
180 if( xDocBroadcaster.is() )
181 xDocBroadcaster->addEventListener(xDocListener);
182}
183
184void SAL_CALL PresenterScreenListener::disposing()
185{
186 Reference< document::XEventBroadcaster > xDocBroadcaster( mxModel, UNO_QUERY );
187 if( xDocBroadcaster.is() )
188 xDocBroadcaster->removeEventListener(
189 Reference<document::XEventListener>(this) );
190
191 if (mpPresenterScreen.is())
192 {
193 mpPresenterScreen->RequestShutdownPresenterScreen();
194 mpPresenterScreen = nullptr;
195 }
196}
197
198// document::XEventListener
199
200void SAL_CALL PresenterScreenListener::notifyEvent( const css::document::EventObject& Event )
201{
202 if (rBHelper.bDisposed || rBHelper.bInDispose)
203 {
204 throw lang::DisposedException (
205 "PresenterScreenListener object has already been disposed",
206 static_cast<uno::XWeak*>(this));
207 }
208
209 if ( Event.EventName == "OnStartPresentation" )
210 {
211 mpPresenterScreen = new PresenterScreen(mxComponentContext, mxModel);
213 mpPresenterScreen->InitializePresenterScreen();
214 }
215 else if ( Event.EventName == "OnEndPresentation" )
216 {
217 if (mpPresenterScreen.is())
218 {
219 mpPresenterScreen->RequestShutdownPresenterScreen();
220 mpPresenterScreen = nullptr;
221 }
222 }
223}
224
225// XEventListener
226
227void SAL_CALL PresenterScreenListener::disposing (const css::lang::EventObject&)
228{
229 if (mpPresenterScreen.is())
230 {
231 mpPresenterScreen->RequestShutdownPresenterScreen();
232 mpPresenterScreen = nullptr;
233 }
234}
235
236} // end of anonymous namespace
237
238//===== PresenterScreen =======================================================
239
241 const Reference<XComponentContext>& rxContext,
242 css::uno::Reference<css::frame::XModel2> xModel)
244 mxModel(std::move(xModel)),
245 mxContextWeak(rxContext)
246{
247}
248
250{
251}
252
253bool PresenterScreen::isPresenterScreenEnabled(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
254{
255 bool dEnablePresenterScreen=true;
256 PresenterConfigurationAccess aConfiguration (
257 rxContext,
258 "/org.openoffice.Office.Impress/",
260 aConfiguration.GetConfigurationNode("Misc/Start/EnablePresenterScreen")
261 >>= dEnablePresenterScreen;
262 return dEnablePresenterScreen;
263}
264
265bool PresenterScreen::isPresenterScreenFullScreen(const css::uno::Reference<css::uno::XComponentContext>& rxContext)
266{
267 bool dPresenterScreenFullScreen = true;
268 PresenterConfigurationAccess aConfiguration (
269 rxContext,
270 "/org.openoffice.Office.Impress/",
272 aConfiguration.GetConfigurationNode("Misc/Start/PresenterScreenFullScreen")
273 >>= dPresenterScreenFullScreen;
274 return dPresenterScreenFullScreen;
275}
276
278{
279 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
280 if (xCC.is() && mxSavedConfiguration.is())
281 {
282 xCC->restoreConfiguration(mxSavedConfiguration);
283 }
284 mxConfigurationControllerWeak = Reference<XConfigurationController>(nullptr);
285
286 Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, UNO_QUERY);
287 if (xViewFactoryComponent.is())
288 xViewFactoryComponent->dispose();
289 Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, UNO_QUERY);
290 if (xPaneFactoryComponent.is())
291 xPaneFactoryComponent->dispose();
292
293 mxModel = nullptr;
294}
295
296//----- XEventListener --------------------------------------------------------
297
298void SAL_CALL PresenterScreen::disposing (const lang::EventObject& /*rEvent*/)
299{
301}
302
303
305{
306 try
307 {
308 Reference<XComponentContext> xContext (mxContextWeak);
310
311 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
312 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
313 Reference<presentation::XSlideShowController> xSlideShowController( xPresentation->getController() );
314
315 if( !xSlideShowController.is() || !xSlideShowController->isFullScreen() )
316 return;
317
318 // find first controller that is not the current controller (the one with the slideshow
319 auto tmpController = mxModel->getCurrentController();
320 Reference< container::XEnumeration > xEnum( mxModel->getControllers() );
321 if( xEnum.is() )
322 {
323 while( xEnum->hasMoreElements() )
324 {
325 Reference< frame::XController > xC( xEnum->nextElement(), UNO_QUERY );
326 if( xC.is() && (xC.get() != tmpController.get()) )
327 {
328 mxController = dynamic_cast<::sd::DrawController*>(xC.get());
329 assert(bool(mxController) == bool(xC) && "only support instances of type DrawController");
330 break;
331 }
332 }
333 }
334 // Get the XController from the first argument.
335
336 Reference<XConfigurationController> xCC( mxController->getConfigurationController());
338
339 Reference<drawing::framework::XResourceId> xMainPaneId(
340 GetMainPaneId(xPresentation, xContext));
341 // An empty reference means that the presenter screen can
342 // not or must not be displayed.
343 if ( ! xMainPaneId.is())
344 return;
345
346 if (xCC.is() && xContext.is())
347 {
348 // Store the current configuration so that we can restore it when
349 // the presenter view is deactivated.
350 mxSavedConfiguration = xCC->getRequestedConfiguration();
351 xCC->lock();
352
353 try
354 {
355 // At the moment the presenter controller is displayed in its
356 // own full screen window that is controlled by the same
357 // configuration controller as the Impress document from
358 // which the presentation was started. Therefore the main
359 // pane is activated additionally to the already existing
360 // panes and does not replace them.
361 xCC->requestResourceActivation(
362 xMainPaneId,
363 ResourceActivationMode_ADD);
364 SetupConfiguration(xContext, xMainPaneId);
365
367 this,
368 xContext,
370 xSlideShowController,
372 xMainPaneId);
373
374 // Create pane and view factories and integrate them into the
375 // drawing framework.
376 SetupPaneFactory(xContext);
377 SetupViewFactory(xContext);
378
379 mpPresenterController->GetWindowManager()->RestoreViewMode();
380 }
381 catch (const RuntimeException&)
382 {
383 xCC->restoreConfiguration(mxSavedConfiguration);
384 }
385 xCC->unlock();
386 }
387 }
388 catch (const Exception&)
389 {
390 }
391}
392
394{
395 try {
396 Reference<XPresentationSupplier> xPS ( mxModel, UNO_QUERY_THROW);
397 Reference<XPresentation2> xPresentation(xPS->getPresentation(), UNO_QUERY_THROW);
398
399 // Get the existing presenter console screen, we want to switch the
400 // presentation to use that instead.
401 sal_Int32 nNewScreen = GetPresenterScreenNumber (xPresentation);
402 if (nNewScreen < 0)
403 return;
404
405 // Adapt that display number to be the 'default' setting of 0 if it matches
406 sal_Int32 nExternalDisplay = Application::GetDisplayExternalScreen();
407
408 if (nNewScreen == nExternalDisplay)
409 nNewScreen = 0; // screen zero is best == the primary display
410 else
411 nNewScreen++; // otherwise we store screens offset by one.
412
413 // Set the new presentation display
414 Reference<beans::XPropertySet> xProperties (xPresentation, UNO_QUERY_THROW);
415 xProperties->setPropertyValue("Display", Any(nNewScreen));
416 } catch (const uno::Exception &) {
417 }
418}
419
425 const Reference<presentation::XPresentation2>& rxPresentation) const
426{
427 sal_Int32 nScreenNumber (0);
428 try
429 {
430 if ( ! rxPresentation.is())
431 return -1;
432
433 // Determine the screen on which the full screen presentation is being
434 // displayed.
435 sal_Int32 nDisplayNumber (-1);
436 if ( ! (rxPresentation->getPropertyValue("Display") >>= nDisplayNumber))
437 return -1;
438 if (nDisplayNumber == -1)
439 {
440 // The special value -1 indicates that the slide show
441 // spans all available displays. That leaves no room for
442 // the presenter screen.
443 return -1;
444 }
445
446 SAL_INFO("sdext.presenter", "Display number is " << nDisplayNumber);
447
448 if (nDisplayNumber > 0)
449 {
450 nScreenNumber = nDisplayNumber - 1;
451 }
452 else if (nDisplayNumber == 0)
453 {
454 // A display number value of 0 indicates the primary screen.
455 // Find out which screen number that is.
457 }
458
459 // We still have to determine the number of screens to decide
460 // whether the presenter screen may be shown at all.
461 sal_Int32 nScreenCount = Application::GetScreenCount();
462
463 if (nScreenCount < 2 || nDisplayNumber > nScreenCount)
464 {
465 // There is either only one screen or the full screen
466 // presentation spans all available screens. The presenter
467 // screen is shown only when a special flag in the configuration
468 // is set or when the presenter screen will be shown as
469 // non-full screen window
470 Reference<XComponentContext> xContext (mxContextWeak);
471 PresenterConfigurationAccess aConfiguration (
472 xContext,
473 "/org.openoffice.Office.PresenterScreen/",
475 bool bStartAlways (false);
476 bool bPresenterScreenFullScreen = isPresenterScreenFullScreen(xContext);
477 if (aConfiguration.GetConfigurationNode(
478 "Presenter/StartAlways") >>= bStartAlways)
479 {
480 if (bStartAlways || !bPresenterScreenFullScreen)
481 return GetPresenterScreenFromScreen(nScreenNumber);
482 }
483 return -1;
484 }
485 }
486 catch (const beans::UnknownPropertyException&)
487 {
488 OSL_ASSERT(false);
489 // For some reason we can not access the screen number. Use
490 // the default instead.
491 }
492 SAL_INFO("sdext.presenter", "Get presenter screen for screen " << nScreenNumber);
493 return GetPresenterScreenFromScreen(nScreenNumber);
494}
495
496sal_Int32 PresenterScreen::GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen )
497{
498 // Setup the resource id of the full screen background pane so that
499 // it is displayed on another screen than the presentation.
500 sal_Int32 nPresenterScreenNumber (1);
501 switch (nPresentationScreen)
502 {
503 case 0:
504 nPresenterScreenNumber = 1;
505 break;
506
507 case 1:
508 nPresenterScreenNumber = 0;
509 break;
510
511 default:
512 SAL_INFO("sdext.presenter", "Warning unexpected, out of bound screen "
513 "mapped to 0" << nPresentationScreen);
514 // When the full screen presentation is displayed on a screen
515 // other than 0 or 1 then place the presenter on the first
516 // available screen.
517 nPresenterScreenNumber = 0;
518 break;
519 }
520 return nPresenterScreenNumber;
521}
522
523Reference<drawing::framework::XResourceId> PresenterScreen::GetMainPaneId (
524 const Reference<presentation::XPresentation2>& rxPresentation,
525 const Reference<XComponentContext>& xContext) const
526{
527 // A negative value means that the presentation spans all available
528 // displays. That leaves no room for the presenter.
529 const sal_Int32 nScreen(GetPresenterScreenNumber(rxPresentation));
530 if (nScreen < 0)
531 return nullptr;
532
533 auto fullScreenStr = isPresenterScreenFullScreen(xContext)
534 ? OUString("true")
535 : OUString("false");
536
537 return ResourceId::create(
538 Reference<XComponentContext>(mxContextWeak),
540 + "?FullScreen="
541 + fullScreenStr
542 + "&ScreenNumber="
543 + OUString::number(nScreen));
544}
545
547{
548 // Restore the configuration that was active before the presenter screen
549 // has been activated. Now, that the presenter screen is displayed in
550 // its own top level window this probably not necessary, but one never knows.
551 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
552 if (xCC.is() && mxSavedConfiguration.is())
553 {
554 xCC->restoreConfiguration(mxSavedConfiguration);
555 mxSavedConfiguration = nullptr;
556 }
557
558 if (xCC.is())
559 {
560 // The actual restoration of the configuration takes place
561 // asynchronously. The view and pane factories can only by disposed
562 // after that. Therefore, set up a listener and wait for the
563 // restoration.
566 xCC,
567 [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); });
568 xCC->update();
569 }
570}
571
573{
574 Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, UNO_QUERY);
575 if (xViewFactoryComponent.is())
576 xViewFactoryComponent->dispose();
577 mxViewFactory = nullptr;
578
579 Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, UNO_QUERY);
580 if (xPaneFactoryComponent.is())
581 xPaneFactoryComponent->dispose();
582 mxPaneFactory = nullptr;
583
585 {
586 mpPresenterController->dispose();
587 mpPresenterController.clear();
588 }
589 mpPaneContainer = new PresenterPaneContainer(Reference<XComponentContext>(mxContextWeak));
590}
591
592void PresenterScreen::SetupPaneFactory (const Reference<XComponentContext>& rxContext)
593{
594 try
595 {
596 if ( ! mxPaneFactory.is())
598 rxContext,
601 }
602 catch (const RuntimeException&)
603 {
604 OSL_ASSERT(false);
605 }
606}
607
608void PresenterScreen::SetupViewFactory (const Reference<XComponentContext>& rxContext)
609{
610 try
611 {
612 if ( ! mxViewFactory.is())
614 rxContext,
617 }
618 catch (const RuntimeException&)
619 {
620 OSL_ASSERT(false);
621 }
622}
623
625 const Reference<XComponentContext>& rxContext,
626 const Reference<XResourceId>& rxAnchorId)
627{
628 try
629 {
630 PresenterConfigurationAccess aConfiguration (
631 rxContext,
632 "org.openoffice.Office.PresenterScreen",
634 maViewDescriptors.clear();
635 ProcessViewDescriptions(aConfiguration);
636 OUString sLayoutName ("DefaultLayout");
637 aConfiguration.GetConfigurationNode(
638 "Presenter/CurrentLayout") >>= sLayoutName;
639 ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
640 }
641 catch (const RuntimeException&)
642 {
643 }
644}
645
647 PresenterConfigurationAccess& rConfiguration,
648 std::u16string_view rsLayoutName,
649 const Reference<XComponentContext>& rxContext,
650 const Reference<XResourceId>& rxAnchorId)
651{
652 try
653 {
654 Reference<container::XHierarchicalNameAccess> xLayoutNode (
655 rConfiguration.GetConfigurationNode(
656 OUString::Concat("Presenter/Layouts/")+rsLayoutName),
657 UNO_QUERY_THROW);
658
659 // Read the parent layout first, if one is referenced.
660 OUString sParentLayout;
662 xLayoutNode,
663 "ParentLayout") >>= sParentLayout;
664 if (!sParentLayout.isEmpty())
665 {
666 // Prevent infinite recursion.
667 if (rsLayoutName != sParentLayout)
668 ProcessLayout(rConfiguration, sParentLayout, rxContext, rxAnchorId);
669 }
670
671 // Process the actual layout list.
672 Reference<container::XNameAccess> xList (
674 xLayoutNode,
675 "Layout"),
676 UNO_QUERY_THROW);
677
678 ::std::vector<OUString> aProperties
679 {
680 "PaneURL",
681 "ViewURL",
682 "RelativeX",
683 "RelativeY",
684 "RelativeWidth",
685 "RelativeHeight"
686 };
688 xList,
690 [this, rxContext, rxAnchorId](std::vector<uno::Any> const& rArgs)
691 {
692 this->ProcessComponent(rArgs, rxContext, rxAnchorId);
693 });
694 }
695 catch (const RuntimeException&)
696 {
697 }
698}
699
701 PresenterConfigurationAccess& rConfiguration)
702{
703 try
704 {
705 Reference<container::XNameAccess> xViewDescriptionsNode (
706 rConfiguration.GetConfigurationNode("Presenter/Views"),
707 UNO_QUERY_THROW);
708
709 ::std::vector<OUString> aProperties
710 {
711 "ViewURL",
712 "Title",
713 "AccessibleTitle",
714 "IsOpaque"
715 };
717 xViewDescriptionsNode,
719 [this](std::vector<uno::Any> const& rArgs)
720 {
721 return this->ProcessViewDescription(rArgs);
722 });
723 }
724 catch (const RuntimeException&)
725 {
726 OSL_ASSERT(false);
727 }
728}
729
731 const ::std::vector<Any>& rValues,
732 const Reference<XComponentContext>& rxContext,
733 const Reference<XResourceId>& rxAnchorId)
734{
735 if (rValues.size() != 6)
736 return;
737
738 try
739 {
740 OUString sPaneURL;
741 OUString sViewURL;
742 double nX = 0;
743 double nY = 0;
744 double nWidth = 0;
745 double nHeight = 0;
746 rValues[0] >>= sPaneURL;
747 rValues[1] >>= sViewURL;
748 rValues[2] >>= nX;
749 rValues[3] >>= nY;
750 rValues[4] >>= nWidth;
751 rValues[5] >>= nHeight;
752
753 if (nX>=0 && nY>=0 && nWidth>0 && nHeight>0)
754 {
755 SetupView(
756 rxContext,
757 rxAnchorId,
758 sPaneURL,
759 sViewURL,
761 }
762 }
763 catch (const Exception&)
764 {
765 OSL_ASSERT(false);
766 }
767}
768
770 const ::std::vector<Any>& rValues)
771{
772 if (rValues.size() != 4)
773 return;
774
775 try
776 {
777 ViewDescriptor aViewDescriptor;
778 OUString sViewURL;
779 rValues[0] >>= sViewURL;
780 rValues[1] >>= aViewDescriptor.msTitle;
781 rValues[2] >>= aViewDescriptor.msAccessibleTitle;
782 rValues[3] >>= aViewDescriptor.mbIsOpaque;
783 if (aViewDescriptor.msAccessibleTitle.isEmpty())
784 aViewDescriptor.msAccessibleTitle = aViewDescriptor.msTitle;
785 maViewDescriptors[sViewURL] = aViewDescriptor;
786 }
787 catch (const Exception&)
788 {
789 OSL_ASSERT(false);
790 }
791}
792
794 const Reference<XComponentContext>& rxContext,
795 const Reference<XResourceId>& rxAnchorId,
796 const OUString& rsPaneURL,
797 const OUString& rsViewURL,
799{
800 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
801 if (!xCC.is())
802 return;
803
804 Reference<XResourceId> xPaneId (ResourceId::createWithAnchor(rxContext,rsPaneURL,rxAnchorId));
805 // Look up the view descriptor.
806 ViewDescriptor aViewDescriptor;
807 ViewDescriptorContainer::const_iterator iDescriptor (maViewDescriptors.find(rsViewURL));
808 if (iDescriptor != maViewDescriptors.end())
809 aViewDescriptor = iDescriptor->second;
810
811 // Prepare the pane.
812 OSL_ASSERT(mpPaneContainer);
813 mpPaneContainer->PreparePane(
814 xPaneId,
815 rsViewURL,
816 aViewDescriptor.msTitle,
817 aViewDescriptor.msAccessibleTitle,
818 aViewDescriptor.mbIsOpaque,
819 rViewInitialization);
820}
821
822} // end of namespace ::sdext::presenter
823
824/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
rtl::Reference< PresenterScreen > mpPresenterScreen
PropertiesInfo aProperties
static unsigned int GetScreenCount()
static unsigned int GetDisplayExternalScreen()
The DrawController is the UNO controller for Impress and Draw.
This class gives access to the configuration.
css::uno::Any GetConfigurationNode(const OUString &rsPathToNode)
Return a configuration node below the root of the called object.
static void ForAll(const css::uno::Reference< css::container::XNameAccess > &rxContainer, const ::std::vector< OUString > &rArguments, const ItemProcessor &rProcessor)
Execute a functor for all elements of the given container.
The controller of the presenter screen is responsible for telling the individual views which slides t...
static void RunOnUpdateEnd(const css::uno::Reference< css::drawing::framework::XConfigurationController > &rxController, const Action &rAction)
This class could also be called PresenterPaneAndViewContainer because it stores not only references t...
::std::function< void(const css::uno::Reference< css::drawing::framework::XView > &)> ViewInitializationFunction
static css::uno::Reference< css::drawing::framework::XResourceFactory > Create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const rtl::Reference<::sd::DrawController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
Create a new instance of this class and register it as resource factory in the drawing framework of t...
The PresenterScreenJob service is instantiated every time a document is created or loaded.
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
PresenterScreenJob(const PresenterScreenJob &)=delete
rtl::Reference<::sd::DrawController > mxController
css::uno::Reference< css::drawing::framework::XConfiguration > mxSavedConfiguration
void SetupConfiguration(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxAnchorId)
Read the current layout from the configuration and call ProcessLayout to bring it on to the screen.
virtual void SAL_CALL disposing() override
css::uno::Reference< css::frame::XModel2 > mxModel
static bool isPresenterScreenFullScreen(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
static bool isPresenterScreenEnabled(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
::rtl::Reference< PresenterController > mpPresenterController
void RequestShutdownPresenterScreen()
Do not call ShutdownPresenterScreen() directly.
void SetupView(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxAnchorId, const OUString &rsPaneURL, const OUString &rsViewURL, const PresenterPaneContainer::ViewInitializationFunction &rViewInitialization)
void ProcessLayout(PresenterConfigurationAccess &rConfiguration, std::u16string_view rsLayoutName, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxAnchorId)
Read one layout from the configuration and make resource activation requests to bring it on to the sc...
ViewDescriptorContainer maViewDescriptors
void InitializePresenterScreen()
Make the presenter screen visible.
css::uno::WeakReference< css::uno::XComponentContext > mxContextWeak
void ProcessComponent(const ::std::vector< css::uno::Any > &rValues, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxAnchorId)
Called by ProcessLayout for a single entry of a Layouts configuration list.
void ProcessViewDescription(const ::std::vector< css::uno::Any > &rValues)
Called by ProcessViewDescriptions for a single entry.
css::uno::Reference< css::drawing::framework::XResourceFactory > mxPaneFactory
void SetupPaneFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Create and initialize the factory for presenter view specific panes.
void ProcessViewDescriptions(PresenterConfigurationAccess &rConfiguration)
Read the view descriptions from the configuration.
static sal_Int32 GetPresenterScreenFromScreen(sal_Int32 nPresentationScreen)
css::uno::Reference< css::drawing::framework::XResourceId > GetMainPaneId(const css::uno::Reference< css::presentation::XPresentation2 > &rxPresentation, const css::uno::Reference< com::sun::star::uno::XComponentContext > &xContext) const
Create a resource id for the full screen background pane so that it is displayed on another screen th...
PresenterScreen(const css::uno::Reference< css::uno::XComponentContext > &rxContext, css::uno::Reference< css::frame::XModel2 > xModel)
sal_Int32 GetPresenterScreenNumber(const css::uno::Reference< css::presentation::XPresentation2 > &rxPresentation) const
Return the built-in screen number on the presentation will normally display the presenter console.
void SetupViewFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Create and initialize the factory for presenter view specific views.
void SwitchMonitors()
Switch / converse monitors between presenter view and slide output.
css::uno::Reference< css::drawing::framework::XResourceFactory > mxViewFactory
::rtl::Reference< PresenterPaneContainer > mpPaneContainer
css::uno::WeakReference< css::drawing::framework::XConfigurationController > mxConfigurationControllerWeak
static css::uno::Reference< css::drawing::framework::XResourceFactory > Create(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference<::sd::DrawController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
Create a new instance of this class and register it as resource factory in the drawing framework of t...
std::mutex m_aMutex
#define SAL_INFO(area, stream)
@ Exception
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * sd_PresenterScreenJob_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
::cppu::WeakComponentImplHelper< css::task::XJob, css::lang::XServiceInfo > PresenterScreenJobInterfaceBase
::cppu::WeakComponentImplHelper< css::lang::XEventListener > PresenterScreenInterfaceBase
This is the bootstrap class of the presenter screen.
Reference< XModel > xModel
unsigned char sal_Bool