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