LibreOffice Module sdext (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 <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>
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 mxController = 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 != mxController) )
327 {
328 mxController = xC;
329 break;
330 }
331 }
332 }
333 // Get the XController from the first argument.
334 Reference<XControllerManager> xCM(mxController, UNO_QUERY_THROW);
335
336 Reference<XConfigurationController> xCC( xCM->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 css::uno::WeakReference<css::lang::XEventListener>(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.
469 Reference<XComponentContext> xContext (mxContextWeak);
470 PresenterConfigurationAccess aConfiguration (
471 xContext,
472 "/org.openoffice.Office.PresenterScreen/",
474 bool bStartAlways (false);
475 if (aConfiguration.GetConfigurationNode(
476 "Presenter/StartAlways") >>= bStartAlways)
477 {
478 if (bStartAlways)
479 return GetPresenterScreenFromScreen(nScreenNumber);
480 }
481 return -1;
482 }
483 }
484 catch (const beans::UnknownPropertyException&)
485 {
486 OSL_ASSERT(false);
487 // For some reason we can not access the screen number. Use
488 // the default instead.
489 }
490 SAL_INFO("sdext.presenter", "Get presenter screen for screen " << nScreenNumber);
491 return GetPresenterScreenFromScreen(nScreenNumber);
492}
493
494sal_Int32 PresenterScreen::GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen )
495{
496 // Setup the resource id of the full screen background pane so that
497 // it is displayed on another screen than the presentation.
498 sal_Int32 nPresenterScreenNumber (1);
499 switch (nPresentationScreen)
500 {
501 case 0:
502 nPresenterScreenNumber = 1;
503 break;
504
505 case 1:
506 nPresenterScreenNumber = 0;
507 break;
508
509 default:
510 SAL_INFO("sdext.presenter", "Warning unexpected, out of bound screen "
511 "mapped to 0" << nPresentationScreen);
512 // When the full screen presentation is displayed on a screen
513 // other than 0 or 1 then place the presenter on the first
514 // available screen.
515 nPresenterScreenNumber = 0;
516 break;
517 }
518 return nPresenterScreenNumber;
519}
520
521Reference<drawing::framework::XResourceId> PresenterScreen::GetMainPaneId (
522 const Reference<presentation::XPresentation2>& rxPresentation,
523 const Reference<XComponentContext>& xContext) const
524{
525 // A negative value means that the presentation spans all available
526 // displays. That leaves no room for the presenter.
527 const sal_Int32 nScreen(GetPresenterScreenNumber(rxPresentation));
528 if (nScreen < 0)
529 return nullptr;
530
531 auto fullScreenStr = isPresenterScreenFullScreen(xContext)
532 ? OUString("true")
533 : OUString("false");
534
535 return ResourceId::create(
536 Reference<XComponentContext>(mxContextWeak),
538 + "?FullScreen="
539 + fullScreenStr
540 + "&ScreenNumber="
541 + OUString::number(nScreen));
542}
543
545{
546 // Restore the configuration that was active before the presenter screen
547 // has been activated. Now, that the presenter screen is displayed in
548 // its own top level window this probably not necessary, but one never knows.
549 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
550 if (xCC.is() && mxSavedConfiguration.is())
551 {
552 xCC->restoreConfiguration(mxSavedConfiguration);
553 mxSavedConfiguration = nullptr;
554 }
555
556 if (xCC.is())
557 {
558 // The actual restoration of the configuration takes place
559 // asynchronously. The view and pane factories can only by disposed
560 // after that. Therefore, set up a listener and wait for the
561 // restoration.
564 xCC,
565 [pSelf](bool){ return pSelf->ShutdownPresenterScreen(); });
566 xCC->update();
567 }
568}
569
571{
572 Reference<lang::XComponent> xViewFactoryComponent (mxViewFactory, UNO_QUERY);
573 if (xViewFactoryComponent.is())
574 xViewFactoryComponent->dispose();
575 mxViewFactory = nullptr;
576
577 Reference<lang::XComponent> xPaneFactoryComponent (mxPaneFactory, UNO_QUERY);
578 if (xPaneFactoryComponent.is())
579 xPaneFactoryComponent->dispose();
580 mxPaneFactory = nullptr;
581
583 {
584 mpPresenterController->dispose();
585 mpPresenterController.clear();
586 }
587 mpPaneContainer = new PresenterPaneContainer(Reference<XComponentContext>(mxContextWeak));
588}
589
590void PresenterScreen::SetupPaneFactory (const Reference<XComponentContext>& rxContext)
591{
592 try
593 {
594 if ( ! mxPaneFactory.is())
596 rxContext,
599 }
600 catch (const RuntimeException&)
601 {
602 OSL_ASSERT(false);
603 }
604}
605
606void PresenterScreen::SetupViewFactory (const Reference<XComponentContext>& rxContext)
607{
608 try
609 {
610 if ( ! mxViewFactory.is())
612 rxContext,
615 }
616 catch (const RuntimeException&)
617 {
618 OSL_ASSERT(false);
619 }
620}
621
623 const Reference<XComponentContext>& rxContext,
624 const Reference<XResourceId>& rxAnchorId)
625{
626 try
627 {
628 PresenterConfigurationAccess aConfiguration (
629 rxContext,
630 "org.openoffice.Office.PresenterScreen",
632 maViewDescriptors.clear();
633 ProcessViewDescriptions(aConfiguration);
634 OUString sLayoutName ("DefaultLayout");
635 aConfiguration.GetConfigurationNode(
636 "Presenter/CurrentLayout") >>= sLayoutName;
637 ProcessLayout(aConfiguration, sLayoutName, rxContext, rxAnchorId);
638 }
639 catch (const RuntimeException&)
640 {
641 }
642}
643
645 PresenterConfigurationAccess& rConfiguration,
646 std::u16string_view rsLayoutName,
647 const Reference<XComponentContext>& rxContext,
648 const Reference<XResourceId>& rxAnchorId)
649{
650 try
651 {
652 Reference<container::XHierarchicalNameAccess> xLayoutNode (
653 rConfiguration.GetConfigurationNode(
654 OUString::Concat("Presenter/Layouts/")+rsLayoutName),
655 UNO_QUERY_THROW);
656
657 // Read the parent layout first, if one is referenced.
658 OUString sParentLayout;
660 xLayoutNode,
661 "ParentLayout") >>= sParentLayout;
662 if (!sParentLayout.isEmpty())
663 {
664 // Prevent infinite recursion.
665 if (rsLayoutName != sParentLayout)
666 ProcessLayout(rConfiguration, sParentLayout, rxContext, rxAnchorId);
667 }
668
669 // Process the actual layout list.
670 Reference<container::XNameAccess> xList (
672 xLayoutNode,
673 "Layout"),
674 UNO_QUERY_THROW);
675
676 ::std::vector<OUString> aProperties
677 {
678 "PaneURL",
679 "ViewURL",
680 "RelativeX",
681 "RelativeY",
682 "RelativeWidth",
683 "RelativeHeight"
684 };
686 xList,
688 [this, rxContext, rxAnchorId](std::vector<uno::Any> const& rArgs)
689 {
690 this->ProcessComponent(rArgs, rxContext, rxAnchorId);
691 });
692 }
693 catch (const RuntimeException&)
694 {
695 }
696}
697
699 PresenterConfigurationAccess& rConfiguration)
700{
701 try
702 {
703 Reference<container::XNameAccess> xViewDescriptionsNode (
704 rConfiguration.GetConfigurationNode("Presenter/Views"),
705 UNO_QUERY_THROW);
706
707 ::std::vector<OUString> aProperties
708 {
709 "ViewURL",
710 "Title",
711 "AccessibleTitle",
712 "IsOpaque"
713 };
715 xViewDescriptionsNode,
717 [this](std::vector<uno::Any> const& rArgs)
718 {
719 return this->ProcessViewDescription(rArgs);
720 });
721 }
722 catch (const RuntimeException&)
723 {
724 OSL_ASSERT(false);
725 }
726}
727
729 const ::std::vector<Any>& rValues,
730 const Reference<XComponentContext>& rxContext,
731 const Reference<XResourceId>& rxAnchorId)
732{
733 if (rValues.size() != 6)
734 return;
735
736 try
737 {
738 OUString sPaneURL;
739 OUString sViewURL;
740 double nX = 0;
741 double nY = 0;
742 double nWidth = 0;
743 double nHeight = 0;
744 rValues[0] >>= sPaneURL;
745 rValues[1] >>= sViewURL;
746 rValues[2] >>= nX;
747 rValues[3] >>= nY;
748 rValues[4] >>= nWidth;
749 rValues[5] >>= nHeight;
750
751 if (nX>=0 && nY>=0 && nWidth>0 && nHeight>0)
752 {
753 SetupView(
754 rxContext,
755 rxAnchorId,
756 sPaneURL,
757 sViewURL,
759 }
760 }
761 catch (const Exception&)
762 {
763 OSL_ASSERT(false);
764 }
765}
766
768 const ::std::vector<Any>& rValues)
769{
770 if (rValues.size() != 4)
771 return;
772
773 try
774 {
775 ViewDescriptor aViewDescriptor;
776 OUString sViewURL;
777 rValues[0] >>= sViewURL;
778 rValues[1] >>= aViewDescriptor.msTitle;
779 rValues[2] >>= aViewDescriptor.msAccessibleTitle;
780 rValues[3] >>= aViewDescriptor.mbIsOpaque;
781 if (aViewDescriptor.msAccessibleTitle.isEmpty())
782 aViewDescriptor.msAccessibleTitle = aViewDescriptor.msTitle;
783 maViewDescriptors[sViewURL] = aViewDescriptor;
784 }
785 catch (const Exception&)
786 {
787 OSL_ASSERT(false);
788 }
789}
790
792 const Reference<XComponentContext>& rxContext,
793 const Reference<XResourceId>& rxAnchorId,
794 const OUString& rsPaneURL,
795 const OUString& rsViewURL,
797{
798 Reference<XConfigurationController> xCC (mxConfigurationControllerWeak);
799 if (!xCC.is())
800 return;
801
802 Reference<XResourceId> xPaneId (ResourceId::createWithAnchor(rxContext,rsPaneURL,rxAnchorId));
803 // Look up the view descriptor.
804 ViewDescriptor aViewDescriptor;
805 ViewDescriptorContainer::const_iterator iDescriptor (maViewDescriptors.find(rsViewURL));
806 if (iDescriptor != maViewDescriptors.end())
807 aViewDescriptor = iDescriptor->second;
808
809 // Prepare the pane.
810 OSL_ASSERT(mpPaneContainer);
811 mpPaneContainer->PreparePane(
812 xPaneId,
813 rsViewURL,
814 aViewDescriptor.msTitle,
815 aViewDescriptor.msAccessibleTitle,
816 aViewDescriptor.mbIsOpaque,
817 rViewInitialization);
818}
819
820} // end of namespace ::sdext::presenter
821
822/* 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()
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 css::uno::Reference< css::frame::XController > &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
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
css::uno::Reference< css::frame::XController > mxController
::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 css::uno::Reference< css::frame::XController > &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 * sdext_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