LibreOffice Module sd (master) 1
fuoaprms.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <fuoaprms.hxx>
21#include <sdattr.hrc>
22
23#include <editeng/colritem.hxx>
24#include <svx/svdundo.hxx>
25#include <sfx2/objsh.hxx>
26#include <sfx2/request.hxx>
27#include <sfx2/viewfrm.hxx>
28#include <sfx2/sfxdlg.hxx>
29#include <svl/intitem.hxx>
30#include <svl/stritem.hxx>
31#include <svx/svdopath.hxx>
32#include <tools/debug.hxx>
33
34#include <strings.hrc>
35#include <drawdoc.hxx>
36#include <ViewShell.hxx>
37#include <ViewShellBase.hxx>
38#include <anminfo.hxx>
39#include <unoaprms.hxx>
40#include <sdundogr.hxx>
41#include <View.hxx>
42#include <sdabstdlg.hxx>
43#include <sdresid.hxx>
44#include <tools/helpers.hxx>
46#include <memory>
47
48using namespace ::com::sun::star;
49
50namespace sd {
51
52
53#define ATTR_MISSING 0
54#define ATTR_MIXED 1
55#define ATTR_SET 2
56
58 ViewShell* pViewSh,
59 ::sd::Window* pWin,
60 ::sd::View* pView,
61 SdDrawDocument* pDoc,
62 SfxRequest& rReq)
63 : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
64{
65}
66
68{
69 rtl::Reference<FuPoor> xFunc( new FuObjectAnimationParameters( pViewSh, pWin, pView, pDoc, rReq ) );
70 xFunc->DoExecute(rReq);
71 return xFunc;
72}
73
75{
77
78 const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
79 const size_t nCount = rMarkList.GetMarkCount();
80
81 short nAnimationSet = ATTR_MISSING;
82 short nEffectSet = ATTR_MISSING;
83 short nTextEffectSet = ATTR_MISSING;
84 short nSpeedSet = ATTR_MISSING;
85 short nFadeColorSet = ATTR_MISSING;
86 short nFadeOutSet = ATTR_MISSING;
87 short nInvisibleSet = ATTR_MISSING;
88 short nSoundOnSet = ATTR_MISSING;
89 short nSoundFileSet = ATTR_MISSING;
90 short nPlayFullSet = ATTR_MISSING;
91 short nClickActionSet = ATTR_MISSING;
92 short nBookmarkSet = ATTR_MISSING;
93
94 short nSecondEffectSet = ATTR_MISSING;
95 short nSecondSpeedSet = ATTR_MISSING;
96 short nSecondSoundOnSet = ATTR_MISSING;
97 short nSecondPlayFullSet = ATTR_MISSING;
98
99 // defaults (for Undo-Action)
100 presentation::AnimationEffect eEffect = presentation::AnimationEffect_NONE;
101 presentation::AnimationEffect eTextEffect = presentation::AnimationEffect_NONE;
102 presentation::AnimationSpeed eSpeed = presentation::AnimationSpeed_MEDIUM;
103 bool bActive = false;
104 bool bFadeOut = false;
105 Color aFadeColor = COL_LIGHTGRAY;
106 bool bInvisible = false;
107 bool bSoundOn = false;
108 OUString aSound;
109 bool bPlayFull = false;
110 presentation::ClickAction eClickAction = presentation::ClickAction_NONE;
111 OUString aBookmark;
112
113 presentation::AnimationEffect eSecondEffect = presentation::AnimationEffect_NONE;
114 presentation::AnimationSpeed eSecondSpeed = presentation::AnimationSpeed_MEDIUM;
115 bool bSecondSoundOn = false;
116 bool bSecondPlayFull = false;
117
118 SdAnimationInfo* pInfo;
119 SdrMark* pMark;
120
121 // inspect first object
122 pMark = rMarkList.GetMark(0);
124 if( pInfo )
125 {
126 bActive = pInfo->mbActive;
127 nAnimationSet = ATTR_SET;
128
129 eEffect = pInfo->meEffect;
130 nEffectSet = ATTR_SET;
131
132 eTextEffect = pInfo->meTextEffect;
133 nTextEffectSet = ATTR_SET;
134
135 eSpeed = pInfo->meSpeed;
136 nSpeedSet = ATTR_SET;
137
138 bFadeOut = pInfo->mbDimPrevious;
139 nFadeOutSet = ATTR_SET;
140
141 aFadeColor = pInfo->maDimColor;
142 nFadeColorSet = ATTR_SET;
143
144 bInvisible = pInfo->mbDimHide;
145 nInvisibleSet = ATTR_SET;
146
147 bSoundOn = pInfo->mbSoundOn;
148 nSoundOnSet = ATTR_SET;
149
150 aSound = pInfo->maSoundFile;
151 nSoundFileSet = ATTR_SET;
152
153 bPlayFull = pInfo->mbPlayFull;
154 nPlayFullSet = ATTR_SET;
155
156 eClickAction = pInfo->meClickAction;
157 nClickActionSet = ATTR_SET;
158
159 aBookmark = pInfo->GetBookmark();
160 nBookmarkSet = ATTR_SET;
161
162 eSecondEffect = pInfo->meSecondEffect;
163 nSecondEffectSet = ATTR_SET;
164
165 eSecondSpeed = pInfo->meSecondSpeed;
166 nSecondSpeedSet = ATTR_SET;
167
168 bSecondSoundOn = pInfo->mbSecondSoundOn;
169 nSecondSoundOnSet = ATTR_SET;
170
171 bSecondPlayFull = pInfo->mbSecondPlayFull;
172 nSecondPlayFullSet = ATTR_SET;
173 }
174
175 // if necessary, inspect more objects
176 for( size_t nObject = 1; nObject < nCount; ++nObject )
177 {
178 pMark = rMarkList.GetMark( nObject );
181 if( pInfo )
182 {
183 if( bActive != pInfo->mbActive )
184 nAnimationSet = ATTR_MIXED;
185
186 if( eEffect != pInfo->meEffect )
187 nEffectSet = ATTR_MIXED;
188
189 if( eTextEffect != pInfo->meTextEffect )
190 nTextEffectSet = ATTR_MIXED;
191
192 if( eSpeed != pInfo->meSpeed )
193 nSpeedSet = ATTR_MIXED;
194
195 if( bFadeOut != pInfo->mbDimPrevious )
196 nFadeOutSet = ATTR_MIXED;
197
198 if( aFadeColor != pInfo->maDimColor )
199 nFadeColorSet = ATTR_MIXED;
200
201 if( bInvisible != pInfo->mbDimHide )
202 nInvisibleSet = ATTR_MIXED;
203
204 if( bSoundOn != pInfo->mbSoundOn )
205 nSoundOnSet = ATTR_MIXED;
206
207 if( aSound != pInfo->maSoundFile )
208 nSoundFileSet = ATTR_MIXED;
209
210 if( bPlayFull != pInfo->mbPlayFull )
211 nPlayFullSet = ATTR_MIXED;
212
213 if( eClickAction != pInfo->meClickAction )
214 nClickActionSet = ATTR_MIXED;
215
216 if( aBookmark != pInfo->GetBookmark() )
217 nBookmarkSet = ATTR_MIXED;
218
219 if( eSecondEffect != pInfo->meSecondEffect )
220 nSecondEffectSet = ATTR_MIXED;
221
222 if( eSecondSpeed != pInfo->meSecondSpeed )
223 nSecondSpeedSet = ATTR_MIXED;
224
225 if( bSecondSoundOn != pInfo->mbSecondSoundOn )
226 nSecondSoundOnSet = ATTR_MIXED;
227
228 if( bSecondPlayFull != pInfo->mbSecondPlayFull )
229 nSecondPlayFullSet = ATTR_MIXED;
230 }
231 else
232 {
233 if (nAnimationSet == ATTR_SET && bActive)
234 nAnimationSet = ATTR_MIXED;
235
236 if (nEffectSet == ATTR_SET && eEffect != presentation::AnimationEffect_NONE)
237 nEffectSet = ATTR_MIXED;
238
239 if (nTextEffectSet == ATTR_SET && eTextEffect != presentation::AnimationEffect_NONE)
240 nTextEffectSet = ATTR_MIXED;
241
242 if (nSpeedSet == ATTR_SET)
243 nSpeedSet = ATTR_MIXED;
244
245 if (nFadeOutSet == ATTR_SET && bFadeOut)
246 nFadeOutSet = ATTR_MIXED;
247
248 if (nFadeColorSet == ATTR_SET)
249 nFadeColorSet = ATTR_MIXED;
250
251 if (nInvisibleSet == ATTR_SET && bInvisible)
252 nInvisibleSet = ATTR_MIXED;
253
254 if (nSoundOnSet == ATTR_SET && bSoundOn)
255 nSoundOnSet = ATTR_MIXED;
256
257 if (nSoundFileSet == ATTR_SET)
258 nSoundFileSet = ATTR_MIXED;
259
260 if (nPlayFullSet == ATTR_SET && bPlayFull)
261 nPlayFullSet = ATTR_MIXED;
262
263 if (nClickActionSet == ATTR_SET && eClickAction != presentation::ClickAction_NONE)
264 nClickActionSet = ATTR_MIXED;
265
266 if (nBookmarkSet == ATTR_SET)
267 nBookmarkSet = ATTR_MIXED;
268
269 if (nSecondEffectSet == ATTR_SET && eSecondEffect != presentation::AnimationEffect_NONE)
270 nSecondEffectSet = ATTR_MIXED;
271
272 if (nSecondSpeedSet == ATTR_SET)
273 nSecondSpeedSet = ATTR_MIXED;
274
275 if (nSecondSoundOnSet == ATTR_SET && bSecondSoundOn)
276 nSecondSoundOnSet = ATTR_MIXED;
277
278 if (nSecondPlayFullSet == ATTR_SET && bSecondPlayFull)
279 nSecondPlayFullSet = ATTR_MIXED;
280 }
281 }
282
283 /* Exactly two objects with path effect?
284 Then, only the animation info at the moved object is valid. */
285 if (nCount == 2)
286 {
287 SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
288 SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
289 SdrObjKind eKind1 = pObject1->GetObjIdentifier();
290 SdrObjKind eKind2 = pObject2->GetObjIdentifier();
293 pInfo = nullptr;
294
295 if (pObject1->GetObjInventor() == SdrInventor::Default &&
296 ((eKind1 == SdrObjKind::Line) || // 2 point line
297 (eKind1 == SdrObjKind::PolyLine) || // Polygon
298 (eKind1 == SdrObjKind::PathLine)) && // Bezier curve
299 (pInfo2 && pInfo2->meEffect == presentation::AnimationEffect_PATH))
300 {
301 pInfo = pInfo2;
302 }
303
304 if (pObject2->GetObjInventor() == SdrInventor::Default &&
305 ((eKind2 == SdrObjKind::Line) || // 2 point line
306 (eKind2 == SdrObjKind::PolyLine) || // Polygon
307 (eKind2 == SdrObjKind::PathLine)) && // Bezier curve
308 (pInfo1 && pInfo1->meEffect == presentation::AnimationEffect_PATH))
309 {
310 pInfo = pInfo1;
311 }
312
313 if (pInfo)
314 {
315 bActive = pInfo->mbActive; nAnimationSet = ATTR_SET;
316 eEffect = pInfo->meEffect; nEffectSet = ATTR_SET;
317 eTextEffect = pInfo->meTextEffect; nTextEffectSet = ATTR_SET;
318 eSpeed = pInfo->meSpeed; nSpeedSet = ATTR_SET;
319 bFadeOut = pInfo->mbDimPrevious; nFadeOutSet = ATTR_SET;
320 aFadeColor = pInfo->maDimColor; nFadeColorSet = ATTR_SET;
321 bInvisible = pInfo->mbDimHide; nInvisibleSet = ATTR_SET;
322 bSoundOn = pInfo->mbSoundOn; nSoundOnSet = ATTR_SET;
323 aSound = pInfo->maSoundFile; nSoundFileSet = ATTR_SET;
324 bPlayFull = pInfo->mbPlayFull; nPlayFullSet = ATTR_SET;
325 eClickAction = pInfo->meClickAction; nClickActionSet = ATTR_SET;
326 aBookmark = pInfo->GetBookmark(); nBookmarkSet = ATTR_SET;
327 eSecondEffect = pInfo->meSecondEffect; nSecondEffectSet = ATTR_SET;
328 eSecondSpeed = pInfo->meSecondSpeed; nSecondSpeedSet = ATTR_SET;
329 bSecondSoundOn = pInfo->mbSecondSoundOn; nSecondSoundOnSet = ATTR_SET;
330 bSecondPlayFull = pInfo->mbSecondPlayFull; nSecondPlayFullSet = ATTR_SET;
331 }
332 }
333
334 const SfxItemSet* pArgs = rReq.GetArgs();
335
336 if(!pArgs)
337 {
338 // fill ItemSet for dialog
340
341 // fill the set
342 if (nAnimationSet == ATTR_SET)
343 aSet.Put( SfxBoolItem( ATTR_ANIMATION_ACTIVE, bActive));
344 else if (nAnimationSet == ATTR_MIXED)
345 aSet.InvalidateItem(ATTR_ANIMATION_ACTIVE);
346 else
347 aSet.Put(SfxBoolItem(ATTR_ANIMATION_ACTIVE, false));
348
349 if (nEffectSet == ATTR_SET)
350 aSet.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT, static_cast<sal_uInt16>(eEffect)));
351 else if (nEffectSet == ATTR_MIXED)
352 aSet.InvalidateItem( ATTR_ANIMATION_EFFECT );
353 else
354 aSet.Put(SfxUInt16Item(ATTR_ANIMATION_EFFECT, sal_uInt16(presentation::AnimationEffect_NONE)));
355
356 if (nTextEffectSet == ATTR_SET)
357 aSet.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT, static_cast<sal_uInt16>(eTextEffect)));
358 else if (nTextEffectSet == ATTR_MIXED)
359 aSet.InvalidateItem( ATTR_ANIMATION_TEXTEFFECT );
360 else
361 aSet.Put(SfxUInt16Item(ATTR_ANIMATION_TEXTEFFECT, sal_uInt16(presentation::AnimationEffect_NONE)));
362
363 if (nSpeedSet == ATTR_SET)
364 aSet.Put(SfxUInt16Item(ATTR_ANIMATION_SPEED, static_cast<sal_uInt16>(eSpeed)));
365 else
366 aSet.InvalidateItem(ATTR_ANIMATION_SPEED);
367
368 if (nFadeOutSet == ATTR_SET)
369 aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, bFadeOut));
370 else if (nFadeOutSet == ATTR_MIXED)
371 aSet.InvalidateItem(ATTR_ANIMATION_FADEOUT);
372 else
373 aSet.Put(SfxBoolItem(ATTR_ANIMATION_FADEOUT, false));
374
375 if (nFadeColorSet == ATTR_SET)
376 aSet.Put(SvxColorItem(aFadeColor, ATTR_ANIMATION_COLOR));
377 else if (nFadeColorSet == ATTR_MIXED)
378 aSet.InvalidateItem(ATTR_ANIMATION_COLOR);
379 else
380 aSet.Put(SvxColorItem(COL_LIGHTGRAY, ATTR_ANIMATION_COLOR));
381
382 if (nInvisibleSet == ATTR_SET)
383 aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, bInvisible));
384 else if (nInvisibleSet == ATTR_MIXED)
385 aSet.InvalidateItem(ATTR_ANIMATION_INVISIBLE);
386 else
387 aSet.Put(SfxBoolItem(ATTR_ANIMATION_INVISIBLE, false));
388
389 if (nSoundOnSet == ATTR_SET)
390 aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, bSoundOn));
391 else if (nSoundOnSet == ATTR_MIXED)
392 aSet.InvalidateItem(ATTR_ANIMATION_SOUNDON);
393 else
394 aSet.Put(SfxBoolItem(ATTR_ANIMATION_SOUNDON, false));
395
396 if (nSoundFileSet == ATTR_SET)
397 aSet.Put(SfxStringItem(ATTR_ANIMATION_SOUNDFILE, aSound));
398 else
399 aSet.InvalidateItem(ATTR_ANIMATION_SOUNDFILE);
400
401 if (nPlayFullSet == ATTR_SET)
402 aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, bPlayFull));
403 else if (nPlayFullSet == ATTR_MIXED)
404 aSet.InvalidateItem(ATTR_ANIMATION_PLAYFULL);
405 else
406 aSet.Put(SfxBoolItem(ATTR_ANIMATION_PLAYFULL, false));
407
408 if (nClickActionSet == ATTR_SET)
409 aSet.Put(SfxUInt16Item(ATTR_ACTION, static_cast<sal_uInt16>(eClickAction)));
410 else if (nClickActionSet == ATTR_MIXED)
411 aSet.InvalidateItem(ATTR_ACTION);
412 else
413 aSet.Put(SfxUInt16Item(ATTR_ACTION, sal_uInt16(presentation::ClickAction_NONE)));
414
415 if (nBookmarkSet == ATTR_SET)
416 aSet.Put(SfxStringItem(ATTR_ACTION_FILENAME, aBookmark));
417 else
418 aSet.InvalidateItem(ATTR_ACTION_FILENAME);
419
420 if (nSecondEffectSet == ATTR_SET)
421 aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECT, static_cast<sal_uInt16>(eSecondEffect)));
422 else if (nSecondEffectSet == ATTR_MIXED)
423 aSet.InvalidateItem( ATTR_ACTION_EFFECT );
424 else
425 aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECT, sal_uInt16(presentation::AnimationEffect_NONE)));
426
427 if (nSecondSpeedSet == ATTR_SET)
428 aSet.Put(SfxUInt16Item(ATTR_ACTION_EFFECTSPEED, static_cast<sal_uInt16>(eSecondSpeed)));
429 else
430 aSet.InvalidateItem(ATTR_ACTION_EFFECTSPEED);
431
432 if (nSecondSoundOnSet == ATTR_SET)
433 aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, bSecondSoundOn));
434 else if (nSecondSoundOnSet == ATTR_MIXED)
435 aSet.InvalidateItem(ATTR_ACTION_SOUNDON);
436 else
437 aSet.Put(SfxBoolItem(ATTR_ACTION_SOUNDON, false));
438
439 if (nSecondPlayFullSet == ATTR_SET)
440 aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, bSecondPlayFull));
441 else if (nSecondPlayFullSet == ATTR_MIXED)
442 aSet.InvalidateItem(ATTR_ACTION_PLAYFULL);
443 else
444 aSet.Put(SfxBoolItem(ATTR_ACTION_PLAYFULL, false));
445
448
449 short nResult = pDlg->Execute();
450
451 if( nResult != RET_OK )
452 return;
453
454 rReq.Done( *( pDlg->GetOutputItemSet() ) );
455 pArgs = rReq.GetArgs();
456 }
457
458 // evaluation of the ItemSets
459 if (pArgs->GetItemState(ATTR_ANIMATION_ACTIVE) == SfxItemState::SET)
460 {
461 bActive = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_ACTIVE)).GetValue();
462 nAnimationSet = ATTR_SET;
463 }
464 else
465 nAnimationSet = ATTR_MISSING;
466
467 if (pArgs->GetItemState(ATTR_ANIMATION_EFFECT) == SfxItemState::SET)
468 {
469 eEffect = static_cast<presentation::AnimationEffect>( pArgs->
470 Get(ATTR_ANIMATION_EFFECT).GetValue());
471 nEffectSet = ATTR_SET;
472 }
473 else
474 nEffectSet = ATTR_MISSING;
475
476 if (pArgs->GetItemState(ATTR_ANIMATION_TEXTEFFECT) == SfxItemState::SET)
477 {
478 eTextEffect = static_cast<presentation::AnimationEffect>(static_cast<const SfxUInt16Item&>( pArgs->
479 Get(ATTR_ANIMATION_TEXTEFFECT)).GetValue());
480 nTextEffectSet = ATTR_SET;
481 }
482 else
483 nTextEffectSet = ATTR_MISSING;
484
485 if (pArgs->GetItemState(ATTR_ANIMATION_SPEED) == SfxItemState::SET)
486 {
487 eSpeed = static_cast<presentation::AnimationSpeed>( pArgs->
488 Get(ATTR_ANIMATION_SPEED).GetValue());
489 nSpeedSet = ATTR_SET;
490 }
491 else
492 nSpeedSet = ATTR_MISSING;
493
494 if (pArgs->GetItemState(ATTR_ANIMATION_FADEOUT) == SfxItemState::SET)
495 {
496 bFadeOut = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_FADEOUT)).GetValue();
497 nFadeOutSet = ATTR_SET;
498 }
499 else
500 nFadeOutSet = ATTR_MISSING;
501
502 if (pArgs->GetItemState(ATTR_ANIMATION_INVISIBLE) == SfxItemState::SET)
503 {
504 bInvisible = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_INVISIBLE)).GetValue();
505 nInvisibleSet = ATTR_SET;
506 }
507 else
508 nInvisibleSet = ATTR_MISSING;
509
510 if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDON) == SfxItemState::SET)
511 {
512 bSoundOn = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_SOUNDON)).GetValue();
513 nSoundOnSet = ATTR_SET;
514 }
515 else
516 nSoundOnSet = ATTR_MISSING;
517
518 if (pArgs->GetItemState(ATTR_ANIMATION_SOUNDFILE) == SfxItemState::SET)
519 {
520 aSound = pArgs->Get(ATTR_ANIMATION_SOUNDFILE).GetValue();
521 nSoundFileSet = ATTR_SET;
522 }
523 else
524 nSoundFileSet = ATTR_MISSING;
525
526 if (pArgs->GetItemState(ATTR_ANIMATION_COLOR) == SfxItemState::SET)
527 {
528 aFadeColor = static_cast<const SvxColorItem&>(pArgs->Get(ATTR_ANIMATION_COLOR)).GetValue();
529 nFadeColorSet = ATTR_SET;
530 }
531 else
532 nFadeColorSet = ATTR_MISSING;
533
534 if (pArgs->GetItemState(ATTR_ANIMATION_PLAYFULL) == SfxItemState::SET)
535 {
536 bPlayFull = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ANIMATION_PLAYFULL)).GetValue();
537 nPlayFullSet = ATTR_SET;
538 }
539 else
540 nPlayFullSet = ATTR_MISSING;
541
542 if (pArgs->GetItemState(ATTR_ACTION) == SfxItemState::SET)
543 {
544 eClickAction = static_cast<presentation::ClickAction>(pArgs->
545 Get(ATTR_ACTION).GetValue());
546 nClickActionSet = ATTR_SET;
547 }
548 else
549 nClickActionSet = ATTR_MISSING;
550
551 if (pArgs->GetItemState(ATTR_ACTION_FILENAME) == SfxItemState::SET)
552 {
553 aBookmark = pArgs->Get(ATTR_ACTION_FILENAME).GetValue();
554 nBookmarkSet = ATTR_SET;
555 }
556 else
557 nBookmarkSet = ATTR_MISSING;
558
559 if (pArgs->GetItemState(ATTR_ACTION_EFFECT) == SfxItemState::SET)
560 {
561 eSecondEffect = static_cast<presentation::AnimationEffect>( pArgs->
562 Get(ATTR_ACTION_EFFECT).GetValue());
563 nSecondEffectSet = ATTR_SET;
564 }
565 else
566 nSecondEffectSet = ATTR_MISSING;
567
568 if (pArgs->GetItemState(ATTR_ACTION_EFFECTSPEED) == SfxItemState::SET)
569 {
570 eSecondSpeed = static_cast<presentation::AnimationSpeed>( pArgs->
571 Get(ATTR_ACTION_EFFECTSPEED).GetValue());
572 nSecondSpeedSet = ATTR_SET;
573 }
574 else
575 nSecondSpeedSet = ATTR_MISSING;
576
577 if (pArgs->GetItemState(ATTR_ACTION_SOUNDON) == SfxItemState::SET)
578 {
579 bSecondSoundOn = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ACTION_SOUNDON)).GetValue();
580 nSecondSoundOnSet = ATTR_SET;
581 }
582 else
583 nSecondSoundOnSet = ATTR_MISSING;
584
585 if (pArgs->GetItemState(ATTR_ACTION_PLAYFULL) == SfxItemState::SET)
586 {
587 bSecondPlayFull = static_cast<const SfxBoolItem&>(pArgs->Get(ATTR_ACTION_PLAYFULL)).GetValue();
588 nSecondPlayFullSet = ATTR_SET;
589 }
590 else
591 nSecondPlayFullSet = ATTR_MISSING;
592
593 // if any attribute is chosen
594 if (!(nEffectSet == ATTR_SET ||
595 nTextEffectSet == ATTR_SET ||
596 nSpeedSet == ATTR_SET ||
597 nAnimationSet == ATTR_SET ||
598 nFadeOutSet == ATTR_SET ||
599 nFadeColorSet == ATTR_SET ||
600 nInvisibleSet == ATTR_SET ||
601 nSoundOnSet == ATTR_SET ||
602 nSoundFileSet == ATTR_SET ||
603 nPlayFullSet == ATTR_SET ||
604 nClickActionSet == ATTR_SET ||
605 nBookmarkSet == ATTR_SET ||
606 nSecondEffectSet == ATTR_SET ||
607 nSecondSpeedSet == ATTR_SET ||
608 nSecondSoundOnSet == ATTR_SET ||
609 nSecondPlayFullSet == ATTR_SET))
610 return;
611
612 // String for undo-group and list-action
613 OUString aComment(SdResId(STR_UNDO_ANIMATION));
614
615 // with 'following curves', we have an additional UndoAction
616 // therefore cling? here
617 pUndoMgr->EnterListAction(aComment, aComment, 0, mpViewShell->GetViewShellBase().GetViewShellId());
618
619 // create undo group
620 std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(mpDoc));
621 pUndoGroup->SetComment(aComment);
622
623 // for the path effect, remember some stuff
624 SdrPathObj* pPath = nullptr;
625 if (eEffect == presentation::AnimationEffect_PATH && nEffectSet == ATTR_SET)
626 {
627 DBG_ASSERT(nCount == 2, "This effect expects two selected objects");
628 SdrObject* pObject1 = rMarkList.GetMark(0)->GetMarkedSdrObj();
629 SdrObject* pObject2 = rMarkList.GetMark(1)->GetMarkedSdrObj();
630 SdrObjKind eKind1 = pObject1->GetObjIdentifier();
631 SdrObjKind eKind2 = pObject2->GetObjIdentifier();
632 SdrObject* pRunningObj = nullptr;
633
634 if (pObject1->GetObjInventor() == SdrInventor::Default &&
635 ((eKind1 == SdrObjKind::Line) || // 2 point line
636 (eKind1 == SdrObjKind::PolyLine) || // Polygon
637 (eKind1 == SdrObjKind::PathLine))) // Bezier curve
638 {
639 pPath = static_cast<SdrPathObj*>(pObject1);
640 pRunningObj = pObject2;
641 }
642
643 if (pObject2->GetObjInventor() == SdrInventor::Default &&
644 ((eKind2 == SdrObjKind::Line) || // 2 point line
645 (eKind2 == SdrObjKind::PolyLine) || // Polygon
646 (eKind2 == SdrObjKind::PathLine))) // Bezier curve
647 {
648 pPath = static_cast<SdrPathObj*>(pObject2);
649 pRunningObj = pObject1;
650 }
651
652 assert(pRunningObj && pPath && "no curve found");
653
654 // push the running object to the end of the curve
655 if (pRunningObj)
656 {
657 ::tools::Rectangle aCurRect(pRunningObj->GetLogicRect());
658 Point aCurCenter(aCurRect.Center());
659 const ::basegfx::B2DPolyPolygon& rPolyPolygon = pPath->GetPathPoly();
660 sal_uInt32 nNoOfPolygons(rPolyPolygon.count());
661 const ::basegfx::B2DPolygon& aPolygon(rPolyPolygon.getB2DPolygon(nNoOfPolygons - 1));
662 sal_uInt32 nPoints(aPolygon.count());
663 const ::basegfx::B2DPoint aNewB2DCenter(aPolygon.getB2DPoint(nPoints - 1));
664 const Point aNewCenter(FRound(aNewB2DCenter.getX()), FRound(aNewB2DCenter.getY()));
665 Size aDistance(aNewCenter.X() - aCurCenter.X(), aNewCenter.Y() - aCurCenter.Y());
666 pRunningObj->Move(aDistance);
667
669 }
670 }
671
672 for (size_t nObject = 0; nObject < nCount; ++nObject)
673 {
674 SdrObject* pObject = rMarkList.GetMark(nObject)->GetMarkedSdrObj();
675
677
678 bool bCreated = false;
679 if( !pInfo )
680 {
682 bCreated = true;
683 }
684
685 // path object for 'following curves'?
686 if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
687 {
689 (mpDoc, pObject, bCreated);
690 pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
691 pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
692 pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
693 pAction->SetSpeed(pInfo->meSpeed, pInfo->meSpeed);
694 pAction->SetDim(pInfo->mbDimPrevious, pInfo->mbDimPrevious);
695 pAction->SetDimColor(pInfo->maDimColor, pInfo->maDimColor);
696 pAction->SetDimHide(pInfo->mbDimHide, pInfo->mbDimHide);
697 pAction->SetSoundOn(pInfo->mbSoundOn, pInfo->mbSoundOn);
698 pAction->SetSound(pInfo->maSoundFile, pInfo->maSoundFile);
699 pAction->SetPlayFull(pInfo->mbPlayFull, pInfo->mbPlayFull);
700 pAction->SetClickAction(pInfo->meClickAction, pInfo->meClickAction);
701 pAction->SetBookmark(pInfo->GetBookmark(), pInfo->GetBookmark());
702 pAction->SetVerb(pInfo->mnVerb, pInfo->mnVerb);
703 pAction->SetSecondEffect(pInfo->meSecondEffect, pInfo->meSecondEffect);
704 pAction->SetSecondSpeed(pInfo->meSecondSpeed, pInfo->meSecondSpeed);
705 pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, pInfo->mbSecondSoundOn);
706 pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull, pInfo->mbSecondPlayFull);
707 pUndoGroup->AddAction(pAction);
708
709 }
710 else
711 {
712
713 // create undo action with old and new sizes
715 (mpDoc, pObject, bCreated);
716 pAction->SetActive(pInfo->mbActive, bActive);
717 pAction->SetEffect(pInfo->meEffect, eEffect);
718 pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
719 pAction->SetSpeed(pInfo->meSpeed, eSpeed);
720 pAction->SetDim(pInfo->mbDimPrevious, bFadeOut);
721 pAction->SetDimColor(pInfo->maDimColor, aFadeColor);
722 pAction->SetDimHide(pInfo->mbDimHide, bInvisible);
723 pAction->SetSoundOn(pInfo->mbSoundOn, bSoundOn);
724 pAction->SetSound(pInfo->maSoundFile, aSound);
725 pAction->SetPlayFull(pInfo->mbPlayFull, bPlayFull);
726 pAction->SetClickAction(pInfo->meClickAction, eClickAction);
727 pAction->SetBookmark(pInfo->GetBookmark(), aBookmark);
728 pAction->SetVerb(pInfo->mnVerb, static_cast<sal_uInt16>(pInfo->GetBookmark().toInt32()) );
729 pAction->SetSecondEffect(pInfo->meSecondEffect, eSecondEffect);
730 pAction->SetSecondSpeed(pInfo->meSecondSpeed, eSecondSpeed);
731 pAction->SetSecondSoundOn(pInfo->mbSecondSoundOn, bSecondSoundOn);
732 pAction->SetSecondPlayFull(pInfo->mbSecondPlayFull,bSecondPlayFull);
733 pUndoGroup->AddAction(pAction);
734
735 // insert new values at info block of the object
736 if (nAnimationSet == ATTR_SET)
737 pInfo->mbActive = bActive;
738
739 if (nEffectSet == ATTR_SET)
740 pInfo->meEffect = eEffect;
741
742 if (nTextEffectSet == ATTR_SET)
743 pInfo->meTextEffect = eTextEffect;
744
745 if (nSpeedSet == ATTR_SET)
746 pInfo->meSpeed = eSpeed;
747
748 if (nFadeOutSet == ATTR_SET)
749 pInfo->mbDimPrevious = bFadeOut;
750
751 if (nFadeColorSet == ATTR_SET)
752 pInfo->maDimColor = aFadeColor;
753
754 if (nInvisibleSet == ATTR_SET)
755 pInfo->mbDimHide = bInvisible;
756
757 if (nSoundOnSet == ATTR_SET)
758 pInfo->mbSoundOn = bSoundOn;
759
760 if (nSoundFileSet == ATTR_SET)
761 pInfo->maSoundFile = aSound;
762
763 if (nPlayFullSet == ATTR_SET)
764 pInfo->mbPlayFull = bPlayFull;
765
766 if (nClickActionSet == ATTR_SET)
767 pInfo->meClickAction = eClickAction;
768
769 if (nBookmarkSet == ATTR_SET)
770 pInfo->SetBookmark( aBookmark );
771
772 if (nSecondEffectSet == ATTR_SET)
773 pInfo->meSecondEffect = eSecondEffect;
774
775 if (nSecondSpeedSet == ATTR_SET)
776 pInfo->meSecondSpeed = eSecondSpeed;
777
778 if (nSecondSoundOnSet == ATTR_SET)
779 pInfo->mbSecondSoundOn = bSecondSoundOn;
780
781 if (nSecondPlayFullSet == ATTR_SET)
782 pInfo->mbSecondPlayFull = bSecondPlayFull;
783
784 if (eClickAction == presentation::ClickAction_VERB)
785 pInfo->mnVerb = static_cast<sal_uInt16>(aBookmark.toInt32());
786 }
787 }
788 // Set the Undo Group in of the Undo Manager
789 pUndoMgr->AddUndoAction(std::move(pUndoGroup));
790 pUndoMgr->LeaveListAction();
791
792 // Model changed
793 mpDoc->SetChanged();
794 // not seen, therefore we do not need to invalidate at the bindings
795}
796
797} // end of namespace sd
798
799/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr tools::Long Y() const
constexpr tools::Long X() const
virtual VclPtr< SfxAbstractDialog > CreatSdActionDialog(weld::Window *pParent, const SfxItemSet *pAttr, ::sd::View *pView)=0
static SD_DLLPUBLIC SdAbstractDialogFactory * Create()
Definition: sdabstdlg.cxx:38
bool mbPlayFull
play sound completely.
Definition: anminfo.hxx:47
css::presentation::AnimationEffect meTextEffect
Animation effect for text content.
Definition: anminfo.hxx:37
bool mbDimHide
hide rather than dim
Definition: anminfo.hxx:42
css::presentation::AnimationEffect meEffect
Animation effect.
Definition: anminfo.hxx:36
void SetBookmark(const OUString &rBookmark)
Definition: anminfo.cxx:95
css::presentation::ClickAction meClickAction
Action at mouse click.
Definition: anminfo.hxx:48
Color maDimColor
for fading the object
Definition: anminfo.hxx:44
sal_uInt16 mnVerb
for OLE object
Definition: anminfo.hxx:54
css::presentation::AnimationEffect meSecondEffect
for object fading.
Definition: anminfo.hxx:49
bool mbSecondSoundOn
for object fading.
Definition: anminfo.hxx:52
OUString GetBookmark() const
Definition: anminfo.cxx:110
OUString maSoundFile
Path to the sound file in MS DOS notation.
Definition: anminfo.hxx:45
css::presentation::AnimationSpeed meSpeed
Speed of the animation.
Definition: anminfo.hxx:38
bool mbDimPrevious
Object fade out.
Definition: anminfo.hxx:40
bool mbActive
turned on?
Definition: anminfo.hxx:39
bool mbSoundOn
Sound on / off.
Definition: anminfo.hxx:46
bool mbSecondPlayFull
for object fading.
Definition: anminfo.hxx:53
css::presentation::AnimationSpeed meSecondSpeed
for object fading.
Definition: anminfo.hxx:50
void SetTextEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect)
Definition: unoaprms.hxx:112
void SetEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect)
Definition: unoaprms.hxx:110
void SetClickAction(css::presentation::ClickAction eTheOldAction, css::presentation::ClickAction eTheNewAction)
Definition: unoaprms.hxx:128
void SetSecondPlayFull(bool bTheOldPlayFull, bool bTheNewPlayFull)
Definition: unoaprms.hxx:140
void SetDimHide(bool bTheOldDimHide, bool bTheNewDimHide)
Definition: unoaprms.hxx:120
void SetVerb(sal_uInt16 nTheOldVerb, sal_uInt16 nTheNewVerb)
Definition: unoaprms.hxx:132
void SetSecondEffect(css::presentation::AnimationEffect eTheOldEffect, css::presentation::AnimationEffect eTheNewEffect)
Definition: unoaprms.hxx:134
void SetSound(const OUString &aTheOldSound, const OUString &aTheNewSound)
Definition: unoaprms.hxx:124
void SetPlayFull(bool bTheOldPlayFull, bool bTheNewPlayFull)
Definition: unoaprms.hxx:126
void SetActive(bool bTheOldActive, bool bTheNewActive)
Definition: unoaprms.hxx:108
void SetDim(bool bTheOldDim, bool bTheNewDim)
Definition: unoaprms.hxx:116
void SetSpeed(css::presentation::AnimationSpeed eTheOldSpeed, css::presentation::AnimationSpeed eTheNewSpeed)
Definition: unoaprms.hxx:114
void SetSecondSoundOn(bool bTheOldSoundOn, bool bTheNewSoundOn)
Definition: unoaprms.hxx:138
void SetDimColor(Color aTheOldDimColor, Color aTheNewDimColor)
Definition: unoaprms.hxx:118
void SetBookmark(const OUString &aTheOldBookmark, const OUString &aTheNewBookmark)
Definition: unoaprms.hxx:130
void SetSoundOn(bool bTheOldSoundOn, bool bTheNewSoundOn)
Definition: unoaprms.hxx:122
void SetSecondSpeed(css::presentation::AnimationSpeed eTheOldSpeed, css::presentation::AnimationSpeed eTheNewSpeed)
Definition: unoaprms.hxx:136
static SdAnimationInfo * GetShapeUserData(SdrObject &rObject, bool bCreate=false)
Definition: drawdoc2.cxx:959
SAL_DLLPRIVATE SfxItemPool & GetPool()
Definition: drawdoc.hxx:237
static SAL_DLLPRIVATE SdAnimationInfo * GetAnimationInfo(SdrObject *pObject)
deprecated
Definition: drawdoc2.cxx:950
virtual SAL_DLLPRIVATE void SetChanged(bool bFlag=true) override
Definition: drawdoc.cxx:658
size_t GetMarkCount() const
SdrMark * GetMark(size_t nNum) const
const SdrMarkList & GetMarkedObjectList() const
SdrObject * GetMarkedSdrObj() const
SdrUndoFactory & GetSdrUndoFactory() const
virtual SdrInventor GetObjInventor() const
virtual void Move(const Size &rSiz)
virtual SdrObjKind GetObjIdentifier() const
virtual const tools::Rectangle & GetLogicRect() const
const basegfx::B2DPolyPolygon & GetPathPoly() const
virtual std::unique_ptr< SdrUndoAction > CreateUndoMoveObject(SdrObject &rObject, const Size &rDist)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
void InvalidateItem(sal_uInt16 nWhich)
const SfxItemSet * GetArgs() const
void Done(bool bRemove=false)
virtual SfxUndoManager * GetUndoManager()
size_t LeaveListAction()
virtual void EnterListAction(const OUString &rComment, const OUString &rRepeatComment, sal_uInt16 nId, ViewShellId nViewShellId)
virtual void AddUndoAction(std::unique_ptr< SfxUndoAction > pAction, bool bTryMerg=false)
virtual SfxObjectShell * GetObjectShell() override
ViewShellId GetViewShellId() const override
virtual void DoExecute(SfxRequest &rReq) override
Definition: fuoaprms.cxx:74
FuObjectAnimationParameters(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuoaprms.cxx:57
static rtl::Reference< FuPoor > Create(ViewShell *pViewSh, ::sd::Window *pWin, ::sd::View *pView, SdDrawDocument *pDoc, SfxRequest &rReq)
Definition: fuoaprms.cxx:67
Base class for all functions.
Definition: fupoor.hxx:48
SdDrawDocument * mpDoc
Definition: fupoor.hxx:148
ViewShell * mpViewShell
Definition: fupoor.hxx:145
::sd::View * mpView
Definition: fupoor.hxx:144
Base class of the stacked shell hierarchy.
Definition: ViewShell.hxx:92
SD_DLLPUBLIC weld::Window * GetFrameWeld() const
Definition: viewshel.cxx:1582
SD_DLLPUBLIC ViewShellBase & GetViewShellBase() const
Definition: viewshel.cxx:1397
SD_DLLPUBLIC SfxViewFrame * GetViewFrame() const
Definition: viewshel.cxx:118
An SdWindow contains the actual working area of ViewShell.
Definition: Window.hxx:45
constexpr Point Center() const
constexpr ::Color COL_LIGHTGRAY(0xC0, 0xC0, 0xC0)
int nCount
#define DBG_ASSERT(sCon, aError)
EmbeddedObjectRef * pObject
#define ATTR_MISSING
Attribute missing.
Definition: fuoaprms.cxx:53
#define ATTR_MIXED
Attribute ambiguous (on multi-selection)
Definition: fuoaprms.cxx:54
#define ATTR_SET
Attribute unique.
Definition: fuoaprms.cxx:55
tools::Long FRound(double fVal)
SVXCORE_DLLPUBLIC MSO_SPT Get(const OUString &)
const char GetValue[]
OUString SdResId(TranslateId aId)
Definition: sdmod.cxx:83
SdrObjKind
o3tl::enumarray< SvxBoxItemLine, sal_uInt16 > aDistance
RET_OK