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