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 { namespace 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 ~IPresentationTime();
67 };
68 
74  : protected ::cppu::BaseMutex,
75  public PresenterControllerInterfaceBase
76 {
77 public:
78  static ::rtl::Reference<PresenterController> Instance (
79  const css::uno::Reference<css::frame::XFrame>& rxFrame);
80 
82  const css::uno::WeakReference<css::lang::XEventListener> &rxScreen,
83  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
84  const css::uno::Reference<css::frame::XController>& rxController,
85  const css::uno::Reference<css::presentation::XSlideShowController>& rxSlideShowController,
86  const rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
87  const css::uno::Reference<css::drawing::framework::XResourceId>& rxMainPaneId);
88  virtual ~PresenterController() override;
89 
90  virtual void SAL_CALL disposing() override;
91 
92  void UpdateCurrentSlide (const sal_Int32 nOffset);
93 
95  GetViewBackground (const OUString& rsViewURL) const;
97  GetViewFont (const OUString& rsViewURL) const;
98  const std::shared_ptr<PresenterTheme>& GetTheme() const;
99  const ::rtl::Reference<PresenterWindowManager>& GetWindowManager() const;
100  const css::uno::Reference<css::presentation::XSlideShowController>&
101  GetSlideShowController() const;
103  const ::rtl::Reference<PresenterPaneBorderPainter>& GetPaneBorderPainter() const;
104  const std::shared_ptr<PresenterCanvasHelper>& GetCanvasHelper() const;
105  const css::uno::Reference<css::drawing::XPresenterHelper>& GetPresenterHelper() const;
106  const std::shared_ptr<PresenterPaintManager>& GetPaintManager() const;
107  double GetSlideAspectRatio() const;
108  void ShowView (const OUString& rsViewURL);
109  void HideView (const OUString& rsViewURL);
110  void SwitchMonitors();
111  void DispatchUnoCommand (const OUString& rsCommand) const;
112  css::uno::Reference<css::frame::XDispatch> GetDispatch (
113  const css::util::URL& rURL) const;
114  css::util::URL CreateURLFromString (const OUString& rsURL) const;
115  const css::uno::Reference<css::drawing::framework::XConfigurationController>&
117  const css::uno::Reference<css::drawing::XDrawPage>& GetCurrentSlide() const;
118  static bool HasTransition (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
119  static bool HasCustomAnimation (css::uno::Reference<css::drawing::XDrawPage> const & rxPage);
120  void SetAccessibilityActiveState (const bool bIsActive);
122 
123  void HandleMouseClick (const css::awt::MouseEvent& rEvent);
124  void UpdatePaneTitles();
125 
129  void RequestViews (
130  const bool bIsSlideSorterActive,
131  const bool bIsNotesViewActive,
132  const bool bIsHelpViewActive);
133 
134  void SetPresentationTime(IPresentationTime* pPresentationTime);
136 
137  // XConfigurationChangeListener
138 
139  virtual void SAL_CALL notifyConfigurationChange (
140  const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
141 
142  // XEventListener
143 
144  virtual void SAL_CALL disposing (
145  const css::lang::EventObject& rEvent) override;
146 
147  // XFrameActionListener
148 
149  virtual void SAL_CALL frameAction (
150  const css::frame::FrameActionEvent& rEvent) override;
151 
152  // XKeyListener
153 
154  virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
155  virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
156 
157  // XMouseListener
158 
159  virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
160 
161  virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
162 
163  virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
164 
165  virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
166 
167 private:
168  typedef ::std::map<css::uno::Reference<css::frame::XFrame>,rtl::Reference<PresenterController> > InstanceContainer;
169  static InstanceContainer maInstances;
170 
171  css::uno::WeakReference<css::lang::XEventListener> mxScreen;
172  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
173  css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas;
174  css::uno::Reference<css::frame::XController> mxController;
175  css::uno::Reference<css::drawing::framework::XConfigurationController>
177  css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
178  css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId;
181  css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
182  css::uno::Reference<css::drawing::XDrawPage> mxNextSlide;
184  std::shared_ptr<PresenterTheme> mpTheme;
185  css::uno::Reference<css::awt::XWindow> mxMainWindow;
187  std::shared_ptr<PresenterCanvasHelper> mpCanvasHelper;
188  css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
189  std::shared_ptr<PresenterPaintManager> mpPaintManager;
191  css::uno::Reference<css::util::XURLTransformer> mxUrlTransformer;
195 
196  void GetSlides (const sal_Int32 nOffset);
197  void UpdateViews();
198  void InitializeMainPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
199  void LoadTheme (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
200  void UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber);
201 
212  void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers);
213 };
214 
215 } } // end of namespace ::sdext::presenter
216 
217 #endif
218 
219 /* 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
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