1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ppt97animations.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sd.hxx"
34 #include "ppt97animations.hxx"
36 // header for class SdrObject
37 #include <svx/svdobj.hxx>
38 // header for class SdPage
40 // header for define DBG_ERROR
41 #include <tools/debug.hxx>
42 // header for define GetXShapeForSdrObject
43 #include <svx/unoapi.hxx>
44 #include "EffectMigration.hxx"
45 #include <CustomAnimationPreset.hxx>
46 #include <com/sun/star/drawing/XShape.hpp>
47 #include <com/sun/star/presentation/TextAnimationType.hpp>
48 #include <com/sun/star/presentation/EffectNodeType.hpp>
49 #include <com/sun/star/presentation/ShapeAnimationSubType.hpp>
51 using namespace ::com::sun::star
;
53 //---------------------------------------------------------------------------------------
55 void Ppt97AnimationInfoAtom::ReadStream( SvStream
& rIn
)
73 //---------------------------------------------------------------------------------------
75 #define MEMBER_CONSTRUCTOR_LIST() \
78 , m_bDirtyCache(true) \
81 , m_bHasSpecialDuration(false) \
82 , m_fDurationInSeconds(0.001)
84 Ppt97Animation::Ppt97Animation( SvStream
& rInputStream
)
85 : MEMBER_CONSTRUCTOR_LIST()
87 m_aAtom
.ReadStream( rInputStream
);
90 Ppt97Animation::Ppt97Animation()
91 : MEMBER_CONSTRUCTOR_LIST()
95 Ppt97Animation::Ppt97Animation( const Ppt97Animation
& rAnimation
)
96 : MEMBER_CONSTRUCTOR_LIST()
101 Ppt97Animation
& Ppt97Animation::operator= ( const Ppt97Animation
& rAnimation
)
103 m_aAtom
= rAnimation
.m_aAtom
;
104 m_aSoundFileUrl
= rAnimation
.m_aSoundFileUrl
;
105 m_bDirtyCache
= rAnimation
.m_bDirtyCache
;
106 m_aPresetId
= rAnimation
.m_aPresetId
;
107 m_aSubType
= rAnimation
.m_aSubType
;
108 m_bHasSpecialDuration
= rAnimation
.m_bHasSpecialDuration
;
109 m_fDurationInSeconds
= rAnimation
.m_fDurationInSeconds
;
114 Ppt97Animation::~Ppt97Animation()
118 bool Ppt97Animation::operator < ( const Ppt97Animation
& rAnimation
) const
120 return m_aAtom
.nOrderID
< rAnimation
.m_aAtom
.nOrderID
;
122 bool Ppt97Animation::operator > ( const Ppt97Animation
& rAnimation
) const
124 return m_aAtom
.nOrderID
> rAnimation
.m_aAtom
.nOrderID
;
126 bool Ppt97Animation::HasEffect() const
128 return m_aAtom
.nBuildType
!= 0;
130 bool Ppt97Animation::HasParagraphEffect() const
132 return m_aAtom
.nBuildType
> 1;
134 sal_Int32
Ppt97Animation::GetParagraphLevel() const
136 sal_Int32 nParagraphLevel
= 0;
137 if(m_aAtom
.nBuildType
>1)
138 nParagraphLevel
= m_aAtom
.nBuildType
-1;
139 return nParagraphLevel
;
141 bool Ppt97Animation::HasSoundEffect() const
143 return m_aAtom
.nSoundRef
&& m_aAtom
.nFlags
& 0x0010;
145 bool Ppt97Animation::HasStopPreviousSound() const
147 return m_aAtom
.nFlags
& 0x0040;
149 bool Ppt97Animation::HasReverseOrder() const
151 return m_aAtom
.nFlags
& 0x001;
153 bool Ppt97Animation::HasAnimateAssociatedShape() const
155 return m_aAtom
.nFlags
& 0x004000;
157 bool Ppt97Animation::HasAfterEffect() const
159 return m_aAtom
.nAfterEffect
!= 0;
161 bool Ppt97Animation::HasAfterEffect_ChangeColor() const
163 return m_aAtom
.nAfterEffect
== 1;
165 bool Ppt97Animation::HasAfterEffect_DimAtNextEffect() const
167 return m_aAtom
.nAfterEffect
== 2;
169 bool Ppt97Animation::HasAfterEffect_DimAfterEffect() const
171 return m_aAtom
.nAfterEffect
== 3;
174 UINT32
Ppt97Animation::GetSoundRef() const
176 return m_aAtom
.nSoundRef
;
178 void Ppt97Animation::SetSoundFileUrl( const ::rtl::OUString
& rSoundFileUrl
)
180 m_aSoundFileUrl
= rSoundFileUrl
;
183 double Ppt97Animation::GetDelayTimeInSeconds() const
185 return m_aAtom
.nDelayTime
!= 0X7FFFFFFF ? m_aAtom
.nDelayTime
/1000.0 : 0.0;
188 bool Ppt97Animation::GetSpecialDuration( double& rfDurationInSeconds
) const
191 if( m_bHasSpecialDuration
)
192 rfDurationInSeconds
= m_fDurationInSeconds
;
193 return m_bHasSpecialDuration
;
196 bool Ppt97Animation::GetSpecialTextIterationDelay( double& rfTextIterationDelay
) const
199 switch(this->GetTextAnimationType())
201 case presentation::TextAnimationType::BY_LETTER
:
202 rfTextIterationDelay
= 0.075;
205 case presentation::TextAnimationType::BY_WORD
:
206 rfTextIterationDelay
= 0.3;
215 sal_Int32
Ppt97Animation::GetDimColor() const
217 return static_cast<sal_Int32
>(m_aAtom
.nDimColor
);
220 void Ppt97Animation::SetDimColor( sal_Int32 nDimColor
)
222 m_aAtom
.nDimColor
= nDimColor
;
224 void Ppt97Animation::SetAnimateAssociatedShape( bool bAnimate
)
228 //the appear effect cannot be animated without text
229 if( this->GetPresetId().equals( ::rtl::OUString::createFromAscii("ooo-entrance-appear") ) )
231 //the random effect may be the appear effect and than has the same problem
232 if( this->GetPresetId().equals( ::rtl::OUString::createFromAscii("ooo-entrance-random") ) )
234 //this case is not 100% correct -> feel free to complete
235 //i consider this case as seldom and not that problematic and a simple correct fix is not in sight
236 DBG_WARNING("you tried to deselect the animation of the form for random animation-> this has been refused");
243 m_aAtom
.nFlags
= m_aAtom
.nFlags
| 0x004000;
244 else if( HasAnimateAssociatedShape() )
246 m_aAtom
.nFlags
= m_aAtom
.nFlags
^ 0x004000;
250 sal_Int16
Ppt97Animation::GetEffectNodeType() const //see com::sun::star::presentation::EffectNodeType
252 sal_Int16 nRet
= presentation::EffectNodeType::ON_CLICK
;
253 if( m_aAtom
.nFlags
& 0x04 )
255 nRet
= presentation::EffectNodeType::AFTER_PREVIOUS
;
260 sal_Int16
Ppt97Animation::GetTextAnimationType() const
262 sal_Int16 nRet
= presentation::TextAnimationType::BY_PARAGRAPH
;
263 switch( m_aAtom
.nSubEffect
)
268 nRet
= presentation::TextAnimationType::BY_LETTER
;
271 nRet
= presentation::TextAnimationType::BY_WORD
;
276 ::rtl::OUString
Ppt97Animation::GetPresetId() const
281 ::rtl::OUString
Ppt97Animation::GetPresetSubType() const
287 void Ppt97Animation::ClearCacheData() const
289 m_aPresetId
= m_aSubType
= rtl::OUString();
290 m_bHasSpecialDuration
= false;
291 m_fDurationInSeconds
= 0.001;
293 void Ppt97Animation::UpdateCacheData() const
302 m_bDirtyCache
= false;
306 switch( m_aAtom
.nFlyMethod
)
309 //eRetval = ::com::sun::star::presentation::AnimationEffect_APPEAR;
310 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-appear"); // --- appear ---
313 //eRetval = ::com::sun::star::presentation::AnimationEffect_RANDOM;
314 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-random"); // --- random ---
316 case 0x02: // --- blinds effect ---
318 switch ( m_aAtom
.nFlyDirection
)
321 //eRetval = ::com::sun::star::presentation::AnimationEffect_VERTICAL_STRIPES;
322 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-venetian-blinds");
323 m_aSubType
= ::rtl::OUString::createFromAscii("horizontal"); // horizontal
326 //eRetval = ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRIPES;
327 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-venetian-blinds");
328 m_aSubType
= ::rtl::OUString::createFromAscii("vertical"); // vertical
333 case 0x03: // --- (hor/ver) shifted appear ---
335 switch ( m_aAtom
.nFlyDirection
)
338 //eRetval = ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_CHECKERBOARD;
339 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-checkerboard");
340 m_aSubType
= ::rtl::OUString::createFromAscii("across"); // vertical ???
343 //eRetval = ::com::sun::star::presentation::AnimationEffect_VERTICAL_CHECKERBOARD;
344 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-checkerboard");
345 m_aSubType
= ::rtl::OUString::createFromAscii("downward"); // horizontal ???
351 //eRetval = ::com::sun::star::presentation::AnimationEffect_DISSOLVE; // --- dissolve ----
352 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-dissolve-in");
354 case 0x08: // --- (hor/ver) lines ---
356 switch ( m_aAtom
.nFlyDirection
)
359 //eRetval = ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_LINES;
360 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-random-bars");
361 m_aSubType
= ::rtl::OUString::createFromAscii("vertical"); // horizontal ???
364 //eRetval = ::com::sun::star::presentation::AnimationEffect_VERTICAL_LINES;
365 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-random-bars");
366 m_aSubType
= rtl::OUString::createFromAscii("horizontal"); // vertical ???
371 case 0x09: // --- diagonal ---
373 switch ( m_aAtom
.nFlyDirection
)
376 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERRIGHT;
377 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-diagonal-squares");
378 m_aSubType
= rtl::OUString::createFromAscii("left-to-top"); // to left top
381 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LOWERLEFT;
382 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-diagonal-squares");
383 m_aSubType
= rtl::OUString::createFromAscii("right-to-top"); // to right top
386 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERRIGHT;
387 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-diagonal-squares");
388 m_aSubType
= rtl::OUString::createFromAscii("left-to-bottom"); // to left bottom
391 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_UPPERLEFT;
392 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-diagonal-squares");
393 m_aSubType
= rtl::OUString::createFromAscii("right-to-bottom"); // to right bottom
398 case 0x0a: // --- roll/wipe ---
400 switch ( m_aAtom
.nFlyDirection
)
403 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_RIGHT;
404 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-wipe");
405 m_aSubType
= rtl::OUString::createFromAscii("from-right"); // from right
408 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_BOTTOM;
409 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-wipe");
410 m_aSubType
= rtl::OUString::createFromAscii("from-bottom"); // from bottom
413 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_LEFT;
414 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-wipe");
415 m_aSubType
= rtl::OUString::createFromAscii("from-left"); // from left
418 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_TOP;
419 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-wipe");
420 m_aSubType
= rtl::OUString::createFromAscii("from-top"); // from top
425 case 0x0b: //--- fade in ---
427 switch ( m_aAtom
.nFlyDirection
)
430 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER;
431 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-box");
432 m_aSubType
= rtl::OUString::createFromAscii("out"); // from center
435 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER;
436 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-box");
437 m_aSubType
= rtl::OUString::createFromAscii("in"); // to center
442 case 0x0c: // --- text effects ---
444 switch ( m_aAtom
.nFlyDirection
)
447 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT;
448 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
449 m_aSubType
= rtl::OUString::createFromAscii("from-left");
453 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP;
454 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
455 m_aSubType
= rtl::OUString::createFromAscii("from-top");
458 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT;
459 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
460 m_aSubType
= rtl::OUString::createFromAscii("from-right");
463 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM;
464 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
465 m_aSubType
= rtl::OUString::createFromAscii("from-bottom");
468 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERLEFT;
469 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
470 m_aSubType
= rtl::OUString::createFromAscii("from-top-left");
473 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_UPPERRIGHT;
474 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
475 m_aSubType
= rtl::OUString::createFromAscii("from-top-right");
478 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERLEFT;
479 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
480 m_aSubType
= rtl::OUString::createFromAscii("from-bottom-left");
483 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LOWERRIGHT;
484 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in");
485 m_aSubType
= rtl::OUString::createFromAscii("from-bottom-right");
487 case 0x8: // -- short text effects --
488 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_LEFT;
489 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-peek-in");
490 m_aSubType
= rtl::OUString::createFromAscii("from-left");
493 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_BOTTOM;
494 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-peek-in");
495 m_aSubType
= rtl::OUString::createFromAscii("from-bottom");
498 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_RIGHT;
499 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-peek-in");
500 m_aSubType
= rtl::OUString::createFromAscii("from-right");
503 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_SHORT_FROM_TOP;
504 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-peek-in");
505 m_aSubType
= rtl::OUString::createFromAscii("from-top");
507 case 0xc: // -- slow text effects --
509 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_LEFT;
510 //rSpeed = ::com::sun::star::presentation::AnimationSpeed_SLOW;
511 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in-slow");
512 m_aSubType
= rtl::OUString::createFromAscii("from-left");
517 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_TOP;
518 //rSpeed = ::com::sun::star::presentation::AnimationSpeed_SLOW;
519 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in-slow");
520 m_aSubType
= rtl::OUString::createFromAscii("from-top");
525 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_RIGHT;
526 //rSpeed = ::com::sun::star::presentation::AnimationSpeed_SLOW;
527 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in-slow");
528 m_aSubType
= rtl::OUString::createFromAscii("from-right");
533 //eRetval = ::com::sun::star::presentation::AnimationEffect_MOVE_FROM_BOTTOM;
534 //rSpeed = ::com::sun::star::presentation::AnimationSpeed_SLOW;
535 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-fly-in-slow");
536 m_aSubType
= rtl::OUString::createFromAscii("from-bottom");
539 case 0x10: // --- zoom ---
540 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER;
541 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
542 m_aSubType
= rtl::OUString::createFromAscii("in");
545 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER;
546 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
547 m_aSubType
= rtl::OUString::createFromAscii("in-slightly");
550 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER;
551 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
552 m_aSubType
= rtl::OUString::createFromAscii("out");
555 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER;
556 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
557 m_aSubType
= rtl::OUString::createFromAscii("out-slightly");
560 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_FROM_CENTER;
561 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
562 m_aSubType
= rtl::OUString::createFromAscii("in-from-screen-center");
565 //eRetval = ::com::sun::star::presentation::AnimationEffect_FADE_TO_CENTER;
566 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-zoom");
567 m_aSubType
= rtl::OUString::createFromAscii("out-from-screen-center");
569 case 0x16: // --- stretch ---
570 //eRetval = ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_STRETCH;
571 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-stretchy");
572 m_aSubType
= rtl::OUString::createFromAscii("across");
575 //eRetval = ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_LEFT;
576 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-stretchy");
577 m_aSubType
= rtl::OUString::createFromAscii("from-left");
580 //eRetval = ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_TOP;
581 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-stretchy");
582 m_aSubType
= rtl::OUString::createFromAscii("from-top");
585 //eRetval = ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_RIGHT;
586 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-stretchy");
587 m_aSubType
= rtl::OUString::createFromAscii("from-right");
590 //eRetval = ::com::sun::star::presentation::AnimationEffect_STRETCH_FROM_BOTTOM;
591 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-stretchy");
592 m_aSubType
= rtl::OUString::createFromAscii("from-bottom");
594 case 0x1b: // --- rotate ---
595 //eRetval = ::com::sun::star::presentation::AnimationEffect_HORIZONTAL_ROTATE;
596 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-swivel");
597 m_aSubType
= rtl::OUString::createFromAscii("vertical");
599 case 0x1c: // --- spirale ---
600 //eRetval = ::com::sun::star::presentation::AnimationEffect_SPIRALOUT_LEFT;
601 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-spiral-in");
606 case 0x0d: // --- open/close ---
608 switch ( m_aAtom
.nFlyDirection
)
611 //eRetval = ::com::sun::star::presentation::AnimationEffect_OPEN_VERTICAL ; // ???
612 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-split");
613 m_aSubType
= rtl::OUString::createFromAscii("horizontal-out"); //horizontal open
616 //eRetval = ::com::sun::star::presentation::AnimationEffect_CLOSE_VERTICAL; // ???
617 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-split");
618 m_aSubType
= rtl::OUString::createFromAscii("horizontal-in"); //horizontal close
621 //eRetval = ::com::sun::star::presentation::AnimationEffect_OPEN_HORIZONTAL; // ???
622 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-split");
623 m_aSubType
= rtl::OUString::createFromAscii("vertical-out"); // vertical open
626 //eRetval = ::com::sun::star::presentation::AnimationEffect_CLOSE_HORIZONTAL; // ???
627 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-split");
628 m_aSubType
= rtl::OUString::createFromAscii("vertical-in"); // vertical close
633 case 0x0e: // --- blink ---
635 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-flash-once");
636 switch ( m_aAtom
.nFlyDirection
)
639 m_fDurationInSeconds
= 0.075;
640 m_bHasSpecialDuration
= true;
643 m_fDurationInSeconds
= 0.5;
644 m_bHasSpecialDuration
= true;
647 m_fDurationInSeconds
= 1.0;
648 m_bHasSpecialDuration
= true;
655 m_aPresetId
= ::rtl::OUString::createFromAscii("ooo-entrance-appear");
656 DBG_ERROR("no effect mapped");
660 m_bDirtyCache
= false;
663 void Ppt97Animation::createAndSetCustomAnimationEffect( SdrObject
* pObj
)
666 if( !this->HasEffect() )
668 if( !pObj
|| !pObj
->GetPage() )
670 DBG_ERROR("no valid SdrObject or page found for ppt import");
674 uno::Reference
< drawing::XShape
> xShape
= GetXShapeForSdrObject( pObj
);
677 DBG_ERROR("no XShape interface found for ppt import");
680 ::sd::MainSequencePtr pMainSequence
= static_cast<SdPage
*>(pObj
->GetPage())->getMainSequence();
681 if( !pMainSequence
.get() )
683 DBG_ERROR("no MainSequence found for ppt import");
687 const ::sd::CustomAnimationPresets
& rPresets( ::sd::CustomAnimationPresets::getCustomAnimationPresets() );
688 ::sd::CustomAnimationPresetPtr
pPreset( rPresets
.getEffectDescriptor( this->GetPresetId() ) );
691 DBG_ERROR("no suiteable preset found for ppt import");
695 //--------------start doing something
697 //1. ------ create an effect from the presets ------
698 ::sd::CustomAnimationEffectPtr
pEffect( new ::sd::CustomAnimationEffect( pPreset
->create( this->GetPresetSubType() ) ) );
701 DBG_ASSERT(pEffect
.get(),"no suiteable effect found");
705 //2. ------ adapt the created effect ------
707 // set the shape targeted by this effect
708 pEffect
->setTarget( makeAny( xShape
) );
710 pEffect
->setBegin( this->GetDelayTimeInSeconds() );
712 // some effects need a different duration than that of the mapped preset effect
713 double fDurationInSeconds
= 1.0;//in secunden
714 if( this->GetSpecialDuration( fDurationInSeconds
) )
715 pEffect
->setDuration( fDurationInSeconds
);
718 if( this->HasAfterEffect() )
720 pEffect
->setHasAfterEffect( sal_True
);
721 if( this->HasAfterEffect_ChangeColor() )
722 pEffect
->setDimColor( uno::makeAny( this->GetDimColor() ) );
724 pEffect
->setAfterEffectOnNext( this->HasAfterEffect_DimAtNextEffect() );
728 if( this->HasSoundEffect() )
729 pEffect
->createAudio( uno::makeAny( m_aSoundFileUrl
) );
732 pEffect
->setIterateType( this->GetTextAnimationType() );
734 // some effects need a different delay between text iteration than that of the mapped preset effect
735 double fTextIterationDelay
= 1.0;
736 if( this->GetSpecialTextIterationDelay( fTextIterationDelay
) )
737 pEffect
->setIterateInterval( fTextIterationDelay
);
739 // is the effect started on click or after the last effect (Another possible value is EffectNodeType::WITH_PREVIOUS )
740 pEffect
->setNodeType( this->GetEffectNodeType() );
742 //set stop sound effect
743 if( this->HasStopPreviousSound() )
744 pEffect
->setStopAudio();
746 // append the effect to the main sequence
747 if( !this->HasParagraphEffect() )
749 if( this->HasAnimateAssociatedShape() )
750 pEffect
->setTargetSubItem( presentation::ShapeAnimationSubType::AS_WHOLE
);
752 pEffect
->setTargetSubItem( presentation::ShapeAnimationSubType::AS_WHOLE
); //todo: set ONLY_TEXT again if that is fixed
753 //pEffect->setTargetSubItem( presentation::ShapeAnimationSubType::ONLY_TEXT );
756 //3. ------ put the created effect to the model and do some last changes fro paragraph effects ------
757 pMainSequence
->append( pEffect
);
758 if( this->HasParagraphEffect() )
760 sal_Int32 nParagraphLevel
= this->GetParagraphLevel();
761 double fDelaySeconds
= this->GetDelayTimeInSeconds();
762 sal_Bool bAnimateAssociatedShape
= this->HasAnimateAssociatedShape();//or only text
763 sal_Bool bTextReverse
= this->HasReverseOrder();
765 // now create effects for each paragraph
766 ::sd::CustomAnimationTextGroupPtr pGroup
= pMainSequence
->
767 createTextGroup( pEffect
, nParagraphLevel
, fDelaySeconds
, bAnimateAssociatedShape
, bTextReverse
);
771 const ::sd::EffectSequence
& rEffects
= pGroup
->getEffects();
772 ::sd::EffectSequence::const_iterator aIter
= rEffects
.begin();
774 ::sd::CustomAnimationEffectPtr pLastEffect
;
775 sal_Int32 nIndex
= 0;
776 for( ; aIter
!= rEffects
.end(); aIter
++ )
778 ::sd::CustomAnimationEffectPtr
pGroupEffect(*aIter
);
780 ////todo? if( nIndex > 1 && pLastEffect && this->HasSoundEffect() )
781 //// pLastEffect->setStopAudio();
784 pGroupEffect
->setNodeType( this->GetEffectNodeType() );
786 else if( nIndex
> 0 )
788 bool bAtParagraphBegin
= false;
790 bAtParagraphBegin
= pGroupEffect
->getParaDepth() < nParagraphLevel
;
792 bAtParagraphBegin
= !pLastEffect
|| pLastEffect
->getParaDepth() < nParagraphLevel
;
793 if( bAtParagraphBegin
)
794 pGroupEffect
->setNodeType( this->GetEffectNodeType() );
795 else if( this->GetTextAnimationType() == presentation::TextAnimationType::BY_PARAGRAPH
)
796 pGroupEffect
->setNodeType( presentation::EffectNodeType::WITH_PREVIOUS
);
798 pGroupEffect
->setNodeType( presentation::EffectNodeType::AFTER_PREVIOUS
);
800 pLastEffect
= pGroupEffect
;
805 pMainSequence
->rebuild();