1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSCREEN_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERSCREEN_HXX
23 #include "PresenterConfigurationAccess.hxx"
24 #include "PresenterPaneContainer.hxx"
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>
36 namespace sdext
{ namespace presenter
{
38 class PresenterController
;
40 typedef ::cppu::WeakComponentImplHelper
<
42 > PresenterScreenJobInterfaceBase
;
43 typedef ::cppu::WeakComponentImplHelper
<
44 css::lang::XEventListener
45 > PresenterScreenInterfaceBase
;
47 /** The PresenterScreenJob service is instantiated every time a document is
48 created or loaded. In its execute() method it then filters out all
49 non-Impress documents and creates and registers a new PresenterScreen
52 class PresenterScreenJob
53 : private ::cppu::BaseMutex
,
54 public PresenterScreenJobInterfaceBase
57 PresenterScreenJob(const PresenterScreenJob
&) = delete;
58 PresenterScreenJob
& operator=(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
);
64 virtual void SAL_CALL
disposing() override
;
68 virtual css::uno::Any SAL_CALL
execute(
69 const css::uno::Sequence
<css::beans::NamedValue
>& Arguments
) override
;
72 explicit PresenterScreenJob (const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
73 virtual ~PresenterScreenJob() override
;
75 css::uno::Reference
<css::uno::XComponentContext
> mxComponentContext
;
78 /** This is the bootstrap class of the presenter screen. It is registered
79 as drawing framework startup service. That means that every drawing
80 framework instance creates an instance of this class.
82 <p>A PresenterScreen object registers itself as listener for drawing
83 framework configuration changes. It waits for the full screen marker (a
84 top level resource) to appear in the current configuration. When that
85 happens the actual presenter screen is initialized. A new
86 PresenterController is created and takes over the task of controlling
87 the presenter screen.</p>
90 : private ::cppu::BaseMutex
,
91 public PresenterScreenInterfaceBase
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;
101 virtual void SAL_CALL
disposing() override
;
103 static bool isPresenterScreenEnabled(
104 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
105 /** Make the presenter screen visible.
107 void InitializePresenterScreen();
109 /** Do not call ShutdownPresenterScreen() directly. Call
110 RequestShutdownPresenterScreen() instead. It will issue an
111 asynchronous call to ShutdownPresenterScreen() when that is safe.
113 void RequestShutdownPresenterScreen();
115 /** Switch / converse monitors between presenter view and slide output
117 void SwitchMonitors();
121 virtual void SAL_CALL
disposing ( const css::lang::EventObject
& rEvent
) override
;
124 css::uno::Reference
<css::frame::XModel2
> mxModel
;
125 css::uno::Reference
<css::frame::XController
> mxController
;
126 css::uno::WeakReference
<css::drawing::framework::XConfigurationController
>
127 mxConfigurationControllerWeak
;
128 css::uno::WeakReference
<css::uno::XComponentContext
> mxContextWeak
;
129 ::rtl::Reference
<PresenterController
> mpPresenterController
;
130 css::uno::Reference
<css::drawing::framework::XConfiguration
> mxSavedConfiguration
;
131 ::rtl::Reference
<PresenterPaneContainer
> mpPaneContainer
;
132 css::uno::Reference
<css::drawing::framework::XResourceFactory
> mxPaneFactory
;
133 css::uno::Reference
<css::drawing::framework::XResourceFactory
> mxViewFactory
;
139 OUString msAccessibleTitle
;
146 typedef ::std::map
<OUString
,ViewDescriptor
> ViewDescriptorContainer
;
147 ViewDescriptorContainer maViewDescriptors
;
149 void ShutdownPresenterScreen();
151 /** Create and initialize the factory for presenter view specific panes.
153 void SetupPaneFactory (
154 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
156 /** Create and initialize the factory for presenter view specific views.
158 void SetupViewFactory (
159 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
);
161 /** Read the current layout from the configuration and call
162 ProcessLayout to bring it on to the screen.
164 void SetupConfiguration (
165 const css::uno::Reference
<css::uno::XComponentContext
>& rxContext
,
166 const css::uno::Reference
<css::drawing::framework::XResourceId
>& rxAnchorId
);
168 /** Read one layout from the configuration and make resource activation
169 requests to bring it on to the screen. When one layout references a
170 parent layout then this method calls itself recursively.
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
);
178 /** Called by ProcessLayout for a single entry of a Layouts
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
);
186 /** Read the view descriptions from the configuration.
188 void ProcessViewDescriptions (
189 PresenterConfigurationAccess
& rConfiguration
);
191 /** Called by ProcessViewDescriptions for a single entry.
193 void ProcessViewDescription (
194 const ::std::vector
<css::uno::Any
>& rValues
);
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
);
203 /** Return the built-in screen number on the presentation will normally
204 display the presenter console.
206 Returns -1 when the presenter screen can or shall not be
209 sal_Int32
GetPresenterScreenNumber (
210 const css::uno::Reference
<css::presentation::XPresentation2
>& rxPresentation
) const;
212 static sal_Int32
GetPresenterScreenFromScreen( sal_Int32 nPresentationScreen
);
214 /** Create a resource id for the full screen background pane so that it
215 is displayed on another screen than the full screen presentation.
217 css::uno::Reference
<css::drawing::framework::XResourceId
> GetMainPaneId (
218 const css::uno::Reference
<css::presentation::XPresentation2
>& rxPresentation
) const;
225 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */