Bump version to 6.0-36
[LibreOffice.git] / slideshow / source / engine / rehearsetimingsactivity.hxx
blob4ae0e16f00ad8781d645a4e15b5f1dbc8c14a85d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
23 #include <activity.hxx>
25 #include <basegfx/range/b2drange.hxx>
27 #include <vector>
28 #include <utility>
29 #include <memory>
31 namespace vcl { class Font; }
32 namespace canvas{ namespace tools{ class ElapsedTime; }}
33 namespace cppcanvas{ class CustomSprite; }
34 namespace basegfx
36 class B2IVector;
37 class B2DRange;
40 namespace slideshow {
41 namespace internal {
43 struct SlideShowContext;
44 class EventMultiplexer;
45 class ScreenUpdater;
46 class RehearseTimingsActivity : public Activity,
47 public ViewEventHandler
49 public:
50 /** Creates the activity.
52 static std::shared_ptr<RehearseTimingsActivity> create(
53 const SlideShowContext& rContext );
55 virtual ~RehearseTimingsActivity() override;
56 RehearseTimingsActivity(const RehearseTimingsActivity&) = delete;
57 RehearseTimingsActivity& operator=(const RehearseTimingsActivity&) = delete;
59 /** Starts and shows the timer; adds to activity queue.
61 void start();
63 /** Stops and hides the timer.
64 @return elapsed time
66 double stop();
68 /** Determines whether the timer button has been clicked.
70 bool hasBeenClicked() const;
72 // ViewEventHandler interface
73 virtual void viewAdded( const UnoViewSharedPtr& rView ) override;
74 virtual void viewRemoved( const UnoViewSharedPtr& rView ) override;
75 virtual void viewChanged( const UnoViewSharedPtr& rView ) override;
76 virtual void viewsChanged() override;
78 // Disposable:
79 virtual void dispose() override;
80 // Activity:
81 virtual double calcTimeLag() const override;
82 virtual bool perform() override;
83 virtual bool isActive() const override;
84 virtual void dequeued() override;
85 virtual void end() override;
87 private:
88 class WakeupEvent;
90 explicit RehearseTimingsActivity( const SlideShowContext& rContext );
92 void paint( ::cppcanvas::CanvasSharedPtr const & canvas ) const;
93 void paintAllSprites() const;
95 class MouseHandler;
96 friend class MouseHandler;
98 typedef std::vector<
99 std::pair<UnoViewSharedPtr,
100 std::shared_ptr<cppcanvas::CustomSprite> > > ViewsVecT;
102 template <typename func_type>
103 void for_each_sprite( func_type const & func ) const
105 ViewsVecT::const_iterator iPos( maViews.begin() );
106 const ViewsVecT::const_iterator iEnd( maViews.end() );
107 for ( ; iPos != iEnd; ++iPos )
108 func( iPos->second );
111 ::basegfx::B2DRange calcSpriteRectangle(
112 UnoViewSharedPtr const & rView ) const;
114 EventQueue& mrEventQueue;
115 ScreenUpdater& mrScreenUpdater;
116 EventMultiplexer& mrEventMultiplexer;
117 ActivitiesQueue& mrActivitiesQueue;
118 canvas::tools::ElapsedTime maElapsedTime;
120 ViewsVecT maViews;
122 /// screen rect of sprite (in view coordinates!)
123 ::basegfx::B2DRange maSpriteRectangle;
125 vcl::Font maFont;
126 std::shared_ptr<WakeupEvent> mpWakeUpEvent;
127 std::shared_ptr<MouseHandler> mpMouseHandler;
128 ::basegfx::B2IVector maSpriteSizePixel;
129 sal_Int32 mnYOffset;
130 bool mbActive;
131 bool mbDrawPressed;
134 } // namespace internal
135 } // namespace presentation
137 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */