1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
31 namespace vcl
{ class Font
; }
32 namespace canvas
{ namespace tools
{ class ElapsedTime
; }}
33 namespace cppcanvas
{ class CustomSprite
; }
43 struct SlideShowContext
;
44 class EventMultiplexer
;
46 class RehearseTimingsActivity
: public Activity
,
47 public ViewEventHandler
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.
63 /** Stops and hides the timer.
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
;
79 virtual void dispose() override
;
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
;
90 explicit RehearseTimingsActivity( const SlideShowContext
& rContext
);
92 void paint( ::cppcanvas::CanvasSharedPtr
const & canvas
) const;
93 void paintAllSprites() const;
96 friend class MouseHandler
;
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
;
122 /// screen rect of sprite (in view coordinates!)
123 ::basegfx::B2DRange maSpriteRectangle
;
126 std::shared_ptr
<WakeupEvent
> mpWakeUpEvent
;
127 std::shared_ptr
<MouseHandler
> mpMouseHandler
;
128 ::basegfx::B2IVector maSpriteSizePixel
;
134 } // namespace internal
135 } // namespace presentation
137 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */