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 { namespace 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 
88 private:
89  void SetLayoutMode (const LayoutMode eMode);
90 
91 public:
96  void SetViewMode (const ViewMode eMode);
97 
98  ViewMode GetViewMode() const;
99 
103  void RestoreViewMode();
104 
105  void AddLayoutListener (
106  const css::uno::Reference<css::document::XEventListener>& rxListener);
107  void RemoveLayoutListener (
108  const css::uno::Reference<css::document::XEventListener>& rxListener);
109 
110  // XWindowListener
111 
112  virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
113 
114  virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
115 
116  virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
117 
118  virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
119 
120  // XPaintListener
121 
122  virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
123 
124  // XMouseListener
125 
126  virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
127 
128  virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
129 
130  virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
131 
132  virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
133 
134  // XFocusListener
135 
136  virtual void SAL_CALL focusGained (const css::awt::FocusEvent& rEvent) override;
137 
138  virtual void SAL_CALL focusLost (const css::awt::FocusEvent& rEvent) override;
139 
140  // XEventListener
141 
142  virtual void SAL_CALL disposing (
143  const css::lang::EventObject& rEvent) override;
144 
145 private:
146  css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
148  css::uno::Reference<css::awt::XWindow> mxParentWindow;
149  css::uno::Reference<css::rendering::XCanvas> mxParentCanvas;
150  css::uno::Reference<css::uno::XInterface> mxPaneBorderManager;
159  std::shared_ptr<PresenterTheme> mpTheme;
161  css::uno::Reference<css::rendering::XBitmap> mxScaledBackgroundBitmap;
162  css::uno::Reference<css::rendering::XPolyPolygon2D> mxClipPolygon;
166  typedef ::std::vector<css::uno::Reference<css::document::XEventListener> >
170 
171  void PaintChildren (const css::awt::PaintEvent& rEvent) const;
172  void UpdateWindowSize (const css::uno::Reference<css::awt::XWindow>& rxBorderWindow);
173  void PaintBackground (const css::awt::Rectangle& rUpdateBox);
175  css::uno::Reference<css::rendering::XPolyPolygon2D> CreateClipPolyPolygon() const;
176 
177  void StoreViewMode (const ViewMode eViewMode);
178 
179  void LayoutStandardMode();
180  void LayoutNotesMode();
181  void LayoutSlideSorterMode();
182  void LayoutHelpMode();
183 
186  css::geometry::RealRectangle2D LayoutToolBar();
187 
188  css::awt::Size CalculatePaneSize (
189  const double nOuterWidth,
190  const OUString& rsPaneURL);
191 
194  void NotifyLayoutModeChange();
195 
196  void NotifyDisposing();
197 
199  void ThrowIfDisposed() const;
200 };
201 
202 } }
203 
204 #endif
205 
206 /* 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)