LibreOffice Module slideshow (master) 1
eventmultiplexer.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#ifndef INCLUDED_SLIDESHOW_SOURCE_INC_EVENTMULTIPLEXER_HXX
20#define INCLUDED_SLIDESHOW_SOURCE_INC_EVENTMULTIPLEXER_HXX
21
22#include "eventhandler.hxx"
23#include "mouseeventhandler.hxx"
25#include "pauseeventhandler.hxx"
27#include "vieweventhandler.hxx"
28
29#include <memory>
30#include <com/sun/star/uno/Reference.hxx>
31
32#include "unoview.hxx"
33
34namespace basegfx { class B2DPoint; }
35
36namespace com::sun::star::drawing { class XShape; }
37
38namespace slideshow::internal {
39
40class EventQueue;
41class UnoViewContainer;
42class AnimationNode;
43
44struct EventMultiplexerImpl;
45
46class RGBColor;
47
55{
56public:
58
68 virtual void viewClobbered( const UnoViewSharedPtr& rView ) = 0;
69};
70
71typedef ::std::shared_ptr< ViewRepaintHandler > ViewRepaintHandlerSharedPtr;
72
80{
81public:
92 virtual bool handleHyperlink( OUString const& rLink ) = 0;
93
94protected:
96};
97
98typedef ::std::shared_ptr< HyperlinkHandler > HyperlinkHandlerSharedPtr;
99
107{
108public:
110 virtual bool colorChanged( RGBColor const& rUserColor ) = 0;
111 virtual bool widthChanged( double nUserStrokeWidth ) = 0;
112 virtual bool eraseAllInkChanged(bool bEraseAllInk) =0;
113 virtual bool eraseInkWidthChanged(sal_Int32 rEraseInkSize) =0;
114 virtual bool switchEraserMode() = 0;
115 virtual bool switchPenMode() = 0;
116 virtual bool disable() = 0;
117};
118
119typedef ::std::shared_ptr< UserPaintEventHandler > UserPaintEventHandlerSharedPtr;
120
134{
135public:
155 EventMultiplexer( EventQueue& rEventQueue,
156 UnoViewContainer const& rViewContainer );
160
161 // Management methods
162
163
166 void clear();
167
168
169 // Automatic mode methods
170
171
179 void setAutomaticMode( bool bIsAuto );
180
183 bool getAutomaticMode() const;
184
191 void setAutomaticTimeout( double nTimeout );
192
195 double getAutomaticTimeout() const;
196
197 // Handler registration methods
198
199
214 void addViewHandler( const ViewEventHandlerWeakPtr& rHandler );
215 void removeViewHandler( const ViewEventHandlerWeakPtr& rHandler );
216
228
237
245
262 void addNextEffectHandler( const EventHandlerSharedPtr& rHandler,
263 double nPriority );
264 void removeNextEffectHandler( const EventHandlerSharedPtr& rHandler );
265
276 void addSlideStartHandler( const EventHandlerSharedPtr& rHandler );
277 void removeSlideStartHandler( const EventHandlerSharedPtr& rHandler );
278
289 void addSlideEndHandler( const EventHandlerSharedPtr& rHandler );
290 void removeSlideEndHandler( const EventHandlerSharedPtr& rHandler );
291
303 const AnimationEventHandlerSharedPtr& rHandler );
305 const AnimationEventHandlerSharedPtr& rHandler );
306
318 const AnimationEventHandlerSharedPtr& rHandler );
320 const AnimationEventHandlerSharedPtr& rHandler );
321
334 const EventHandlerSharedPtr& rHandler );
336 const EventHandlerSharedPtr& rHandler );
337
349 const AnimationEventHandlerSharedPtr& rHandler );
351 const AnimationEventHandlerSharedPtr& rHandler );
352
364 const AnimationEventHandlerSharedPtr& rHandler );
366 const AnimationEventHandlerSharedPtr& rHandler );
367
371 void addPauseHandler( const PauseEventHandlerSharedPtr& rHandler );
372 void removePauseHandler( const PauseEventHandlerSharedPtr& rHandler );
373
387 void addClickHandler( const MouseEventHandlerSharedPtr& rHandler,
388 double nPriority );
389 void removeClickHandler( const MouseEventHandlerSharedPtr& rHandler );
390
406 double nPriority );
408
417 double nPriority );
419
420
432 double nPriority );
434
435
436 // External event notifications
437
438
445 void notifyViewAdded( const UnoViewSharedPtr& rView );
446
452 void notifyViewRemoved( const UnoViewSharedPtr& rView );
453
462 void notifyViewChanged( const UnoViewSharedPtr& rView );
463
472 void notifyViewChanged( const css::uno::Reference<css::presentation::XSlideShowView>& xView );
473
480 void notifyViewsChanged();
481
490 void notifyViewClobbered( const css::uno::Reference<css::presentation::XSlideShowView>& xView );
491
497 void notifyShapeListenerAdded( const css::uno::Reference<css::drawing::XShape>& xShape );
498
504 void notifyShapeListenerRemoved( const css::uno::Reference<css::drawing::XShape>& xShape );
505
512 void notifyUserPaintColor( RGBColor const& rUserColor );
513
519 void notifyUserPaintStrokeWidth( double rUserStrokeWidth );
520
521
528 void notifyEraseAllInk( bool bEraseAllInk );
529 void notifySwitchPenMode();
531 void notifyEraseInkWidth( sal_Int32 rEraseInkSize );
532
539
549 bool notifyNextEffect();
550
558
569 bool notifySlideEndEvent();
570
585 bool notifyAnimationStart( const AnimationNodeSharedPtr& rNode );
586
601 bool notifyAnimationEnd( const AnimationNodeSharedPtr& rNode );
602
611
626 bool notifyAudioStopped( const AnimationNodeSharedPtr& rNode );
627
635 void notifyPauseMode( bool bPauseShow );
636
648
651 void notifyHyperlinkClicked( OUString const& hyperLink );
652
653 basegfx::B2DPoint toMatrixPoint(css::uno::Reference<css::uno::XInterface> xInterface,
655
656 basegfx::B2DPoint toNormalPoint(css::uno::Reference<css::uno::XInterface> xInterface,
658
659private:
660 std::unique_ptr<EventMultiplexerImpl> mpImpl;
661};
662
663} // namespace Presentation::internal
664
665#endif // INCLUDED_SLIDESHOW_SOURCE_INC_EVENTMULTIPLEXER_HXX
666
667/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class multiplexes user-activated and slide-show global events.
void removeClickHandler(const MouseEventHandlerSharedPtr &rHandler)
void setAutomaticTimeout(double nTimeout)
Set the timeout for automatic mode.
void notifyViewChanged(const UnoViewSharedPtr &rView)
View changed.
void addAnimationStartHandler(const AnimationEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when an XAnimationNode starts its active duration.
void addHyperlinkHandler(const HyperlinkHandlerSharedPtr &rHandler, double nPriority)
Registers a hyperlink click handler.
bool notifyAudioStopped(const AnimationNodeSharedPtr &rNode)
Notify that for the given node, audio output has stopped.
void removeMouseMoveHandler(const MouseEventHandlerSharedPtr &rHandler)
void notifyViewRemoved(const UnoViewSharedPtr &rView)
View removed.
double getAutomaticTimeout() const
Get automatic mode timeout value.
void addClickHandler(const MouseEventHandlerSharedPtr &rHandler, double nPriority)
Register a mouse handler that is called on mouse click.
void addMouseMoveHandler(const MouseEventHandlerSharedPtr &rHandler, double nPriority)
Register a mouse handler that is called for mouse moves.
void removeSlideAnimationsEndHandler(const EventHandlerSharedPtr &rHandler)
void addCommandStopAudioHandler(const AnimationEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when an XCommand node's with the command STOPAUDIO is a...
void removeAnimationEndHandler(const AnimationEventHandlerSharedPtr &rHandler)
EventMultiplexer(EventQueue &rEventQueue, UnoViewContainer const &rViewContainer)
Create an event multiplexer.
void notifyUserPaintStrokeWidth(double rUserStrokeWidth)
Notify a new user paint width.
void clear()
Clear all registered handlers.
void removeSlideEndHandler(const EventHandlerSharedPtr &rHandler)
void removeViewRepaintHandler(const ViewRepaintHandlerSharedPtr &rHandler)
void removeViewHandler(const ViewEventHandlerWeakPtr &rHandler)
void removePauseHandler(const PauseEventHandlerSharedPtr &rHandler)
void addSlideEndHandler(const EventHandlerSharedPtr &rHandler)
Register an event handler that will be called when the slide is about to vanish.
void notifyUserPaintColor(RGBColor const &rUserColor)
Notify a new user paint color.
void addSlideStartHandler(const EventHandlerSharedPtr &rHandler)
Register an event handler that will be called when the slide is just shown.
void notifyEraseAllInk(bool bEraseAllInk)
Notify a new user paint erase all ink mode.
basegfx::B2DPoint toNormalPoint(css::uno::Reference< css::uno::XInterface > xInterface, basegfx::B2DPoint pnt)
void addSlideAnimationsEndHandler(const EventHandlerSharedPtr &rHandler)
Register an event handler that will be called when the main animation sequence of a slide ends its ac...
void removeAudioStoppedHandler(const AnimationEventHandlerSharedPtr &rHandler)
bool notifyAnimationStart(const AnimationNodeSharedPtr &rNode)
Notify that the given node enters its active duration.
void notifyPauseMode(bool bPauseShow)
Notify that the show has entered or exited pause mode.
void notifyUserPaintDisabled()
Notify that user paint is disabled.
void removeDoubleClickHandler(const MouseEventHandlerSharedPtr &rHandler)
void notifyViewAdded(const UnoViewSharedPtr &rView)
View added.
bool notifyCommandStopAudio(const AnimationNodeSharedPtr &rNode)
Notify that all audio has to be stopped.
bool getAutomaticMode() const
Get automatic mode setting.
bool notifySlideEndEvent()
Notify that a slide has ended.
void notifySlideStartEvent()
Notify that a new slide has started.
void notifyViewChanged(const css::uno::Reference< css::presentation::XSlideShowView > &xView)
View changed.
void addViewHandler(const ViewEventHandlerWeakPtr &rHandler)
Register an event handler that will be called when views are changed.
EventMultiplexer(const EventMultiplexer &)=delete
std::unique_ptr< EventMultiplexerImpl > mpImpl
void addNextEffectHandler(const EventHandlerSharedPtr &rHandler, double nPriority)
Register an event handler that will be called when the user requests the next effect.
bool notifyNextEffect()
Notify that the user requested the next effect.
void notifyViewClobbered(const css::uno::Reference< css::presentation::XSlideShowView > &xView)
View clobbered.
void addPauseHandler(const PauseEventHandlerSharedPtr &rHandler)
Register a handler that is called when the show enters or exits pause mode.
void notifyViewsChanged()
All Views changed.
void addDoubleClickHandler(const MouseEventHandlerSharedPtr &rHandler, double nPriority)
Register a mouse handler that is called on a double mouse click.
void removeSlideStartHandler(const EventHandlerSharedPtr &rHandler)
basegfx::B2DPoint toMatrixPoint(css::uno::Reference< css::uno::XInterface > xInterface, basegfx::B2DPoint pnt)
void removeNextEffectHandler(const EventHandlerSharedPtr &rHandler)
void addViewRepaintHandler(const ViewRepaintHandlerSharedPtr &rHandler)
Register an event handler that will be called when a view gets clobbered.
void addAnimationEndHandler(const AnimationEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when an XAnimationNode ends its active duration.
void notifyEraseInkWidth(sal_Int32 rEraseInkSize)
void notifyShapeListenerAdded(const css::uno::Reference< css::drawing::XShape > &xShape)
New shape event listener added.
bool notifySlideAnimationsEnd()
Notify that the slide animations sequence leaves its active duration.
void addShapeListenerHandler(const ShapeListenerEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when XShapeListeners are changed.
void removeHyperlinkHandler(const HyperlinkHandlerSharedPtr &rHandler)
void notifyShapeListenerRemoved(const css::uno::Reference< css::drawing::XShape > &xShape)
A shape event listener was removed.
void removeShapeListenerHandler(const ShapeListenerEventHandlerSharedPtr &rHandler)
void setAutomaticMode(bool bIsAuto)
Change automatic mode.
void removeAnimationStartHandler(const AnimationEventHandlerSharedPtr &rHandler)
EventMultiplexer & operator=(const EventMultiplexer &)=delete
void removeCommandStopAudioHandler(const AnimationEventHandlerSharedPtr &rHandler)
void addAudioStoppedHandler(const AnimationEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when an XAudio node's sound stops playing.
void notifyHyperlinkClicked(OUString const &hyperLink)
Notifies that a hyperlink has been clicked.
bool notifyAnimationEnd(const AnimationNodeSharedPtr &rNode)
Notify that the given node leaves its active duration.
void addUserPaintHandler(const UserPaintEventHandlerSharedPtr &rHandler)
Register an event handler that will be called when user paint parameters change.
This class handles events in a presentation.
Definition: eventqueue.hxx:41
Interface for handling hyperlink clicks.
virtual bool handleHyperlink(OUString const &rLink)=0
Handle the event.
RGB color space class.
Definition: rgbcolor.hxx:35
Interface for handling user paint state changes.
virtual bool eraseAllInkChanged(bool bEraseAllInk)=0
virtual bool widthChanged(double nUserStrokeWidth)=0
virtual bool colorChanged(RGBColor const &rUserColor)=0
virtual bool eraseInkWidthChanged(sal_Int32 rEraseInkSize)=0
Interface for handling view repaint events.
virtual void viewClobbered(const UnoViewSharedPtr &rView)=0
Notify clobbered view.
::std::weak_ptr< ViewEventHandler > ViewEventHandlerWeakPtr
::std::shared_ptr< EventHandler > EventHandlerSharedPtr
::std::shared_ptr< MouseEventHandler > MouseEventHandlerSharedPtr
::std::shared_ptr< PauseEventHandler > PauseEventHandlerSharedPtr
::std::shared_ptr< ShapeListenerEventHandler > ShapeListenerEventHandlerSharedPtr
::std::shared_ptr< HyperlinkHandler > HyperlinkHandlerSharedPtr
::std::shared_ptr< UserPaintEventHandler > UserPaintEventHandlerSharedPtr
::std::shared_ptr< AnimationNode > AnimationNodeSharedPtr
::std::shared_ptr< ViewRepaintHandler > ViewRepaintHandlerSharedPtr
::std::shared_ptr< AnimationEventHandler > AnimationEventHandlerSharedPtr
std::shared_ptr< UnoView > UnoViewSharedPtr