LibreOffice Module sdext (master)  1
PresenterController.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_PRESENTERCONTROLLER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERCONTROLLER_HXX
22 
25 #include "PresenterTheme.hxx"
26 #include <cppuhelper/compbase.hxx>
27 #include <cppuhelper/basemutex.hxx>
28 #include <com/sun/star/awt/XKeyListener.hpp>
29 #include <com/sun/star/awt/XMouseListener.hpp>
30 #include <com/sun/star/drawing/XPresenterHelper.hpp>
31 #include <com/sun/star/frame/XController.hpp>
32 #include <com/sun/star/frame/XDispatch.hpp>
33 #include <com/sun/star/presentation/XSlideShowController.hpp>
34 #include <com/sun/star/frame/XFrameActionListener.hpp>
35 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
36 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
37 #include <com/sun/star/drawing/framework/XPane.hpp>
38 #include <com/sun/star/uno/XComponentContext.hpp>
39 #include <com/sun/star/util/XURLTransformer.hpp>
40 #include <rtl/ref.hxx>
41 #include <map>
42 #include <memory>
43 
44 namespace sdext::presenter {
45 
46 class PresenterCanvasHelper;
47 class PresenterPaintManager;
48 class PresenterPaneAnimator;
49 class PresenterPaneContainer;
50 class PresenterPaneBorderPainter;
51 class PresenterTheme;
53 
54 typedef ::cppu::WeakComponentImplHelper <
55  css::drawing::framework::XConfigurationChangeListener,
56  css::frame::XFrameActionListener,
57  css::awt::XKeyListener,
58  css::awt::XMouseListener
60 
63 {
64 public:
65  virtual void restart() = 0;
66  virtual bool isPaused() = 0;
67  virtual void setPauseStatus(const bool pauseStatus) = 0;
68  virtual ~IPresentationTime();
69 };
70 
76  : protected ::cppu::BaseMutex,
77  public PresenterControllerInterfaceBase
78 {
79 public:
80  static ::rtl::Reference<PresenterController> Instance (
81  const css::uno::Reference<css::frame::XFrame>& rxFrame);
82 
84  const css::uno::WeakReference<css::lang::XEventListener> &rxScreen,
85  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
86  const css::uno::Reference<css::frame::XController>& rxController,
87  const css::uno::Reference<css::presentation::XSlideShowController>& rxSlideShowController,
88  const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
89  const css::uno::Reference<css::drawing::framework::XResourceId>& rxMainPaneId);
90  virtual ~PresenterController() override;
91 
92  virtual void SAL_CALL disposing() override;
93 
94  void UpdateCurrentSlide (const sal_Int32 nOffset);
95 
97  GetViewBackground (const OUString& rsViewURL) const;
99  GetViewFont (const OUString& rsViewURL) const;
100  const std::shared_ptr<PresenterTheme>& GetTheme() const;
101  const ::rtl::Reference<PresenterWindowManager>& GetWindowManager() const;
102  const css::uno::Reference<css::presentation::XSlideShowController>&
103  GetSlideShowController() const;
105  const ::rtl::Reference<PresenterPaneBorderPainter>& GetPaneBorderPainter() const;
106  const std::shared_ptr<PresenterCanvasHelper>& GetCanvasHelper() const;
107  const css::uno::Reference<css::drawing::XPresenterHelper>& GetPresenterHelper() const;
108  const std::shared_ptr<PresenterPaintManager>& GetPaintManager() const;
109  double GetSlideAspectRatio() const;
110  void ShowView (const OUString& rsViewURL);
111  void HideView (const OUString& rsViewURL);
112  void SwitchMonitors();
113  void ExitPresenter();
114  void DispatchUnoCommand (const OUString& rsCommand) const;
115  css::uno::Reference<css::frame::XDispatch> GetDispatch (
116  const css::util::URL& rURL) const;
117  css::util::URL CreateURLFromString (const OUString& rsURL) const;
118  const css::uno::Reference<css::drawing::framework::XConfigurationController>&
120  const css::uno::Reference<css::drawing::XDrawPage>& GetCurrentSlide() const;
121  static bool HasTransition (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
122  static bool HasCustomAnimation (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
123  void SetAccessibilityActiveState (const bool bIsActive);
125 
126  void HandleMouseClick (const css::awt::MouseEvent& rEvent);
127  void UpdatePaneTitles();
128 
132  void RequestViews (
133  const bool bIsSlideSorterActive,
134  const bool bIsNotesViewActive,
135  const bool bIsHelpViewActive);
136 
137  void SetPresentationTime(IPresentationTime* pPresentationTime);
139 
140  // XConfigurationChangeListener
141 
142  virtual void SAL_CALL notifyConfigurationChange (
143  const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
144 
145  // XEventListener
146 
147  virtual void SAL_CALL disposing (
148  const css::lang::EventObject& rEvent) override;
149 
150  // XFrameActionListener
151 
152  virtual void SAL_CALL frameAction (
153  const css::frame::FrameActionEvent& rEvent) override;
154 
155  // XKeyListener
156 
157  virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
158  virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
159 
160  // XMouseListener
161 
162  virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
163 
164  virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
165 
166  virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
167 
168  virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
169 
170 private:
171  typedef ::std::map<css::uno::Reference<css::frame::XFrame>,rtl::Reference<PresenterController> > InstanceContainer;
172  static InstanceContainer maInstances;
173 
174  css::uno::WeakReference<css::lang::XEventListener> mxScreen;
175  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
176  css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas;
177  css::uno::Reference<css::frame::XController> mxController;
178  css::uno::Reference<css::drawing::framework::XConfigurationController>
180  css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
181  css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId;
184  css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
185  css::uno::Reference<css::drawing::XDrawPage> mxNextSlide;
187  std::shared_ptr<PresenterTheme> mpTheme;
188  css::uno::Reference<css::awt::XWindow> mxMainWindow;
190  std::shared_ptr<PresenterCanvasHelper> mpCanvasHelper;
191  css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
192  std::shared_ptr<PresenterPaintManager> mpPaintManager;
194  css::uno::Reference<css::util::XURLTransformer> mxUrlTransformer;
198 
199  void GetSlides (const sal_Int32 nOffset);
200  void UpdateViews();
201  void InitializeMainPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
202  void LoadTheme (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
203  void UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber);
204 
215  void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers);
216 };
217 
218 } // end of namespace ::sdext::presenter
219 
220 #endif
221 
222 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
static::rtl::Reference< PresenterController > Instance(const css::uno::Reference< css::frame::XFrame > &rxFrame)
const std::shared_ptr< PresenterPaintManager > & GetPaintManager() const
std::shared_ptr< FontDescriptor > SharedFontDescriptor
std::shared_ptr< PresenterCanvasHelper > mpCanvasHelper
css::uno::Reference< css::util::XURLTransformer > mxUrlTransformer
void DispatchUnoCommand(const OUString &rsCommand) const
Represents an element in the toolbar that shows the time elapsed since the presentation started...
css::uno::WeakReference< css::lang::XEventListener > mxScreen
const std::shared_ptr< PresenterTheme > & GetTheme() const
void HideView(const OUString &rsViewURL)
::rtl::Reference< PresenterAccessible > mpAccessibleObject
virtual void SAL_CALL frameAction(const css::frame::FrameActionEvent &rEvent) override
void InitializeMainPane(const css::uno::Reference< css::drawing::framework::XPane > &rxPane)
static bool HasCustomAnimation(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
css::util::URL CreateURLFromString(const OUString &rsURL) const
const ::rtl::Reference< PresenterPaneBorderPainter > & GetPaneBorderPainter() const
virtual void SAL_CALL keyPressed(const css::awt::KeyEvent &rEvent) override
const css::uno::Reference< css::drawing::XPresenterHelper > & GetPresenterHelper() const
std::shared_ptr< PresenterPaintManager > mpPaintManager
PresenterController(const css::uno::WeakReference< css::lang::XEventListener > &rxScreen, const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::frame::XController > &rxController, const css::uno::Reference< css::presentation::XSlideShowController > &rxSlideShowController, const rtl::Reference< PresenterPaneContainer > &rpPaneContainer, const css::uno::Reference< css::drawing::framework::XResourceId > &rxMainPaneId)
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
void GetSlides(const sal_Int32 nOffset)
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL disposing() override
::rtl::Reference< PresenterPaneBorderPainter > mpPaneBorderPainter
The controller of the presenter screen is responsible for telling the individual views which slides t...
virtual void SAL_CALL keyReleased(const css::awt::KeyEvent &rEvent) override
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
::cppu::WeakComponentImplHelper< css::drawing::framework::XConfigurationChangeListener, css::frame::XFrameActionListener, css::awt::XKeyListener, css::awt::XMouseListener > PresenterControllerInterfaceBase
void UpdateCurrentSlide(const sal_Int32 nOffset)
SharedBitmapDescriptor GetViewBackground(const OUString &rsViewURL) const
css::uno::Reference< css::rendering::XSpriteCanvas > mxCanvas
void SetPresentationTime(IPresentationTime *pPresentationTime)
void RequestViews(const bool bIsSlideSorterActive, const bool bIsNotesViewActive, const bool bIsHelpViewActive)
Request activation or deactivation of (some of) the views according to the given parameters.
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
PresenterTheme::SharedFontDescriptor GetViewFont(const OUString &rsViewURL) const
::std::map< css::uno::Reference< css::frame::XFrame >, rtl::Reference< PresenterController > > InstanceContainer
void ShowView(const OUString &rsViewURL)
A simple manager of the positions of the panes of the presenter screen.
rtl::Reference< PresenterPaneContainer > mpPaneContainer
const css::uno::Reference< css::presentation::XSlideShowController > & GetSlideShowController() const
void LoadTheme(const css::uno::Reference< css::drawing::framework::XPane > &rxPane)
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
const css::uno::Reference< css::drawing::XDrawPage > & GetCurrentSlide() const
css::uno::Reference< css::frame::XController > mxController
css::uno::Reference< css::frame::XDispatch > GetDispatch(const css::util::URL &rURL) const
css::uno::Reference< css::drawing::XDrawPage > mxCurrentSlide
const std::shared_ptr< PresenterCanvasHelper > & GetCanvasHelper() const
void UpdatePendingSlideNumber(const sal_Int32 nPendingSlideNumber)
void SetAccessibilityActiveState(const bool bIsActive)
const ::rtl::Reference< PresenterWindowManager > & GetWindowManager() const
const css::uno::Reference< css::drawing::framework::XConfigurationController > & GetConfigurationController() const
virtual void setPauseStatus(const bool pauseStatus)=0
css::uno::Reference< css::drawing::XDrawPage > mxNextSlide
const rtl::Reference< PresenterPaneContainer > & GetPaneContainer() const
css::uno::Reference< css::drawing::framework::XConfigurationController > mxConfigurationController
css::uno::Reference< css::drawing::XPresenterHelper > mxPresenterHelper
virtual void SAL_CALL notifyConfigurationChange(const css::drawing::framework::ConfigurationChangeEvent &rEvent) override
std::shared_ptr< PresenterTheme > mpTheme
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
::rtl::Reference< PresenterWindowManager > mpWindowManager
void HandleNumericKeyPress(const sal_Int32 nKey, const sal_Int32 nModifiers)
This method is called when the user pressed one of the numerical keys.
void HandleMouseClick(const css::awt::MouseEvent &rEvent)
static bool HasTransition(css::uno::Reference< css::drawing::XDrawPage > const &rxPage)
css::uno::Reference< css::awt::XWindow > mxMainWindow
css::uno::Reference< css::drawing::framework::XResourceId > mxMainPaneId