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 
37 namespace sdext::presenter {
38 
40 
41 typedef ::cppu::WeakComponentImplHelper <
42  css::task::XJob, css::lang::XServiceInfo
44 
51  : private ::cppu::BaseMutex,
52  public PresenterScreenJobInterfaceBase
53 {
54 public:
55  PresenterScreenJob(const PresenterScreenJob&) = delete;
57 
58  virtual void SAL_CALL disposing() override;
59 
60  // XServiceInfo
61  virtual OUString SAL_CALL getImplementationName() override;
62  virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
63  virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames () override;
64 
65  // XJob
66  virtual css::uno::Any SAL_CALL execute(
67  const css::uno::Sequence<css::beans::NamedValue >& Arguments) override;
68 
69  explicit PresenterScreenJob (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
70  virtual ~PresenterScreenJob() override;
71 
72 private:
73  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
74 };
75 
87 typedef ::cppu::WeakComponentImplHelper <
88  css::lang::XEventListener
91  : private ::cppu::BaseMutex,
93 {
94 public:
96  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
97  const css::uno::Reference<css::frame::XModel2>& rxModel);
98  virtual ~PresenterScreen() override;
99  PresenterScreen(const PresenterScreen&) = delete;
100  PresenterScreen& operator=(const PresenterScreen&) = delete;
101 
102  virtual void SAL_CALL disposing() override;
103 
104  static bool isPresenterScreenEnabled(
105  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
109 
115 
118  void SwitchMonitors();
119 
120  // XEventListener
121 
122  virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
123 
124 private:
125  css::uno::Reference<css::frame::XModel2 > mxModel;
126  css::uno::Reference<css::frame::XController> mxController;
127  css::uno::WeakReference<css::drawing::framework::XConfigurationController>
129  css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak;
131  css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration;
133  css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory;
134  css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory;
135 
137  {
138  public:
139  OUString msTitle;
143  : mbIsOpaque(false)
144  {
145  }
146  };
147  typedef ::std::map<OUString,ViewDescriptor> ViewDescriptorContainer;
148  ViewDescriptorContainer maViewDescriptors;
149 
151 
154  void SetupPaneFactory (
155  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
156 
159  void SetupViewFactory (
160  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
161 
165  void SetupConfiguration (
166  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
167  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
168 
173  void ProcessLayout (
174  PresenterConfigurationAccess& rConfiguration,
175  const OUString& rsLayoutName,
176  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
177  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
178 
182  void ProcessComponent (
183  const ::std::vector<css::uno::Any>& rValues,
184  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
185  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
186 
190  PresenterConfigurationAccess& rConfiguration);
191 
195  const ::std::vector<css::uno::Any>& rValues);
196 
197  void SetupView (
198  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
199  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
200  const OUString& rsPaneURL,
201  const OUString& rsViewURL,
202  const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization);
203 
210  sal_Int32 GetPresenterScreenNumber (
211  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
212 
213  static sal_Int32 GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen );
214 
218  css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
219  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
220 };
221 
222 }
223 
224 #endif
225 
226 /* 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
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 ProcessLayout(PresenterConfigurationAccess &rConfiguration, const OUString &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...
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