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: activitiesqueue.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_ACTIVITIESQUEUE_HXX
32 #define INCLUDED_SLIDESHOW_ACTIVITIESQUEUE_HXX
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 */
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
56 class ActivitiesQueue
: private ::boost::noncopyable
59 /** Create an ActivitiesQueue.
62 Pointer to global presentation timer. Used for
63 adjusting and holding global presentation time.
66 const ::boost::shared_ptr
< ::canvas::tools::ElapsedTime
>& pPresTimer
);
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).
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
91 /** Remove all pending activities from the queue.
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();
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
117 ActivityQueue maCurrentActivitiesReinsert
; // currently running
118 // activities, that are
119 // already processed for
120 // this round, and wants
121 // to be reinserted next
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 */