xref: /aoo41x/main/sd/source/ui/func/fuoaprms.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 
32 #include "fuoaprms.hxx"
33 
34 #include "sdattr.hxx"
35 #include <svx/svdpagv.hxx>
36 #include <editeng/colritem.hxx>
37 #include <svx/svdundo.hxx>
38 #include <vcl/group.hxx>
39 #include <vcl/fixed.hxx>
40 #include <sfx2/objsh.hxx>
41 #include <sfx2/request.hxx>
42 #include <sfx2/viewfrm.hxx>
43 #ifndef _MSGBOX_HXX //autogen
44 #include <vcl/msgbox.hxx>
45 #endif
46 #include <svl/aeitem.hxx>
47 #include "svx/xtable.hxx"
48 
49 #include "strings.hrc"
50 #include "glob.hrc"
51 #include "drawdoc.hxx"
52 #include "ViewShell.hxx"
53 #include "anminfo.hxx"
54 #include "unoaprms.hxx"                 // Undo-Action
55 #include "sdundogr.hxx"                 // Undo Gruppe
56 #include "View.hxx"
57 #include "sdabstdlg.hxx"
58 #include "sdresid.hxx"
59 #include <vcl/salbtype.hxx>		// FRound
60 #include <basegfx/polygon/b2dpolygon.hxx>
61 
62 using namespace ::com::sun::star;
63 
64 namespace sd {
65 
66 TYPEINIT1( FuObjectAnimationParameters, FuPoor );
67 
68 #define ATTR_MISSING    0       // Attribut nicht verfuegbar
69 #define ATTR_MIXED      1       // Attribut uneindeutig (bei Mehrfachselektion)
70 #define ATTR_SET        2       // Attribut eindeutig
71 
72 /*************************************************************************
73 |*
74 |* Konstruktor
75 |*
76 \************************************************************************/
77 
78 FuObjectAnimationParameters::FuObjectAnimationParameters (
79     ViewShell*	 pViewSh,
80     ::sd::Window*		 pWin,
81     ::sd::View*		 pView,
82     SdDrawDocument* pDoc,
83     SfxRequest&	 rReq)
84 	: FuPoor(pViewSh, pWin, pView, pDoc, rReq)
85 {
86 }
87 
88 FunctionReference FuObjectAnimationParameters::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
89 {
90 	FunctionReference xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) );
91 	xFunc->DoExecute(rReq);
92 	return xFunc;
93 }
94 
95 void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
96 {
97 	::svl::IUndoManager* pUndoMgr = mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager();
98 
99 	const SdrMarkList& rMarkList  = mpView->GetMarkedObjectList();
100 	sal_uLong		 nCount 	= rMarkList.GetMarkCount();
101 	sal_uLong		 nObject	= 0;
102 
103 	short nAnimationSet     = ATTR_MISSING;
104 	short nEffectSet        = ATTR_MISSING;
105 	short nTextEffectSet    = ATTR_MISSING;
106 	short nSpeedSet         = ATTR_MISSING;
107 	short nFadeColorSet     = ATTR_MISSING;
108 	short nFadeOutSet       = ATTR_MISSING;
109 	short nInvisibleSet     = ATTR_MISSING;
110 	short nSoundOnSet       = ATTR_MISSING;
111 	short nSoundFileSet     = ATTR_MISSING;
112 	short nPlayFullSet      = ATTR_MISSING;
113 	short nClickActionSet   = ATTR_MISSING;
114 	short nBookmarkSet      = ATTR_MISSING;
115 
116 	short nSecondEffectSet      = ATTR_MISSING;
117 	short nSecondSpeedSet       = ATTR_MISSING;
118 	short nSecondSoundOnSet     = ATTR_MISSING;
119 	short nSecondPlayFullSet    = ATTR_MISSING;
120 
121 
122 
123 //    sal_Bool bDontKnow   = sal_False;
124 
125 									// defaulten (fuer Undo-Aktion)
126 	presentation::AnimationEffect eEffect         = presentation::AnimationEffect_NONE;
127 	presentation::AnimationEffect eTextEffect     = presentation::AnimationEffect_NONE;
128 	presentation::AnimationSpeed  eSpeed          = presentation::AnimationSpeed_MEDIUM;
129 	sal_Bool            bActive         = sal_False;
130 	sal_Bool            bFadeOut        = sal_False;
131 	Color           aFadeColor      = COL_LIGHTGRAY;
132 	sal_Bool            bInvisible      = sal_False;
133 	sal_Bool            bSoundOn        = sal_False;
134 	String          aSound;
135 	sal_Bool            bPlayFull       = sal_False;
136 	presentation::ClickAction     eClickAction    = presentation::ClickAction_NONE;
137 	String          aBookmark;
138 
139 	presentation::AnimationEffect eSecondEffect   = presentation::AnimationEffect_NONE;
140 	presentation::AnimationSpeed  eSecondSpeed    = presentation::AnimationSpeed_MEDIUM;
141 	sal_Bool            bSecondSoundOn  = sal_False;
142 	sal_Bool            bSecondPlayFull = sal_False;
143 
144 
145 	SdAnimationInfo* pInfo;
146 	SdrMark* pMark;
147 
148 	// das erste Objekt untersuchen
149 	pMark = rMarkList.GetMark(0);
150 	pInfo = mpDoc->GetAnimationInfo(pMark->GetMarkedSdrObj());
151 	if( pInfo )
152 	{
153 		bActive             = pInfo->mbActive;
154 		nAnimationSet       = ATTR_SET;
155 
156 		eEffect             = pInfo->meEffect;
157 		nEffectSet          = ATTR_SET;
158 
159 		eTextEffect         = pInfo->meTextEffect;
160 		nTextEffectSet      = ATTR_SET;
161 
162 		eSpeed              = pInfo->meSpeed;
163 		nSpeedSet           = ATTR_SET;
164 
165 		bFadeOut            = pInfo->mbDimPrevious;
166 		nFadeOutSet         = ATTR_SET;
167 
168 		aFadeColor          = pInfo->maDimColor;
169 		nFadeColorSet       = ATTR_SET;
170 
171 		bInvisible          = pInfo->mbDimHide;
172 		nInvisibleSet       = ATTR_SET;
173 
174 		bSoundOn            = pInfo->mbSoundOn;
175 		nSoundOnSet         = ATTR_SET;
176 
177 		aSound              = pInfo->maSoundFile;
178 		nSoundFileSet       = ATTR_SET;
179 
180 		bPlayFull           = pInfo->mbPlayFull;
181 		nPlayFullSet        = ATTR_SET;
182 
183 		eClickAction        = pInfo->meClickAction;
184 		nClickActionSet     = ATTR_SET;
185 
186 		aBookmark           = pInfo->GetBookmark();
187 		nBookmarkSet        = ATTR_SET;
188 
189 		eSecondEffect       = pInfo->meSecondEffect;
190 		nSecondEffectSet    = ATTR_SET;
191 
192 		eSecondSpeed        = pInfo->meSecondSpeed;
193 		nSecondSpeedSet     = ATTR_SET;
194 
195 		bSecondSoundOn      = pInfo->mbSecondSoundOn;
196 		nSecondSoundOnSet   = ATTR_SET;
197 
198 		bSecondPlayFull     = pInfo->mbSecondPlayFull;
199 		nSecondPlayFullSet  = ATTR_SET;
200 	}
201 
202 	// ggfs. weitere Objekte untersuchen
203 	for( nObject = 1; nObject < nCount; nObject++ )
204 	{
205 		pMark = rMarkList.GetMark( nObject );
206 		SdrObject* pObject = pMark->GetMarkedSdrObj();
207 		pInfo = mpDoc->GetAnimationInfo(pObject);
208 		if( pInfo )
209 		{
210 			if( bActive != pInfo->mbActive )
211 				nAnimationSet = ATTR_MIXED;
212 
213 			if( eEffect != pInfo->meEffect )
214 				nEffectSet = ATTR_MIXED;
215 
216 			if( eTextEffect != pInfo->meTextEffect )
217 				nTextEffectSet = ATTR_MIXED;
218 
219 			if( eSpeed != pInfo->meSpeed )
220 				nSpeedSet = ATTR_MIXED;
221 
222 			if( bFadeOut != pInfo->mbDimPrevious )
223 				nFadeOutSet = ATTR_MIXED;
224 
225 			if( aFadeColor != pInfo->maDimColor )
226 				nFadeColorSet = ATTR_MIXED;
227 
228 			if( bInvisible != pInfo->mbDimHide )
229 				nInvisibleSet = ATTR_MIXED;
230 
231 			if( bSoundOn != pInfo->mbSoundOn )
232 				nSoundOnSet = ATTR_MIXED;
233 
234 			if( aSound != pInfo->maSoundFile )
235 				nSoundFileSet = ATTR_MIXED;
236 
237 			if( bPlayFull != pInfo->mbPlayFull )
238 				nPlayFullSet = ATTR_MIXED;
239 
240 			if( eClickAction != pInfo->meClickAction )
241 				nClickActionSet = ATTR_MIXED;
242 
243 			if( aBookmark != pInfo->GetBookmark() )
244 				nBookmarkSet = ATTR_MIXED;
245 
246 			if( eSecondEffect != pInfo->meSecondEffect )
247 				nSecondEffectSet = ATTR_MIXED;
248 
249 			if( eSecondSpeed != pInfo->meSecondSpeed )
250 				nSecondSpeedSet = ATTR_MIXED;
251 
252 			if( bSecondSoundOn != pInfo->mbSecondSoundOn )
253 				nSecondSoundOnSet = ATTR_MIXED;
254 
255 			if( bSecondPlayFull != pInfo->mbSecondPlayFull )
256 				nSecondPlayFullSet = ATTR_MIXED;
257 		}
258 		else
259 		{
260 			if (nAnimationSet == ATTR_SET && bActive == sal_True)
261 				nAnimationSet = ATTR_MIXED;
262 
263 			if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE)
264 				nEffectSet = ATTR_MIXED;
265 
266 			if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE)
267 				nTextEffectSet = ATTR_MIXED;
268 
269 			if (nSpeedSet == ATTR_SET)
270 				nSpeedSet = ATTR_MIXED;
271 
272 			if (nFadeOutSet == ATTR_SET && bFadeOut == sal_True)
273 				nFadeOutSet = ATTR_MIXED;
274 
275 			if (nFadeColorSet == ATTR_SET)
276 				nFadeColorSet = ATTR_MIXED;
277 
278 			if (nInvisibleSet == ATTR_SET && bInvisible == sal_True)
279 				nInvisibleSet = ATTR_MIXED;
280 
281 			if (nSoundOnSet == ATTR_SET && bSoundOn == sal_True)
282 				nSoundOnSet = ATTR_MIXED;
283 
284 			if (nSoundFileSet == ATTR_SET)
285 				nSoundFileSet = ATTR_MIXED;
286 
287 			if (nPlayFullSet == ATTR_SET && bPlayFull == sal_True)
288 				nPlayFullSet = ATTR_MIXED;
289 
290 			if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE)
291 				nClickActionSet = ATTR_MIXED;
292 
293 			if (nBookmarkSet == ATTR_SET)
294 				nBookmarkSet = ATTR_MIXED;
295 
296 			if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE)
297 				nSecondEffectSet = ATTR_MIXED;
298 
299 			if (nSecondSpeedSet == ATTR_SET)
300 				nSecondSpeedSet = ATTR_MIXED;
301 
302 			if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn == sal_True)
303 				nSecondSoundOnSet = ATTR_MIXED;
304 
305 			if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull == sal_True)
306 				nSecondPlayFullSet = ATTR_MIXED;
307 		}
308 	}
309 
310 	// Genau zwei Objekte mit Pfadeffekt? Dann gilt nur die Animationsinfo
311 	// am bewegten Objekt.
312 	if (nCount == 2)
313 	{
314 		SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
315 		SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
316 		SdrObjKind eKind1   = (SdrObjKind)pObject1->GetObjIdentifier();
317 		SdrObjKind eKind2   = (SdrObjKind)pObject2->GetObjIdentifier();
318 		SdAnimationInfo* pInfo1 = mpDoc->GetAnimationInfo(pObject1);
319 		SdAnimationInfo* pInfo2 = mpDoc->GetAnimationInfo(pObject2);
320 		pInfo  = NULL;
321 
322 		if (pObject1->GetObjInventor() == SdrInventor &&
323 			((eKind1 == OBJ_LINE) ||                        // 2-Punkt-Linie
324 			 (eKind1 == OBJ_PLIN) ||                        // Polygon
325 			 (eKind1 == OBJ_PATHLINE))                &&    // Bezier-Kurve
326 			 (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH))
327 		{
328 			pInfo = pInfo2;
329 		}
330 
331 		if (pObject2->GetObjInventor() == SdrInventor &&
332 			((eKind2 == OBJ_LINE) ||                        // 2-Punkt-Linie
333 			 (eKind2 == OBJ_PLIN) ||                        // Polygon
334 			 (eKind2 == OBJ_PATHLINE))                &&    // Bezier-Kurve
335 			(pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH))
336 		{
337 			pInfo = pInfo1;
338 		}
339 
340 		if (pInfo)
341 		{
342 			bActive         = pInfo->mbActive;          nAnimationSet       = ATTR_SET;
343 			eEffect         = pInfo->meEffect;          nEffectSet          = ATTR_SET;
344 			eTextEffect     = pInfo->meTextEffect;      nTextEffectSet      = ATTR_SET;
345 			eSpeed          = pInfo->meSpeed;           nSpeedSet           = ATTR_SET;
346 			bFadeOut        = pInfo->mbDimPrevious;     nFadeOutSet         = ATTR_SET;
347 			aFadeColor      = pInfo->maDimColor;        nFadeColorSet       = ATTR_SET;
348 			bInvisible      = pInfo->mbDimHide;         nInvisibleSet       = ATTR_SET;
349 			bSoundOn        = pInfo->mbSoundOn;         nSoundOnSet         = ATTR_SET;
350 			aSound          = pInfo->maSoundFile;       nSoundFileSet       = ATTR_SET;
351 			bPlayFull       = pInfo->mbPlayFull;        nPlayFullSet        = ATTR_SET;
352 			eClickAction    = pInfo->meClickAction;     nClickActionSet     = ATTR_SET;
353 			aBookmark       = pInfo->GetBookmark();     nBookmarkSet        = ATTR_SET;
354 			eSecondEffect   = pInfo->meSecondEffect;    nSecondEffectSet    = ATTR_SET;
355 			eSecondSpeed    = pInfo->meSecondSpeed;     nSecondSpeedSet     = ATTR_SET;
356 			bSecondSoundOn  = pInfo->mbSecondSoundOn;   nSecondSoundOnSet   = ATTR_SET;
357 			bSecondPlayFull = pInfo->mbSecondPlayFull;  nSecondPlayFullSet  = ATTR_SET;
358 		}
359 	}
360 
361 	const SfxItemSet* pArgs = rReq.GetArgs();
362 
363 	if(!pArgs)
364 	{
365 		// ItemSet fuer Dialog fuellen
366 		SfxItemSet aSet(mpDoc->GetPool(), ATTR_ANIMATION_START, ATTR_ACTION_END);
367 
368 		// das Set besetzen
369 		if (nAnimationSet == ATTR_SET)
370 			aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive));
371 		else if (nAnimationSet == ATTR_MIXED)
372 			aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE);
373 		else
374 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, sal_False));
375 
376 		if (nEffectSet == ATTR_SET)
377 			aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, (sal_uInt16)eEffect));
378 		else if (nEffectSet == ATTR_MIXED)
379 			aSet.InvalidateItem( ATTR_ANIMATION_EFFECT );
380 		else
381 			aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, presentation::AnimationEffect_NONE));
382 
383 		if (nTextEffectSet == ATTR_SET)
384 			aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, (sal_uInt16)eTextEffect));
385 		else if (nTextEffectSet == ATTR_MIXED)
386 			aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT );
387 		else
388 			aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, presentation::AnimationEffect_NONE));
389 
390 		if (nSpeedSet == ATTR_SET)
391 			aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_SPEED, (sal_uInt16)eSpeed));
392 		else
393 			aSet.InvalidateItem(ATTR_ANIMATION_SPEED);
394 
395 		if (nFadeOutSet == ATTR_SET)
396 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut));
397 		else if (nFadeOutSet == ATTR_MIXED)
398 			aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT);
399 		else
400 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, sal_False));
401 
402 		if (nFadeColorSet == ATTR_SET)
403 			aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR));
404 		else if (nFadeColorSet == ATTR_MIXED)
405 			aSet.InvalidateItem(ATTR_ANIMATION_COLOR);
406 		else
407 			aSet.Put(SvxColorItem(RGB_Color(COL_LIGHTGRAY), ATTR_ANIMATION_COLOR));
408 
409 		if (nInvisibleSet == ATTR_SET)
410 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible));
411 		else if (nInvisibleSet == ATTR_MIXED)
412 			aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE);
413 		else
414 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, sal_False));
415 
416 		if (nSoundOnSet == ATTR_SET)
417 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn));
418 		else if (nSoundOnSet == ATTR_MIXED)
419 			aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON);
420 		else
421 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, sal_False));
422 
423 		if (nSoundFileSet == ATTR_SET)
424 			aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound));
425 		else
426 			aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE);
427 
428 		if (nPlayFullSet == ATTR_SET)
429 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull));
430 		else if (nPlayFullSet == ATTR_MIXED)
431 			aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL);
432 		else
433 			aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, sal_False));
434 
435 		if (nClickActionSet == ATTR_SET)
436 			aSet.Put(SfxAllEnumItem(ATTR_ACTION, (sal_uInt16)eClickAction));
437 		else if (nClickActionSet == ATTR_MIXED)
438 			aSet.InvalidateItem(ATTR_ACTION);
439 		else
440 			aSet.Put(SfxAllEnumItem(ATTR_ACTION, presentation::ClickAction_NONE));
441 
442 		if (nBookmarkSet == ATTR_SET)
443 			aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark));
444 		else
445 			aSet.InvalidateItem(ATTR_ACTION_FILENAME);
446 
447 		if (nSecondEffectSet == ATTR_SET)
448 			aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, (sal_uInt16)eSecondEffect));
449 		else if (nSecondEffectSet == ATTR_MIXED)
450 			aSet.InvalidateItem( ATTR_ACTION_EFFECT );
451 		else
452 			aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, presentation::AnimationEffect_NONE));
453 
454 		if (nSecondSpeedSet == ATTR_SET)
455 			aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECTSPEED, (sal_uInt16)eSecondSpeed));
456 		else
457 			aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED);
458 
459 		if (nSecondSoundOnSet == ATTR_SET)
460 			aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn));
461 		else if (nSecondSoundOnSet == ATTR_MIXED)
462 			aSet.InvalidateItem(ATTR_ACTION_SOUNDON);
463 		else
464 			aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, sal_False));
465 
466 		if (nSecondPlayFullSet == ATTR_SET)
467 			aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull));
468 		else if (nPlayFullSet == ATTR_MIXED)
469 			aSet.InvalidateItem(ATTR_ACTION_PLAYFULL);
470 		else
471 			aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, sal_False));
472 
473 		SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
474 		SfxAbstractDialog* pDlg = pFact ? pFact->CreatSdActionDialog( NULL, &aSet, mpView ) : 0;
475 
476 		sal_uInt16 nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
477 
478 		if( nResult == RET_OK )
479 		{
480 			rReq.Done( *( pDlg->GetOutputItemSet() ) );
481 			pArgs = rReq.GetArgs();
482 		}
483 
484 		delete pDlg;
485 
486 		if( nResult != RET_OK )
487 			return;
488 	}
489 
490 	// Auswertung des ItemSets
491 	if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SFX_ITEM_SET)
492 	{
493 		bActive = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue();
494 		nAnimationSet = ATTR_SET;
495 	}
496 	else
497 		nAnimationSet = ATTR_MISSING;
498 
499 	if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SFX_ITEM_SET)
500 	{
501 		eEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
502 					Get(ATTR_ANIMATION_EFFECT)).GetValue();
503 		nEffectSet = ATTR_SET;
504 	}
505 	else
506 		nEffectSet = ATTR_MISSING;
507 
508 	if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SFX_ITEM_SET)
509 	{
510 		eTextEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
511 						Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue();
512 		nTextEffectSet = ATTR_SET;
513 	}
514 	else
515 		nTextEffectSet = ATTR_MISSING;
516 
517 	if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SFX_ITEM_SET)
518 	{
519 		eSpeed  = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
520 					Get(ATTR_ANIMATION_SPEED)).GetValue();
521 		nSpeedSet = ATTR_SET;
522 	}
523 	else
524 		nSpeedSet = ATTR_MISSING;
525 
526 	if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SFX_ITEM_SET)
527 	{
528 		bFadeOut = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue();
529 		nFadeOutSet = ATTR_SET;
530 	}
531 	else
532 		nFadeOutSet = ATTR_MISSING;
533 
534 	if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SFX_ITEM_SET)
535 	{
536 		bInvisible = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue();
537 		nInvisibleSet = ATTR_SET;
538 	}
539 	else
540 		nInvisibleSet = ATTR_MISSING;
541 
542 	if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SFX_ITEM_SET)
543 	{
544 		bSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue();
545 		nSoundOnSet = ATTR_SET;
546 	}
547 	else
548 		nSoundOnSet = ATTR_MISSING;
549 
550 	if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SFX_ITEM_SET)
551 	{
552 		aSound =  ((SfxStringItem&)pArgs->Get(ATTR_ANIMATION_SOUNDFILE)).GetValue();
553 		nSoundFileSet = ATTR_SET;
554 	}
555 	else
556 		nSoundFileSet = ATTR_MISSING;
557 
558 	if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SFX_ITEM_SET)
559 	{
560 		aFadeColor = ((SvxColorItem&)pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue();
561 		nFadeColorSet = ATTR_SET;
562 	}
563 	else
564 		nFadeColorSet = ATTR_MISSING;
565 
566 	if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SFX_ITEM_SET)
567 	{
568 		bPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue();
569 		nPlayFullSet = ATTR_SET;
570 	}
571 	else
572 		nPlayFullSet = ATTR_MISSING;
573 
574 	if (pArgs->GetItemState(ATTR_ACTION) == SFX_ITEM_SET)
575 	{
576 		eClickAction = (presentation::ClickAction)((SfxAllEnumItem&)pArgs->
577 					Get(ATTR_ACTION)).GetValue();
578 		nClickActionSet = ATTR_SET;
579 	}
580 	else
581 		nClickActionSet = ATTR_MISSING;
582 
583 	if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SFX_ITEM_SET)
584 	{
585 		aBookmark = ((SfxStringItem&)pArgs->
586 						Get(ATTR_ACTION_FILENAME)).GetValue();
587 		nBookmarkSet = ATTR_SET;
588 	}
589 	else
590 		nBookmarkSet = ATTR_MISSING;
591 
592 	if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SFX_ITEM_SET)
593 	{
594 		eSecondEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
595 					Get(ATTR_ACTION_EFFECT)).GetValue();
596 		nSecondEffectSet = ATTR_SET;
597 	}
598 	else
599 		nSecondEffectSet = ATTR_MISSING;
600 
601 	if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SFX_ITEM_SET)
602 	{
603 		eSecondSpeed  = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
604 					Get(ATTR_ACTION_EFFECTSPEED)).GetValue();
605 		nSecondSpeedSet = ATTR_SET;
606 	}
607 	else
608 		nSecondSpeedSet = ATTR_MISSING;
609 
610 	if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SFX_ITEM_SET)
611 	{
612 		bSecondSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue();
613 		nSecondSoundOnSet = ATTR_SET;
614 	}
615 	else
616 		nSecondSoundOnSet = ATTR_MISSING;
617 
618 	if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SFX_ITEM_SET)
619 	{
620 		bSecondPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue();
621 		nSecondPlayFullSet = ATTR_SET;
622 	}
623 	else
624 		nSecondPlayFullSet = ATTR_MISSING;
625 
626 	// Wenn irgendwelche Attribute ausgewaehlt wurden
627 	if (nEffectSet         == ATTR_SET  ||
628 		nTextEffectSet     == ATTR_SET  ||
629 		nSpeedSet          == ATTR_SET  ||
630 		nAnimationSet      == ATTR_SET  ||
631 		nFadeOutSet        == ATTR_SET  ||
632 		nFadeColorSet      == ATTR_SET  ||
633 		nInvisibleSet      == ATTR_SET  ||
634 		nSoundOnSet        == ATTR_SET  ||
635 		nSoundFileSet      == ATTR_SET  ||
636 		nPlayFullSet       == ATTR_SET  ||
637 		nClickActionSet    == ATTR_SET  ||
638 		nBookmarkSet       == ATTR_SET  ||
639 		nSecondEffectSet   == ATTR_SET  ||
640 		nSecondSpeedSet    == ATTR_SET  ||
641 		nSecondSoundOnSet  == ATTR_SET  ||
642 		nSecondPlayFullSet == ATTR_SET)
643 	{
644 		// String fuer Undo-Group und List-Action
645 		String aComment(SdResId(STR_UNDO_ANIMATION));
646 
647 		// bei 'an Kurve entlang' gibt's noch eine extra UndoAction, darum
648 		// hier klammern
649 		pUndoMgr->EnterListAction(aComment, aComment);
650 
651 		// Undo Gruppe erzeugen
652 		SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
653 		pUndoGroup->SetComment(aComment);
654 
655 
656 		// fuer den Pfad-Effekt einige Dinge merken
657 		SdrObject*  pRunningObj = NULL;
658 		SdrPathObj* pPath       = NULL;
659 		if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
660 		{
661 			DBG_ASSERT(nCount == 2, "dieser Effekt braucht genau 2 selektierte Objekte");
662 			SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
663 			SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
664 			SdrObjKind eKind1   = (SdrObjKind)pObject1->GetObjIdentifier();
665 			SdrObjKind eKind2   = (SdrObjKind)pObject2->GetObjIdentifier();
666 
667 			if (pObject1->GetObjInventor() == SdrInventor &&
668 				((eKind1 == OBJ_LINE) ||        // 2-Punkt-Linie
669 				 (eKind1 == OBJ_PLIN) ||        // Polygon
670 				 (eKind1 == OBJ_PATHLINE)))     // Bezier-Kurve
671 			{
672 				pPath = (SdrPathObj*)pObject1;
673 				pRunningObj = pObject2;
674 			}
675 
676 			if (pObject2->GetObjInventor() == SdrInventor &&
677 				((eKind2 == OBJ_LINE) ||        // 2-Punkt-Linie
678 				 (eKind2 == OBJ_PLIN) ||        // Polygon
679 				 (eKind2 == OBJ_PATHLINE)))     // Bezier-Kurve
680 			{
681 				pPath = (SdrPathObj*)pObject2;
682 				pRunningObj = pObject1;
683 			}
684 
685 			DBG_ASSERT(pPath, "keine Kurve gefunden");
686 
687 
688 			// das laufende Objekt auf das Kurvenende schieben
689 			Rectangle aCurRect(pRunningObj->GetLogicRect());
690 			Point     aCurCenter(aCurRect.Center());
691 			const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly();
692 			sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
693 			const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L));
694 			sal_uInt32 nPoints(aPolygon.count());
695 			const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L));
696 			const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
697 			Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
698 			pRunningObj->Move(aDistance);
699 
700 			pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance));
701 		}
702 
703 		for (nObject = 0; nObject < nCount; nObject++)
704 		{
705 			SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj();
706 
707 			pInfo = mpDoc->GetAnimationInfo(pObject);
708 
709 			sal_Bool bCreated = sal_False;
710 			if( !pInfo )
711 			{
712 				pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
713 				bCreated = sal_True;
714 			}
715 
716 			// das Pfadobjekt fuer 'an Kurve entlang'?
717 			if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
718 			{
719 				SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
720 												(mpDoc, pObject, bCreated);
721 				pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
722 				pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
723 				pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
724 				pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
725 				pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
726 				pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
727 				pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
728 				pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
729 				pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
730 				pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
731 //				pAction->SetPathObj(pInfo->mpPathObj, pInfo->mpPathObj);
732 				pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction);
733 				pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark());
734 //				pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation, sal_True);
735 				pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
736 				pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
737 				pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
738 				pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
739 				pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
740 				pUndoGroup->AddAction(pAction);
741 
742 //				pInfo->mbInvisibleInPresentation = sal_True;
743 			}
744 			else
745 			{
746 
747 				// Undo-Action mit alten und neuen Groessen erzeugen
748 				SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
749 												(mpDoc, pObject, bCreated);
750 				pAction->SetActive(pInfo->mbActive, bActive);
751 				pAction->SetEffect(pInfo->meEffect, eEffect);
752 				pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
753 				pAction->SetSpeed(pInfo->meSpeed, eSpeed);
754 				pAction->SetDim(pInfo->mbDimPrevious, bFadeOut);
755 				pAction->SetDimColor(pInfo->maDimColor, aFadeColor);
756 				pAction->SetDimHide(pInfo->mbDimHide, bInvisible);
757 				pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn);
758 				pAction->SetSound(pInfo->maSoundFile, aSound);
759 				pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull);
760 				pAction->SetPathObj(pInfo->mpPathObj, pPath);
761 				pAction->SetClickAction(pInfo->meClickAction, eClickAction);
762 				pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
763 //				pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation,
764 //											pInfo->mbInvisibleInPresentation);
765 				pAction->SetVerb(pInfo->mnVerb, (sal_uInt16)pInfo->GetBookmark().ToInt32() );
766 				pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect);
767 				pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed);
768 				pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn);
769 				pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull);
770 				pUndoGroup->AddAction(pAction);
771 
772 				// neue Werte am Infoblock des Objekts eintragen
773 				if (nAnimationSet == ATTR_SET)
774 					pInfo->mbActive = bActive;
775 
776 				if (nEffectSet == ATTR_SET)
777 					pInfo->meEffect = eEffect;
778 
779 				if (nTextEffectSet == ATTR_SET)
780 					pInfo->meTextEffect = eTextEffect;
781 
782 				if (nSpeedSet == ATTR_SET)
783 					pInfo->meSpeed = eSpeed;
784 
785 				if (nFadeOutSet == ATTR_SET)
786 					pInfo->mbDimPrevious = bFadeOut;
787 
788 				if (nFadeColorSet == ATTR_SET)
789 					pInfo->maDimColor = aFadeColor;
790 
791 				if (nInvisibleSet == ATTR_SET)
792 					pInfo->mbDimHide = bInvisible;
793 
794 				if (nSoundOnSet == ATTR_SET)
795 					pInfo->mbSoundOn = bSoundOn;
796 
797 				if (nSoundFileSet == ATTR_SET)
798 					pInfo->maSoundFile = aSound;
799 
800 				if (nPlayFullSet == ATTR_SET)
801 					pInfo->mbPlayFull = bPlayFull;
802 
803 				if (nClickActionSet == ATTR_SET)
804 					pInfo->meClickAction = eClickAction;
805 
806 				if (nBookmarkSet == ATTR_SET)
807 					pInfo->SetBookmark( aBookmark );
808 
809 				if (nSecondEffectSet == ATTR_SET)
810 					pInfo->meSecondEffect = eSecondEffect;
811 
812 				if (nSecondSpeedSet == ATTR_SET)
813 					pInfo->meSecondSpeed = eSecondSpeed;
814 
815 				if (nSecondSoundOnSet == ATTR_SET)
816 					pInfo->mbSecondSoundOn = bSecondSoundOn;
817 
818 				if (nSecondPlayFullSet == ATTR_SET)
819 					pInfo->mbSecondPlayFull = bSecondPlayFull;
820 
821 				// noch ein paar Spezialitaeten
822 //				if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
823 //					pInfo->mSetPath(pPath);
824 
825 				if (eClickAction == presentation::ClickAction_VERB)
826 					pInfo->mnVerb = (sal_uInt16)aBookmark.ToInt32();
827 			}
828 		}
829 		// Undo Gruppe dem Undo Manager uebergeben
830 		pUndoMgr->AddUndoAction(pUndoGroup);
831 		pUndoMgr->LeaveListAction();
832 
833 		// Model geaendert
834 		mpDoc->SetChanged();
835 	}
836 	// sieht man nicht, also muss an den Bindings nicht invalidiert werden
837 }
838 
839 } // end of namespace sd
840