fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / include / vcl / animate.hxx
blobdd374e8aed516f102e2579d3702332b44df28fa5
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SV_ANIMATE_HXX
21 #define _SV_ANIMATE_HXX
23 #include <vcl/dllapi.h>
24 #include <vcl/timer.hxx>
25 #include <vcl/bitmapex.hxx>
27 #define ANIMATION_TIMEOUT_ON_CLICK 2147483647L
29 enum Disposal
31 DISPOSE_NOT,
32 DISPOSE_BACK,
33 DISPOSE_FULL,
34 DISPOSE_PREVIOUS
37 enum CycleMode
39 CYCLE_NOT,
40 CYCLE_NORMAL,
41 CYCLE_FALLBACK,
42 CYCLE_REVERS,
43 CYCLE_REVERS_FALLBACK
46 struct VCL_DLLPUBLIC AnimationBitmap
48 BitmapEx aBmpEx;
49 Point aPosPix;
50 Size aSizePix;
51 long nWait;
52 Disposal eDisposal;
53 sal_Bool bUserInput;
55 AnimationBitmap() {}
56 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 bUserInput ( sal_False )
71 sal_Bool operator==( const AnimationBitmap& rAnimBmp ) const
73 return( rAnimBmp.aBmpEx == aBmpEx &&
74 rAnimBmp.aPosPix == aPosPix &&
75 rAnimBmp.aSizePix == aSizePix &&
76 rAnimBmp.nWait == nWait &&
77 rAnimBmp.eDisposal == eDisposal &&
78 rAnimBmp.bUserInput == bUserInput );
81 sal_Bool operator!=( const AnimationBitmap& rAnimBmp ) const
82 { return !( *this == rAnimBmp ); }
84 sal_Bool IsEqual( const AnimationBitmap& rAnimBmp ) const
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 ) );
94 sal_uLong GetChecksum() const;
97 struct AInfo
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;
112 AInfo() : pOutDev( NULL ),
113 pViewData( NULL ),
114 nExtraData( 0L ),
115 bWithSize( sal_False ),
116 bPause( sal_False ) {}
119 class ImplAnimView;
120 typedef ::std::vector< AnimationBitmap* > AnimationBitmapList_impl;
121 typedef ::std::vector< ImplAnimView* > AnimViewList_impl;
123 class VCL_DLLPUBLIC Animation
125 SAL_DLLPRIVATE static sal_uLong mnAnimCount;
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;
146 SAL_DLLPRIVATE void ImplRestartTimer( sal_uLong nTimeout );
147 DECL_DLLPRIVATE_LINK( ImplTimeoutHdl, void* );
149 public:
151 SAL_DLLPRIVATE static void ImplIncAnimCount() { mnAnimCount++; }
152 SAL_DLLPRIVATE static void ImplDecAnimCount() { mnAnimCount--; }
153 SAL_DLLPRIVATE sal_uLong ImplGetCurPos() const { return mnPos; }
156 public:
157 Animation();
158 Animation( const Animation& rAnimation );
159 ~Animation();
161 Animation& operator=( const Animation& rAnimation );
162 sal_Bool operator==( const Animation& rAnimation ) const;
163 sal_Bool operator!=( const Animation& rAnimation ) const
164 { return !(*this==rAnimation); }
166 void Clear();
168 sal_Bool Start(
169 OutputDevice* pOutDev,
170 const Point& rDestPt,
171 const Size& rDestSz,
172 long nExtraData = 0,
173 OutputDevice* pFirstFrameOutDev = NULL
175 void Stop( OutputDevice* pOutDev = NULL, long nExtraData = 0 );
177 void Draw( OutputDevice* pOutDev, const Point& rDestPt ) const;
178 void Draw( OutputDevice* pOutDev, const Point& rDestPt, const Size& rDestSz ) const;
180 sal_Bool IsInAnimation() const { return mbIsInAnimation; }
181 sal_Bool IsTransparent() const;
182 sal_Bool IsTerminated() const { return mbLoopTerminated; }
184 const Size& GetDisplaySizePixel() const { return maGlobalSize; }
185 void SetDisplaySizePixel( const Size& rSize ) { maGlobalSize = rSize; }
187 const BitmapEx& GetBitmapEx() const { return maBitmapEx; }
188 void SetBitmapEx( const BitmapEx& rBmpEx ) { maBitmapEx = rBmpEx; }
190 sal_uLong GetLoopCount() const { return mnLoopCount; }
191 void SetLoopCount( const sal_uLong nLoopCount );
192 void ResetLoopCount();
194 void SetCycleMode( CycleMode eMode );
195 CycleMode GetCycleMode() const { return meCycleMode; }
197 void SetNotifyHdl( const Link& rLink ) { maNotifyLink = rLink; }
198 const Link& GetNotifyHdl() const { return maNotifyLink; }
200 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 );
205 sal_uLong GetSizeBytes() const;
206 sal_uLong GetChecksum() const;
208 public:
210 sal_Bool Convert( BmpConversion eConversion );
211 sal_Bool ReduceColors(
212 sal_uInt16 nNewColorCount,
213 BmpReduce eReduce = BMP_REDUCE_SIMPLE
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
226 sal_Bool Filter(
227 BmpFilter eFilter,
228 const BmpFilterParam* pFilterParam = NULL,
229 const Link* pProgress = NULL
232 friend VCL_DLLPUBLIC SvStream& operator>>( SvStream& rIStream, Animation& rAnimation );
233 friend VCL_DLLPUBLIC SvStream& operator<<( SvStream& rOStream, const Animation& rAnimation );
236 #endif // _SV_ANIMATE_HXX
238 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */