bump product version to 5.0.4.1
[LibreOffice.git] / slideshow / source / engine / rehearsetimingsactivity.hxx
blobf35b735e04dd06505745340f04ed398c5b37a21c
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>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/enable_shared_from_this.hpp>
28 #include <boost/noncopyable.hpp>
30 #include <vector>
31 #include <utility>
33 namespace vcl { class Font; }
34 namespace canvas{ namespace tools{ class ElapsedTime; }}
35 namespace cppcanvas{ class CustomSprite; }
36 namespace basegfx
38 class B2IVector;
39 class B2DRange;
42 namespace slideshow {
43 namespace internal {
45 struct SlideShowContext;
46 class EventMultiplexer;
47 class ScreenUpdater;
48 class RehearseTimingsActivity : public Activity,
49 public ViewEventHandler,
50 public boost::enable_shared_from_this<RehearseTimingsActivity>,
51 private ::boost::noncopyable
53 public:
54 /** Creates the activity.
56 static boost::shared_ptr<RehearseTimingsActivity> create(
57 const SlideShowContext& rContext );
59 virtual ~RehearseTimingsActivity();
61 /** Starts and shows the timer; adds to activity queue.
63 void start();
65 /** Stops and hides the timer.
66 @return elapsed time
68 double stop();
70 /** Determines whether the timer button has been clicked.
72 bool hasBeenClicked() const;
74 // ViewEventHandler interface
75 virtual void viewAdded( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
76 virtual void viewRemoved( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
77 virtual void viewChanged( const UnoViewSharedPtr& rView ) SAL_OVERRIDE;
78 virtual void viewsChanged() SAL_OVERRIDE;
80 // Disposable:
81 virtual void dispose() SAL_OVERRIDE;
82 // Activity:
83 virtual double calcTimeLag() const SAL_OVERRIDE;
84 virtual bool perform() SAL_OVERRIDE;
85 virtual bool isActive() const SAL_OVERRIDE;
86 virtual void dequeued() SAL_OVERRIDE;
87 virtual void end() SAL_OVERRIDE;
89 private:
90 class WakeupEvent;
92 explicit RehearseTimingsActivity( const SlideShowContext& rContext );
94 void paint( ::cppcanvas::CanvasSharedPtr const & canvas ) const;
95 void paintAllSprites() const;
97 class MouseHandler;
98 friend class MouseHandler;
100 typedef ::std::vector<
101 ::std::pair<UnoViewSharedPtr,
102 boost::shared_ptr<cppcanvas::CustomSprite> > > ViewsVecT;
104 template <typename func_type>
105 void for_each_sprite( func_type const & func ) const
107 ViewsVecT::const_iterator iPos( maViews.begin() );
108 const ViewsVecT::const_iterator iEnd( maViews.end() );
109 for ( ; iPos != iEnd; ++iPos )
110 func( iPos->second );
113 ::basegfx::B2DRange calcSpriteRectangle(
114 UnoViewSharedPtr const & rView ) const;
116 EventQueue& mrEventQueue;
117 ScreenUpdater& mrScreenUpdater;
118 EventMultiplexer& mrEventMultiplexer;
119 ActivitiesQueue& mrActivitiesQueue;
120 canvas::tools::ElapsedTime maElapsedTime;
122 ViewsVecT maViews;
124 /// screen rect of sprite (in view coordinates!)
125 ::basegfx::B2DRange maSpriteRectangle;
127 vcl::Font maFont;
128 boost::shared_ptr<WakeupEvent> mpWakeUpEvent;
129 boost::shared_ptr<MouseHandler> mpMouseHandler;
130 ::basegfx::B2IVector maSpriteSizePixel;
131 sal_Int32 mnYOffset;
132 bool mbActive;
133 bool mbDrawPressed;
136 } // namespace internal
137 } // namespace presentation
139 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_REHEARSETIMINGSACTIVITY_HXX
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */