LibreOffice Module sdext (master)  1
PresenterScreen.hxx
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 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSCREEN_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSCREEN_HXX
22 
25 #include <cppuhelper/compbase.hxx>
26 #include <cppuhelper/basemutex.hxx>
27 #include <com/sun/star/frame/XController.hpp>
28 #include <com/sun/star/frame/XModel2.hpp>
29 #include <com/sun/star/task/XJob.hpp>
30 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
32 #include <com/sun/star/presentation/XPresentation2.hpp>
33 #include <rtl/ref.hxx>
34 
35 #include <map>
36 #include <string_view>
37 
38 namespace sdext::presenter {
39 
41 
42 typedef ::cppu::WeakComponentImplHelper <
43  css::task::XJob, css::lang::XServiceInfo
45 
52  : private ::cppu::BaseMutex,
53  public PresenterScreenJobInterfaceBase
54 {
55 public:
56  PresenterScreenJob(const PresenterScreenJob&) = delete;
58 
59  virtual void SAL_CALL disposing() override;
60 
61  // XServiceInfo
62  virtual OUString SAL_CALL getImplementationName() override;
63  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
64  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
65 
66  // XJob
67  virtual css::uno::Any SAL_CALL execute(
68  const css::uno::Sequence<css::beans::NamedValue >& Arguments) override;
69 
70  explicit PresenterScreenJob (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
71  virtual ~PresenterScreenJob() override;
72 
73 private:
74  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
75 };
76 
88 typedef ::cppu::WeakComponentImplHelper <
89  css::lang::XEventListener
92  : private ::cppu::BaseMutex,
94 {
95 public:
97  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
98  const css::uno::Reference<css::frame::XModel2>& rxModel);
99  virtual ~PresenterScreen() override;
100  PresenterScreen(const PresenterScreen&) = delete;
101  PresenterScreen& operator=(const PresenterScreen&) = delete;
102 
103  virtual void SAL_CALL disposing() override;
104 
105  static bool isPresenterScreenEnabled(
106  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
110 
116 
119  void SwitchMonitors();
120 
121  // XEventListener
122 
123  virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
124 
125 private:
126  css::uno::Reference<css::frame::XModel2 > mxModel;
127  css::uno::Reference<css::frame::XController> mxController;
128  css::uno::WeakReference<css::drawing::framework::XConfigurationController>
130  css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak;
132  css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration;
134  css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory;
135  css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory;
136 
138  {
139  public:
140  OUString msTitle;
144  : mbIsOpaque(false)
145  {
146  }
147  };
148  typedef ::std::map<OUString,ViewDescriptor> ViewDescriptorContainer;
149  ViewDescriptorContainer maViewDescriptors;
150 
152 
155  void SetupPaneFactory (
156  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
157 
160  void SetupViewFactory (
161  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
162 
166  void SetupConfiguration (
167  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
168  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
169 
174  void ProcessLayout (
175  PresenterConfigurationAccess& rConfiguration,
176  std::u16string_view rsLayoutName,
177  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
178  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
179 
183  void ProcessComponent (
184  const ::std::vector<css::uno::Any>& rValues,
185  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
186  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
187 
191  PresenterConfigurationAccess& rConfiguration);
192 
196  const ::std::vector<css::uno::Any>& rValues);
197 
198  void SetupView (
199  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
200  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
201  const OUString& rsPaneURL,
202  const OUString& rsViewURL,
203  const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization);
204 
211  sal_Int32 GetPresenterScreenNumber (
212  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
213 
214  static sal_Int32 GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen );
215 
219  css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
220  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
221 };
222 
223 }
224 
225 #endif
226 
227 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::frame::XModel2 > mxModel
css::uno::Reference< css::drawing::framework::XResourceFactory > mxViewFactory
::cppu::WeakComponentImplHelper< css::lang::XEventListener > PresenterScreenInterfaceBase
This is the bootstrap class of the presenter screen.
css::uno::WeakReference< css::uno::XComponentContext > mxContextWeak
::cppu::WeakComponentImplHelper< css::task::XJob, css::lang::XServiceInfo > PresenterScreenJobInterfaceBase
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...
virtual void SAL_CALL disposing() override
static sal_Int32 GetPresenterScreenFromScreen(sal_Int32 nPresentationScreen)
PresenterScreenJob(const PresenterScreenJob &)=delete
This class gives access to the configuration.
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 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)
The controller of the presenter screen is responsible for telling the individual views which slides t...
void SwitchMonitors()
Switch / converse monitors between presenter view and slide output.
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...
void InitializePresenterScreen()
Make the presenter screen visible.
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
void SetupPaneFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Create and initialize the factory for presenter view specific panes.
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...
::std::function< void(const css::uno::Reference< css::drawing::framework::XView > &)> ViewInitializationFunction
unsigned char sal_Bool
::std::map< OUString, ViewDescriptor > ViewDescriptorContainer
css::uno::Reference< css::drawing::framework::XResourceId > GetMainPaneId(const css::uno::Reference< css::presentation::XPresentation2 > &rxPresentation) const
Create a resource id for the full screen background pane so that it is displayed on another screen th...
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
css::uno::Reference< css::frame::XController > mxController
css::uno::Reference< css::drawing::framework::XResourceFactory > mxPaneFactory
void ProcessViewDescriptions(PresenterConfigurationAccess &rConfiguration)
Read the view descriptions from the configuration.
::rtl::Reference< PresenterPaneContainer > mpPaneContainer
::rtl::Reference< PresenterController > mpPresenterController
The PresenterScreenJob service is instantiated every time a document is created or loaded...
PresenterScreenJob & operator=(const PresenterScreenJob &)=delete
PresenterScreen & operator=(const PresenterScreen &)=delete
css::uno::WeakReference< css::drawing::framework::XConfigurationController > mxConfigurationControllerWeak
ViewDescriptorContainer maViewDescriptors
void SetupViewFactory(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
Create and initialize the factory for presenter view specific views.
css::uno::Reference< css::drawing::framework::XConfiguration > mxSavedConfiguration
void RequestShutdownPresenterScreen()
Do not call ShutdownPresenterScreen() directly.
static bool isPresenterScreenEnabled(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
PresenterScreen(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XModel2 > &rxModel)
virtual void SAL_CALL disposing() override
void ProcessViewDescription(const ::std::vector< css::uno::Any > &rValues)
Called by ProcessViewDescriptions for a single entry.
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override