LibreOffice Module sdext (master)  1
PresenterWindowManager.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_PRESENTERWINDOWMANAGER_HXX
21 #define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERWINDOWMANAGER_HXX
22 
24 #include "PresenterTheme.hxx"
25 #include <com/sun/star/awt/Size.hpp>
26 #include <com/sun/star/awt/XFocusListener.hpp>
27 #include <com/sun/star/awt/XPaintListener.hpp>
28 #include <com/sun/star/awt/XWindow.hpp>
29 #include <com/sun/star/awt/XWindowListener.hpp>
30 #include <com/sun/star/document/XEventListener.hpp>
31 #include <com/sun/star/drawing/framework/XPane.hpp>
32 #include <com/sun/star/rendering/XBitmap.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
34 #include <cppuhelper/basemutex.hxx>
35 #include <cppuhelper/compbase.hxx>
36 #include <rtl/ref.hxx>
37 #include <memory>
38 
39 namespace sdext::presenter {
40 
41 class PresenterController;
42 class PresenterPaneBorderPainter;
44 
45 typedef ::cppu::WeakComponentImplHelper<
46  css::awt::XWindowListener,
47  css::awt::XPaintListener,
48  css::awt::XMouseListener,
49  css::awt::XFocusListener
51 
57  : protected ::cppu::BaseMutex,
58  public PresenterWindowManagerInterfaceBase
59 {
60 public:
62  const css::uno::Reference<css::uno::XComponentContext>& rxContext,
63  const ::rtl::Reference<PresenterPaneContainer>& rpPaneContainer,
64  const ::rtl::Reference<PresenterController>& rpPresenterController);
65  virtual ~PresenterWindowManager() override;
68 
69  void SAL_CALL disposing() override;
70 
71  void SetParentPane (const css::uno::Reference<css::drawing::framework::XPane>& rxPane);
72  void SetTheme (const std::shared_ptr<PresenterTheme>& rpTheme);
73  void NotifyViewCreation (const css::uno::Reference<css::drawing::framework::XView>& rxView);
75  const OUString& rsPaneURL,
76  const double nX,
77  const double nY,
78  const double nWidth,
79  const double nHeight);
80  void SetPaneBorderPainter (const ::rtl::Reference<PresenterPaneBorderPainter>& rPainter);
81  void Update();
82  void Layout();
83 
84  void SetSlideSorterState (bool bIsActive);
85  void SetHelpViewState (bool bIsActive);
86  void SetPauseState (bool bIsPaused);
87 
89 private:
90  void SetLayoutMode (const LayoutMode eMode);
91 
92 public:
97  void SetViewMode (const ViewMode eMode);
98 
99  ViewMode GetViewMode() const;
100 
104  void RestoreViewMode();
105 
106  void AddLayoutListener (
107  const css::uno::Reference<css::document::XEventListener>& rxListener);
108  void RemoveLayoutListener (
109  const css::uno::Reference<css::document::XEventListener>& rxListener);
110 
111  // XWindowListener
112 
113  virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
114 
115  virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
116 
117  virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
118 
119  virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
120 
121  // XPaintListener
122 
123  virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
124 
125  // XMouseListener
126 
127  virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
128 
129  virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
130 
131  virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
132 
133  virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
134 
135  // XFocusListener
136 
137  virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent) override;
138 
139  virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent) override;
140 
141  // XEventListener
142 
143  virtual void SAL_CALL disposing (
144  const css::lang::EventObject& rEvent) override;
145 
146 private:
147  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
149  css::uno::Reference<css::awt::XWindow> mxParentWindow;
150  css::uno::Reference<css::rendering::XCanvas> mxParentCanvas;
151  css::uno::Reference<css::uno::XInterface> mxPaneBorderManager;
160  std::shared_ptr<PresenterTheme> mpTheme;
162  css::uno::Reference<css::rendering::XBitmap> mxScaledBackgroundBitmap;
163  css::uno::Reference<css::rendering::XPolyPolygon2D> mxClipPolygon;
168  typedef ::std::vector<css::uno::Reference<css::document::XEventListener> >
172 
173  void PaintChildren (const css::awt::PaintEvent& rEvent) const;
174  void UpdateWindowSize (const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
175  void PaintBackground (const css::awt::Rectangle& rUpdateBox);
177  css::uno::Reference<css::rendering::XPolyPolygon2D> CreateClipPolyPolygon() const;
178 
179  void StoreViewMode (const ViewMode eViewMode);
180 
181  void LayoutStandardMode();
182  void LayoutNotesMode();
183  void LayoutSlideSorterMode();
184  void LayoutHelpMode();
185 
188  css::geometry::RealRectangle2D LayoutToolBar();
189 
190  css::awt::Size CalculatePaneSize (
191  const double nOuterWidth,
192  const OUString& rsPaneURL);
193 
196  void NotifyLayoutModeChange();
197 
198  void NotifyDisposing();
199 
201  void ThrowIfDisposed() const;
202 };
203 
204 }
205 
206 #endif
207 
208 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::rtl::Reference< PresenterController > mpPresenterController
css::uno::Reference< css::rendering::XCanvas > mxParentCanvas
void PaintChildren(const css::awt::PaintEvent &rEvent) const
css::uno::Reference< css::rendering::XBitmap > mxScaledBackgroundBitmap
::std::vector< css::uno::Reference< css::document::XEventListener > > LayoutListenerContainer
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
bool mbIsLayouting
This flag is set to while the Layout() method is being executed.
void RestoreViewMode()
Restore the layout mode (or slide sorter state) from the configuration.
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
css::uno::Reference< css::uno::XInterface > mxPaneBorderManager
::cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XFocusListener > PresenterWindowManagerInterfaceBase
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
void SetViewMode(const ViewMode eMode)
The high-level method to switch the view mode.
std::shared_ptr< PresenterBitmapContainer::BitmapDescriptor > SharedBitmapDescriptor
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
std::shared_ptr< PresenterTheme > mpTheme
virtual void SAL_CALL focusGained(const css::awt::FocusEvent &rEvent) override
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
A theme is a set of properties describing fonts, colors, and bitmaps to be used to draw background...
void SetTheme(const std::shared_ptr< PresenterTheme > &rpTheme)
::rtl::Reference< PresenterPaneBorderPainter > mpPaneBorderPainter
void RemoveLayoutListener(const css::uno::Reference< css::document::XEventListener > &rxListener)
PresenterWindowManager(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const ::rtl::Reference< PresenterPaneContainer > &rpPaneContainer, const ::rtl::Reference< PresenterController > &rpPresenterController)
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::geometry::RealRectangle2D LayoutToolBar()
Layout the tool bar and return its outer bounding box.
void SetParentPane(const css::uno::Reference< css::drawing::framework::XPane > &rxPane)
void SetPaneBorderPainter(const ::rtl::Reference< PresenterPaneBorderPainter > &rPainter)
void AddLayoutListener(const css::uno::Reference< css::document::XEventListener > &rxListener)
A simple manager of the positions of the panes of the presenter screen.
css::uno::Reference< css::rendering::XPolyPolygon2D > mxClipPolygon
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::awt::Size CalculatePaneSize(const double nOuterWidth, const OUString &rsPaneURL)
::rtl::Reference< PresenterPaneContainer > mpPaneContainer
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
void PaintBackground(const css::awt::Rectangle &rUpdateBox)
void SetPanePosSizeAbsolute(const OUString &rsPaneURL, const double nX, const double nY, const double nWidth, const double nHeight)
PresenterWindowManager & operator=(const PresenterWindowManager &)=delete
void UpdateWindowSize(const css::uno::Reference< css::awt::XWindow > &rxBorderWindow)
virtual void SAL_CALL focusLost(const css::awt::FocusEvent &rEvent) override
css::uno::Reference< css::awt::XWindow > mxParentWindow
void NotifyLayoutModeChange()
Notify changes of the layout mode and of the slide sorter state.
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
css::uno::Reference< css::rendering::XPolyPolygon2D > CreateClipPolyPolygon() const
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
void NotifyViewCreation(const css::uno::Reference< css::drawing::framework::XView > &rxView)