LibreOffice Module slideshow (master) 1
rehearsetimingsactivity.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_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
22
23#include <activity.hxx>
24#include <activitiesqueue.hxx>
25#include <eventqueue.hxx>
26#include <vieweventhandler.hxx>
27
29#include <vcl/font.hxx>
30
31#include <vector>
32#include <utility>
33#include <memory>
34
35namespace vcl { class Font; }
36namespace canvas::tools{ class ElapsedTime; }
37namespace cppcanvas{ class CustomSprite; }
38namespace basegfx
39{
40 class B2IVector;
41 class B2DRange;
42}
43
44namespace slideshow::internal {
45
46struct SlideShowContext;
47class EventMultiplexer;
48class ScreenUpdater;
50 public ViewEventHandler
51{
52public:
55 static std::shared_ptr<RehearseTimingsActivity> create(
56 const SlideShowContext& rContext );
57
58 virtual ~RehearseTimingsActivity() override;
61
64 void start();
65
69 double stop();
70
73 bool hasBeenClicked() const;
74
75 // ViewEventHandler interface
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 // Disposable:
82 virtual void dispose() override;
83 // Activity:
84 virtual double calcTimeLag() const override;
85 virtual bool perform() override;
86 virtual bool isActive() const override;
87 virtual void dequeued() override;
88 virtual void end() override;
89
90private:
91 class WakeupEvent;
92
93 explicit RehearseTimingsActivity( const SlideShowContext& rContext );
94
95 void paint( ::cppcanvas::CanvasSharedPtr const & canvas ) const;
96 void paintAllSprites() const;
97
98 class MouseHandler;
99 friend class MouseHandler;
100
101 typedef std::vector<
102 std::pair<UnoViewSharedPtr,
103 std::shared_ptr<cppcanvas::CustomSprite> > > ViewsVecT;
104
105 template <typename func_type>
106 void for_each_sprite( func_type const & func ) const
107 {
108 ViewsVecT::const_iterator iPos( maViews.begin() );
109 const ViewsVecT::const_iterator iEnd( maViews.end() );
110 for ( ; iPos != iEnd; ++iPos )
111 func( iPos->second );
112 }
113
115 UnoViewSharedPtr const & rView ) const;
116
122
124
127
129 std::shared_ptr<WakeupEvent> mpWakeUpEvent;
130 std::shared_ptr<MouseHandler> mpMouseHandler;
132 sal_Int32 mnYOffset;
135};
136
137} // namespace presentation::internal
138
139#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
This class handles the XSprite updates needed for animations, such as moves, scales etc.
This class multiplexes user-activated and slide-show global events.
This class handles events in a presentation.
Definition: eventqueue.hxx:41
virtual void dispose() override
Dispose all object references.
void start()
Starts and shows the timer; adds to activity queue.
virtual double calcTimeLag() const override
Calculates whether the activity lags time.
virtual void viewRemoved(const UnoViewSharedPtr &rView) override
Notify removed view.
RehearseTimingsActivity(const RehearseTimingsActivity &)=delete
RehearseTimingsActivity & operator=(const RehearseTimingsActivity &)=delete
::basegfx::B2DRange calcSpriteRectangle(UnoViewSharedPtr const &rView) const
virtual void end() override
Forces this activity deactivate and get to its end state (if possible), but does not dispose.
void paint(::cppcanvas::CanvasSharedPtr const &canvas) const
bool hasBeenClicked() const
Determines whether the timer button has been clicked.
::basegfx::B2DRange maSpriteRectangle
screen rect of sprite (in view coordinates!)
virtual bool perform() override
Perform the activity associated with this interface's implementation.
virtual void viewAdded(const UnoViewSharedPtr &rView) override
Notify new view.
virtual void dequeued() override
Notifies the Activity that it has now left the ActivitiesQueue.
virtual bool isActive() const override
Query whether this activity is still continuing.
std::vector< std::pair< UnoViewSharedPtr, std::shared_ptr< cppcanvas::CustomSprite > > > ViewsVecT
virtual void viewChanged(const UnoViewSharedPtr &rView) override
Notify changed view.
virtual void viewsChanged() override
Notify that all views changed.
static std::shared_ptr< RehearseTimingsActivity > create(const SlideShowContext &rContext)
Creates the activity.
Interface for handling view events.
std::shared_ptr< Canvas > CanvasSharedPtr
std::shared_ptr< UnoView > UnoViewSharedPtr
Common arguments for slideshow objects.