LibreOffice Module sd (master) 1
PresenterToolBar.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_PRESENTERTOOLBAR_HXX
21#define INCLUDED_SDEXT_SOURCE_PRESENTER_PRESENTERTOOLBAR_HXX
22
25
28#include <com/sun/star/awt/XMouseListener.hpp>
29#include <com/sun/star/awt/XMouseMotionListener.hpp>
30#include <com/sun/star/awt/XPaintListener.hpp>
31#include <com/sun/star/awt/XWindowListener.hpp>
32#include <com/sun/star/drawing/XDrawPage.hpp>
33#include <com/sun/star/drawing/XDrawView.hpp>
34#include <com/sun/star/drawing/framework/XView.hpp>
35#include <com/sun/star/drawing/framework/XResourceId.hpp>
36#include <com/sun/star/frame/XController.hpp>
37
38#include <functional>
39
40namespace sdext::presenter {
41
42typedef cppu::WeakComponentImplHelper<
43 css::awt::XWindowListener,
44 css::awt::XPaintListener,
45 css::awt::XMouseListener,
46 css::awt::XMouseMotionListener,
47 css::drawing::XDrawView
49
50typedef cppu::WeakComponentImplHelper<
51 css::awt::XPaintListener,
52 css::drawing::framework::XView,
53 css::drawing::XDrawView
55
62 : private ::cppu::BaseMutex,
64 public CachablePresenterView
65{
66public:
67 typedef ::std::function<void ()> Action;
68
69 enum Anchor { Left, Center };
70
72 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
73 css::uno::Reference<css::awt::XWindow> xWindow,
74 css::uno::Reference<css::rendering::XCanvas> xCanvas,
75 ::rtl::Reference<PresenterController> pPresenterController,
76 const Anchor eAnchor);
77 virtual ~PresenterToolBar() override;
80
81 void Initialize (
82 const OUString& rsConfigurationPath);
83
84 virtual void SAL_CALL disposing() override;
85
86 void InvalidateArea (
87 const css::awt::Rectangle& rRepaintBox,
88 const bool bSynchronous);
89
90 void RequestLayout();
91 css::geometry::RealSize2D const & GetMinimalSize();
92 const ::rtl::Reference<PresenterController>& GetPresenterController() const;
93 const css::uno::Reference<css::uno::XComponentContext>& GetComponentContext() const;
94
95 // lang::XEventListener
96
97 virtual void SAL_CALL
98 disposing (const css::lang::EventObject& rEventObject) override;
99
100 // XWindowListener
101
102 virtual void SAL_CALL windowResized (const css::awt::WindowEvent& rEvent) override;
103
104 virtual void SAL_CALL windowMoved (const css::awt::WindowEvent& rEvent) override;
105
106 virtual void SAL_CALL windowShown (const css::lang::EventObject& rEvent) override;
107
108 virtual void SAL_CALL windowHidden (const css::lang::EventObject& rEvent) override;
109
110 // XPaintListener
111
112 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
113
114 // XMouseListener
115
116 virtual void SAL_CALL mousePressed (const css::awt::MouseEvent& rEvent) override;
117
118 virtual void SAL_CALL mouseReleased (const css::awt::MouseEvent& rEvent) override;
119
120 virtual void SAL_CALL mouseEntered (const css::awt::MouseEvent& rEvent) override;
121
122 virtual void SAL_CALL mouseExited (const css::awt::MouseEvent& rEvent) override;
123
124 // XMouseMotionListener
125
126 virtual void SAL_CALL mouseMoved (const css::awt::MouseEvent& rEvent) override;
127
128 virtual void SAL_CALL mouseDragged (const css::awt::MouseEvent& rEvent) override;
129
130 // XDrawView
131
132 virtual void SAL_CALL setCurrentPage (
133 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
134
135 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
136
137 class Context;
138
139private:
140 css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
141
143 typedef std::shared_ptr<ElementContainerPart> SharedElementContainerPart;
144 typedef ::std::vector<SharedElementContainerPart> ElementContainer;
147 css::uno::Reference<css::awt::XWindow> mxWindow;
148 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
149 css::uno::Reference<css::presentation::XSlideShowController> mxSlideShowController;
150 css::uno::Reference<css::drawing::XDrawPage> mxCurrentSlide;
157 css::geometry::RealSize2D maMinimalSize;
158
159 void CreateControls (
160 const OUString& rsConfigurationPath);
161 void Layout (const css::uno::Reference<css::rendering::XCanvas>& rxCanvas);
162 css::geometry::RealSize2D CalculatePartSize (
163 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
164 const SharedElementContainerPart& rpPart,
165 const bool bIsHorizontal);
166 static void LayoutPart (
167 const css::uno::Reference<css::rendering::XCanvas>& rxCanvas,
168 const SharedElementContainerPart& rpPart,
169 const css::geometry::RealRectangle2D& rBoundingBox,
170 const css::geometry::RealSize2D& rPartSize,
171 const bool bIsHorizontal);
172 void Paint (
173 const css::awt::Rectangle& rUpdateBox,
174 const css::rendering::ViewState& rViewState);
175
176 void UpdateSlideNumber();
177
178 void CheckMouseOver (
179 const css::awt::MouseEvent& rEvent,
180 const bool bOverWindow,
181 const bool bMouseDown=false);
182
183 void ProcessEntry (
184 const css::uno::Reference<css::beans::XPropertySet>& rProperties,
185 Context const & rContext);
186
190 void ThrowIfDisposed() const;
191};
192
196 : private ::cppu::BaseMutex,
198{
199public:
201 const css::uno::Reference<css::uno::XComponentContext>& rxContext,
202 const css::uno::Reference<css::drawing::framework::XResourceId>& rxViewId,
203 const ::rtl::Reference<::sd::DrawController>& rxController,
204 const ::rtl::Reference<PresenterController>& rpPresenterController);
205 virtual ~PresenterToolBarView() override;
208
209 virtual void SAL_CALL disposing() override;
210
211 const ::rtl::Reference<PresenterToolBar>& GetPresenterToolBar() const;
212
213 // XPaintListener
214
215 virtual void SAL_CALL windowPaint (const css::awt::PaintEvent& rEvent) override;
216
217 // lang::XEventListener
218
219 virtual void SAL_CALL
220 disposing (const css::lang::EventObject& rEventObject) override;
221
222 // XResourceId
223
224 virtual css::uno::Reference<css::drawing::framework::XResourceId> SAL_CALL getResourceId() override;
225
226 virtual sal_Bool SAL_CALL isAnchorOnly() override;
227
228 // XDrawView
229
230 virtual void SAL_CALL setCurrentPage (
231 const css::uno::Reference<css::drawing::XDrawPage>& rxSlide) override;
232
233 virtual css::uno::Reference<css::drawing::XDrawPage> SAL_CALL getCurrentPage() override;
234
235private:
236 // css::uno::Reference<css::uno::XComponentContext> mxComponentContext;
237 css::uno::Reference<css::drawing::framework::XPane> mxPane;
238 css::uno::Reference<css::drawing::framework::XResourceId> mxViewId;
239 css::uno::Reference<css::awt::XWindow> mxWindow;
240 css::uno::Reference<css::rendering::XCanvas> mxCanvas;
243
244};
245
246} // end of namespace ::sdext::presenter
247
248#endif
249
250/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
View for the PresenterToolBar.
css::uno::Reference< css::drawing::framework::XResourceId > mxViewId
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
css::uno::Reference< css::rendering::XCanvas > mxCanvas
css::uno::Reference< css::drawing::framework::XPane > mxPane
PresenterToolBarView(const css::uno::Reference< css::uno::XComponentContext > &rxContext, const css::uno::Reference< css::drawing::framework::XResourceId > &rxViewId, const ::rtl::Reference<::sd::DrawController > &rxController, const ::rtl::Reference< PresenterController > &rpPresenterController)
css::uno::Reference< css::awt::XWindow > mxWindow
::rtl::Reference< PresenterController > mpPresenterController
PresenterToolBarView & operator=(const PresenterToolBarView &)=delete
const ::rtl::Reference< PresenterToolBar > & GetPresenterToolBar() const
virtual void SAL_CALL disposing(const css::lang::EventObject &rEventObject) override
::rtl::Reference< PresenterToolBar > mpToolBar
PresenterToolBarView(const PresenterToolBarView &)=delete
virtual sal_Bool SAL_CALL isAnchorOnly() override
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
virtual void SAL_CALL disposing() override
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
virtual css::uno::Reference< css::drawing::framework::XResourceId > SAL_CALL getResourceId() override
A simple tool bar that can display bitmapped buttons and labels.
const css::uno::Reference< css::uno::XComponentContext > & GetComponentContext() const
::std::vector< SharedElementContainerPart > ElementContainer
void InvalidateArea(const css::awt::Rectangle &rRepaintBox, const bool bSynchronous)
std::shared_ptr< ElementContainerPart > SharedElementContainerPart
virtual void SAL_CALL mouseDragged(const css::awt::MouseEvent &rEvent) override
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getCurrentPage() override
css::geometry::RealSize2D const & GetMinimalSize()
css::uno::Reference< css::awt::XWindow > mxWindow
virtual void SAL_CALL disposing(const css::lang::EventObject &rEventObject) override
virtual void SAL_CALL mouseReleased(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowMoved(const css::awt::WindowEvent &rEvent) override
static void LayoutPart(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const SharedElementContainerPart &rpPart, const css::geometry::RealRectangle2D &rBoundingBox, const css::geometry::RealSize2D &rPartSize, const bool bIsHorizontal)
void Initialize(const OUString &rsConfigurationPath)
css::uno::Reference< css::presentation::XSlideShowController > mxSlideShowController
PresenterToolBar & operator=(const PresenterToolBar &)=delete
virtual void SAL_CALL disposing() override
virtual void SAL_CALL mouseEntered(const css::awt::MouseEvent &rEvent) override
void ProcessEntry(const css::uno::Reference< css::beans::XPropertySet > &rProperties, Context const &rContext)
virtual void SAL_CALL windowResized(const css::awt::WindowEvent &rEvent) override
virtual void SAL_CALL windowHidden(const css::lang::EventObject &rEvent) override
PresenterToolBar(const css::uno::Reference< css::uno::XComponentContext > &rxContext, css::uno::Reference< css::awt::XWindow > xWindow, css::uno::Reference< css::rendering::XCanvas > xCanvas, ::rtl::Reference< PresenterController > pPresenterController, const Anchor eAnchor)
const ::rtl::Reference< PresenterController > & GetPresenterController() const
virtual void SAL_CALL mousePressed(const css::awt::MouseEvent &rEvent) override
PresenterToolBar(const PresenterToolBar &)=delete
virtual void SAL_CALL setCurrentPage(const css::uno::Reference< css::drawing::XDrawPage > &rxSlide) override
css::uno::Reference< css::drawing::XDrawPage > mxCurrentSlide
void CreateControls(const OUString &rsConfigurationPath)
void Layout(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas)
SharedElementContainerPart mpCurrentContainerPart
virtual void SAL_CALL mouseExited(const css::awt::MouseEvent &rEvent) override
virtual void SAL_CALL windowShown(const css::lang::EventObject &rEvent) override
css::geometry::RealSize2D maMinimalSize
The minimal size that is necessary to display all elements without overlap and with minimal gaps betw...
virtual void SAL_CALL windowPaint(const css::awt::PaintEvent &rEvent) override
css::uno::Reference< css::uno::XComponentContext > mxComponentContext
virtual void SAL_CALL mouseMoved(const css::awt::MouseEvent &rEvent) override
::rtl::Reference< PresenterController > mpPresenterController
void Paint(const css::awt::Rectangle &rUpdateBox, const css::rendering::ViewState &rViewState)
css::uno::Reference< css::rendering::XCanvas > mxCanvas
css::geometry::RealSize2D CalculatePartSize(const css::uno::Reference< css::rendering::XCanvas > &rxCanvas, const SharedElementContainerPart &rpPart, const bool bIsHorizontal)
void CheckMouseOver(const css::awt::MouseEvent &rEvent, const bool bOverWindow, const bool bMouseDown=false)
cppu::WeakComponentImplHelper< css::awt::XPaintListener, css::drawing::framework::XView, css::drawing::XDrawView > PresenterToolBarViewInterfaceBase
cppu::WeakComponentImplHelper< css::awt::XWindowListener, css::awt::XPaintListener, css::awt::XMouseListener, css::awt::XMouseMotionListener, css::drawing::XDrawView > PresenterToolBarInterfaceBase
unsigned char sal_Bool