LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/func - fuoaprms.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 441 0.2 %
Date: 2012-12-27 Functions: 2 10 20.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10