LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/vcl - animate.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 9 30 30.0 %
Date: 2013-07-09 Functions: 8 21 38.1 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       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/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      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 .
      18             :  */
      19             : 
      20             : #ifndef _SV_ANIMATE_HXX
      21             : #define _SV_ANIMATE_HXX
      22             : 
      23             : #include <vcl/dllapi.h>
      24             : #include <vcl/timer.hxx>
      25             : #include <vcl/bitmapex.hxx>
      26             : 
      27             : #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
      28             : 
      29             : enum Disposal
      30             : {
      31             :     DISPOSE_NOT,
      32             :     DISPOSE_BACK,
      33             :     DISPOSE_FULL,
      34             :     DISPOSE_PREVIOUS
      35             : };
      36             : 
      37             : enum CycleMode
      38             : {
      39             :     CYCLE_NOT,
      40             :     CYCLE_NORMAL,
      41             :     CYCLE_FALLBACK,
      42             :     CYCLE_REVERS,
      43             :     CYCLE_REVERS_FALLBACK
      44             : };
      45             : 
      46         408 : struct VCL_DLLPUBLIC AnimationBitmap
      47             : {
      48             :     BitmapEx    aBmpEx;
      49             :     Point       aPosPix;
      50             :     Size        aSizePix;
      51             :     long        nWait;
      52             :     Disposal    eDisposal;
      53             :     sal_Bool    bUserInput;
      54             : 
      55          61 :                 AnimationBitmap() {}
      56           3 :                 AnimationBitmap(
      57             :                     const BitmapEx& rBmpEx,
      58             :                     const Point& rPosPix,
      59             :                     const Size& rSizePix,
      60             :                     long _nWait = 0L,
      61             :                     Disposal _eDisposal = DISPOSE_NOT
      62             :                 ) :
      63             :                     aBmpEx      ( rBmpEx ),
      64             :                     aPosPix     ( rPosPix ),
      65             :                     aSizePix    ( rSizePix ),
      66             :                     nWait       ( _nWait ),
      67             :                     eDisposal   ( _eDisposal ),
      68           3 :                     bUserInput  ( sal_False )
      69           3 :                 {}
      70             : 
      71           0 :     bool    operator==( const AnimationBitmap& rAnimBmp ) const
      72             :                 {
      73           0 :                     return( rAnimBmp.aBmpEx == aBmpEx &&
      74           0 :                             rAnimBmp.aPosPix == aPosPix &&
      75           0 :                             rAnimBmp.aSizePix == aSizePix &&
      76           0 :                             rAnimBmp.nWait == nWait &&
      77           0 :                             rAnimBmp.eDisposal == eDisposal &&
      78           0 :                             rAnimBmp.bUserInput == bUserInput );
      79             :                 }
      80             : 
      81           0 :     bool    operator!=( const AnimationBitmap& rAnimBmp ) const
      82           0 :                 { return !( *this == rAnimBmp ); }
      83             : 
      84             :     sal_Bool    IsEqual( const AnimationBitmap& rAnimBmp ) const
      85             :                 {
      86             :                     return( rAnimBmp.aPosPix == aPosPix &&
      87             :                             rAnimBmp.aSizePix == aSizePix &&
      88             :                             rAnimBmp.nWait == nWait &&
      89             :                             rAnimBmp.eDisposal == eDisposal &&
      90             :                             rAnimBmp.bUserInput == bUserInput &&
      91             :                             rAnimBmp.aBmpEx.IsEqual( aBmpEx ) );
      92             :                 }
      93             : 
      94             :     sal_uLong   GetChecksum() const;
      95             : };
      96             : 
      97           0 : struct AInfo
      98             : {
      99             :     Bitmap          aLastSaveBitmap;
     100             :     Bitmap          aBackBitmap;
     101             :     Rectangle       aClipRect;
     102             :     Size            aLastSaveSize;
     103             :     Point           aLastSavePoint;
     104             :     Point           aStartOrg;
     105             :     Size            aStartSize;
     106             :     OutputDevice*   pOutDev;
     107             :     void*           pViewData;
     108             :     long            nExtraData;
     109             :     sal_Bool        bWithSize;
     110             :     sal_Bool        bPause;
     111             : 
     112           0 :                     AInfo() : pOutDev( NULL ),
     113             :                               pViewData( NULL ),
     114             :                               nExtraData( 0L ),
     115             :                               bWithSize( sal_False ),
     116           0 :                               bPause( sal_False ) {}
     117             : };
     118             : 
     119             : class ImplAnimView;
     120             : typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl;
     121             : typedef ::std::vector< ImplAnimView* > AnimViewList_impl;
     122             : 
     123             : class VCL_DLLPUBLIC Animation
     124             : {
     125             :     SAL_DLLPRIVATE static sal_uLong     mnAnimCount;
     126             : 
     127             :     AnimationBitmapList_impl    maList;
     128             :     AnimViewList_impl           maViewList;
     129             :     Link                    maNotifyLink;
     130             :     BitmapEx                maBitmapEx;
     131             :     Timer                   maTimer;
     132             :     Size                    maGlobalSize;
     133             :     void*                   mpExtraData;
     134             :     long                    mnLoopCount;
     135             :     long                    mnLoops;
     136             :     size_t                  mnPos;
     137             :     Disposal                meLastDisposal;
     138             :     CycleMode               meCycleMode;
     139             :     sal_Bool                mbFirst;
     140             :     sal_Bool                mbIsInAnimation;
     141             :     sal_Bool                mbWithSize;
     142             :     sal_Bool                mbLoopTerminated;
     143             :     sal_Bool                mbIsWaiting;
     144             : 
     145             : 
     146             :     SAL_DLLPRIVATE void     ImplRestartTimer( sal_uLong nTimeout );
     147             :     DECL_DLLPRIVATE_LINK(   ImplTimeoutHdl, void* );
     148             : 
     149             : public:
     150             : 
     151           0 :     SAL_DLLPRIVATE static void  ImplIncAnimCount() { mnAnimCount++; }
     152           0 :     SAL_DLLPRIVATE static void  ImplDecAnimCount() { mnAnimCount--; }
     153           0 :     SAL_DLLPRIVATE sal_uLong    ImplGetCurPos() const { return mnPos; }
     154             : 
     155             : 
     156             : public:
     157             :                             Animation();
     158             :                             Animation( const Animation& rAnimation );
     159             :                             ~Animation();
     160             : 
     161             :     Animation&              operator=( const Animation& rAnimation );
     162             :     bool                operator==( const Animation& rAnimation ) const;
     163             :     bool                operator!=( const Animation& rAnimation ) const
     164             :                             { return !(*this==rAnimation); }
     165             : 
     166             :     void                    Clear();
     167             : 
     168             :     sal_Bool                Start(
     169             :                                 OutputDevice* pOutDev,
     170             :                                 const Point& rDestPt,
     171             :                                 const Size& rDestSz,
     172             :                                 long nExtraData = 0,
     173             :                                 OutputDevice* pFirstFrameOutDev = NULL
     174             :                             );
     175             :     void                    Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 );
     176             : 
     177             :     void                    Draw( OutputDevice* pOutDev, const Point& rDestPt ) const;
     178             :     void                    Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const;
     179             : 
     180          64 :     sal_Bool                IsInAnimation() const { return mbIsInAnimation; }
     181             :     sal_Bool                IsTransparent() const;
     182             :     sal_Bool                IsTerminated() const { return mbLoopTerminated; }
     183             : 
     184           0 :     const Size&             GetDisplaySizePixel() const { return maGlobalSize; }
     185          10 :     void                    SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; }
     186             : 
     187          17 :     const BitmapEx&         GetBitmapEx() const { return maBitmapEx; }
     188           0 :     void                    SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; }
     189             : 
     190           0 :     sal_uLong               GetLoopCount() const { return mnLoopCount; }
     191             :     void                    SetLoopCount( const sal_uLong nLoopCount );
     192             :     void                    ResetLoopCount();
     193             : 
     194             :     void                    SetCycleMode( CycleMode eMode );
     195           0 :     CycleMode               GetCycleMode() const { return meCycleMode; }
     196             : 
     197           0 :     void                    SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; }
     198           0 :     const Link&             GetNotifyHdl() const { return maNotifyLink; }
     199             : 
     200         213 :     size_t                  Count() const { return maList.size(); }
     201             :     sal_Bool                Insert( const AnimationBitmap& rAnimationBitmap );
     202             :     const AnimationBitmap&  Get( sal_uInt16 nAnimation ) const;
     203             :     void                    Replace( const AnimationBitmap& rNewAnimationBmp, sal_uInt16 nAnimation );
     204             : 
     205             :     sal_uLong               GetSizeBytes() const;
     206             :     sal_uLong               GetChecksum() const;
     207             : 
     208             : public:
     209             : 
     210             :     sal_Bool                Convert( BmpConversion eConversion );
     211             :     sal_Bool                ReduceColors(
     212             :                                 sal_uInt16 nNewColorCount,
     213             :                                 BmpReduce eReduce = BMP_REDUCE_SIMPLE
     214             :                             );
     215             :     sal_Bool                Invert();
     216             :     sal_Bool                Mirror( sal_uLong nMirrorFlags );
     217             :     sal_Bool                Adjust(
     218             :                                 short nLuminancePercent = 0,
     219             :                                 short nContrastPercent = 0,
     220             :                                 short nChannelRPercent = 0,
     221             :                                 short nChannelGPercent = 0,
     222             :                                 short nChannelBPercent = 0,
     223             :                                 double fGamma = 1.0,
     224             :                                 sal_Bool bInvert = sal_False
     225             :                             );
     226             :     sal_Bool                Filter(
     227             :                                 BmpFilter eFilter,
     228             :                                 const BmpFilterParam* pFilterParam = NULL,
     229             :                                 const Link* pProgress = NULL
     230             :                             );
     231             : 
     232             :     friend VCL_DLLPUBLIC SvStream&  operator>>( SvStream& rIStream, Animation& rAnimation );
     233             :     friend VCL_DLLPUBLIC SvStream&  operator<<( SvStream& rOStream, const Animation& rAnimation );
     234             : };
     235             : 
     236             : #endif // _SV_ANIMATE_HXX
     237             : 
     238             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10