1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rehearsetimingsactivity.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef INCLUDED_SLIDESHOW_REHEARSETIMINGSACTIVITY_HXX
32 #define INCLUDED_SLIDESHOW_REHEARSETIMINGSACTIVITY_HXX
34 #include "activity.hxx"
36 #include <basegfx/range/b2drange.hxx>
37 #include <boost/shared_ptr.hpp>
38 #include <boost/enable_shared_from_this.hpp>
39 #include <boost/noncopyable.hpp>
45 namespace canvas
{ namespace tools
{ class ElapsedTime
; }}
46 namespace cppcanvas
{ class CustomSprite
; }
56 struct SlideShowContext
;
57 class EventMultiplexer
;
59 class RehearseTimingsActivity
: public Activity
,
60 public ViewEventHandler
,
61 public boost::enable_shared_from_this
<RehearseTimingsActivity
>,
62 private ::boost::noncopyable
65 /** Creates the activity.
67 static boost::shared_ptr
<RehearseTimingsActivity
> create(
68 const SlideShowContext
& rContext
);
70 virtual ~RehearseTimingsActivity();
72 /** Starts and shows the timer; adds to activity queue.
76 /** Stops and hides the timer.
81 /** Determines whether the timer button has been clicked.
83 bool hasBeenClicked() const;
85 // ViewEventHandler interface
86 virtual void viewAdded( const UnoViewSharedPtr
& rView
);
87 virtual void viewRemoved( const UnoViewSharedPtr
& rView
);
88 virtual void viewChanged( const UnoViewSharedPtr
& rView
);
89 virtual void viewsChanged();
92 virtual void dispose();
94 virtual double calcTimeLag() const;
95 virtual bool perform();
96 virtual bool isActive() const;
97 virtual void dequeued();
103 explicit RehearseTimingsActivity( const SlideShowContext
& rContext
);
105 void paint( ::cppcanvas::CanvasSharedPtr
const & canvas
) const;
106 void paintAllSprites() const;
109 friend class MouseHandler
;
111 typedef ::std::vector
<
112 ::std::pair
<UnoViewSharedPtr
,
113 boost::shared_ptr
<cppcanvas::CustomSprite
> > > ViewsVecT
;
115 template <typename func_type
>
116 void for_each_sprite( func_type
const & func
) const
118 ViewsVecT::const_iterator
iPos( maViews
.begin() );
119 const ViewsVecT::const_iterator
iEnd( maViews
.end() );
120 for ( ; iPos
!= iEnd
; ++iPos
)
121 func( iPos
->second
);
124 ::basegfx::B2DRange
calcSpriteRectangle(
125 UnoViewSharedPtr
const & rView
) const;
127 EventQueue
& mrEventQueue
;
128 ScreenUpdater
& mrScreenUpdater
;
129 EventMultiplexer
& mrEventMultiplexer
;
130 ActivitiesQueue
& mrActivitiesQueue
;
131 canvas::tools::ElapsedTime maElapsedTime
;
135 /// screen rect of sprite (in view coordinates!)
136 ::basegfx::B2DRange maSpriteRectangle
;
139 boost::shared_ptr
<WakeupEvent
> mpWakeUpEvent
;
140 boost::shared_ptr
<MouseHandler
> mpMouseHandler
;
141 ::basegfx::B2IVector maSpriteSizePixel
;
147 } // namespace internal
148 } // namespace presentation
150 #endif /* INCLUDED_SLIDESHOW_REHEARSETIMINGSACTIVITY_HXX */