LCOV - code coverage report
Current view: top level - svx/inc/svx/sdr/animation - scheduler.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1 0.0 %
Date: 2012-08-25 Functions: 0 1 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : #ifndef _SDR_ANIMATION_SCHEDULER_HXX
      30                 :            : #define _SDR_ANIMATION_SCHEDULER_HXX
      31                 :            : 
      32                 :            : #include <sal/types.h>
      33                 :            : #include <vcl/timer.hxx>
      34                 :            : #include <svx/svxdllapi.h>
      35                 :            : 
      36                 :            : //////////////////////////////////////////////////////////////////////////////
      37                 :            : // event class
      38                 :            : 
      39                 :            : namespace sdr
      40                 :            : {
      41                 :            :     namespace animation
      42                 :            :     {
      43                 :            :         class Event
      44                 :            :         {
      45                 :            :             // time of event in ms
      46                 :            :             sal_uInt32                                      mnTime;
      47                 :            : 
      48                 :            :             // pointer for simply linked list
      49                 :            :             Event*                                          mpNext;
      50                 :            : 
      51                 :            :         public:
      52                 :            :             // constructor/destructor
      53                 :            :             explicit Event(sal_uInt32 nTime);
      54                 :            :             SVX_DLLPUBLIC virtual ~Event();
      55                 :            : 
      56                 :            :             // access to mpNext
      57                 :            :             Event* GetNext() const;
      58                 :            :             void SetNext(Event* pNew);
      59                 :            : 
      60                 :            :             // get/set time
      61                 :            :             sal_uInt32 GetTime() const;
      62                 :            :             void SVX_DLLPUBLIC SetTime(sal_uInt32 nNew);
      63                 :            : 
      64                 :            :             // execute event
      65                 :            :             virtual void Trigger(sal_uInt32 nTime) = 0;
      66                 :            :         };
      67                 :            :     } // end of namespace animation
      68                 :            : } // end of namespace sdr
      69                 :            : 
      70                 :            : //////////////////////////////////////////////////////////////////////////////
      71                 :            : // eventlist class
      72                 :            : 
      73                 :            : namespace sdr
      74                 :            : {
      75                 :            :     namespace animation
      76                 :            :     {
      77                 :            :         class EventList
      78                 :            :         {
      79                 :            :             // pointer to first entry
      80                 :            :             Event*                                          mpHead;
      81                 :            : 
      82                 :            :         public:
      83                 :            :             // constructor/destructor
      84                 :            :             EventList();
      85                 :            :             SVX_DLLPUBLIC virtual ~EventList();
      86                 :            : 
      87                 :            :             // insert/remove time dependent
      88                 :            :             void Insert(Event* pNew);
      89                 :            :             void Remove(Event* pOld);
      90                 :            : 
      91                 :            :             // clear list
      92                 :            :             void Clear();
      93                 :            : 
      94                 :            :             // get first
      95                 :            :             Event* GetFirst();
      96                 :            :         };
      97                 :            :     } // end of namespace animation
      98                 :            : } // end of namespace sdr
      99                 :            : 
     100                 :            : //////////////////////////////////////////////////////////////////////////////
     101                 :            : // scheduler class
     102                 :            : 
     103                 :            : namespace sdr
     104                 :            : {
     105                 :            :     namespace animation
     106                 :            :     {
     107                 :            :         class Scheduler : public Timer
     108                 :            :         {
     109                 :            :             // time in ms
     110                 :            :             sal_uInt32                                      mnTime;
     111                 :            : 
     112                 :            :             // next delta time
     113                 :            :             sal_uInt32                                      mnDeltaTime;
     114                 :            : 
     115                 :            :             // list of events
     116                 :            :             EventList                                       maList;
     117                 :            : 
     118                 :            :             // Flag which remembers if this timer is paused. Default
     119                 :            :             // is false.
     120                 :            :             bool                                            mbIsPaused;
     121                 :            : 
     122                 :            :         public:
     123                 :            :             // constructor/destructor
     124                 :            :             Scheduler();
     125                 :            :             SVX_DLLPUBLIC virtual ~Scheduler();
     126                 :            : 
     127                 :            :             // From baseclass Timer, the timeout call
     128                 :            :             SVX_DLLPUBLIC virtual void Timeout();
     129                 :            : 
     130                 :            :             // get time
     131                 :            :             sal_uInt32 GetTime();
     132                 :            : 
     133                 :            :             // #i38135#
     134                 :            :             void SetTime(sal_uInt32 nTime);
     135                 :            : 
     136                 :            :             // execute all ripe events, removes executed ones from the scheduler
     137                 :            :             void triggerEvents();
     138                 :            : 
     139                 :            :             // re-start or stop timer according to event list
     140                 :            :             void checkTimeout();
     141                 :            : 
     142                 :            :             // insert/remove events, wrapper to EventList methods
     143                 :            :             void SVX_DLLPUBLIC InsertEvent(Event* pNew);
     144                 :            :             void RemoveEvent(Event* pOld);
     145                 :            : 
     146                 :            :             // get/set pause
     147                 :          0 :             bool IsPaused() const { return mbIsPaused; }
     148                 :            :             void SetPaused(bool bNew);
     149                 :            :         };
     150                 :            :     } // end of namespace animation
     151                 :            : } // end of namespace sdr
     152                 :            : 
     153                 :            : //////////////////////////////////////////////////////////////////////////////
     154                 :            : 
     155                 :            : #endif //_SDR_ANIMATION_SCHEDULER_HXX
     156                 :            : 
     157                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10