LibreOffice Module slideshow (master) 1
slideoverlaybutton.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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#pragma once
21
22#include <sal/config.h>
23
24#include <eventmultiplexer.hxx>
25#include <mouseeventhandler.hxx>
26#include <screenupdater.hxx>
27#include <unoview.hxx>
28#include <vieweventhandler.hxx>
29
31#include <cppcanvas/sprite.hxx>
32
33#include <com/sun/star/rendering/XBitmap.hpp>
34#include <com/sun/star/awt/Point.hpp>
35
36#include <functional>
37#include <memory>
38#include <vector>
39
40namespace slideshow::internal
41{
42class EventMultiplexer;
43typedef std::shared_ptr<class SlideOverlayButton> SlideOverlayButtonSharedPtr;
44
46{
47public:
50
52 create(const css::uno::Reference<css::rendering::XBitmap>& xIconBitmap,
53 css::awt::Point pPosition, std::function<void(basegfx::B2DPoint)> clickHandler,
54 ScreenUpdater& rScreenUpdater, EventMultiplexer& rEventMultiplexer,
55 const UnoViewContainer& rViewContainer);
56
59 void show() { setVisible(true); }
60
63 void hide() { setVisible(false); }
64
65 css::geometry::IntegerSize2D getSize() const;
67
68private:
69 SlideOverlayButton(css::uno::Reference<css::rendering::XBitmap> xIconBitmap,
70 css::awt::Point pPosition,
71 std::function<void(basegfx::B2DPoint)> clickHandler,
72 ScreenUpdater& rScreenUpdater, EventMultiplexer& rEventMultiplexer,
73 const UnoViewContainer& rViewContainer);
74
75 // ViewEventHandler
76 virtual void viewAdded(const UnoViewSharedPtr& rView) override;
77 virtual void viewRemoved(const UnoViewSharedPtr& rView) override;
78 virtual void viewChanged(const UnoViewSharedPtr& rView) override;
79 virtual void viewsChanged() override;
80
81 // MouseEventHandler
82 virtual bool handleMousePressed(const css::awt::MouseEvent& e) override;
83 virtual bool handleMouseReleased(const css::awt::MouseEvent& e) override;
84 virtual bool handleMouseDragged(const css::awt::MouseEvent& e) override;
85 virtual bool handleMouseMoved(const css::awt::MouseEvent& e) override;
86
87 void setVisible(const bool bVisible);
88
89 typedef std::vector<std::pair<UnoViewSharedPtr, cppcanvas::CustomSpriteSharedPtr>> ViewsVecT;
90
91 css::uno::Reference<css::rendering::XBitmap> mxIconBitmap;
93 css::awt::Point mpPosition;
94 std::function<void(basegfx::B2DPoint)> mClickHandler;
95
98 bool mbVisible = false;
99};
100}
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
This class multiplexes user-activated and slide-show global events.
Interface for handling mouse events.
std::function< void(basegfx::B2DPoint)> mClickHandler
virtual void viewRemoved(const UnoViewSharedPtr &rView) override
Notify removed view.
virtual bool handleMouseReleased(const css::awt::MouseEvent &e) override
Handle a mouse button released event.
virtual void viewAdded(const UnoViewSharedPtr &rView) override
Notify new view.
SlideOverlayButton(const SlideOverlayButton &)=delete
virtual void viewsChanged() override
Notify that all views changed.
virtual bool handleMouseDragged(const css::awt::MouseEvent &e) override
Handle a mouse was moved with a pressed button event.
virtual void viewChanged(const UnoViewSharedPtr &rView) override
Notify changed view.
css::uno::Reference< css::rendering::XBitmap > mxIconBitmap
SlideOverlayButton & operator=(const SlideOverlayButton &)=delete
static SlideOverlayButtonSharedPtr create(const css::uno::Reference< css::rendering::XBitmap > &xIconBitmap, css::awt::Point pPosition, std::function< void(basegfx::B2DPoint)> clickHandler, ScreenUpdater &rScreenUpdater, EventMultiplexer &rEventMultiplexer, const UnoViewContainer &rViewContainer)
virtual bool handleMouseMoved(const css::awt::MouseEvent &e) override
Handle a mouse was moved event.
std::vector< std::pair< UnoViewSharedPtr, cppcanvas::CustomSpriteSharedPtr > > ViewsVecT
virtual bool handleMousePressed(const css::awt::MouseEvent &e) override
Handle a mouse button pressed event.
css::geometry::IntegerSize2D getSize() const
basegfx::B2DPoint calcSpritePos(UnoViewSharedPtr const &rView) const
Interface for handling view events.
std::shared_ptr< class SlideOverlayButton > SlideOverlayButtonSharedPtr
std::shared_ptr< UnoView > UnoViewSharedPtr