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 INCLUDED_SD_INC_CUSTOMANIMATIONEFFECT_HXX
21 : #define INCLUDED_SD_INC_CUSTOMANIMATIONEFFECT_HXX
22 :
23 : #include <com/sun/star/animations/XAnimationNode.hpp>
24 : #include <com/sun/star/animations/XTimeContainer.hpp>
25 : #include <com/sun/star/animations/XAudio.hpp>
26 : #include <com/sun/star/drawing/XShape.hpp>
27 : #include <com/sun/star/util/XChangesListener.hpp>
28 :
29 : #include <boost/shared_ptr.hpp>
30 :
31 : #include <vcl/timer.hxx>
32 :
33 : #include <sddllapi.h>
34 :
35 : #include <list>
36 : #include <map>
37 :
38 : class SdrPathObj;
39 :
40 : namespace sd {
41 :
42 : enum EValue { VALUE_FROM, VALUE_TO, VALUE_BY, VALUE_FIRST, VALUE_LAST };
43 :
44 : class CustomAnimationEffect;
45 :
46 : class CustomAnimationPreset;
47 : typedef boost::shared_ptr< CustomAnimationPreset > CustomAnimationPresetPtr;
48 :
49 : typedef boost::shared_ptr< CustomAnimationEffect > CustomAnimationEffectPtr;
50 :
51 : typedef std::list< CustomAnimationEffectPtr > EffectSequence;
52 :
53 : class EffectSequenceHelper;
54 :
55 : class SD_DLLPUBLIC CustomAnimationEffect
56 : {
57 : friend class MainSequence;
58 : friend class EffectSequenceHelper;
59 :
60 : public:
61 : CustomAnimationEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
62 : virtual ~CustomAnimationEffect();
63 :
64 0 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& getNode() const { return mxNode; }
65 : SAL_DLLPRIVATE void setNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
66 : SAL_DLLPRIVATE void replaceNode( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
67 :
68 : SAL_DLLPRIVATE CustomAnimationEffectPtr clone() const;
69 :
70 : // attributes
71 0 : SAL_DLLPRIVATE const OUString& getPresetId() const { return maPresetId; }
72 0 : SAL_DLLPRIVATE const OUString& getPresetSubType() const { return maPresetSubType; }
73 0 : SAL_DLLPRIVATE const OUString& getProperty() const { return maProperty; }
74 :
75 0 : SAL_DLLPRIVATE sal_Int16 getPresetClass() const { return mnPresetClass; }
76 : SAL_DLLPRIVATE void setPresetClass( sal_Int16 nPresetClass );
77 :
78 0 : SAL_DLLPRIVATE sal_Int16 getNodeType() const { return mnNodeType; }
79 : void setNodeType( sal_Int16 nNodeType );
80 :
81 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getRepeatCount() const;
82 : SAL_DLLPRIVATE void setRepeatCount( const ::com::sun::star::uno::Any& rRepeatCount );
83 :
84 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getEnd() const;
85 : SAL_DLLPRIVATE void setEnd( const ::com::sun::star::uno::Any& rEnd );
86 :
87 : SAL_DLLPRIVATE sal_Int16 getFill() const;
88 : SAL_DLLPRIVATE void setFill( sal_Int16 nFill );
89 :
90 0 : SAL_DLLPRIVATE double getBegin() const { return mfBegin; }
91 : void setBegin( double fBegin );
92 :
93 0 : SAL_DLLPRIVATE double getDuration() const { return mfDuration; }
94 : void setDuration( double fDuration );
95 :
96 0 : SAL_DLLPRIVATE double getAbsoluteDuration() const { return mfAbsoluteDuration; }
97 :
98 : SAL_DLLPRIVATE const OUString& getName() const { return maName; }
99 : SAL_DLLPRIVATE void setName( const OUString& rName ) { maName = rName; }
100 :
101 0 : SAL_DLLPRIVATE sal_Int16 getIterateType() const { return mnIterateType; }
102 : void setIterateType( sal_Int16 nIterateType );
103 :
104 0 : SAL_DLLPRIVATE double getIterateInterval() const { return mfIterateInterval; }
105 : void setIterateInterval( double fIterateInterval );
106 :
107 0 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getTarget() const { return maTarget; }
108 : void setTarget( const ::com::sun::star::uno::Any& rTarget );
109 :
110 0 : SAL_DLLPRIVATE bool hasAfterEffect() const { return mbHasAfterEffect; }
111 0 : SAL_DLLPRIVATE void setHasAfterEffect( bool bHasAfterEffect ) { mbHasAfterEffect = bHasAfterEffect; }
112 :
113 0 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getDimColor() const { return maDimColor; }
114 0 : SAL_DLLPRIVATE void setDimColor( ::com::sun::star::uno::Any aDimColor ) { maDimColor = aDimColor; }
115 :
116 0 : SAL_DLLPRIVATE bool IsAfterEffectOnNext() const { return mbAfterEffectOnNextEffect; }
117 0 : SAL_DLLPRIVATE void setAfterEffectOnNext( bool bOnNextEffect ) { mbAfterEffectOnNextEffect = bOnNextEffect; }
118 :
119 0 : SAL_DLLPRIVATE sal_Int32 getParaDepth() const { return mnParaDepth; }
120 :
121 0 : SAL_DLLPRIVATE bool hasText() const { return mbHasText; }
122 :
123 0 : SAL_DLLPRIVATE sal_Int16 getCommand() const { return mnCommand; }
124 :
125 0 : SAL_DLLPRIVATE double getAcceleration() const { return mfAcceleration; }
126 : SAL_DLLPRIVATE void setAcceleration( double fAcceleration );
127 :
128 0 : SAL_DLLPRIVATE double getDecelerate() const { return mfDecelerate; }
129 : SAL_DLLPRIVATE void setDecelerate( double fDecelerate );
130 :
131 0 : SAL_DLLPRIVATE bool getAutoReverse() const { return mbAutoReverse; }
132 : SAL_DLLPRIVATE void setAutoReverse( bool bAutoReverse );
133 :
134 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getProperty( sal_Int32 nNodeType, const OUString& rAttributeName, EValue eValue );
135 : SAL_DLLPRIVATE bool setProperty( sal_Int32 nNodeType, const OUString& rAttributeName, EValue eValue, const ::com::sun::star::uno::Any& rValue );
136 :
137 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getTransformationProperty( sal_Int32 nTransformType, EValue eValue );
138 : SAL_DLLPRIVATE bool setTransformationProperty( sal_Int32 nTransformType, EValue eValue, const ::com::sun::star::uno::Any& rValue );
139 :
140 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getColor( sal_Int32 nIndex );
141 : SAL_DLLPRIVATE void setColor( sal_Int32 nIndex, const ::com::sun::star::uno::Any& rColor );
142 :
143 : SAL_DLLPRIVATE ::com::sun::star::uno::Any getRotation();
144 : SAL_DLLPRIVATE void setRotation( const ::com::sun::star::uno::Any& rRotation );
145 :
146 0 : SAL_DLLPRIVATE sal_Int32 getGroupId() const { return mnGroupId; }
147 : SAL_DLLPRIVATE void setGroupId( sal_Int32 nGroupId );
148 :
149 0 : SAL_DLLPRIVATE sal_Int16 getTargetSubItem() const { return mnTargetSubItem; }
150 : void setTargetSubItem( sal_Int16 nSubItem );
151 :
152 : SAL_DLLPRIVATE OUString getPath() const;
153 : SAL_DLLPRIVATE void setPath( const OUString& rPath );
154 :
155 : SAL_DLLPRIVATE bool checkForText();
156 : SAL_DLLPRIVATE bool calculateIterateDuration();
157 :
158 : SAL_DLLPRIVATE void setAudio( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio >& xAudio );
159 : SAL_DLLPRIVATE bool getStopAudio() const;
160 : void setStopAudio();
161 : void createAudio( const ::com::sun::star::uno::Any& rSource, double fVolume = 1.0 );
162 : SAL_DLLPRIVATE void removeAudio();
163 0 : SAL_DLLPRIVATE const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio >& getAudio() const { return mxAudio; }
164 :
165 0 : SAL_DLLPRIVATE EffectSequenceHelper* getEffectSequence() const { return mpEffectSequence; }
166 :
167 : // helper
168 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > createAfterEffectNode() const throw (com::sun::star::uno::Exception);
169 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTargetShape() const;
170 :
171 : // static helpers
172 : SAL_DLLPRIVATE static sal_Int32 get_node_type( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
173 : SAL_DLLPRIVATE static sal_Int32 getNumberOfSubitems( const ::com::sun::star::uno::Any& aTarget, sal_Int16 nIterateType );
174 :
175 : SAL_DLLPRIVATE SdrPathObj* createSdrPathObjFromPath();
176 : SAL_DLLPRIVATE void updateSdrPathObjFromPath( SdrPathObj& rPathObj );
177 : SAL_DLLPRIVATE void updatePathFromSdrPathObj( const SdrPathObj& rPathObj );
178 :
179 : protected:
180 0 : SAL_DLLPRIVATE void setEffectSequence( EffectSequenceHelper* pSequence ) { mpEffectSequence = pSequence; }
181 :
182 : private:
183 : sal_Int16 mnNodeType;
184 : OUString maPresetId;
185 : OUString maPresetSubType;
186 : OUString maProperty;
187 : sal_Int16 mnPresetClass;
188 : double mfBegin;
189 : double mfDuration; // this is the maximum duration of the subeffects
190 : double mfAbsoluteDuration; // this is the maximum duration of the subeffects including possible iterations
191 : sal_Int32 mnGroupId;
192 : sal_Int16 mnIterateType;
193 : double mfIterateInterval;
194 : sal_Int32 mnParaDepth;
195 : bool mbHasText;
196 : double mfAcceleration;
197 : double mfDecelerate;
198 : bool mbAutoReverse;
199 : sal_Int16 mnTargetSubItem;
200 : sal_Int16 mnCommand;
201 :
202 : EffectSequenceHelper* mpEffectSequence;
203 :
204 : OUString maName;
205 :
206 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > mxNode;
207 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAudio > mxAudio;
208 : ::com::sun::star::uno::Any maTarget;
209 :
210 : bool mbHasAfterEffect;
211 : ::com::sun::star::uno::Any maDimColor;
212 : bool mbAfterEffectOnNextEffect;
213 : };
214 :
215 : struct stl_CustomAnimationEffect_search_node_predict
216 : {
217 : stl_CustomAnimationEffect_search_node_predict( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xSearchNode );
218 : bool operator()( CustomAnimationEffectPtr pEffect ) const;
219 : const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& mxSearchNode;
220 : };
221 :
222 : enum ESequenceHint { EFFECT_EDITED, EFFECT_REMOVED, EFFECT_ADDED };
223 :
224 : /** this listener is implemented by UI components to track changes in the animation core */
225 96 : class ISequenceListener
226 : {
227 : public:
228 : virtual void notify_change() = 0;
229 :
230 : protected:
231 96 : ~ISequenceListener() {}
232 : };
233 :
234 : /** this class keeps track of a group of animations that build up
235 : a text animation for a single shape */
236 0 : class CustomAnimationTextGroup
237 : {
238 : friend class EffectSequenceHelper;
239 :
240 : public:
241 : CustomAnimationTextGroup( const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& rTarget, sal_Int32 nGroupId );
242 :
243 : void reset();
244 : void addEffect( CustomAnimationEffectPtr& pEffect );
245 :
246 : const ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& getTarget() const { return maTarget; }
247 0 : const EffectSequence& getEffects() const { return maEffects; }
248 :
249 : /* -1: as single object, 0: all at once, n > 0: by n Th paragraph */
250 0 : sal_Int32 getTextGrouping() const { return mnTextGrouping; }
251 :
252 0 : bool getAnimateForm() const { return mbAnimateForm; }
253 0 : bool getTextReverse() const { return mbTextReverse; }
254 0 : double getTextGroupingAuto() const { return mfGroupingAuto; }
255 :
256 : private:
257 : EffectSequence maEffects;
258 : ::com::sun::star::uno::Reference< com::sun::star::drawing::XShape > maTarget;
259 :
260 : enum { PARA_LEVELS = 5 };
261 :
262 : sal_Int32 mnTextGrouping;
263 : bool mbAnimateForm;
264 : bool mbTextReverse;
265 : double mfGroupingAuto;
266 : sal_Int32 mnLastPara;
267 : sal_Int8 mnDepthFlags[PARA_LEVELS];
268 : sal_Int32 mnGroupId;
269 : };
270 :
271 : typedef boost::shared_ptr< CustomAnimationTextGroup > CustomAnimationTextGroupPtr;
272 : typedef std::map< sal_Int32, CustomAnimationTextGroupPtr > CustomAnimationTextGroupMap;
273 :
274 : class SD_DLLPUBLIC EffectSequenceHelper
275 : {
276 : friend class MainSequence;
277 :
278 : public:
279 : SAL_DLLPRIVATE EffectSequenceHelper();
280 : SAL_DLLPRIVATE EffectSequenceHelper( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer >& xSequenceRoot );
281 : SAL_DLLPRIVATE virtual ~EffectSequenceHelper();
282 :
283 : SAL_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRootNode();
284 :
285 : SAL_DLLPRIVATE CustomAnimationEffectPtr append( const CustomAnimationPresetPtr& pDescriptor, const ::com::sun::star::uno::Any& rTarget, double fDuration = -1.0 );
286 : SAL_DLLPRIVATE CustomAnimationEffectPtr append( const SdrPathObj& rPathObj, const ::com::sun::star::uno::Any& rTarget, double fDuration = -1.0 );
287 : void append( const CustomAnimationEffectPtr& pEffect );
288 : SAL_DLLPRIVATE void insert( EffectSequence::iterator& rPos, const CustomAnimationEffectPtr& pEffect );
289 : SAL_DLLPRIVATE void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, double fDuration = -1.0 );
290 : SAL_DLLPRIVATE void replace( const CustomAnimationEffectPtr& pEffect, const CustomAnimationPresetPtr& pDescriptor, const OUString& rPresetSubType, double fDuration = -1.0 );
291 : SAL_DLLPRIVATE void remove( const CustomAnimationEffectPtr& pEffect );
292 :
293 : SAL_DLLPRIVATE void create( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
294 : SAL_DLLPRIVATE void createEffectsequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
295 : SAL_DLLPRIVATE void processAfterEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
296 : SAL_DLLPRIVATE void createEffects( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode );
297 :
298 0 : SAL_DLLPRIVATE sal_Int32 getCount() const { return sal::static_int_cast< sal_Int32 >( maEffects.size() ); }
299 :
300 : SAL_DLLPRIVATE virtual CustomAnimationEffectPtr findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const;
301 :
302 : SAL_DLLPRIVATE virtual bool disposeShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
303 : SAL_DLLPRIVATE virtual void insertTextRange( const com::sun::star::uno::Any& aTarget );
304 : SAL_DLLPRIVATE virtual void disposeTextRange( const com::sun::star::uno::Any& aTarget );
305 : SAL_DLLPRIVATE virtual bool hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
306 : SAL_DLLPRIVATE virtual void onTextChanged( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape );
307 :
308 : /** this must be called if effects from this sequence are changed.
309 : the method will call the registered listeners */
310 : SAL_DLLPRIVATE void update( const CustomAnimationEffectPtr& pEffect );
311 :
312 : /** this method rebuilds the animation nodes */
313 : SAL_DLLPRIVATE virtual void rebuild();
314 :
315 2 : SAL_DLLPRIVATE EffectSequence::iterator getBegin() { return maEffects.begin(); }
316 2 : SAL_DLLPRIVATE EffectSequence::iterator getEnd() { return maEffects.end(); }
317 : SAL_DLLPRIVATE EffectSequence::iterator find( const CustomAnimationEffectPtr& pEffect );
318 :
319 0 : SAL_DLLPRIVATE EffectSequence& getSequence() { return maEffects; }
320 :
321 : SAL_DLLPRIVATE void addListener( ISequenceListener* pListener );
322 : SAL_DLLPRIVATE void removeListener( ISequenceListener* pListener );
323 :
324 : // text group methods
325 :
326 : SAL_DLLPRIVATE CustomAnimationTextGroupPtr findGroup( sal_Int32 nGroupId );
327 : CustomAnimationTextGroupPtr createTextGroup( CustomAnimationEffectPtr pEffect, sal_Int32 nTextGrouping, double fTextGroupingAuto, bool bAnimateForm, bool bTextReverse );
328 : SAL_DLLPRIVATE void setTextGrouping( CustomAnimationTextGroupPtr pTextGroup, sal_Int32 nTextGrouping );
329 : SAL_DLLPRIVATE void setAnimateForm( CustomAnimationTextGroupPtr pTextGroup, bool bAnimateForm );
330 : SAL_DLLPRIVATE void setTextGroupingAuto( CustomAnimationTextGroupPtr pTextGroup, double fTextGroupingAuto );
331 : SAL_DLLPRIVATE void setTextReverse( CustomAnimationTextGroupPtr pTextGroup, bool bAnimateForm );
332 :
333 0 : SAL_DLLPRIVATE sal_Int32 getSequenceType() const { return mnSequenceType; }
334 :
335 0 : SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getTriggerShape() const { return mxEventSource; }
336 0 : SAL_DLLPRIVATE void setTriggerShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xTrigger ) { mxEventSource = xTrigger; }
337 :
338 : SAL_DLLPRIVATE virtual sal_Int32 getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const;
339 : SAL_DLLPRIVATE virtual CustomAnimationEffectPtr getEffectFromOffset( sal_Int32 nOffset ) const;
340 :
341 : protected:
342 : SAL_DLLPRIVATE virtual void implRebuild();
343 : SAL_DLLPRIVATE virtual void reset();
344 :
345 : SAL_DLLPRIVATE void createTextGroupParagraphEffects( CustomAnimationTextGroupPtr pTextGroup, CustomAnimationEffectPtr pEffect, bool bUsed );
346 :
347 : SAL_DLLPRIVATE void notify_listeners();
348 :
349 : SAL_DLLPRIVATE void updateTextGroups();
350 :
351 : protected:
352 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer > mxSequenceRoot;
353 : EffectSequence maEffects;
354 : std::list< ISequenceListener* > maListeners;
355 : CustomAnimationTextGroupMap maGroupMap;
356 : sal_Int32 mnSequenceType;
357 : ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxEventSource;
358 : };
359 :
360 : class MainSequence;
361 :
362 0 : class InteractiveSequence : public EffectSequenceHelper
363 : {
364 : friend class MainSequence;
365 : friend class MainSequenceChangeGuard;
366 :
367 : public:
368 : InteractiveSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer >& xSequenceRoot, MainSequence* pMainSequence );
369 :
370 : /** this method rebuilds the animation nodes */
371 : virtual void rebuild() SAL_OVERRIDE;
372 :
373 : private:
374 : virtual void implRebuild() SAL_OVERRIDE;
375 :
376 : MainSequence* mpMainSequence;
377 : };
378 :
379 : typedef boost::shared_ptr< InteractiveSequence > InteractiveSequencePtr;
380 : typedef std::list< InteractiveSequencePtr > InteractiveSequenceList;
381 :
382 : class MainSequence : public EffectSequenceHelper, public ISequenceListener
383 : {
384 : friend class UndoAnimation;
385 : friend class MainSequenceRebuildGuard;
386 : friend class MainSequenceChangeGuard;
387 :
388 : public:
389 : MainSequence();
390 : MainSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTimingRootNode );
391 : virtual ~MainSequence();
392 :
393 : virtual ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode > getRootNode() SAL_OVERRIDE;
394 : void reset( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xTimingRootNode );
395 :
396 : /** this method rebuilds the animation nodes */
397 : virtual void rebuild() SAL_OVERRIDE;
398 :
399 : virtual CustomAnimationEffectPtr findEffect( const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xNode ) const SAL_OVERRIDE;
400 :
401 : virtual bool disposeShape( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) SAL_OVERRIDE;
402 : virtual void insertTextRange( const com::sun::star::uno::Any& aTarget ) SAL_OVERRIDE;
403 : virtual void disposeTextRange( const com::sun::star::uno::Any& aTarget ) SAL_OVERRIDE;
404 : virtual bool hasEffect( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) SAL_OVERRIDE;
405 : virtual void onTextChanged( const com::sun::star::uno::Reference< com::sun::star::drawing::XShape >& xShape ) SAL_OVERRIDE;
406 :
407 0 : const InteractiveSequenceList& getInteractiveSequenceList() const { return maInteractiveSequenceList; }
408 :
409 : virtual void notify_change() SAL_OVERRIDE;
410 :
411 : bool setTrigger( const CustomAnimationEffectPtr& pEffect, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xTriggerShape );
412 :
413 : /** starts a timer that recreates the internal structure from the API core after 1 second */
414 : void startRecreateTimer();
415 :
416 : /** starts a timer that rebuilds the API core from the internal structure after 1 second */
417 : void startRebuildTimer();
418 :
419 : virtual sal_Int32 getOffsetFromEffect( const CustomAnimationEffectPtr& xEffect ) const SAL_OVERRIDE;
420 : virtual CustomAnimationEffectPtr getEffectFromOffset( sal_Int32 nOffset ) const SAL_OVERRIDE;
421 :
422 : protected:
423 : /** permits rebuilds until unlockRebuilds() is called. All rebuild calls during a locked sequence are
424 : process after unlockRebuilds() call. lockRebuilds() and unlockRebuilds() calls can be nested. */
425 : void lockRebuilds();
426 : void unlockRebuilds();
427 :
428 : DECL_LINK(onTimerHdl, void *);
429 :
430 : virtual void implRebuild() SAL_OVERRIDE;
431 :
432 : void init();
433 :
434 : void createMainSequence();
435 : virtual void reset() SAL_OVERRIDE;
436 :
437 : InteractiveSequencePtr createInteractiveSequence( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape );
438 :
439 : InteractiveSequenceList maInteractiveSequenceList;
440 :
441 : ::com::sun::star::uno::Reference< ::com::sun::star::util::XChangesListener > mxChangesListener;
442 : ::com::sun::star::uno::Reference< ::com::sun::star::animations::XTimeContainer > mxTimingRootNode;
443 : Timer maTimer;
444 : bool mbTimerMode;
445 : bool mbRebuilding;
446 :
447 : long mnRebuildLockGuard;
448 : bool mbPendingRebuildRequest;
449 : sal_Int32 mbIgnoreChanges;
450 : };
451 :
452 : typedef boost::shared_ptr< MainSequence > MainSequencePtr;
453 :
454 : class MainSequenceRebuildGuard
455 : {
456 : public:
457 : MainSequenceRebuildGuard( const MainSequencePtr& pMainSequence );
458 : ~MainSequenceRebuildGuard();
459 :
460 : private:
461 : MainSequencePtr mpMainSequence;
462 : };
463 :
464 : }
465 :
466 : #endif // INCLUDED_SD_INC_CUSTOMANIMATIONEFFECT_HXX
467 :
468 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|