fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sdext / source / presenter / PresenterController.hxx
blob88d3d3ad1ca7bee432d4bc081136149ef7ee7bd3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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_PRESENTERCONTROLLER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERCONTROLLER_HXX
23 #include "PresenterAccessibility.hxx"
24 #include "PresenterPaneContainer.hxx"
25 #include "PresenterTheme.hxx"
26 #include "PresenterSprite.hxx"
27 #include <cppuhelper/compbase6.hxx>
28 #include <cppuhelper/basemutex.hxx>
29 #include <com/sun/star/awt/FontDescriptor.hpp>
30 #include <com/sun/star/awt/XFocusListener.hpp>
31 #include <com/sun/star/awt/XKeyListener.hpp>
32 #include <com/sun/star/awt/XMouseListener.hpp>
33 #include <com/sun/star/drawing/XPresenterHelper.hpp>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/frame/XDispatch.hpp>
36 #include <com/sun/star/beans/XPropertySet.hpp>
37 #include <com/sun/star/presentation/XSlideShowController.hpp>
38 #include <com/sun/star/presentation/XSlideShowListener.hpp>
39 #include <com/sun/star/frame/XFrameActionListener.hpp>
40 #include <com/sun/star/drawing/framework/XConfigurationChangeListener.hpp>
41 #include <com/sun/star/drawing/framework/XConfigurationController.hpp>
42 #include <com/sun/star/drawing/framework/XPane.hpp>
43 #include <com/sun/star/uno/XComponentContext.hpp>
44 #include <com/sun/star/util/Color.hpp>
45 #include <com/sun/star/util/XURLTransformer.hpp>
46 #include <rtl/ref.hxx>
47 #include <map>
48 #include <boost/shared_ptr.hpp>
50 namespace sdext { namespace presenter {
52 class PresenterCanvasHelper;
53 class PresenterPaintManager;
54 class PresenterPaneAnimator;
55 class PresenterPaneContainer;
56 class PresenterPaneBorderPainter;
57 class PresenterTheme;
58 class PresenterWindowManager;
60 namespace {
61 typedef ::cppu::WeakComponentImplHelper6 <
62 css::drawing::framework::XConfigurationChangeListener,
63 css::frame::XFrameActionListener,
64 css::awt::XKeyListener,
65 css::awt::XFocusListener,
66 css::awt::XMouseListener,
67 css::awt::XMouseMotionListener
68 > PresenterControllerInterfaceBase;
71 /** The controller of the presenter screen is responsible for telling the
72 individual views which slides to show. Additionally it provides access
73 to frequently used values of the current theme.
75 class PresenterController
76 : protected ::cppu::BaseMutex,
77 public PresenterControllerInterfaceBase
79 public:
80 static ::rtl::Reference<PresenterController> Instance (
81 const css::uno::Reference<css::frame::XFrame>& rxFrame);
83 PresenterController (
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();
92 virtual void SAL_CALL disposing() SAL_OVERRIDE;
94 void UpdateCurrentSlide (const sal_Int32 nOffset);
96 SharedBitmapDescriptor
97 GetViewBackground (const OUString& rsViewURL) const;
98 PresenterTheme::SharedFontDescriptor
99 GetViewFont (const OUString& rsViewURL) const;
100 ::boost::shared_ptr<PresenterTheme> GetTheme() const;
101 ::rtl::Reference<PresenterWindowManager> GetWindowManager() const;
102 css::uno::Reference<css::presentation::XSlideShowController>
103 GetSlideShowController() const;
104 rtl::Reference<PresenterPaneContainer> GetPaneContainer() const;
105 ::rtl::Reference<PresenterPaneBorderPainter> GetPaneBorderPainter() const;
106 ::boost::shared_ptr<PresenterCanvasHelper> GetCanvasHelper() const;
107 css::uno::Reference<css::drawing::XPresenterHelper> GetPresenterHelper() const;
108 ::boost::shared_ptr<PresenterPaintManager> GetPaintManager() const;
109 void HideSlideSorter();
110 double GetSlideAspectRatio() const;
111 void ShowView (const OUString& rsViewURL);
112 void HideView (const OUString& rsViewURL);
113 void SwitchMonitors();
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 css::uno::Reference<css::drawing::framework::XConfigurationController>
119 GetConfigurationController() const;
120 css::uno::Reference<css::drawing::XDrawPage> GetCurrentSlide() const;
121 static bool HasTransition (css::uno::Reference<css::drawing::XDrawPage>& rxPage);
122 static bool HasCustomAnimation (css::uno::Reference<css::drawing::XDrawPage>& rxPage);
123 void SetAccessibilityActiveState (const bool bIsActive);
124 bool IsAccessibilityActive() const { return mbIsAccessibilityActive;}
126 void HandleMouseClick (const css::awt::MouseEvent& rEvent);
127 void UpdatePaneTitles();
129 /** Request activation or deactivation of (some of) the views according
130 to the given parameters.
132 void RequestViews (
133 const bool bIsSlideSorterActive,
134 const bool bIsNotesViewActive,
135 const bool bIsHelpViewActive);
137 // XConfigurationChangeListener
139 virtual void SAL_CALL notifyConfigurationChange (
140 const css::drawing::framework::ConfigurationChangeEvent& rEvent)
141 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
143 // XEventListener
145 virtual void SAL_CALL disposing (
146 const css::lang::EventObject& rEvent)
147 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
149 // XFrameActionListener
151 virtual void SAL_CALL frameAction (
152 const css::frame::FrameActionEvent& rEvent)
153 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
155 // XKeyListener
157 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent)
158 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
159 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent)
160 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
162 // XFocusListener
164 virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent)
165 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
166 virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent)
167 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
169 // XMouseListener
171 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent)
172 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
174 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent)
175 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
177 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent)
178 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
180 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent)
181 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
183 // XMouseMotionListener
185 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent)
186 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
188 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent)
189 throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
191 private:
192 typedef ::std::map<css::uno::Reference<css::frame::XFrame>,rtl::Reference<PresenterController> > InstanceContainer;
193 static InstanceContainer maInstances;
195 css::uno::WeakReference<css::lang::XEventListener> mxScreen;
196 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
197 css::uno::Reference<css::rendering::XSpriteCanvas> mxCanvas;
198 css::uno::Reference<css::frame::XController> mxController;
199 css::uno::Reference<css::drawing::framework::XConfigurationController>
200 mxConfigurationController;
201 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
202 css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId;
203 rtl::Reference<PresenterPaneContainer> mpPaneContainer;
204 sal_Int32 mnCurrentSlideIndex;
205 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
206 css::uno::Reference<css::drawing::XDrawPage> mxNextSlide;
207 ::rtl::Reference<PresenterWindowManager> mpWindowManager;
208 ::boost::shared_ptr<PresenterPaneAnimator> mpCurrentPaneAnimation;
209 sal_Int32 mnWindowBackgroundColor;
210 ::boost::shared_ptr<PresenterTheme> mpTheme;
211 css::uno::Reference<css::awt::XWindow> mxMainWindow;
212 ::rtl::Reference<PresenterPaneBorderPainter> mpPaneBorderPainter;
213 ::boost::shared_ptr<PresenterCanvasHelper> mpCanvasHelper;
214 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
215 ::boost::shared_ptr<PresenterPaintManager> mpPaintManager;
216 sal_Int32 mnPendingSlideNumber;
217 css::uno::Reference<css::util::XURLTransformer> mxUrlTransformer;
218 ::rtl::Reference<PresenterAccessible> mpAccessibleObject;
219 bool mbIsAccessibilityActive;
221 void InitializePresenterScreen();
222 void InitializeSlideShowView (const css::uno::Reference<css::uno::XInterface>& rxView);
223 void GetSlides (const sal_Int32 nOffset);
224 void UpdateViews();
225 void InitializeMainPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
226 void LoadTheme (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
227 void UpdatePendingSlideNumber (const sal_Int32 nPendingSlideNumber);
229 /** This method is called when the user pressed one of the numerical
230 keys. Depending on the modifier, numeric keys switch to another
231 slide (no modifier), or change to another view (Ctrl modifier).
232 @param nKey
233 Numeric value that is printed on the pressed key. For example
234 pressing the key '4' will result in the value 4, not the ASCII
235 code (0x34?).
236 @param nModifiers
237 The modifier bit field as provided by the key up event.
239 void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers);
241 void ThrowIfDisposed() const throw (css::lang::DisposedException);
244 } } // end of namespace ::sdext::presenter
246 #endif
248 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */