vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / presenter / PresenterController.hxx
blob22811fc44c6272076151da8d753a5e334bbc61f4
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 <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>
44 namespace sdext { namespace presenter {
46 class PresenterCanvasHelper;
47 class PresenterPaintManager;
48 class PresenterPaneAnimator;
49 class PresenterPaneContainer;
50 class PresenterPaneBorderPainter;
51 class PresenterTheme;
52 class PresenterWindowManager;
54 typedef ::cppu::WeakComponentImplHelper <
55 css::drawing::framework::XConfigurationChangeListener,
56 css::frame::XFrameActionListener,
57 css::awt::XKeyListener,
58 css::awt::XMouseListener
59 > PresenterControllerInterfaceBase;
61 /// Represents an element in the toolbar that shows the time elapsed since the presentation started.
62 class IPresentationTime
64 public:
65 virtual void restart() = 0;
66 virtual ~IPresentationTime();
69 /** The controller of the presenter screen is responsible for telling the
70 individual views which slides to show. Additionally it provides access
71 to frequently used values of the current theme.
73 class PresenterController
74 : protected ::cppu::BaseMutex,
75 public PresenterControllerInterfaceBase
77 public:
78 static ::rtl::Reference<PresenterController> Instance (
79 const css::uno::Reference<css::frame::XFrame>& rxFrame);
81 PresenterController (
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;
90 virtual void SAL_CALL disposing() override;
92 void UpdateCurrentSlide (const sal_Int32 nOffset);
94 SharedBitmapDescriptor
95 GetViewBackground (const OUString& rsViewURL) const;
96 PresenterTheme::SharedFontDescriptor
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;
102 const rtl::Reference<PresenterPaneContainer>& GetPaneContainer() 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>&
116 GetConfigurationController() const;
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);
121 bool IsAccessibilityActive() const { return mbIsAccessibilityActive;}
123 void HandleMouseClick (const css::awt::MouseEvent& rEvent);
124 void UpdatePaneTitles();
126 /** Request activation or deactivation of (some of) the views according
127 to the given parameters.
129 void RequestViews (
130 const bool bIsSlideSorterActive,
131 const bool bIsNotesViewActive,
132 const bool bIsHelpViewActive);
134 void SetPresentationTime(IPresentationTime* pPresentationTime);
135 IPresentationTime* GetPresentationTime();
137 // XConfigurationChangeListener
139 virtual void SAL_CALL notifyConfigurationChange (
140 const css::drawing::framework::ConfigurationChangeEvent& rEvent) override;
142 // XEventListener
144 virtual void SAL_CALL disposing (
145 const css::lang::EventObject& rEvent) override;
147 // XFrameActionListener
149 virtual void SAL_CALL frameAction (
150 const css::frame::FrameActionEvent& rEvent) override;
152 // XKeyListener
154 virtual void SAL_CALL keyPressed (const css::awt::KeyEvent& rEvent) override;
155 virtual void SAL_CALL keyReleased (const css::awt::KeyEvent& rEvent) override;
157 // XMouseListener
159 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
161 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
163 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
165 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
167 private:
168 typedef ::std::map<css::uno::Reference<css::frame::XFrame>,rtl::Reference<PresenterController> > InstanceContainer;
169 static InstanceContainer maInstances;
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>
176 mxConfigurationController;
177 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
178 css::uno::Reference<css::drawing::framework::XResourceId> mxMainPaneId;
179 rtl::Reference<PresenterPaneContainer> mpPaneContainer;
180 sal_Int32 mnCurrentSlideIndex;
181 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
182 css::uno::Reference<css::drawing::XDrawPage> mxNextSlide;
183 ::rtl::Reference<PresenterWindowManager> mpWindowManager;
184 std::shared_ptr<PresenterTheme> mpTheme;
185 css::uno::Reference<css::awt::XWindow> mxMainWindow;
186 ::rtl::Reference<PresenterPaneBorderPainter> mpPaneBorderPainter;
187 std::shared_ptr<PresenterCanvasHelper> mpCanvasHelper;
188 css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
189 std::shared_ptr<PresenterPaintManager> mpPaintManager;
190 sal_Int32 mnPendingSlideNumber;
191 css::uno::Reference<css::util::XURLTransformer> mxUrlTransformer;
192 ::rtl::Reference<PresenterAccessible> mpAccessibleObject;
193 bool mbIsAccessibilityActive;
194 IPresentationTime* mpPresentationTime;
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);
202 /** This method is called when the user pressed one of the numerical
203 keys. Depending on the modifier, numeric keys switch to another
204 slide (no modifier), or change to another view (Ctrl modifier).
205 @param nKey
206 Numeric value that is printed on the pressed key. For example
207 pressing the key '4' will result in the value 4, not the ASCII
208 code (0x34?).
209 @param nModifiers
210 The modifier bit field as provided by the key up event.
212 void HandleNumericKeyPress (const sal_Int32 nKey, const sal_Int32 nModifiers);
215 } } // end of namespace ::sdext::presenter
217 #endif
219 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */