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

Generated by: LCOV version 1.10