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/drawing/framework/XConfigurationController.hpp>
31 #include <com/sun/star/presentation/XPresentation2.hpp>
32 #include <rtl/ref.hxx>
33 
34 #include <map>
35 
36 namespace sdext { namespace presenter {
37 
39 
40 typedef ::cppu::WeakComponentImplHelper <
41  css::task::XJob
43 typedef ::cppu::WeakComponentImplHelper <
44  css::lang::XEventListener
46 
53  : private ::cppu::BaseMutex,
54  public PresenterScreenJobInterfaceBase
55 {
56 public:
57  PresenterScreenJob(const PresenterScreenJob&) = delete;
59  static OUString getImplementationName_static();
60  static css::uno::Sequence< OUString > getSupportedServiceNames_static();
61  static css::uno::Reference<css::uno::XInterface> Create(
62  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
63 
64  virtual void SAL_CALL disposing() override;
65 
66  // XJob
67 
68  virtual css::uno::Any SAL_CALL execute(
69  const css::uno::Sequence<css::beans::NamedValue >& Arguments) override;
70 
71 private:
72  explicit PresenterScreenJob (const css::uno::Reference<css::uno::XComponentContext>& rxContext);
73  virtual ~PresenterScreenJob() override;
74 
75  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
76 };
77 
90  : private ::cppu::BaseMutex,
92 {
93 public:
95  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
96  const css::uno::Reference<css::frame::XModel2>& rxModel);
97  virtual ~PresenterScreen() override;
98  PresenterScreen(const PresenterScreen&) = delete;
99  PresenterScreen& operator=(const PresenterScreen&) = delete;
100 
101  virtual void SAL_CALL disposing() override;
102 
103  static bool isPresenterScreenEnabled(
104  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
108 
114 
117  void SwitchMonitors();
118 
119  // XEventListener
120 
121  virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
122 
123 private:
124  css::uno::Reference<css::frame::XModel2 > mxModel;
125  css::uno::Reference<css::frame::XController> mxController;
126  css::uno::WeakReference<css::drawing::framework::XConfigurationController>
128  css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak;
130  css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration;
132  css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory;
133  css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory;
134 
136  {
137  public:
138  OUString msTitle;
142  : mbIsOpaque(false)
143  {
144  }
145  };
146  typedef ::std::map<OUString,ViewDescriptor> ViewDescriptorContainer;
147  ViewDescriptorContainer maViewDescriptors;
148 
150 
153  void SetupPaneFactory (
154  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
155 
158  void SetupViewFactory (
159  const css::uno::Reference<css::uno::XComponentContext>& rxContext);
160 
164  void SetupConfiguration (
165  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
166  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
167 
172  void ProcessLayout (
173  PresenterConfigurationAccess& rConfiguration,
174  const OUString& rsLayoutName,
175  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
176  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
177 
181  void ProcessComponent (
182  const ::std::vector<css::uno::Any>& rValues,
183  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
184  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
185 
189  PresenterConfigurationAccess& rConfiguration);
190 
194  const ::std::vector<css::uno::Any>& rValues);
195 
196  void SetupView (
197  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
198  const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
199  const OUString& rsPaneURL,
200  const OUString& rsViewURL,
201  const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization);
202 
209  sal_Int32 GetPresenterScreenNumber (
210  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
211 
212  static sal_Int32 GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen );
213 
217  css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
218  const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
219 };
220 
221 } }
222 
223 #endif
224 
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XModel2 > mxModel
static css::uno::Sequence< OUString > getSupportedServiceNames_static()
css::uno::Reference< css::drawing::framework::XResourceFactory > mxViewFactory
::cppu::WeakComponentImplHelper< css::lang::XEventListener > PresenterScreenInterfaceBase
css::uno::WeakReference< css::uno::XComponentContext > mxContextWeak
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.
::cppu::WeakComponentImplHelper< css::task::XJob > PresenterScreenJobInterfaceBase
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
::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
This is the bootstrap class of the presenter screen.
static css::uno::Reference< css::uno::XInterface > Create(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
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.