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
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
38namespace sdext::presenter {
39
40class PresenterController;
41
42typedef ::cppu::WeakComponentImplHelper <
43 css::task::XJob, css::lang::XServiceInfo
45
52 : private ::cppu::BaseMutex,
54{
55public:
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
73private:
74 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
75};
76
88typedef ::cppu::WeakComponentImplHelper <
89 css::lang::XEventListener
92 : private ::cppu::BaseMutex,
94{
95public:
97 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
98 css::uno::Reference<css::frame::XModel2> xModel);
99 virtual ~PresenterScreen() override;
102
103 virtual void SAL_CALL disposing() override;
104
105 static bool isPresenterScreenEnabled(
106 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
107 static bool isPresenterScreenFullScreen(
108 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
109
113
119
122 void SwitchMonitors();
123
124 // XEventListener
125
126 virtual void SAL_CALL disposing ( const css::lang::EventObject& rEvent) override;
127
128private:
129 css::uno::Reference<css::frame::XModel2 > mxModel;
130 css::uno::Reference<css::frame::XController> mxController;
131 css::uno::WeakReference<css::drawing::framework::XConfigurationController>
133 css::uno::WeakReference<css::uno::XComponentContext> mxContextWeak;
135 css::uno::Reference<css::drawing::framework::XConfiguration> mxSavedConfiguration;
137 css::uno::Reference<css::drawing::framework::XResourceFactory> mxPaneFactory;
138 css::uno::Reference<css::drawing::framework::XResourceFactory> mxViewFactory;
139
141 {
142 public:
143 OUString msTitle;
147 : mbIsOpaque(false)
148 {
149 }
150 };
151 typedef ::std::map<OUString,ViewDescriptor> ViewDescriptorContainer;
153
155
158 void SetupPaneFactory (
159 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
160
163 void SetupViewFactory (
164 const css::uno::Reference<css::uno::XComponentContext>& rxContext);
165
169 void SetupConfiguration (
170 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
171 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
172
177 void ProcessLayout (
178 PresenterConfigurationAccess& rConfiguration,
179 std::u16string_view rsLayoutName,
180 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
181 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
182
186 void ProcessComponent (
187 const ::std::vector<css::uno::Any>& rValues,
188 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
189 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId);
190
194 PresenterConfigurationAccess& rConfiguration);
195
199 const ::std::vector<css::uno::Any>& rValues);
200
201 void SetupView (
202 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
203 const css::uno::Reference<css::drawing::framework::XResourceId>& rxAnchorId,
204 const OUString& rsPaneURL,
205 const OUString& rsViewURL,
206 const PresenterPaneContainer::ViewInitializationFunction& rViewInitialization);
207
214 sal_Int32 GetPresenterScreenNumber (
215 const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation) const;
216
217 static sal_Int32 GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen );
218
222 css::uno::Reference<css::drawing::framework::XResourceId> GetMainPaneId (
223 const css::uno::Reference<css::presentation::XPresentation2>& rxPresentation,
224 const css::uno::Reference<com::sun::star::uno::XComponentContext>& xContext) const;
225};
226
227}
228
229#endif
230
231/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class gives access to the configuration.
::std::function< void(const css::uno::Reference< css::drawing::framework::XView > &)> ViewInitializationFunction
The PresenterScreenJob service is instantiated every time a document is created or loaded.
virtual void SAL_CALL disposing() override
virtual css::uno::Any SAL_CALL execute(const css::uno::Sequence< css::beans::NamedValue > &Arguments) override
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
PresenterScreenJob & operator=(const PresenterScreenJob &)=delete
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
PresenterScreenJob(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
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
PresenterScreen(const PresenterScreen &)=delete
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...
::std::map< OUString, ViewDescriptor > ViewDescriptorContainer
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.
virtual void SAL_CALL disposing(const css::lang::EventObject &rEvent) override
void SwitchMonitors()
Switch / converse monitors between presenter view and slide output.
css::uno::Reference< css::drawing::framework::XResourceFactory > mxViewFactory
PresenterScreen & operator=(const PresenterScreen &)=delete
css::uno::Reference< css::frame::XController > mxController
::rtl::Reference< PresenterPaneContainer > mpPaneContainer
css::uno::WeakReference< css::drawing::framework::XConfigurationController > mxConfigurationControllerWeak
::cppu::WeakComponentImplHelper< css::task::XJob, css::lang::XServiceInfo > PresenterScreenJobInterfaceBase
::cppu::WeakComponentImplHelper< css::lang::XEventListener > PresenterScreenInterfaceBase
This is the bootstrap class of the presenter screen.
unsigned char sal_Bool