Update ooo320-m1
[ooovba.git] / sd / source / ui / func / fuoaprms.cxx
blobdb7550726aa551d9b879dba5d3e4e79996615981
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: fuoaprms.cxx,v $
10 * $Revision: 1.18 $
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"
35 #include "fuoaprms.hxx"
37 #include "sdattr.hxx"
38 #include <svx/svdpagv.hxx>
39 #include <svx/colritem.hxx>
40 #include <svx/svdundo.hxx>
41 #include <vcl/group.hxx>
42 #include <vcl/fixed.hxx>
43 #include <sfx2/objsh.hxx>
44 #include <sfx2/request.hxx>
45 #include <sfx2/viewfrm.hxx>
46 #ifndef _MSGBOX_HXX //autogen
47 #include <vcl/msgbox.hxx>
48 #endif
49 #include <svtools/aeitem.hxx>
50 #include "svx/xtable.hxx"
52 #include "strings.hrc"
53 #include "glob.hrc"
54 #include "drawdoc.hxx"
55 #include "ViewShell.hxx"
56 #include "anminfo.hxx"
57 #include "unoaprms.hxx" // Undo-Action
58 #include "sdundogr.hxx" // Undo Gruppe
59 #include "View.hxx"
60 #include "sdabstdlg.hxx"
61 #include "sdresid.hxx"
62 #include <vcl/salbtype.hxx> // FRound
63 #include <basegfx/polygon/b2dpolygon.hxx>
65 using namespace ::com::sun::star;
67 namespace sd {
69 TYPEINIT1( FuObjectAnimationParameters, FuPoor );
71 #define ATTR_MISSING 0 // Attribut nicht verfuegbar
72 #define ATTR_MIXED 1 // Attribut uneindeutig (bei Mehrfachselektion)
73 #define ATTR_SET 2 // Attribut eindeutig
75 /*************************************************************************
77 |* Konstruktor
79 \************************************************************************/
81 FuObjectAnimationParameters::FuObjectAnimationParameters (
82 ViewShell* pViewSh,
83 ::sd::Window* pWin,
84 ::sd::View* pView,
85 SdDrawDocument* pDoc,
86 SfxRequest& rReq)
87 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
91 FunctionReference FuObjectAnimationParameters::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
93 FunctionReference xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) );
94 xFunc->DoExecute(rReq);
95 return xFunc;
98 void FuObjectAnimationParameters::DoExecute( SfxRequest& rReq )
100 SfxUndoManager* pUndoMgr = mpViewShell->GetViewFrame()->GetObjectShell()->GetUndoManager();
102 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
103 ULONG nCount = rMarkList.GetMarkCount();
104 ULONG nObject = 0;
106 short nAnimationSet = ATTR_MISSING;
107 short nEffectSet = ATTR_MISSING;
108 short nTextEffectSet = ATTR_MISSING;
109 short nSpeedSet = ATTR_MISSING;
110 short nFadeColorSet = ATTR_MISSING;
111 short nFadeOutSet = ATTR_MISSING;
112 short nInvisibleSet = ATTR_MISSING;
113 short nSoundOnSet = ATTR_MISSING;
114 short nSoundFileSet = ATTR_MISSING;
115 short nPlayFullSet = ATTR_MISSING;
116 short nClickActionSet = ATTR_MISSING;
117 short nBookmarkSet = ATTR_MISSING;
119 short nSecondEffectSet = ATTR_MISSING;
120 short nSecondSpeedSet = ATTR_MISSING;
121 short nSecondSoundOnSet = ATTR_MISSING;
122 short nSecondPlayFullSet = ATTR_MISSING;
126 // BOOL bDontKnow = FALSE;
128 // defaulten (fuer Undo-Aktion)
129 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
130 presentation::AnimationEffect eTextEffect = presentation::AnimationEffect_NONE;
131 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
132 BOOL bActive = FALSE;
133 BOOL bFadeOut = FALSE;
134 Color aFadeColor = COL_LIGHTGRAY;
135 BOOL bInvisible = FALSE;
136 BOOL bSoundOn = FALSE;
137 String aSound;
138 BOOL bPlayFull = FALSE;
139 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
140 String aBookmark;
142 presentation::AnimationEffect eSecondEffect = presentation::AnimationEffect_NONE;
143 presentation::AnimationSpeed eSecondSpeed = presentation::AnimationSpeed_MEDIUM;
144 BOOL bSecondSoundOn = FALSE;
145 BOOL bSecondPlayFull = FALSE;
148 SdAnimationInfo* pInfo;
149 SdrMark* pMark;
151 // das erste Objekt untersuchen
152 pMark = rMarkList.GetMark(0);
153 pInfo = mpDoc->GetAnimationInfo(pMark->GetMarkedSdrObj());
154 if( pInfo )
156 bActive = pInfo->mbActive;
157 nAnimationSet = ATTR_SET;
159 eEffect = pInfo->meEffect;
160 nEffectSet = ATTR_SET;
162 eTextEffect = pInfo->meTextEffect;
163 nTextEffectSet = ATTR_SET;
165 eSpeed = pInfo->meSpeed;
166 nSpeedSet = ATTR_SET;
168 bFadeOut = pInfo->mbDimPrevious;
169 nFadeOutSet = ATTR_SET;
171 aFadeColor = pInfo->maDimColor;
172 nFadeColorSet = ATTR_SET;
174 bInvisible = pInfo->mbDimHide;
175 nInvisibleSet = ATTR_SET;
177 bSoundOn = pInfo->mbSoundOn;
178 nSoundOnSet = ATTR_SET;
180 aSound = pInfo->maSoundFile;
181 nSoundFileSet = ATTR_SET;
183 bPlayFull = pInfo->mbPlayFull;
184 nPlayFullSet = ATTR_SET;
186 eClickAction = pInfo->meClickAction;
187 nClickActionSet = ATTR_SET;
189 aBookmark = pInfo->GetBookmark();
190 nBookmarkSet = ATTR_SET;
192 eSecondEffect = pInfo->meSecondEffect;
193 nSecondEffectSet = ATTR_SET;
195 eSecondSpeed = pInfo->meSecondSpeed;
196 nSecondSpeedSet = ATTR_SET;
198 bSecondSoundOn = pInfo->mbSecondSoundOn;
199 nSecondSoundOnSet = ATTR_SET;
201 bSecondPlayFull = pInfo->mbSecondPlayFull;
202 nSecondPlayFullSet = ATTR_SET;
205 // ggfs. weitere Objekte untersuchen
206 for( nObject = 1; nObject < nCount; nObject++ )
208 pMark = rMarkList.GetMark( nObject );
209 SdrObject* pObject = pMark->GetMarkedSdrObj();
210 pInfo = mpDoc->GetAnimationInfo(pObject);
211 if( pInfo )
213 if( bActive != pInfo->mbActive )
214 nAnimationSet = ATTR_MIXED;
216 if( eEffect != pInfo->meEffect )
217 nEffectSet = ATTR_MIXED;
219 if( eTextEffect != pInfo->meTextEffect )
220 nTextEffectSet = ATTR_MIXED;
222 if( eSpeed != pInfo->meSpeed )
223 nSpeedSet = ATTR_MIXED;
225 if( bFadeOut != pInfo->mbDimPrevious )
226 nFadeOutSet = ATTR_MIXED;
228 if( aFadeColor != pInfo->maDimColor )
229 nFadeColorSet = ATTR_MIXED;
231 if( bInvisible != pInfo->mbDimHide )
232 nInvisibleSet = ATTR_MIXED;
234 if( bSoundOn != pInfo->mbSoundOn )
235 nSoundOnSet = ATTR_MIXED;
237 if( aSound != pInfo->maSoundFile )
238 nSoundFileSet = ATTR_MIXED;
240 if( bPlayFull != pInfo->mbPlayFull )
241 nPlayFullSet = ATTR_MIXED;
243 if( eClickAction != pInfo->meClickAction )
244 nClickActionSet = ATTR_MIXED;
246 if( aBookmark != pInfo->GetBookmark() )
247 nBookmarkSet = ATTR_MIXED;
249 if( eSecondEffect != pInfo->meSecondEffect )
250 nSecondEffectSet = ATTR_MIXED;
252 if( eSecondSpeed != pInfo->meSecondSpeed )
253 nSecondSpeedSet = ATTR_MIXED;
255 if( bSecondSoundOn != pInfo->mbSecondSoundOn )
256 nSecondSoundOnSet = ATTR_MIXED;
258 if( bSecondPlayFull != pInfo->mbSecondPlayFull )
259 nSecondPlayFullSet = ATTR_MIXED;
261 else
263 if (nAnimationSet == ATTR_SET && bActive == TRUE)
264 nAnimationSet = ATTR_MIXED;
266 if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE)
267 nEffectSet = ATTR_MIXED;
269 if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE)
270 nTextEffectSet = ATTR_MIXED;
272 if (nSpeedSet == ATTR_SET)
273 nSpeedSet = ATTR_MIXED;
275 if (nFadeOutSet == ATTR_SET && bFadeOut == TRUE)
276 nFadeOutSet = ATTR_MIXED;
278 if (nFadeColorSet == ATTR_SET)
279 nFadeColorSet = ATTR_MIXED;
281 if (nInvisibleSet == ATTR_SET && bInvisible == TRUE)
282 nInvisibleSet = ATTR_MIXED;
284 if (nSoundOnSet == ATTR_SET && bSoundOn == TRUE)
285 nSoundOnSet = ATTR_MIXED;
287 if (nSoundFileSet == ATTR_SET)
288 nSoundFileSet = ATTR_MIXED;
290 if (nPlayFullSet == ATTR_SET && bPlayFull == TRUE)
291 nPlayFullSet = ATTR_MIXED;
293 if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE)
294 nClickActionSet = ATTR_MIXED;
296 if (nBookmarkSet == ATTR_SET)
297 nBookmarkSet = ATTR_MIXED;
299 if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE)
300 nSecondEffectSet = ATTR_MIXED;
302 if (nSecondSpeedSet == ATTR_SET)
303 nSecondSpeedSet = ATTR_MIXED;
305 if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn == TRUE)
306 nSecondSoundOnSet = ATTR_MIXED;
308 if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull == TRUE)
309 nSecondPlayFullSet = ATTR_MIXED;
313 // Genau zwei Objekte mit Pfadeffekt? Dann gilt nur die Animationsinfo
314 // am bewegten Objekt.
315 if (nCount == 2)
317 SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
318 SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
319 SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
320 SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
321 SdAnimationInfo* pInfo1 = mpDoc->GetAnimationInfo(pObject1);
322 SdAnimationInfo* pInfo2 = mpDoc->GetAnimationInfo(pObject2);
323 pInfo = NULL;
325 if (pObject1->GetObjInventor() == SdrInventor &&
326 ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
327 (eKind1 == OBJ_PLIN) || // Polygon
328 (eKind1 == OBJ_PATHLINE)) && // Bezier-Kurve
329 (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH))
331 pInfo = pInfo2;
334 if (pObject2->GetObjInventor() == SdrInventor &&
335 ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
336 (eKind2 == OBJ_PLIN) || // Polygon
337 (eKind2 == OBJ_PATHLINE)) && // Bezier-Kurve
338 (pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH))
340 pInfo = pInfo1;
343 if (pInfo)
345 bActive = pInfo->mbActive; nAnimationSet = ATTR_SET;
346 eEffect = pInfo->meEffect; nEffectSet = ATTR_SET;
347 eTextEffect = pInfo->meTextEffect; nTextEffectSet = ATTR_SET;
348 eSpeed = pInfo->meSpeed; nSpeedSet = ATTR_SET;
349 bFadeOut = pInfo->mbDimPrevious; nFadeOutSet = ATTR_SET;
350 aFadeColor = pInfo->maDimColor; nFadeColorSet = ATTR_SET;
351 bInvisible = pInfo->mbDimHide; nInvisibleSet = ATTR_SET;
352 bSoundOn = pInfo->mbSoundOn; nSoundOnSet = ATTR_SET;
353 aSound = pInfo->maSoundFile; nSoundFileSet = ATTR_SET;
354 bPlayFull = pInfo->mbPlayFull; nPlayFullSet = ATTR_SET;
355 eClickAction = pInfo->meClickAction; nClickActionSet = ATTR_SET;
356 aBookmark = pInfo->GetBookmark(); nBookmarkSet = ATTR_SET;
357 eSecondEffect = pInfo->meSecondEffect; nSecondEffectSet = ATTR_SET;
358 eSecondSpeed = pInfo->meSecondSpeed; nSecondSpeedSet = ATTR_SET;
359 bSecondSoundOn = pInfo->mbSecondSoundOn; nSecondSoundOnSet = ATTR_SET;
360 bSecondPlayFull = pInfo->mbSecondPlayFull; nSecondPlayFullSet = ATTR_SET;
364 const SfxItemSet* pArgs = rReq.GetArgs();
366 if(!pArgs)
368 // ItemSet fuer Dialog fuellen
369 SfxItemSet aSet(mpDoc->GetPool(), ATTR_ANIMATION_START, ATTR_ACTION_END);
371 // das Set besetzen
372 if (nAnimationSet == ATTR_SET)
373 aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive));
374 else if (nAnimationSet == ATTR_MIXED)
375 aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE);
376 else
377 aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, FALSE));
379 if (nEffectSet == ATTR_SET)
380 aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, (USHORT)eEffect));
381 else if (nEffectSet == ATTR_MIXED)
382 aSet.InvalidateItem( ATTR_ANIMATION_EFFECT );
383 else
384 aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_EFFECT, presentation::AnimationEffect_NONE));
386 if (nTextEffectSet == ATTR_SET)
387 aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, (USHORT)eTextEffect));
388 else if (nTextEffectSet == ATTR_MIXED)
389 aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT );
390 else
391 aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_TEXTEFFECT, presentation::AnimationEffect_NONE));
393 if (nSpeedSet == ATTR_SET)
394 aSet.Put(SfxAllEnumItem(ATTR_ANIMATION_SPEED, (USHORT)eSpeed));
395 else
396 aSet.InvalidateItem(ATTR_ANIMATION_SPEED);
398 if (nFadeOutSet == ATTR_SET)
399 aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut));
400 else if (nFadeOutSet == ATTR_MIXED)
401 aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT);
402 else
403 aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, FALSE));
405 if (nFadeColorSet == ATTR_SET)
406 aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR));
407 else if (nFadeColorSet == ATTR_MIXED)
408 aSet.InvalidateItem(ATTR_ANIMATION_COLOR);
409 else
410 aSet.Put(SvxColorItem(RGB_Color(COL_LIGHTGRAY), ATTR_ANIMATION_COLOR));
412 if (nInvisibleSet == ATTR_SET)
413 aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible));
414 else if (nInvisibleSet == ATTR_MIXED)
415 aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE);
416 else
417 aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, FALSE));
419 if (nSoundOnSet == ATTR_SET)
420 aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn));
421 else if (nSoundOnSet == ATTR_MIXED)
422 aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON);
423 else
424 aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, FALSE));
426 if (nSoundFileSet == ATTR_SET)
427 aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound));
428 else
429 aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE);
431 if (nPlayFullSet == ATTR_SET)
432 aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull));
433 else if (nPlayFullSet == ATTR_MIXED)
434 aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL);
435 else
436 aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, FALSE));
438 if (nClickActionSet == ATTR_SET)
439 aSet.Put(SfxAllEnumItem(ATTR_ACTION, (USHORT)eClickAction));
440 else if (nClickActionSet == ATTR_MIXED)
441 aSet.InvalidateItem(ATTR_ACTION);
442 else
443 aSet.Put(SfxAllEnumItem(ATTR_ACTION, presentation::ClickAction_NONE));
445 if (nBookmarkSet == ATTR_SET)
446 aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark));
447 else
448 aSet.InvalidateItem(ATTR_ACTION_FILENAME);
450 if (nSecondEffectSet == ATTR_SET)
451 aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, (USHORT)eSecondEffect));
452 else if (nSecondEffectSet == ATTR_MIXED)
453 aSet.InvalidateItem( ATTR_ACTION_EFFECT );
454 else
455 aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECT, presentation::AnimationEffect_NONE));
457 if (nSecondSpeedSet == ATTR_SET)
458 aSet.Put(SfxAllEnumItem(ATTR_ACTION_EFFECTSPEED, (USHORT)eSecondSpeed));
459 else
460 aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED);
462 if (nSecondSoundOnSet == ATTR_SET)
463 aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn));
464 else if (nSecondSoundOnSet == ATTR_MIXED)
465 aSet.InvalidateItem(ATTR_ACTION_SOUNDON);
466 else
467 aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, FALSE));
469 if (nSecondPlayFullSet == ATTR_SET)
470 aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull));
471 else if (nPlayFullSet == ATTR_MIXED)
472 aSet.InvalidateItem(ATTR_ACTION_PLAYFULL);
473 else
474 aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, FALSE));
476 SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
477 SfxAbstractDialog* pDlg = pFact ? pFact->CreatSdActionDialog( NULL, &aSet, mpView ) : 0;
479 USHORT nResult = pDlg ? pDlg->Execute() : RET_CANCEL;
481 if( nResult == RET_OK )
483 rReq.Done( *( pDlg->GetOutputItemSet() ) );
484 pArgs = rReq.GetArgs();
487 delete pDlg;
489 if( nResult != RET_OK )
490 return;
493 // Auswertung des ItemSets
494 if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SFX_ITEM_SET)
496 bActive = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue();
497 nAnimationSet = ATTR_SET;
499 else
500 nAnimationSet = ATTR_MISSING;
502 if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SFX_ITEM_SET)
504 eEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
505 Get(ATTR_ANIMATION_EFFECT)).GetValue();
506 nEffectSet = ATTR_SET;
508 else
509 nEffectSet = ATTR_MISSING;
511 if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SFX_ITEM_SET)
513 eTextEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
514 Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue();
515 nTextEffectSet = ATTR_SET;
517 else
518 nTextEffectSet = ATTR_MISSING;
520 if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SFX_ITEM_SET)
522 eSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
523 Get(ATTR_ANIMATION_SPEED)).GetValue();
524 nSpeedSet = ATTR_SET;
526 else
527 nSpeedSet = ATTR_MISSING;
529 if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SFX_ITEM_SET)
531 bFadeOut = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue();
532 nFadeOutSet = ATTR_SET;
534 else
535 nFadeOutSet = ATTR_MISSING;
537 if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SFX_ITEM_SET)
539 bInvisible = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue();
540 nInvisibleSet = ATTR_SET;
542 else
543 nInvisibleSet = ATTR_MISSING;
545 if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SFX_ITEM_SET)
547 bSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue();
548 nSoundOnSet = ATTR_SET;
550 else
551 nSoundOnSet = ATTR_MISSING;
553 if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SFX_ITEM_SET)
555 aSound = ((SfxStringItem&)pArgs->Get(ATTR_ANIMATION_SOUNDFILE)).GetValue();
556 nSoundFileSet = ATTR_SET;
558 else
559 nSoundFileSet = ATTR_MISSING;
561 if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SFX_ITEM_SET)
563 aFadeColor = ((SvxColorItem&)pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue();
564 nFadeColorSet = ATTR_SET;
566 else
567 nFadeColorSet = ATTR_MISSING;
569 if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SFX_ITEM_SET)
571 bPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue();
572 nPlayFullSet = ATTR_SET;
574 else
575 nPlayFullSet = ATTR_MISSING;
577 if (pArgs->GetItemState(ATTR_ACTION) == SFX_ITEM_SET)
579 eClickAction = (presentation::ClickAction)((SfxAllEnumItem&)pArgs->
580 Get(ATTR_ACTION)).GetValue();
581 nClickActionSet = ATTR_SET;
583 else
584 nClickActionSet = ATTR_MISSING;
586 if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SFX_ITEM_SET)
588 aBookmark = ((SfxStringItem&)pArgs->
589 Get(ATTR_ACTION_FILENAME)).GetValue();
590 nBookmarkSet = ATTR_SET;
592 else
593 nBookmarkSet = ATTR_MISSING;
595 if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SFX_ITEM_SET)
597 eSecondEffect = (presentation::AnimationEffect)((SfxAllEnumItem&) pArgs->
598 Get(ATTR_ACTION_EFFECT)).GetValue();
599 nSecondEffectSet = ATTR_SET;
601 else
602 nSecondEffectSet = ATTR_MISSING;
604 if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SFX_ITEM_SET)
606 eSecondSpeed = (presentation::AnimationSpeed)((SfxAllEnumItem&) pArgs->
607 Get(ATTR_ACTION_EFFECTSPEED)).GetValue();
608 nSecondSpeedSet = ATTR_SET;
610 else
611 nSecondSpeedSet = ATTR_MISSING;
613 if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SFX_ITEM_SET)
615 bSecondSoundOn = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue();
616 nSecondSoundOnSet = ATTR_SET;
618 else
619 nSecondSoundOnSet = ATTR_MISSING;
621 if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SFX_ITEM_SET)
623 bSecondPlayFull = ((SfxBoolItem&)pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue();
624 nSecondPlayFullSet = ATTR_SET;
626 else
627 nSecondPlayFullSet = ATTR_MISSING;
629 // Wenn irgendwelche Attribute ausgewaehlt wurden
630 if (nEffectSet == ATTR_SET ||
631 nTextEffectSet == ATTR_SET ||
632 nSpeedSet == ATTR_SET ||
633 nAnimationSet == ATTR_SET ||
634 nFadeOutSet == ATTR_SET ||
635 nFadeColorSet == ATTR_SET ||
636 nInvisibleSet == ATTR_SET ||
637 nSoundOnSet == ATTR_SET ||
638 nSoundFileSet == ATTR_SET ||
639 nPlayFullSet == ATTR_SET ||
640 nClickActionSet == ATTR_SET ||
641 nBookmarkSet == ATTR_SET ||
642 nSecondEffectSet == ATTR_SET ||
643 nSecondSpeedSet == ATTR_SET ||
644 nSecondSoundOnSet == ATTR_SET ||
645 nSecondPlayFullSet == ATTR_SET)
647 // String fuer Undo-Group und List-Action
648 String aComment(SdResId(STR_UNDO_ANIMATION));
650 // bei 'an Kurve entlang' gibt's noch eine extra UndoAction, darum
651 // hier klammern
652 pUndoMgr->EnterListAction(aComment, aComment);
654 // Undo Gruppe erzeugen
655 SdUndoGroup* pUndoGroup = new SdUndoGroup(mpDoc);
656 pUndoGroup->SetComment(aComment);
659 // fuer den Pfad-Effekt einige Dinge merken
660 SdrObject* pRunningObj = NULL;
661 SdrPathObj* pPath = NULL;
662 if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
664 DBG_ASSERT(nCount == 2, "dieser Effekt braucht genau 2 selektierte Objekte");
665 SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
666 SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
667 SdrObjKind eKind1 = (SdrObjKind)pObject1->GetObjIdentifier();
668 SdrObjKind eKind2 = (SdrObjKind)pObject2->GetObjIdentifier();
670 if (pObject1->GetObjInventor() == SdrInventor &&
671 ((eKind1 == OBJ_LINE) || // 2-Punkt-Linie
672 (eKind1 == OBJ_PLIN) || // Polygon
673 (eKind1 == OBJ_PATHLINE))) // Bezier-Kurve
675 pPath = (SdrPathObj*)pObject1;
676 pRunningObj = pObject2;
679 if (pObject2->GetObjInventor() == SdrInventor &&
680 ((eKind2 == OBJ_LINE) || // 2-Punkt-Linie
681 (eKind2 == OBJ_PLIN) || // Polygon
682 (eKind2 == OBJ_PATHLINE))) // Bezier-Kurve
684 pPath = (SdrPathObj*)pObject2;
685 pRunningObj = pObject1;
688 DBG_ASSERT(pPath, "keine Kurve gefunden");
691 // das laufende Objekt auf das Kurvenende schieben
692 Rectangle aCurRect(pRunningObj->GetLogicRect());
693 Point aCurCenter(aCurRect.Center());
694 const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly();
695 sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
696 const ::basegfx::B2DPolygon aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1L));
697 sal_uInt32 nPoints(aPolygon.count());
698 const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1L));
699 const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
700 Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
701 pRunningObj->Move(aDistance);
703 pUndoMgr->AddUndoAction(mpDoc->GetSdrUndoFactory().CreateUndoMoveObject( *pRunningObj, aDistance));
706 for (nObject = 0; nObject < nCount; nObject++)
708 SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj();
710 pInfo = mpDoc->GetAnimationInfo(pObject);
712 BOOL bCreated = FALSE;
713 if( !pInfo )
715 pInfo = SdDrawDocument::GetShapeUserData(*pObject,true);
716 bCreated = TRUE;
719 // das Pfadobjekt fuer 'an Kurve entlang'?
720 if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
722 SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
723 (mpDoc, pObject, bCreated);
724 pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
725 pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
726 pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
727 pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
728 pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
729 pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
730 pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
731 pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
732 pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
733 pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
734 // pAction->SetPathObj(pInfo->mpPathObj, pInfo->mpPathObj);
735 pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction);
736 pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark());
737 // pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation, TRUE);
738 pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
739 pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
740 pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
741 pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
742 pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
743 pUndoGroup->AddAction(pAction);
745 // pInfo->mbInvisibleInPresentation = TRUE;
747 else
750 // Undo-Action mit alten und neuen Groessen erzeugen
751 SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
752 (mpDoc, pObject, bCreated);
753 pAction->SetActive(pInfo->mbActive, bActive);
754 pAction->SetEffect(pInfo->meEffect, eEffect);
755 pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
756 pAction->SetSpeed(pInfo->meSpeed, eSpeed);
757 pAction->SetDim(pInfo->mbDimPrevious, bFadeOut);
758 pAction->SetDimColor(pInfo->maDimColor, aFadeColor);
759 pAction->SetDimHide(pInfo->mbDimHide, bInvisible);
760 pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn);
761 pAction->SetSound(pInfo->maSoundFile, aSound);
762 pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull);
763 pAction->SetPathObj(pInfo->mpPathObj, pPath);
764 pAction->SetClickAction(pInfo->meClickAction, eClickAction);
765 pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
766 // pAction->SetInvisibleInPres(pInfo->mbInvisibleInPresentation,
767 // pInfo->mbInvisibleInPresentation);
768 pAction->SetVerb(pInfo->mnVerb, (USHORT)pInfo->GetBookmark().ToInt32() );
769 pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect);
770 pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed);
771 pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn);
772 pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull);
773 pUndoGroup->AddAction(pAction);
775 // neue Werte am Infoblock des Objekts eintragen
776 if (nAnimationSet == ATTR_SET)
777 pInfo->mbActive = bActive;
779 if (nEffectSet == ATTR_SET)
780 pInfo->meEffect = eEffect;
782 if (nTextEffectSet == ATTR_SET)
783 pInfo->meTextEffect = eTextEffect;
785 if (nSpeedSet == ATTR_SET)
786 pInfo->meSpeed = eSpeed;
788 if (nFadeOutSet == ATTR_SET)
789 pInfo->mbDimPrevious = bFadeOut;
791 if (nFadeColorSet == ATTR_SET)
792 pInfo->maDimColor = aFadeColor;
794 if (nInvisibleSet == ATTR_SET)
795 pInfo->mbDimHide = bInvisible;
797 if (nSoundOnSet == ATTR_SET)
798 pInfo->mbSoundOn = bSoundOn;
800 if (nSoundFileSet == ATTR_SET)
801 pInfo->maSoundFile = aSound;
803 if (nPlayFullSet == ATTR_SET)
804 pInfo->mbPlayFull = bPlayFull;
806 if (nClickActionSet == ATTR_SET)
807 pInfo->meClickAction = eClickAction;
809 if (nBookmarkSet == ATTR_SET)
810 pInfo->SetBookmark( aBookmark );
812 if (nSecondEffectSet == ATTR_SET)
813 pInfo->meSecondEffect = eSecondEffect;
815 if (nSecondSpeedSet == ATTR_SET)
816 pInfo->meSecondSpeed = eSecondSpeed;
818 if (nSecondSoundOnSet == ATTR_SET)
819 pInfo->mbSecondSoundOn = bSecondSoundOn;
821 if (nSecondPlayFullSet == ATTR_SET)
822 pInfo->mbSecondPlayFull = bSecondPlayFull;
824 // noch ein paar Spezialitaeten
825 // if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
826 // pInfo->mSetPath(pPath);
828 if (eClickAction == presentation::ClickAction_VERB)
829 pInfo->mnVerb = (USHORT)aBookmark.ToInt32();
832 // Undo Gruppe dem Undo Manager uebergeben
833 pUndoMgr->AddUndoAction(pUndoGroup);
834 pUndoMgr->LeaveListAction();
836 // Model geaendert
837 mpDoc->SetChanged();
839 // sieht man nicht, also muss an den Bindings nicht invalidiert werden
842 } // end of namespace sd