update dev300-m58
[ooovba.git] / slideshow / source / inc / activitiesqueue.hxx
blob8c795962dc18a8cef42dfa30a227917b60e447ba
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: activitiesqueue.hxx,v $
10 * $Revision: 1.10 $
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_ACTIVITIESQUEUE_HXX
32 #define INCLUDED_SLIDESHOW_ACTIVITIESQUEUE_HXX
34 #include <deque>
36 #include "activity.hxx"
37 #include "unoviewcontainer.hxx"
39 #include <canvas/elapsedtime.hxx>
41 #include <boost/shared_ptr.hpp>
42 #include <boost/utility.hpp> // for boost::noncopyable
45 /* Definition of ActivitiesQueue class */
47 namespace slideshow
49 namespace internal
51 /** This class handles the XSprite updates needed for
52 animations, such as moves, scales etc. You can add
53 activity objects to this class, which are called in a
54 round-robin fashion.
56 class ActivitiesQueue : private ::boost::noncopyable
58 public:
59 /** Create an ActivitiesQueue.
61 @param pPresTimer
62 Pointer to global presentation timer. Used for
63 adjusting and holding global presentation time.
65 ActivitiesQueue(
66 const ::boost::shared_ptr< ::canvas::tools::ElapsedTime >& pPresTimer );
67 ~ActivitiesQueue();
69 /** Add the given activity to the queue.
71 bool addActivity( const ActivitySharedPtr& pActivity );
73 /** Process the activities queue.
75 This method performs the smallest atomic processing
76 possible on the queue (typically, this means one
77 activity get processed).
79 void process();
81 /** Call all dequeued activities' dequeued() method
83 void processDequeued();
85 /** Query state of the queue
87 @return false, if queue is empty, true otherwise
89 bool isEmpty() const;
91 /** Remove all pending activities from the queue.
93 void clear();
95 /** Gets the queue's timer object.
97 ::boost::shared_ptr< ::canvas::tools::ElapsedTime > const &
98 getTimer() const { return mpTimer; }
100 /** returns number of all activities, waiting, reinserted and dequeued
102 std::size_t size() const
104 return maCurrentActivitiesWaiting.size() + maCurrentActivitiesReinsert.size() + maDequeuedActivities.size();
107 private:
108 ::boost::shared_ptr< ::canvas::tools::ElapsedTime > mpTimer;
110 typedef ::std::deque< ActivitySharedPtr > ActivityQueue;
112 ActivityQueue maCurrentActivitiesWaiting; // currently running
113 // activities, that still
114 // await processing for this
115 // round
117 ActivityQueue maCurrentActivitiesReinsert; // currently running
118 // activities, that are
119 // already processed for
120 // this round, and wants
121 // to be reinserted next
122 // round
124 ActivityQueue maDequeuedActivities; // This list collects all activities which did not request
125 // a reinsertion. After the screen update has been
126 // performed, those are notified via dequeued(). This
127 // facilitates cleanup actions taking place _after_ the
128 // current frame has been displayed.
133 #endif /* INCLUDED_SLIDESHOW_ACTIVITIESQUEUE_HXX */