LCOV - code coverage report
Current view: top level - sd/source/ui/animations - CustomAnimationPane.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 1308 0.0 %
Date: 2012-08-25 Functions: 0 54 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 2679 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/presentation/EffectPresetClass.hpp>
      31                 :            : #include <com/sun/star/animations/XAnimationNodeSupplier.hpp>
      32                 :            : #include <com/sun/star/view/XSelectionSupplier.hpp>
      33                 :            : #include <com/sun/star/drawing/XDrawView.hpp>
      34                 :            : #include <com/sun/star/drawing/XShape.hpp>
      35                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      36                 :            : #include <com/sun/star/presentation/EffectNodeType.hpp>
      37                 :            : #include <com/sun/star/presentation/EffectCommands.hpp>
      38                 :            : #include <com/sun/star/animations/AnimationTransformType.hpp>
      39                 :            : #include <com/sun/star/text/XTextRangeCompare.hpp>
      40                 :            : #include <com/sun/star/container/XEnumerationAccess.hpp>
      41                 :            : #include <com/sun/star/container/XIndexAccess.hpp>
      42                 :            : #include <com/sun/star/presentation/ParagraphTarget.hpp>
      43                 :            : #include <com/sun/star/text/XText.hpp>
      44                 :            : #include <com/sun/star/awt/XWindow.hpp>
      45                 :            : #include <com/sun/star/drawing/LineStyle.hpp>
      46                 :            : #include <com/sun/star/drawing/FillStyle.hpp>
      47                 :            : #include <comphelper/processfactory.hxx>
      48                 :            : #include <sfx2/dispatch.hxx>
      49                 :            : #include "STLPropertySet.hxx"
      50                 :            : #include "CustomAnimationPane.hxx"
      51                 :            : #include "CustomAnimationDialog.hxx"
      52                 :            : #include "CustomAnimationCreateDialog.hxx"
      53                 :            : #include "CustomAnimationPane.hrc"
      54                 :            : #include "CustomAnimation.hrc"
      55                 :            : #include "CustomAnimationList.hxx"
      56                 :            : #include <vcl/lstbox.hxx>
      57                 :            : #include <vcl/fixed.hxx>
      58                 :            : 
      59                 :            : #include <vcl/button.hxx>
      60                 :            : #include <vcl/combobox.hxx>
      61                 :            : #include <vcl/scrbar.hxx>
      62                 :            : 
      63                 :            : #include <comphelper/sequence.hxx>
      64                 :            : #include <sfx2/frame.hxx>
      65                 :            : 
      66                 :            : #include <svx/unoapi.hxx>
      67                 :            : #include <svx/svxids.hrc>
      68                 :            : #include <DrawDocShell.hxx>
      69                 :            : #include <ViewShellBase.hxx>
      70                 :            : #include "DrawViewShell.hxx"
      71                 :            : #include "DrawController.hxx"
      72                 :            : #include "sdresid.hxx"
      73                 :            : #include "drawview.hxx"
      74                 :            : #include "slideshow.hxx"
      75                 :            : #include "undoanim.hxx"
      76                 :            : #include "optsitem.hxx"
      77                 :            : #include "sddll.hxx"
      78                 :            : #include "framework/FrameworkHelper.hxx"
      79                 :            : 
      80                 :            : #include "EventMultiplexer.hxx"
      81                 :            : #include "DialogListBox.hxx"
      82                 :            : 
      83                 :            : #include "glob.hrc"
      84                 :            : #include "sdpage.hxx"
      85                 :            : #include "drawdoc.hxx"
      86                 :            : #include "app.hrc"
      87                 :            : 
      88                 :            : #include <memory>
      89                 :            : #include <algorithm>
      90                 :            : 
      91                 :            : #include <basegfx/polygon/b2dpolypolygontools.hxx>
      92                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      93                 :            : #include <basegfx/range/b2drange.hxx>
      94                 :            : 
      95                 :            : using namespace ::com::sun::star;
      96                 :            : using namespace ::com::sun::star::animations;
      97                 :            : using namespace ::com::sun::star::presentation;
      98                 :            : using namespace ::com::sun::star::text;
      99                 :            : 
     100                 :            : using ::rtl::OUString;
     101                 :            : using namespace ::com::sun::star::uno;
     102                 :            : using namespace ::com::sun::star::drawing;
     103                 :            : using ::com::sun::star::view::XSelectionSupplier;
     104                 :            : using ::com::sun::star::view::XSelectionChangeListener;
     105                 :            : using ::com::sun::star::frame::XController;
     106                 :            : using ::com::sun::star::frame::XModel;
     107                 :            : using ::com::sun::star::beans::XPropertySet;
     108                 :            : using ::com::sun::star::beans::XPropertyChangeListener;
     109                 :            : using ::com::sun::star::container::XIndexAccess;
     110                 :            : using ::com::sun::star::container::XEnumerationAccess;
     111                 :            : using ::com::sun::star::container::XEnumeration;
     112                 :            : using ::com::sun::star::text::XText;
     113                 :            : using ::sd::framework::FrameworkHelper;
     114                 :            : 
     115                 :            : namespace sd {
     116                 :            : 
     117                 :            : // --------------------------------------------------------------------
     118                 :            : 
     119                 :          0 : void fillDurationComboBox( ComboBox* pBox )
     120                 :            : {
     121                 :            :     static const double gdVerySlow = 5.0;
     122                 :            :     static const double gdSlow = 3.0;
     123                 :            :     static const double gdNormal = 2.0;
     124                 :            :     static const double gdFast = 1.0;
     125                 :            :     static const double gdVeryFast = 0.5;
     126                 :            : 
     127 [ #  # ][ #  # ]:          0 :     String aVerySlow( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_SLOW ) );
     128 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aVerySlow ), (void*)&gdVerySlow );
     129                 :            : 
     130 [ #  # ][ #  # ]:          0 :     String aSlow( SdResId( STR_CUSTOMANIMATION_DURATION_SLOW ) );
     131 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aSlow ), (void*)&gdSlow );
     132                 :            : 
     133 [ #  # ][ #  # ]:          0 :     String aNormal( SdResId( STR_CUSTOMANIMATION_DURATION_NORMAL ) );
     134 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aNormal ), (void*)&gdNormal );
     135                 :            : 
     136 [ #  # ][ #  # ]:          0 :     String aFast( SdResId( STR_CUSTOMANIMATION_DURATION_FAST ) );
     137 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aFast ), (void*)&gdFast );
     138                 :            : 
     139 [ #  # ][ #  # ]:          0 :     String aVeryFast( SdResId( STR_CUSTOMANIMATION_DURATION_VERY_FAST ) );
     140 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aVeryFast ), (void*)&gdVeryFast );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     141                 :          0 : }
     142                 :            : 
     143                 :          0 : void fillRepeatComboBox( ComboBox* pBox )
     144                 :            : {
     145 [ #  # ][ #  # ]:          0 :     String aNone( SdResId( STR_CUSTOMANIMATION_REPEAT_NONE ) );
     146 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aNone ), (void*)((sal_Int32)0) );
     147                 :            : 
     148 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 2 ) ), (void*)((sal_Int32)1) );
         [ #  # ][ #  # ]
     149 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 3 ) ), (void*)((sal_Int32)3) );
         [ #  # ][ #  # ]
     150 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 4 ) ), (void*)((sal_Int32)4) );
         [ #  # ][ #  # ]
     151 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 5 ) ), (void*)((sal_Int32)5) );
         [ #  # ][ #  # ]
     152 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( String::CreateFromInt32( 10 ) ), (void*)((sal_Int32)10) );
         [ #  # ][ #  # ]
     153                 :            : 
     154 [ #  # ][ #  # ]:          0 :     String aUntilClick( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_NEXT_CLICK ) );
     155 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aUntilClick ), (void*)((sal_Int32)-1) );
     156                 :            : 
     157 [ #  # ][ #  # ]:          0 :     String aEndOfSlide( SdResId( STR_CUSTOMANIMATION_REPEAT_UNTIL_END_OF_SLIDE ) );
     158 [ #  # ][ #  # ]:          0 :     pBox->SetEntryData( pBox->InsertEntry( aEndOfSlide ), (void*)((sal_Int32)-2) );
         [ #  # ][ #  # ]
                 [ #  # ]
     159                 :          0 : }
     160                 :            : 
     161                 :            : // --------------------------------------------------------------------
     162                 :            : 
     163                 :          0 : CustomAnimationPane::CustomAnimationPane( ::Window* pParent, ViewShellBase& rBase, const Size& rMinSize )
     164                 :            : :   Control( pParent, SdResId(DLG_CUSTOMANIMATIONPANE) ),
     165                 :            :     mrBase( rBase ),
     166                 :            :     mpCustomAnimationPresets(NULL),
     167                 :            :     mnPropertyType( nPropertyTypeNone ),
     168                 :            :     maMinSize( rMinSize ),
     169 [ #  # ][ #  # ]:          0 :     mxModel( rBase.GetDocShell()->GetDoc()->getUnoModel(), UNO_QUERY ),
     170 [ #  # ][ #  # ]:          0 :     maLateInitTimer()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     171                 :            : {
     172                 :            :     // load resources
     173 [ #  # ][ #  # ]:          0 :     mpFLEffect = new FixedLine( this, SdResId( FL_EFFECT ) );
                 [ #  # ]
     174                 :            : 
     175 [ #  # ][ #  # ]:          0 :     mpPBAddEffect = new PushButton( this, SdResId( PB_ADD_EFFECT ) );
                 [ #  # ]
     176 [ #  # ][ #  # ]:          0 :     mpPBChangeEffect = new PushButton( this, SdResId( PB_CHANGE_EFFECT ) );
                 [ #  # ]
     177 [ #  # ][ #  # ]:          0 :     mpPBRemoveEffect = new PushButton( this, SdResId( PB_REMOVE_EFFECT ) );
                 [ #  # ]
     178                 :            : 
     179 [ #  # ][ #  # ]:          0 :     mpFLModify = new FixedLine( this, SdResId( FL_MODIFY ) );
                 [ #  # ]
     180                 :            : 
     181 [ #  # ][ #  # ]:          0 :     mpFTStart = new FixedText( this, SdResId( FT_START ) );
                 [ #  # ]
     182 [ #  # ][ #  # ]:          0 :     mpLBStart = new ListBox( this, SdResId( LB_START ) );
                 [ #  # ]
     183 [ #  # ][ #  # ]:          0 :     mpFTProperty = new FixedText( this, SdResId( FT_PROPERTY ) );
                 [ #  # ]
     184 [ #  # ][ #  # ]:          0 :     mpLBProperty = new PropertyControl( this, SdResId( LB_PROPERTY ) );
                 [ #  # ]
     185 [ #  # ][ #  # ]:          0 :     mpPBPropertyMore = new PushButton( this, SdResId( PB_PROPERTY_MORE ) );
                 [ #  # ]
     186                 :            : 
     187 [ #  # ][ #  # ]:          0 :     mpFTSpeed = new FixedText( this, SdResId( FT_SPEED ) );
                 [ #  # ]
     188 [ #  # ][ #  # ]:          0 :     mpCBSpeed = new ComboBox( this, SdResId( CB_SPEED ) );
                 [ #  # ]
     189                 :            : 
     190 [ #  # ][ #  # ]:          0 :     mpCustomAnimationList = new CustomAnimationList( this, SdResId( CT_CUSTOM_ANIMATION_LIST ), this );
                 [ #  # ]
     191                 :            : 
     192 [ #  # ][ #  # ]:          0 :     mpPBMoveUp = new PushButton( this, SdResId( PB_MOVE_UP ) );
                 [ #  # ]
     193 [ #  # ][ #  # ]:          0 :     mpPBMoveDown = new PushButton( this, SdResId( PB_MOVE_DOWN ) );
                 [ #  # ]
     194 [ #  # ][ #  # ]:          0 :     mpFTChangeOrder = new FixedText( this, SdResId( FT_CHANGE_ORDER ) );
                 [ #  # ]
     195 [ #  # ][ #  # ]:          0 :     mpFLSeperator1 = new FixedLine( this, SdResId( FL_SEPERATOR1 ) );
                 [ #  # ]
     196 [ #  # ][ #  # ]:          0 :     mpPBPlay = new PushButton( this, SdResId( PB_PLAY ) );
                 [ #  # ]
     197 [ #  # ][ #  # ]:          0 :     mpPBSlideShow = new PushButton( this, SdResId( PB_SLIDE_SHOW ) );
                 [ #  # ]
     198 [ #  # ][ #  # ]:          0 :     mpFLSeperator2 = new FixedLine( this, SdResId( FL_SEPERATOR2 ) );
                 [ #  # ]
     199 [ #  # ][ #  # ]:          0 :     mpCBAutoPreview = new CheckBox( this, SdResId( CB_AUTOPREVIEW ) );
                 [ #  # ]
     200                 :            : 
     201 [ #  # ][ #  # ]:          0 :     maStrProperty = mpFTProperty->GetText();
                 [ #  # ]
     202                 :            : 
     203         [ #  # ]:          0 :     FreeResource();
     204                 :            : 
     205                 :            :     // use bold font for group headings (same font for all fixed lines):
     206         [ #  # ]:          0 :     Font font( mpFLEffect->GetFont() );
     207         [ #  # ]:          0 :     font.SetWeight( WEIGHT_BOLD );
     208         [ #  # ]:          0 :     mpFLEffect->SetFont( font );
     209         [ #  # ]:          0 :     mpFLModify->SetFont( font );
     210                 :            : 
     211         [ #  # ]:          0 :     fillDurationComboBox( mpCBSpeed );
     212         [ #  # ]:          0 :     mpPBMoveUp->SetSymbol( SYMBOL_ARROW_UP );
     213         [ #  # ]:          0 :     mpPBMoveDown->SetSymbol( SYMBOL_ARROW_DOWN );
     214                 :            : 
     215         [ #  # ]:          0 :     mpPBAddEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     216         [ #  # ]:          0 :     mpPBChangeEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     217         [ #  # ]:          0 :     mpPBRemoveEffect->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     218         [ #  # ]:          0 :     mpLBStart->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     219         [ #  # ]:          0 :     mpCBSpeed->SetSelectHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     220         [ #  # ]:          0 :     mpPBPropertyMore->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     221         [ #  # ]:          0 :     mpPBMoveUp->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     222         [ #  # ]:          0 :     mpPBMoveDown->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     223         [ #  # ]:          0 :     mpPBPlay->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     224         [ #  # ]:          0 :     mpPBSlideShow->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     225         [ #  # ]:          0 :     mpCBAutoPreview->SetClickHdl( LINK( this, CustomAnimationPane, implControlHdl ) );
     226                 :            : 
     227 [ #  # ][ #  # ]:          0 :     maStrModify = mpFLEffect->GetText();
                 [ #  # ]
     228                 :            : 
     229                 :            :     // resize controls according to current size
     230         [ #  # ]:          0 :     updateLayout();
     231                 :            : 
     232                 :            :     // get current controller and initialize listeners
     233                 :            :     try
     234                 :            :     {
     235 [ #  # ][ #  # ]:          0 :         mxView = Reference< XDrawView >::query(mrBase.GetController());
         [ #  # ][ #  # ]
     236         [ #  # ]:          0 :         addListener();
     237                 :            :     }
     238         [ #  # ]:          0 :     catch( Exception& )
     239                 :            :     {
     240                 :            :         OSL_FAIL( "sd::CustomAnimationPane::CustomAnimationPane(), Exception caught!" );
     241                 :            :     }
     242                 :            : 
     243                 :            :     // get current page and update custom animation list
     244         [ #  # ]:          0 :     onChangeCurrentPage();
     245                 :            : 
     246                 :            :     // Wait a short time before the presets list is created.  This gives the
     247                 :            :     // system time to paint the control.
     248         [ #  # ]:          0 :     maLateInitTimer.SetTimeout(100);
     249         [ #  # ]:          0 :     maLateInitTimer.SetTimeoutHdl(LINK(this, CustomAnimationPane, lateInitCallback));
     250 [ #  # ][ #  # ]:          0 :     maLateInitTimer.Start();
     251                 :          0 : }
     252                 :            : 
     253 [ #  # ][ #  # ]:          0 : CustomAnimationPane::~CustomAnimationPane()
         [ #  # ][ #  # ]
     254                 :            : {
     255         [ #  # ]:          0 :     maLateInitTimer.Stop();
     256                 :            : 
     257         [ #  # ]:          0 :     removeListener();
     258                 :            : 
     259         [ #  # ]:          0 :     MotionPathTagVector aTags;
     260                 :          0 :     aTags.swap( maMotionPathTags );
     261                 :          0 :     MotionPathTagVector::iterator aIter;
     262 [ #  # ][ #  # ]:          0 :     for( aIter = aTags.begin(); aIter != aTags.end(); ++aIter )
     263         [ #  # ]:          0 :         (*aIter)->Dispose();
     264                 :            : 
     265 [ #  # ][ #  # ]:          0 :     delete mpFLModify;
     266 [ #  # ][ #  # ]:          0 :     delete mpPBAddEffect;
     267 [ #  # ][ #  # ]:          0 :     delete mpPBChangeEffect;
     268 [ #  # ][ #  # ]:          0 :     delete mpPBRemoveEffect;
     269 [ #  # ][ #  # ]:          0 :     delete mpFLEffect;
     270 [ #  # ][ #  # ]:          0 :     delete mpFTStart;
     271 [ #  # ][ #  # ]:          0 :     delete mpLBStart;
     272 [ #  # ][ #  # ]:          0 :     delete mpFTProperty;
     273 [ #  # ][ #  # ]:          0 :     delete mpLBProperty;
     274 [ #  # ][ #  # ]:          0 :     delete mpPBPropertyMore;
     275 [ #  # ][ #  # ]:          0 :     delete mpFTSpeed;
     276 [ #  # ][ #  # ]:          0 :     delete mpCBSpeed;
     277 [ #  # ][ #  # ]:          0 :     delete mpCustomAnimationList;
     278 [ #  # ][ #  # ]:          0 :     delete mpFTChangeOrder;
     279 [ #  # ][ #  # ]:          0 :     delete mpPBMoveUp;
     280 [ #  # ][ #  # ]:          0 :     delete mpPBMoveDown;
     281 [ #  # ][ #  # ]:          0 :     delete mpFLSeperator1;
     282 [ #  # ][ #  # ]:          0 :     delete mpPBPlay;
     283 [ #  # ][ #  # ]:          0 :     delete mpPBSlideShow;
     284 [ #  # ][ #  # ]:          0 :     delete mpFLSeperator2;
     285 [ #  # ][ #  # ]:          0 :     delete mpCBAutoPreview;
     286         [ #  # ]:          0 : }
     287                 :            : 
     288                 :          0 : void CustomAnimationPane::addUndo()
     289                 :            : {
     290                 :          0 :     ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
     291         [ #  # ]:          0 :     if( pManager )
     292                 :            :     {
     293                 :          0 :         SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
     294         [ #  # ]:          0 :         if( pPage )
     295         [ #  # ]:          0 :             pManager->AddUndoAction( new UndoAnimation( mrBase.GetDocShell()->GetDoc(), pPage ) );
     296                 :            :     }
     297                 :          0 : }
     298                 :            : 
     299                 :          0 : void CustomAnimationPane::Resize()
     300                 :            : {
     301                 :          0 :     updateLayout();
     302                 :          0 : }
     303                 :            : 
     304                 :          0 : void CustomAnimationPane::StateChanged( StateChangedType nStateChange )
     305                 :            : {
     306                 :          0 :     Control::StateChanged( nStateChange );
     307                 :            : 
     308         [ #  # ]:          0 :     if( nStateChange == STATE_CHANGE_VISIBLE )
     309                 :          0 :         updateMotionPathTags();
     310                 :          0 : }
     311                 :            : 
     312                 :          0 : void CustomAnimationPane::KeyInput( const KeyEvent& rKEvt )
     313                 :            : {
     314         [ #  # ]:          0 :     if( mpCustomAnimationList )
     315                 :          0 :         mpCustomAnimationList->KeyInput( rKEvt );
     316                 :          0 : }
     317                 :            : 
     318                 :          0 : void CustomAnimationPane::addListener()
     319                 :            : {
     320         [ #  # ]:          0 :     Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) );
     321                 :            :     mrBase.GetEventMultiplexer()->AddEventListener (
     322                 :            :         aLink,
     323                 :            :         tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
     324                 :            :         | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
     325                 :            :         | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
     326                 :            :         | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
     327                 :            :         | tools::EventMultiplexerEvent::EID_DISPOSING
     328 [ #  # ][ #  # ]:          0 :         | tools::EventMultiplexerEvent::EID_END_TEXT_EDIT);
                 [ #  # ]
     329                 :          0 : }
     330                 :            : 
     331                 :          0 : void CustomAnimationPane::removeListener()
     332                 :            : {
     333         [ #  # ]:          0 :     Link aLink( LINK(this,CustomAnimationPane,EventMultiplexerListener) );
     334 [ #  # ][ #  # ]:          0 :     mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
                 [ #  # ]
     335                 :          0 : }
     336                 :            : 
     337                 :          0 : IMPL_LINK(CustomAnimationPane,EventMultiplexerListener,
     338                 :            :     tools::EventMultiplexerEvent*,pEvent)
     339                 :            : {
     340   [ #  #  #  #  :          0 :     switch (pEvent->meEventId)
                #  #  # ]
     341                 :            :     {
     342                 :            :         case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
     343                 :          0 :             onSelectionChanged();
     344                 :          0 :             break;
     345                 :            : 
     346                 :            :         case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
     347                 :          0 :             onChangeCurrentPage();
     348                 :          0 :             break;
     349                 :            : 
     350                 :            :         case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
     351                 :            :             // At this moment the controller may not yet been set at model
     352                 :            :             // or ViewShellBase.  Take it from the view shell passed with
     353                 :            :             // the event.
     354         [ #  # ]:          0 :             if (mrBase.GetMainViewShell() != NULL)
     355                 :            :             {
     356 [ #  # ][ #  # ]:          0 :                 if( mrBase.GetMainViewShell()->GetShellType() == ViewShell::ST_IMPRESS )
     357                 :            :                 {
     358 [ #  # ][ #  # ]:          0 :                     mxView = Reference<XDrawView>::query(mrBase.GetDrawController());
     359                 :          0 :                     onSelectionChanged();
     360                 :          0 :                     onChangeCurrentPage();
     361                 :          0 :                     break;
     362                 :            :                 }
     363                 :            :             }
     364                 :            :         // fall through intended
     365                 :            :         case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
     366                 :          0 :             mxView = 0;
     367                 :          0 :             mxCurrentPage = 0;
     368                 :          0 :             updateControls();
     369                 :          0 :             break;
     370                 :            : 
     371                 :            :         case tools::EventMultiplexerEvent::EID_DISPOSING:
     372         [ #  # ]:          0 :             mxView = Reference<XDrawView>();
     373                 :          0 :             onSelectionChanged();
     374                 :          0 :             onChangeCurrentPage();
     375                 :          0 :             break;
     376                 :            :         case tools::EventMultiplexerEvent::EID_END_TEXT_EDIT:
     377 [ #  # ][ #  # ]:          0 :             if( mpMainSequence.get() && pEvent->mpUserData )
                 [ #  # ]
     378         [ #  # ]:          0 :                 mpCustomAnimationList->update( mpMainSequence );
     379                 :          0 :             break;
     380                 :            :     }
     381                 :          0 :     return 0;
     382                 :            : }
     383                 :            : 
     384                 :            : 
     385                 :          0 : void CustomAnimationPane::updateLayout()
     386                 :            : {
     387         [ #  # ]:          0 :     Size aPaneSize( GetSizePixel() );
     388         [ #  # ]:          0 :     if( aPaneSize.Width() < maMinSize.Width() )
     389                 :          0 :         aPaneSize.Width() = maMinSize.Width();
     390                 :            : 
     391         [ #  # ]:          0 :     if( aPaneSize.Height() < maMinSize.Height() )
     392                 :          0 :         aPaneSize.Height() = maMinSize.Height();
     393                 :            : 
     394 [ #  # ][ #  # ]:          0 :     Point aOffset( LogicToPixel( Point(3,3), MAP_APPFONT ) );
                 [ #  # ]
     395                 :          0 :     Point aCursor( aOffset );
     396                 :            : 
     397                 :            :     // place the modify fixed line
     398                 :            : 
     399                 :            :     // place the "modify effect" fixed line
     400         [ #  # ]:          0 :     Size aSize( mpFLModify->GetSizePixel() );
     401                 :          0 :     aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
     402                 :            : 
     403         [ #  # ]:          0 :     mpFLModify->SetPosSizePixel( aCursor, aSize );
     404                 :            : 
     405                 :          0 :     aCursor.Y() += aSize.Height() + aOffset.Y();
     406                 :            : 
     407                 :          0 :     const int nButtonExtraWidth = 4 * aOffset.X();
     408                 :            : 
     409                 :            :     // the "add effect" button is placed top-left
     410         [ #  # ]:          0 :     Size aCtrlSize( mpPBAddEffect->GetSizePixel() );
     411         [ #  # ]:          0 :     aCtrlSize.setWidth( mpPBAddEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
     412         [ #  # ]:          0 :     mpPBAddEffect->SetPosSizePixel( aCursor, aCtrlSize );
     413                 :            : 
     414                 :          0 :     aCursor.X() += aOffset.X() + aCtrlSize.Width();
     415                 :            : 
     416                 :            :     // place the "change effect" button
     417                 :            : 
     418                 :            :     // if the "change" button does not fit right of the "add effect", put it on the next line
     419         [ #  # ]:          0 :     aCtrlSize = mpPBChangeEffect->GetSizePixel();
     420         [ #  # ]:          0 :     aCtrlSize.setWidth( mpPBChangeEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
     421         [ #  # ]:          0 :     if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() )
     422                 :            :     {
     423                 :          0 :         aCursor.X() = aOffset.X();
     424                 :          0 :         aCursor.Y() += aCtrlSize.Height() + aOffset.Y();
     425                 :            :     }
     426         [ #  # ]:          0 :     mpPBChangeEffect->SetPosSizePixel( aCursor, aCtrlSize );
     427                 :            : 
     428                 :          0 :     aCursor.X() += aOffset.X() + aCtrlSize.Width();
     429                 :            : 
     430                 :            :     // place the "remove effect" button
     431                 :            : 
     432                 :            :     // if the "remove" button does not fit right of the "add effect", put it on the next line
     433         [ #  # ]:          0 :     aCtrlSize = mpPBRemoveEffect->GetSizePixel();
     434         [ #  # ]:          0 :     aCtrlSize.setWidth( mpPBRemoveEffect->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
     435         [ #  # ]:          0 :     if( ( aCursor.X() + aCtrlSize.Width() + aOffset.X() ) > aPaneSize.Width() )
     436                 :            :     {
     437                 :          0 :         aCursor.X() = aOffset.X();
     438                 :          0 :         aCursor.Y() += aCtrlSize.Height() + aOffset.Y();
     439                 :            :     }
     440                 :            : 
     441         [ #  # ]:          0 :     mpPBRemoveEffect->SetPosSizePixel( aCursor, aCtrlSize );
     442                 :            : 
     443                 :          0 :     aCursor.X() = aOffset.X();
     444                 :          0 :     aCursor.Y() += aCtrlSize.Height() + 2 * aOffset.Y();
     445                 :            : 
     446                 :            :     // place the "modify effect" fixed line
     447         [ #  # ]:          0 :     aSize = mpFLEffect->GetSizePixel();
     448                 :          0 :     aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
     449                 :            : 
     450         [ #  # ]:          0 :     mpFLEffect->SetPosSizePixel( aCursor, aSize );
     451                 :            : 
     452                 :          0 :     aCursor.Y() += aSize.Height() + aOffset.Y();
     453                 :            : 
     454                 :            :     // ---------------------------------------------------------------------------
     455                 :            :     // place the properties controls
     456                 :            : 
     457                 :            :     // calc minimum width for fixedtext
     458                 :            : 
     459         [ #  # ]:          0 :     Size aFixedTextSize( mpFTStart->CalcMinimumSize() );
     460                 :          0 :     long nWidth = aFixedTextSize.Width();
     461         [ #  # ]:          0 :     aFixedTextSize = mpFTProperty->CalcMinimumSize();
     462         [ #  # ]:          0 :     nWidth = std::max( nWidth, aFixedTextSize.Width() );
     463         [ #  # ]:          0 :     aFixedTextSize = mpFTSpeed->CalcMinimumSize();
     464         [ #  # ]:          0 :     aFixedTextSize.Width() = std::max( nWidth, aFixedTextSize.Width() ) + aOffset.X();
     465         [ #  # ]:          0 :     mpFTStart->SetSizePixel(aFixedTextSize);
     466         [ #  # ]:          0 :     mpFTProperty->SetSizePixel(aFixedTextSize);
     467         [ #  # ]:          0 :     mpFTSpeed->SetSizePixel(aFixedTextSize);
     468                 :            : 
     469         [ #  # ]:          0 :     aSize = mpPBPropertyMore->GetSizePixel();
     470                 :            : 
     471                 :            :     // place the "start" fixed text
     472                 :            : 
     473                 :          0 :     Point aFTPos( aCursor );
     474                 :          0 :     Point aLBPos( aCursor );
     475 [ #  # ][ #  # ]:          0 :     Size aListBoxSize( LogicToPixel( Size( 60, 12 ), MAP_APPFONT ) );
                 [ #  # ]
     476                 :          0 :     long nDeltaY = aListBoxSize.Height() + aOffset.Y();
     477                 :            : 
     478                 :            :     // linebreak?
     479         [ #  # ]:          0 :     if( (aFixedTextSize.Width() + aListBoxSize.Width() + aSize.Width() + 4 * aOffset.X()) > aPaneSize.Width() )
     480                 :            :     {
     481                 :            :         // y position for list box is below fixed text
     482                 :          0 :         aLBPos.Y() += aFixedTextSize.Height() + aOffset.Y();
     483                 :            : 
     484                 :            :         // height of fixed text + list box + something = 2 * list box
     485                 :          0 :         nDeltaY = aListBoxSize.Height() +  aFixedTextSize.Height() + 2*aOffset.Y();
     486                 :            :     }
     487                 :            :     else
     488                 :            :     {
     489                 :            :         // x position for list box is right of fixed text
     490                 :          0 :         aLBPos.X() += aFixedTextSize.Width() + aOffset.X();
     491                 :            : 
     492         [ #  # ]:          0 :         if( aListBoxSize.Height() > aFixedTextSize.Height() )
     493                 :          0 :             aFTPos.Y() = aLBPos.Y() + ((aListBoxSize.Height() - aFixedTextSize.Height()) >> 1);
     494                 :            :         else
     495                 :          0 :             aLBPos.Y() = aFTPos.Y() + ((aFixedTextSize.Height() - aListBoxSize.Height()) >> 1);
     496                 :            :     }
     497                 :            : 
     498                 :            :     // width of the listbox is from its left side until end of pane
     499                 :          0 :     aListBoxSize.Width() = aPaneSize.Width() - aLBPos.X() - aSize.Width() - 2 * aOffset.X();
     500                 :            : 
     501         [ #  # ]:          0 :     mpFTStart->SetPosPixel( aFTPos );
     502         [ #  # ]:          0 :     mpLBStart->SetPosSizePixel( aLBPos, aListBoxSize );
     503                 :            : 
     504                 :          0 :     aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY;
     505                 :            : 
     506         [ #  # ]:          0 :     mpFTProperty->SetPosPixel( aFTPos );
     507         [ #  # ]:          0 :     mpLBProperty->SetPosSizePixel( aLBPos, aListBoxSize );
     508         [ #  # ]:          0 :     mpLBProperty->Resize();
     509                 :            : 
     510                 :          0 :     Point aMorePos( aLBPos );
     511                 :          0 :     aMorePos.X() += aListBoxSize.Width() + aOffset.X();
     512         [ #  # ]:          0 :     mpPBPropertyMore->SetPosPixel( aMorePos );
     513                 :            : 
     514                 :          0 :     aFTPos.Y() += nDeltaY; aLBPos.Y() += nDeltaY;
     515                 :            : 
     516         [ #  # ]:          0 :     mpFTSpeed->SetPosPixel( aFTPos );
     517         [ #  # ]:          0 :     mpCBSpeed->SetPosSizePixel( aLBPos, aListBoxSize );
     518                 :            : 
     519                 :          0 :     aFTPos.Y() += nDeltaY + aOffset.Y();
     520                 :            : 
     521                 :          0 :     Point aListPos( aFTPos );
     522                 :            : 
     523                 :            :     // positionate the buttons on the bottom
     524                 :            : 
     525                 :            :     // place the auto preview checkbox
     526         [ #  # ]:          0 :     aCursor = Point( aOffset.X(), aPaneSize.Height() - mpCBAutoPreview->GetSizePixel().Height() - aOffset.Y() );
     527         [ #  # ]:          0 :     mpCBAutoPreview->SetPosPixel( aCursor );
     528                 :            : 
     529                 :            :     // place the seperator 2 fixed line
     530         [ #  # ]:          0 :     aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator2->GetSizePixel().Height();
     531         [ #  # ]:          0 :     aSize = mpFLSeperator2->GetSizePixel();
     532                 :          0 :     aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
     533         [ #  # ]:          0 :     mpFLSeperator2->SetPosSizePixel( aCursor, aSize );
     534                 :            : 
     535                 :            :     // next, layout and place the play and slide show buttons
     536         [ #  # ]:          0 :     aCtrlSize = mpPBSlideShow->GetSizePixel();
     537         [ #  # ]:          0 :     aCtrlSize.setWidth( mpPBSlideShow->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
     538                 :            : 
     539         [ #  # ]:          0 :     Size aPlaySize( mpPBPlay->GetSizePixel() );
     540         [ #  # ]:          0 :     aPlaySize.setWidth( mpPBPlay->CalcMinimumSize( aSize.Width() ).getWidth() + nButtonExtraWidth );
     541                 :            : 
     542                 :          0 :     aCursor.Y() -= aCtrlSize.Height() /* + aOffset.Y() */;
     543                 :            : 
     544                 :            :     // do we need two lines for the buttons?
     545 [ #  # ][ #  # ]:          0 :     int aTestWidth = aCursor.X() + mpPBPlay->GetSizePixel().Width() + 2 * aOffset.X() + mpPBSlideShow->GetSizePixel().Width();
     546         [ #  # ]:          0 :     if( aTestWidth > aPaneSize.Width() )
     547                 :            :     {
     548         [ #  # ]:          0 :         mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize );
     549                 :          0 :         aCursor.Y() -= aCtrlSize.Height() + aOffset.Y();
     550         [ #  # ]:          0 :         mpPBPlay->SetPosSizePixel( aCursor, aPlaySize );
     551                 :            :     }
     552                 :            :     else
     553                 :            :     {
     554         [ #  # ]:          0 :         mpPBPlay->SetPosSizePixel( aCursor, aPlaySize );
     555                 :          0 :         aCursor.X() += aPlaySize.Width() + aOffset.X();
     556         [ #  # ]:          0 :         mpPBSlideShow->SetPosSizePixel( aCursor, aCtrlSize );
     557                 :            :     }
     558                 :            : 
     559                 :            :     // place the seperator 1 fixed line
     560                 :          0 :     aCursor.X() = aOffset.X();
     561         [ #  # ]:          0 :     aCursor.Y() -= /* aOffset.Y() + */ mpFLSeperator1->GetSizePixel().Height();
     562         [ #  # ]:          0 :     aSize = mpFLSeperator1->GetSizePixel();
     563                 :          0 :     aSize.Width() = aPaneSize.Width() - 2 * aOffset.X();
     564         [ #  # ]:          0 :     mpFLSeperator1->SetPosSizePixel( aCursor, aSize );
     565                 :            : 
     566                 :            :     // place the move down button
     567         [ #  # ]:          0 :     aSize = mpPBMoveDown->GetSizePixel();
     568                 :            : 
     569                 :          0 :     aCursor.X() = aPaneSize.Width() - aOffset.X() - aSize.Width();
     570                 :          0 :     aCursor.Y() -= aOffset.Y() + aSize.Height();
     571         [ #  # ]:          0 :     mpPBMoveDown->SetPosPixel( aCursor );
     572                 :            : 
     573                 :          0 :     aCursor.X() -= aOffset.X() + aSize.Width();
     574         [ #  # ]:          0 :     mpPBMoveUp->SetPosPixel( aCursor );
     575                 :            : 
     576                 :            :     // Place the change order label.
     577                 :            :     // Its width has to be calculated dynamically so that is can be
     578                 :            :     // displayed flush right without having too much space to the buttons
     579                 :            :     // with some languages or truncated text with others.
     580 [ #  # ][ #  # ]:          0 :     mpFTChangeOrder->SetSizePixel(mpFTChangeOrder->CalcMinimumSize());
     581                 :            : 
     582         [ #  # ]:          0 :     aCursor.X() -= aOffset.X() + mpFTChangeOrder->GetSizePixel().Width();
     583         [ #  # ]:          0 :     aCursor.Y() += (aSize.Height() - mpFTChangeOrder->GetSizePixel().Height()) >> 1;
     584         [ #  # ]:          0 :     mpFTChangeOrder->SetPosPixel( aCursor );
     585                 :            : 
     586                 :            :     // positionate the custom animation list control
     587                 :          0 :     Size aCustomAnimationListSize( aPaneSize.Width() - aListPos.X() - aOffset.X(), aCursor.Y() - aListPos.Y() - 2 * aOffset.Y() );
     588         [ #  # ]:          0 :     mpCustomAnimationList->SetPosSizePixel( aListPos, aCustomAnimationListSize );
     589                 :          0 : }
     590                 :            : 
     591                 :          0 : static sal_Int32 getPropertyType( const OUString& rProperty )
     592                 :            : {
     593         [ #  # ]:          0 :     if ( rProperty == "Direction" )
     594                 :          0 :         return nPropertyTypeDirection;
     595                 :            : 
     596         [ #  # ]:          0 :     if ( rProperty == "Spokes" )
     597                 :          0 :         return nPropertyTypeSpokes;
     598                 :            : 
     599         [ #  # ]:          0 :     if ( rProperty == "Zoom" )
     600                 :          0 :         return nPropertyTypeZoom;
     601                 :            : 
     602         [ #  # ]:          0 :     if ( rProperty == "Accelerate" )
     603                 :          0 :         return nPropertyTypeAccelerate;
     604                 :            : 
     605         [ #  # ]:          0 :     if ( rProperty == "Decelerate" )
     606                 :          0 :         return nPropertyTypeDecelerate;
     607                 :            : 
     608         [ #  # ]:          0 :     if ( rProperty == "Color1" )
     609                 :          0 :         return nPropertyTypeFirstColor;
     610                 :            : 
     611         [ #  # ]:          0 :     if ( rProperty == "Color2" )
     612                 :          0 :         return nPropertyTypeSecondColor;
     613                 :            : 
     614         [ #  # ]:          0 :     if ( rProperty == "FillColor" )
     615                 :          0 :         return nPropertyTypeFillColor;
     616                 :            : 
     617         [ #  # ]:          0 :     if ( rProperty == "ColorStyle" )
     618                 :          0 :         return nPropertyTypeColorStyle;
     619                 :            : 
     620         [ #  # ]:          0 :     if ( rProperty == "AutoReverse" )
     621                 :          0 :         return nPropertyTypeAutoReverse;
     622                 :            : 
     623         [ #  # ]:          0 :     if ( rProperty == "FontStyle" )
     624                 :          0 :         return nPropertyTypeFont;
     625                 :            : 
     626         [ #  # ]:          0 :     if ( rProperty == "CharColor" )
     627                 :          0 :         return nPropertyTypeCharColor;
     628                 :            : 
     629         [ #  # ]:          0 :     if ( rProperty == "CharHeight" )
     630                 :          0 :         return nPropertyTypeCharHeight;
     631                 :            : 
     632         [ #  # ]:          0 :     if ( rProperty == "CharDecoration" )
     633                 :          0 :         return nPropertyTypeCharDecoration;
     634                 :            : 
     635         [ #  # ]:          0 :     if ( rProperty == "LineColor" )
     636                 :          0 :         return nPropertyTypeLineColor;
     637                 :            : 
     638         [ #  # ]:          0 :     if ( rProperty == "Rotate" )
     639                 :          0 :         return nPropertyTypeRotate;
     640                 :            : 
     641         [ #  # ]:          0 :     if ( rProperty == "Transparency" )
     642                 :          0 :         return nPropertyTypeTransparency;
     643                 :            : 
     644         [ #  # ]:          0 :     if ( rProperty == "Color" )
     645                 :          0 :         return nPropertyTypeColor;
     646                 :            : 
     647         [ #  # ]:          0 :     if ( rProperty == "Scale" )
     648                 :          0 :         return nPropertyTypeScale;
     649                 :            : 
     650                 :          0 :     return nPropertyTypeNone;
     651                 :            : }
     652                 :            : 
     653                 :          0 : OUString getPropertyName( sal_Int32 nPropertyType )
     654                 :            : {
     655   [ #  #  #  #  :          0 :     switch( nPropertyType )
          #  #  #  #  #  
          #  #  #  #  #  
             #  #  #  # ]
     656                 :            :     {
     657                 :            :     case nPropertyTypeDirection:
     658 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_DIRECTION_PROPERTY ) ) );
         [ #  # ][ #  # ]
     659                 :            : 
     660                 :            :     case nPropertyTypeSpokes:
     661 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_SPOKES_PROPERTY ) ) );
         [ #  # ][ #  # ]
     662                 :            : 
     663                 :            :     case nPropertyTypeFirstColor:
     664 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FIRST_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     665                 :            : 
     666                 :            :     case nPropertyTypeSecondColor:
     667 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_SECOND_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     668                 :            : 
     669                 :            :     case nPropertyTypeZoom:
     670 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_ZOOM_PROPERTY ) ) );
         [ #  # ][ #  # ]
     671                 :            : 
     672                 :            :     case nPropertyTypeFillColor:
     673 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FILL_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     674                 :            : 
     675                 :            :     case nPropertyTypeColorStyle:
     676 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_STYLE_PROPERTY ) ) );
         [ #  # ][ #  # ]
     677                 :            : 
     678                 :            :     case nPropertyTypeFont:
     679 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_PROPERTY ) ) );
         [ #  # ][ #  # ]
     680                 :            : 
     681                 :            :     case nPropertyTypeCharHeight:
     682 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_SIZE_PROPERTY ) ) );
         [ #  # ][ #  # ]
     683                 :            : 
     684                 :            :     case nPropertyTypeCharColor:
     685 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     686                 :            : 
     687                 :            :     case nPropertyTypeCharHeightStyle:
     688 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_SIZE_STYLE_PROPERTY ) ) );
         [ #  # ][ #  # ]
     689                 :            : 
     690                 :            :     case nPropertyTypeCharDecoration:
     691 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_FONT_STYLE_PROPERTY ) ) );
         [ #  # ][ #  # ]
     692                 :            : 
     693                 :            :     case nPropertyTypeLineColor:
     694 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_LINE_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     695                 :            : 
     696                 :            :     case nPropertyTypeRotate:
     697 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) );
         [ #  # ][ #  # ]
     698                 :            : 
     699                 :            :     case nPropertyTypeColor:
     700 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_COLOR_PROPERTY ) ) );
         [ #  # ][ #  # ]
     701                 :            : 
     702                 :            :     case nPropertyTypeTransparency:
     703 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_AMOUNT_PROPERTY ) ) );
         [ #  # ][ #  # ]
     704                 :            : 
     705                 :            :     case nPropertyTypeScale:
     706 [ #  # ][ #  # ]:          0 :         return OUString( String( SdResId( STR_CUSTOMANIMATION_SCALE_PROPERTY ) ) );
         [ #  # ][ #  # ]
     707                 :            :     }
     708                 :            : 
     709                 :          0 :     OUString aStr;
     710                 :          0 :     return aStr;
     711                 :            : }
     712                 :            : 
     713                 :          0 : void CustomAnimationPane::updateControls()
     714                 :            : {
     715                 :          0 :     mpFLModify->Enable( mxView.is() );
     716                 :          0 :     mpFTSpeed->Enable( mxView.is() );
     717                 :          0 :     mpCBSpeed->Enable( mxView.is() );
     718                 :          0 :     mpCustomAnimationList->Enable( mxView.is() );
     719                 :          0 :     mpFTChangeOrder->Enable( mxView.is() );
     720                 :          0 :     mpPBMoveUp->Enable( mxView.is() );
     721                 :          0 :     mpPBMoveDown->Enable( mxView.is() );
     722                 :          0 :     mpFLSeperator1->Enable( mxView.is() );
     723                 :          0 :     mpPBPlay->Enable( mxView.is() );
     724                 :          0 :     mpPBSlideShow->Enable( mxView.is() );
     725                 :          0 :     mpFLSeperator2->Enable( mxView.is() );
     726                 :          0 :     mpCBAutoPreview->Enable( mxView.is() );
     727                 :            : 
     728         [ #  # ]:          0 :     if( !mxView.is() )
     729                 :            :     {
     730                 :          0 :         mpPBAddEffect->Enable( sal_False );
     731                 :          0 :         mpPBChangeEffect->Enable( sal_False );
     732                 :          0 :         mpPBRemoveEffect->Enable( sal_False );
     733                 :          0 :         mpFLEffect->Enable( sal_False );
     734                 :          0 :         mpFTStart->Enable( sal_False );
     735                 :          0 :         mpLBStart->Enable( sal_False );
     736                 :          0 :         mpPBPropertyMore->Enable( sal_False );
     737                 :          0 :         mpLBProperty->Enable( sal_False );
     738                 :          0 :         mpFTProperty->Enable( sal_False );
     739                 :          0 :         mpCustomAnimationList->clear();
     740                 :          0 :         return;
     741                 :            :     }
     742                 :            : 
     743                 :          0 :     const int nSelectionCount = maListSelection.size();
     744                 :            : 
     745                 :          0 :     mpPBAddEffect->Enable( maViewSelection.hasValue() );
     746                 :          0 :     mpPBChangeEffect->Enable( nSelectionCount);
     747                 :          0 :     mpPBRemoveEffect->Enable(nSelectionCount);
     748                 :            : 
     749                 :          0 :     mpFLEffect->Enable(nSelectionCount > 0);
     750                 :          0 :     mpFTStart->Enable(nSelectionCount > 0);
     751                 :          0 :     mpLBStart->Enable(nSelectionCount > 0);
     752                 :          0 :     mpPBPropertyMore->Enable(nSelectionCount > 0);
     753                 :            : 
     754                 :          0 :     mpFTProperty->SetText( maStrProperty );
     755                 :            : 
     756                 :          0 :     mnPropertyType = nPropertyTypeNone;
     757                 :            : 
     758         [ #  # ]:          0 :     if( nSelectionCount == 1 )
     759                 :            :     {
     760 [ #  # ][ #  # ]:          0 :         CustomAnimationEffectPtr pEffect = maListSelection.front();
     761                 :            : 
     762 [ #  # ][ #  # ]:          0 :         OUString aUIName( getPresets().getUINameForPresetId( pEffect->getPresetId() ) );
     763                 :            : 
     764         [ #  # ]:          0 :         OUString aTemp( maStrModify );
     765                 :            : 
     766         [ #  # ]:          0 :         if( !aUIName.isEmpty() )
     767                 :            :         {
     768                 :          0 :             aTemp += OUString( (sal_Unicode)' ' );
     769                 :          0 :             aTemp += aUIName;
     770                 :            :         }
     771 [ #  # ][ #  # ]:          0 :         mpFLEffect->SetText( aTemp );
                 [ #  # ]
     772                 :            : 
     773 [ #  # ][ #  # ]:          0 :         CustomAnimationPresetPtr pDescriptor = getPresets().getEffectDescriptor( pEffect->getPresetId() );
     774         [ #  # ]:          0 :         if( pDescriptor.get() )
     775                 :            :         {
     776                 :          0 :             PropertySubControl* pSubControl = NULL;
     777                 :            : 
     778                 :          0 :             Any aValue;
     779                 :            : 
     780         [ #  # ]:          0 :             UStringList aProperties( pDescriptor->getProperties() );
     781         [ #  # ]:          0 :             if( aProperties.size() >= 1 )
     782                 :            :             {
     783 [ #  # ][ #  # ]:          0 :                 mnPropertyType = getPropertyType( aProperties.front() );
     784                 :            : 
     785 [ #  # ][ #  # ]:          0 :                 mpFTProperty->SetText( getPropertyName( mnPropertyType )  );
         [ #  # ][ #  # ]
     786                 :            : 
     787 [ #  # ][ #  # ]:          0 :                 aValue = getProperty1Value( mnPropertyType, pEffect );
                 [ #  # ]
     788                 :            :             }
     789                 :            : 
     790         [ #  # ]:          0 :             if( aValue.hasValue() )
     791                 :            :             {
     792                 :          0 :                 pSubControl = mpLBProperty->getSubControl();
     793 [ #  # ][ #  # ]:          0 :                 if( !pSubControl || (pSubControl->getControlType() != mnPropertyType) )
                 [ #  # ]
     794                 :            :                 {
     795 [ #  # ][ #  # ]:          0 :                     pSubControl = PropertySubControl::create( mnPropertyType, this, aValue, pEffect->getPresetId(), LINK( this, CustomAnimationPane, implPropertyHdl ) );
     796         [ #  # ]:          0 :                     mpLBProperty->setSubControl( pSubControl );
     797                 :            :                 }
     798                 :            :                 else
     799                 :            :                 {
     800         [ #  # ]:          0 :                     pSubControl->setValue( aValue, pEffect->getPresetId() );
     801                 :            :                 }
     802                 :            :             }
     803                 :            :             else
     804                 :            :             {
     805         [ #  # ]:          0 :                 mpLBProperty->setSubControl( 0 );
     806                 :            :             }
     807                 :            : 
     808 [ #  # ][ #  # ]:          0 :             bool bEnable = (pSubControl != 0) && (pSubControl->getControl()->IsEnabled());
         [ #  # ][ #  # ]
     809         [ #  # ]:          0 :             mpLBProperty->Enable( bEnable );
     810         [ #  # ]:          0 :             mpFTProperty->Enable( bEnable );
     811                 :            :         }
     812                 :            :         else
     813                 :            :         {
     814         [ #  # ]:          0 :             mpLBProperty->setSubControl( 0 );
     815         [ #  # ]:          0 :             mpFTProperty->Enable( sal_False );
     816         [ #  # ]:          0 :             mpLBProperty->Enable( sal_False );
     817         [ #  # ]:          0 :             mpPBPropertyMore->Enable( sal_False );
     818                 :            :         }
     819                 :            : 
     820                 :          0 :         sal_uInt16 nPos = 0xffff;
     821                 :            : 
     822                 :          0 :         sal_Int16 nNodeType = pEffect->getNodeType();
     823   [ #  #  #  # ]:          0 :         switch( nNodeType )
     824                 :            :         {
     825                 :          0 :         case EffectNodeType::ON_CLICK:          nPos = 0; break;
     826                 :          0 :         case EffectNodeType::WITH_PREVIOUS:     nPos = 1; break;
     827                 :          0 :         case EffectNodeType::AFTER_PREVIOUS:    nPos = 2; break;
     828                 :            :         }
     829                 :            : 
     830         [ #  # ]:          0 :         mpLBStart->SelectEntryPos( nPos );
     831                 :            : 
     832                 :          0 :         double fDuration = pEffect->getDuration();
     833                 :          0 :         const bool bHasSpeed = fDuration > 0.001;
     834                 :            : 
     835         [ #  # ]:          0 :         mpFTSpeed->Enable(bHasSpeed);
     836         [ #  # ]:          0 :         mpCBSpeed->Enable(bHasSpeed);
     837                 :            : 
     838         [ #  # ]:          0 :         if( bHasSpeed )
     839                 :            :         {
     840         [ #  # ]:          0 :             if( fDuration == 5.0 )
     841                 :          0 :                 nPos = 0;
     842         [ #  # ]:          0 :             else if( fDuration == 3.0 )
     843                 :          0 :                 nPos = 1;
     844         [ #  # ]:          0 :             else if( fDuration == 2.0 )
     845                 :          0 :                 nPos = 2;
     846         [ #  # ]:          0 :             else if( fDuration == 1.0 )
     847                 :          0 :                 nPos = 3;
     848         [ #  # ]:          0 :             else if( fDuration == 0.5 )
     849                 :          0 :                 nPos = 4;
     850                 :            :             else
     851                 :          0 :                 nPos = 0xffff;
     852                 :            : 
     853         [ #  # ]:          0 :             mpCBSpeed->SelectEntryPos( nPos );
     854                 :            :         }
     855                 :            : 
     856         [ #  # ]:          0 :         mpPBPropertyMore->Enable( sal_True );
     857                 :            : 
     858 [ #  # ][ #  # ]:          0 :         mpFTChangeOrder->Enable( sal_True );
                 [ #  # ]
     859                 :            :     }
     860                 :            :     else
     861                 :            :     {
     862                 :          0 :         mpLBProperty->setSubControl( 0 );
     863                 :          0 :         mpFTProperty->Enable( sal_False );
     864                 :          0 :         mpLBProperty->Enable( sal_False );
     865                 :          0 :         mpPBPropertyMore->Enable( sal_False );
     866                 :          0 :         mpFTSpeed->Enable(sal_False);
     867                 :          0 :         mpCBSpeed->Enable(sal_False);
     868                 :          0 :         mpFTChangeOrder->Enable( sal_False );
     869                 :          0 :         mpLBStart->SetNoSelection();
     870                 :          0 :         mpCBSpeed->SetNoSelection();
     871                 :          0 :         mpFLEffect->SetText( maStrModify );
     872                 :            :     }
     873                 :            : 
     874                 :          0 :     bool bEnableUp = true;
     875                 :          0 :     bool bEnableDown = true;
     876         [ #  # ]:          0 :     if( nSelectionCount == 0 )
     877                 :            :     {
     878                 :          0 :         bEnableUp = false;
     879                 :          0 :         bEnableDown = false;
     880                 :            :     }
     881                 :            :     else
     882                 :            :     {
     883 [ #  # ][ #  # ]:          0 :         if( mpMainSequence->find( maListSelection.front() ) == mpMainSequence->getBegin() )
                 [ #  # ]
     884                 :          0 :             bEnableUp = false;
     885                 :            : 
     886 [ #  # ][ #  # ]:          0 :         EffectSequence::iterator aIter( mpMainSequence->find( maListSelection.back() ) );
     887         [ #  # ]:          0 :         if( aIter == mpMainSequence->getEnd() )
     888                 :            :         {
     889                 :          0 :             bEnableDown = false;
     890                 :            :         }
     891                 :            :         else
     892                 :            :         {
     893 [ #  # ][ #  # ]:          0 :             do
                 [ #  # ]
     894                 :            :             {
     895                 :          0 :                 ++aIter;
     896                 :            :             }
     897 [ #  # ][ #  # ]:          0 :             while( (aIter != mpMainSequence->getEnd()) && !(mpCustomAnimationList->isExpanded((*aIter)) ) );
                 [ #  # ]
     898                 :            : 
     899         [ #  # ]:          0 :             if( aIter == mpMainSequence->getEnd() )
     900                 :          0 :                 bEnableDown = false;
     901                 :            :         }
     902                 :            : 
     903 [ #  # ][ #  # ]:          0 :         if( bEnableUp || bEnableDown )
     904                 :            :         {
     905         [ #  # ]:          0 :             MainSequenceRebuildGuard aGuard( mpMainSequence );
     906                 :            : 
     907                 :          0 :             EffectSequenceHelper* pSequence = 0;
     908                 :          0 :             EffectSequence::iterator aRebuildIter( maListSelection.begin() );
     909                 :          0 :             const EffectSequence::iterator aRebuildEnd( maListSelection.end() );
     910         [ #  # ]:          0 :             while( aRebuildIter != aRebuildEnd )
     911                 :            :             {
     912         [ #  # ]:          0 :                 CustomAnimationEffectPtr pEffect = (*aRebuildIter++);
     913                 :            : 
     914         [ #  # ]:          0 :                 if( pEffect.get() )
     915                 :            :                 {
     916         [ #  # ]:          0 :                     if( pSequence == 0 )
     917                 :            :                     {
     918                 :          0 :                         pSequence = pEffect->getEffectSequence();
     919                 :            :                     }
     920                 :            :                     else
     921                 :            :                     {
     922         [ #  # ]:          0 :                         if( pSequence != pEffect->getEffectSequence() )
     923                 :            :                         {
     924                 :          0 :                             bEnableUp = false;
     925                 :          0 :                             bEnableDown = false;
     926                 :            :                             break;
     927                 :            :                         }
     928                 :            :                     }
     929                 :            :                 }
     930 [ #  # ][ #  # ]:          0 :             }
                 [ #  # ]
     931                 :            :         }
     932                 :            :     }
     933                 :            : 
     934                 :          0 :     mpPBMoveUp->Enable(bEnableUp);
     935                 :          0 :     mpPBMoveDown->Enable(bEnableDown);
     936                 :            : 
     937                 :          0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     938                 :          0 :     mpCBAutoPreview->Check( pOptions->IsPreviewChangedEffects() == sal_True );
     939                 :            : 
     940                 :          0 :     updateMotionPathTags();
     941                 :            : }
     942                 :            : 
     943                 :          0 : static bool updateMotionPathImpl( CustomAnimationPane& rPane, ::sd::View& rView,  EffectSequence::iterator aIter, EffectSequence::iterator aEnd, MotionPathTagVector& rOldTags, MotionPathTagVector& rNewTags )
     944                 :            : {
     945                 :          0 :     bool bChanges = false;
     946         [ #  # ]:          0 :     while( aIter != aEnd )
     947                 :            :     {
     948         [ #  # ]:          0 :         CustomAnimationEffectPtr pEffect( (*aIter++) );
     949 [ #  # ][ #  # ]:          0 :         if( pEffect.get() && pEffect->getPresetClass() == ::com::sun::star::presentation::EffectPresetClass::MOTIONPATH )
                 [ #  # ]
     950                 :            :         {
     951                 :          0 :             rtl::Reference< MotionPathTag > xMotionPathTag;
     952                 :            :             // first try to find if there is already a tag for this
     953                 :          0 :             MotionPathTagVector::iterator aMIter( rOldTags.begin() );
     954 [ #  # ][ #  # ]:          0 :             for( ; aMIter != rOldTags.end(); ++aMIter )
     955                 :            :             {
     956                 :          0 :                 rtl::Reference< MotionPathTag > xTag( (*aMIter) );
     957         [ #  # ]:          0 :                 if( xTag->getEffect() == pEffect )
     958                 :            :                 {
     959         [ #  # ]:          0 :                     if( !xTag->isDisposed() )
     960                 :            :                     {
     961         [ #  # ]:          0 :                         xMotionPathTag = xTag;
     962         [ #  # ]:          0 :                         rOldTags.erase( aMIter );
     963                 :            :                     }
     964                 :            :                     break;
     965                 :            :                 }
     966         [ #  # ]:          0 :             }
     967                 :            : 
     968                 :            :             // if not found, create new one
     969         [ #  # ]:          0 :             if( !xMotionPathTag.is() )
     970                 :            :             {
     971 [ #  # ][ #  # ]:          0 :                 xMotionPathTag.set( new MotionPathTag( rPane, rView, pEffect ) );
     972                 :          0 :                 bChanges = true;
     973                 :            :             }
     974                 :            : 
     975         [ #  # ]:          0 :             if( xMotionPathTag.is() )
     976         [ #  # ]:          0 :                 rNewTags.push_back( xMotionPathTag );
     977                 :            :         }
     978         [ #  # ]:          0 :     }
     979                 :            : 
     980                 :          0 :     return bChanges;
     981                 :            : }
     982                 :            : 
     983                 :          0 : void CustomAnimationPane::updateMotionPathTags()
     984                 :            : {
     985                 :          0 :     bool bChanges = false;
     986                 :            : 
     987         [ #  # ]:          0 :     MotionPathTagVector aTags;
     988                 :          0 :     aTags.swap( maMotionPathTags );
     989                 :            : 
     990                 :          0 :     ::sd::View* pView = 0;
     991                 :            : 
     992         [ #  # ]:          0 :     if( mxView.is() )
     993                 :            :     {
     994         [ #  # ]:          0 :         ::boost::shared_ptr<ViewShell> xViewShell( mrBase.GetMainViewShell() );
     995         [ #  # ]:          0 :         if( xViewShell.get() )
     996         [ #  # ]:          0 :             pView = xViewShell->GetView();
     997                 :            :     }
     998                 :            : 
     999 [ #  # ][ #  # ]:          0 :     if( IsVisible() && mpMainSequence.get() && pView )
         [ #  # ][ #  # ]
                 [ #  # ]
    1000                 :            :     {
    1001         [ #  # ]:          0 :         bChanges = updateMotionPathImpl( *this, *pView, mpMainSequence->getBegin(), mpMainSequence->getEnd(), aTags, maMotionPathTags );
    1002                 :            : 
    1003                 :          0 :         const InteractiveSequenceList& rISL = mpMainSequence->getInteractiveSequenceList();
    1004                 :          0 :         InteractiveSequenceList::const_iterator aISI( rISL.begin() );
    1005         [ #  # ]:          0 :         while( aISI != rISL.end() )
    1006                 :            :         {
    1007         [ #  # ]:          0 :             InteractiveSequencePtr pIS( (*aISI++) );
    1008         [ #  # ]:          0 :             bChanges |= updateMotionPathImpl( *this, *pView, pIS->getBegin(), pIS->getEnd(), aTags, maMotionPathTags );
    1009         [ #  # ]:          0 :         }
    1010                 :            :     }
    1011                 :            : 
    1012         [ #  # ]:          0 :     if( !aTags.empty() )
    1013                 :            :     {
    1014                 :          0 :         bChanges = true;
    1015                 :          0 :         MotionPathTagVector::iterator aIter( aTags.begin() );
    1016 [ #  # ][ #  # ]:          0 :         while( aIter != aTags.end() )
    1017                 :            :         {
    1018         [ #  # ]:          0 :             rtl::Reference< MotionPathTag > xTag( (*aIter++) );
    1019         [ #  # ]:          0 :             xTag->Dispose();
    1020                 :          0 :         }
    1021                 :            :     }
    1022                 :            : 
    1023 [ #  # ][ #  # ]:          0 :     if( bChanges && pView )
    1024         [ #  # ]:          0 :         pView->updateHandles();
    1025                 :          0 : }
    1026                 :            : 
    1027                 :          0 : void CustomAnimationPane::onSelectionChanged()
    1028                 :            : {
    1029         [ #  # ]:          0 :     if( !maSelectionLock.isLocked() )
    1030                 :            :     {
    1031                 :          0 :         ScopeLockGuard aGuard( maSelectionLock );
    1032                 :            : 
    1033         [ #  # ]:          0 :         if( mxView.is() ) try
    1034                 :            :         {
    1035         [ #  # ]:          0 :             Reference< XSelectionSupplier >  xSel( mxView, UNO_QUERY_THROW );
    1036         [ #  # ]:          0 :             if (xSel.is())
    1037                 :            :             {
    1038 [ #  # ][ #  # ]:          0 :                 maViewSelection = xSel->getSelection();
    1039         [ #  # ]:          0 :                 mpCustomAnimationList->onSelectionChanged( maViewSelection );
    1040         [ #  # ]:          0 :                 updateControls();
    1041         [ #  # ]:          0 :             }
    1042                 :            :         }
    1043         [ #  # ]:          0 :         catch( Exception& )
    1044                 :            :         {
    1045                 :            :             OSL_FAIL( "sd::CustomAnimationPane::onSelectionChanged(), Exception caught!" );
    1046                 :          0 :         }
    1047                 :            :     }
    1048                 :          0 : }
    1049                 :            : 
    1050                 :          0 : void CustomAnimationPane::onDoubleClick()
    1051                 :            : {
    1052                 :          0 :     showOptions();
    1053                 :          0 : }
    1054                 :            : 
    1055                 :          0 : void CustomAnimationPane::onContextMenu( sal_uInt16 nSelectedPopupEntry )
    1056                 :            : {
    1057   [ #  #  #  #  :          0 :     switch( nSelectedPopupEntry )
             #  #  #  # ]
    1058                 :            :     {
    1059                 :          0 :     case CM_WITH_CLICK:     onChangeStart( EffectNodeType::ON_CLICK ); break;
    1060                 :          0 :     case CM_WITH_PREVIOUS:  onChangeStart( EffectNodeType::WITH_PREVIOUS  ); break;
    1061                 :          0 :     case CM_AFTER_PREVIOUS: onChangeStart( EffectNodeType::AFTER_PREVIOUS ); break;
    1062                 :          0 :     case CM_OPTIONS:        showOptions(); break;
    1063                 :          0 :     case CM_DURATION:       showOptions(RID_TP_CUSTOMANIMATION_DURATION); break;
    1064                 :          0 :     case CM_REMOVE:         onRemove(); break;
    1065         [ #  # ]:          0 :     case CM_CREATE:         if( maViewSelection.hasValue() ) onChange( true ); break;
    1066                 :            :     }
    1067                 :            : 
    1068                 :          0 :     updateControls();
    1069                 :          0 : }
    1070                 :            : 
    1071                 :          0 : void addValue( STLPropertySet* pSet, sal_Int32 nHandle, const Any& rValue )
    1072                 :            : {
    1073   [ #  #  #  # ]:          0 :     switch( pSet->getPropertyState( nHandle ) )
    1074                 :            :     {
    1075                 :            :     case STLPropertyState_AMBIGUOUS:
    1076                 :            :         // value is already ambiguous, do nothing
    1077                 :          0 :         break;
    1078                 :            :     case STLPropertyState_DIRECT:
    1079                 :            :         // set to ambiguous if existing value is different
    1080         [ #  # ]:          0 :         if( rValue != pSet->getPropertyValue( nHandle ) )
    1081                 :          0 :             pSet->setPropertyState( nHandle, STLPropertyState_AMBIGUOUS );
    1082                 :          0 :         break;
    1083                 :            :     case STLPropertyState_DEFAULT:
    1084                 :            :         // just set new value
    1085                 :          0 :         pSet->setPropertyValue( nHandle, rValue );
    1086                 :          0 :         break;
    1087                 :            :     }
    1088                 :          0 : }
    1089                 :            : 
    1090                 :          0 : static sal_Int32 calcMaxParaDepth( Reference< XShape > xTargetShape )
    1091                 :            : {
    1092                 :          0 :     sal_Int32 nMaxParaDepth = -1;
    1093                 :            : 
    1094         [ #  # ]:          0 :     if( xTargetShape.is() )
    1095                 :            :     {
    1096         [ #  # ]:          0 :         Reference< XEnumerationAccess > xText( xTargetShape, UNO_QUERY );
    1097         [ #  # ]:          0 :         if( xText.is() )
    1098                 :            :         {
    1099                 :          0 :             Reference< XPropertySet > xParaSet;
    1100                 :          0 :             const OUString strNumberingLevel( "NumberingLevel" );
    1101                 :            : 
    1102 [ #  # ][ #  # ]:          0 :             Reference< XEnumeration > xEnumeration( xText->createEnumeration(), UNO_QUERY_THROW );
                 [ #  # ]
    1103 [ #  # ][ #  # ]:          0 :             while( xEnumeration->hasMoreElements() )
                 [ #  # ]
    1104                 :            :             {
    1105 [ #  # ][ #  # ]:          0 :                 xEnumeration->nextElement() >>= xParaSet;
                 [ #  # ]
    1106         [ #  # ]:          0 :                 if( xParaSet.is() )
    1107                 :            :                 {
    1108                 :          0 :                     sal_Int32 nParaDepth = 0;
    1109 [ #  # ][ #  # ]:          0 :                     xParaSet->getPropertyValue( strNumberingLevel ) >>= nParaDepth;
    1110                 :            : 
    1111         [ #  # ]:          0 :                     if( nParaDepth > nMaxParaDepth )
    1112                 :          0 :                         nMaxParaDepth = nParaDepth;
    1113                 :            :                 }
    1114                 :          0 :             }
    1115                 :          0 :         }
    1116                 :            :     }
    1117                 :            : 
    1118                 :          0 :     return nMaxParaDepth + 1;
    1119                 :            : }
    1120                 :            : 
    1121                 :          0 : Any CustomAnimationPane::getProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect )
    1122                 :            : {
    1123   [ #  #  #  #  :          0 :     switch( nType )
             #  #  #  #  
                      # ]
    1124                 :            :     {
    1125                 :            :     case nPropertyTypeDirection:
    1126                 :            :     case nPropertyTypeSpokes:
    1127                 :            :     case nPropertyTypeZoom:
    1128         [ #  # ]:          0 :         return makeAny( pEffect->getPresetSubType() );
    1129                 :            : 
    1130                 :            :     case nPropertyTypeColor:
    1131                 :            :     case nPropertyTypeFillColor:
    1132                 :            :     case nPropertyTypeFirstColor:
    1133                 :            :     case nPropertyTypeSecondColor:
    1134                 :            :     case nPropertyTypeCharColor:
    1135                 :            :     case nPropertyTypeLineColor:
    1136                 :            :         {
    1137                 :          0 :             const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1;
    1138         [ #  # ]:          0 :             return pEffect->getColor( nIndex );
    1139                 :            :         }
    1140                 :            : 
    1141                 :            :     case nPropertyTypeFont:
    1142         [ #  # ]:          0 :         return pEffect->getProperty( AnimationNodeType::SET, "CharFontName" , VALUE_TO );
    1143                 :            : 
    1144                 :            :     case nPropertyTypeCharHeight:
    1145                 :            :         {
    1146                 :          0 :             const OUString aAttributeName( "CharHeight" );
    1147         [ #  # ]:          0 :             Any aValue( pEffect->getProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO ) );
    1148         [ #  # ]:          0 :             if( !aValue.hasValue() )
    1149         [ #  # ]:          0 :                 aValue = pEffect->getProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO );
    1150                 :          0 :             return aValue;
    1151                 :            :         }
    1152                 :            : 
    1153                 :            :     case nPropertyTypeRotate:
    1154         [ #  # ]:          0 :         return pEffect->getTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY);
    1155                 :            : 
    1156                 :            :     case nPropertyTypeTransparency:
    1157         [ #  # ]:          0 :         return pEffect->getProperty( AnimationNodeType::SET, "Opacity" , VALUE_TO );
    1158                 :            : 
    1159                 :            :     case nPropertyTypeScale:
    1160         [ #  # ]:          0 :         return pEffect->getTransformationProperty( AnimationTransformType::SCALE, VALUE_BY );
    1161                 :            : 
    1162                 :            :     case nPropertyTypeCharDecoration:
    1163                 :            :         {
    1164         [ #  # ]:          0 :             Sequence< Any > aValues(3);
    1165 [ #  # ][ #  # ]:          0 :             aValues[0] = pEffect->getProperty( AnimationNodeType::SET, "CharWeight" , VALUE_TO );
    1166 [ #  # ][ #  # ]:          0 :             aValues[1] = pEffect->getProperty( AnimationNodeType::SET, "CharPosture" , VALUE_TO );
    1167 [ #  # ][ #  # ]:          0 :             aValues[2] = pEffect->getProperty( AnimationNodeType::SET, "CharUnderline" , VALUE_TO );
    1168 [ #  # ][ #  # ]:          0 :             return makeAny( aValues );
    1169                 :            :         }
    1170                 :            :     }
    1171                 :            : 
    1172                 :          0 :     Any aAny;
    1173                 :          0 :     return aAny;
    1174                 :            : }
    1175                 :            : 
    1176                 :          0 : bool CustomAnimationPane::setProperty1Value( sal_Int32 nType, CustomAnimationEffectPtr pEffect, const Any& rValue )
    1177                 :            : {
    1178                 :          0 :     bool bEffectChanged = false;
    1179   [ #  #  #  #  :          0 :     switch( nType )
             #  #  #  #  
                      # ]
    1180                 :            :     {
    1181                 :            :     case nPropertyTypeDirection:
    1182                 :            :     case nPropertyTypeSpokes:
    1183                 :            :     case nPropertyTypeZoom:
    1184                 :            :         {
    1185                 :          0 :             OUString aPresetSubType;
    1186                 :          0 :             rValue >>= aPresetSubType;
    1187         [ #  # ]:          0 :             if( aPresetSubType != pEffect->getPresetSubType() )
    1188                 :            :             {
    1189 [ #  # ][ #  # ]:          0 :                 getPresets().changePresetSubType( pEffect, aPresetSubType );
         [ #  # ][ #  # ]
    1190                 :          0 :                 bEffectChanged = true;
    1191                 :          0 :             }
    1192                 :            :         }
    1193                 :          0 :         break;
    1194                 :            : 
    1195                 :            :     case nPropertyTypeFillColor:
    1196                 :            :     case nPropertyTypeColor:
    1197                 :            :     case nPropertyTypeFirstColor:
    1198                 :            :     case nPropertyTypeSecondColor:
    1199                 :            :     case nPropertyTypeCharColor:
    1200                 :            :     case nPropertyTypeLineColor:
    1201                 :            :         {
    1202                 :          0 :             const sal_Int32 nIndex = (nPropertyTypeFirstColor == nType) ? 0 : 1;
    1203         [ #  # ]:          0 :             Any aOldColor( pEffect->getColor( nIndex ) );
    1204         [ #  # ]:          0 :             if( aOldColor != rValue )
    1205                 :            :             {
    1206         [ #  # ]:          0 :                 pEffect->setColor( nIndex, rValue );
    1207                 :          0 :                 bEffectChanged = true;
    1208                 :          0 :             }
    1209                 :            :         }
    1210                 :          0 :         break;
    1211                 :            : 
    1212                 :            :     case nPropertyTypeFont:
    1213         [ #  # ]:          0 :         bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharFontName" , VALUE_TO, rValue );
    1214                 :          0 :         break;
    1215                 :            : 
    1216                 :            :     case nPropertyTypeCharHeight:
    1217                 :            :         {
    1218                 :          0 :             const OUString aAttributeName( "CharHeight" );
    1219         [ #  # ]:          0 :             bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, aAttributeName, VALUE_TO, rValue );
    1220         [ #  # ]:          0 :             if( !bEffectChanged )
    1221         [ #  # ]:          0 :                 bEffectChanged = pEffect->setProperty( AnimationNodeType::ANIMATE, aAttributeName, VALUE_TO, rValue );
    1222                 :            :         }
    1223                 :          0 :         break;
    1224                 :            :     case nPropertyTypeRotate:
    1225                 :          0 :         bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::ROTATE, VALUE_BY , rValue );
    1226                 :          0 :         break;
    1227                 :            : 
    1228                 :            :     case nPropertyTypeTransparency:
    1229         [ #  # ]:          0 :         bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "Opacity" , VALUE_TO, rValue );
    1230                 :          0 :         break;
    1231                 :            : 
    1232                 :            :     case nPropertyTypeScale:
    1233                 :          0 :         bEffectChanged = pEffect->setTransformationProperty( AnimationTransformType::SCALE, VALUE_BY, rValue );
    1234                 :          0 :         break;
    1235                 :            : 
    1236                 :            :     case nPropertyTypeCharDecoration:
    1237                 :            :         {
    1238         [ #  # ]:          0 :             Sequence< Any > aValues(3);
    1239         [ #  # ]:          0 :             rValue >>= aValues;
    1240 [ #  # ][ #  # ]:          0 :             bEffectChanged = pEffect->setProperty( AnimationNodeType::SET, "CharWeight" , VALUE_TO, aValues[0] );
    1241 [ #  # ][ #  # ]:          0 :             bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharPosture" , VALUE_TO, aValues[1] );
    1242 [ #  # ][ #  # ]:          0 :             bEffectChanged |= pEffect->setProperty( AnimationNodeType::SET, "CharUnderline" , VALUE_TO, aValues[2] );
                 [ #  # ]
    1243                 :            :         }
    1244                 :          0 :         break;
    1245                 :            : 
    1246                 :            :     }
    1247                 :            : 
    1248                 :          0 :     return bEffectChanged;
    1249                 :            : }
    1250                 :            : 
    1251                 :          0 : static sal_Bool hasVisibleShape( const Reference< XShape >& xShape )
    1252                 :            : {
    1253                 :            :     try
    1254                 :            :     {
    1255 [ #  # ][ #  # ]:          0 :         const OUString sShapeType( xShape->getShapeType() );
    1256                 :            : 
    1257 [ #  # ][ #  #  :          0 :         if( sShapeType == "com.sun.star.presentation.TitleTextShape" || sShapeType == "com.sun.star.presentation.OutlinerShape" ||
             #  #  #  # ]
                 [ #  # ]
    1258                 :          0 :             sShapeType == "com.sun.star.presentation.SubtitleShape" || sShapeType == "com.sun.star.drawing.TextShape" )
    1259                 :            :         {
    1260                 :          0 :             const OUString sFillStyle( "FillStyle" );
    1261                 :          0 :             const OUString sLineStyle( "LineStyle" );
    1262         [ #  # ]:          0 :             Reference< XPropertySet > xSet( xShape, UNO_QUERY_THROW );
    1263                 :            : 
    1264                 :            :             FillStyle eFillStyle;
    1265 [ #  # ][ #  # ]:          0 :             xSet->getPropertyValue( sFillStyle ) >>= eFillStyle;
                 [ #  # ]
    1266                 :            : 
    1267                 :            :             ::com::sun::star::drawing::LineStyle eLineStyle;
    1268 [ #  # ][ #  # ]:          0 :             xSet->getPropertyValue( sLineStyle ) >>= eLineStyle;
                 [ #  # ]
    1269                 :            : 
    1270 [ #  # ][ #  # ]:          0 :             return eFillStyle != FillStyle_NONE || eLineStyle != ::com::sun::star::drawing::LineStyle_NONE;
    1271 [ #  # ][ #  # ]:          0 :         }
    1272                 :            :     }
    1273                 :          0 :     catch( Exception& )
    1274                 :            :     {
    1275                 :            :     }
    1276                 :          0 :     return sal_True;
    1277                 :            : }
    1278                 :            : 
    1279                 :          0 : STLPropertySet* CustomAnimationPane::createSelectionSet()
    1280                 :            : {
    1281         [ #  # ]:          0 :     STLPropertySet* pSet = CustomAnimationDialog::createDefaultSet();
    1282                 :            : 
    1283 [ #  # ][ #  # ]:          0 :     pSet->setPropertyValue( nHandleCurrentPage, makeAny( mxCurrentPage ) );
    1284                 :            : 
    1285                 :          0 :     sal_Int32 nMaxParaDepth = 0;
    1286                 :            : 
    1287                 :            :     // get options from selected effects
    1288                 :          0 :     EffectSequence::iterator aIter( maListSelection.begin() );
    1289                 :          0 :     const EffectSequence::iterator aEnd( maListSelection.end() );
    1290         [ #  # ]:          0 :     const CustomAnimationPresets& rPresets (getPresets());
    1291         [ #  # ]:          0 :     while( aIter != aEnd )
    1292                 :            :     {
    1293         [ #  # ]:          0 :         CustomAnimationEffectPtr pEffect = (*aIter++);
    1294                 :            : 
    1295                 :          0 :         EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
    1296         [ #  # ]:          0 :         if( !pEffectSequence )
    1297                 :          0 :             pEffectSequence = mpMainSequence.get();
    1298                 :            : 
    1299         [ #  # ]:          0 :         if( pEffect->hasText() )
    1300                 :            :         {
    1301 [ #  # ][ #  # ]:          0 :             sal_Int32 n = calcMaxParaDepth(pEffect->getTargetShape());
    1302         [ #  # ]:          0 :             if( n > nMaxParaDepth )
    1303                 :          0 :                 nMaxParaDepth = n;
    1304                 :            :         }
    1305                 :            : 
    1306 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleHasAfterEffect, makeAny( pEffect->hasAfterEffect() ) );
    1307 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleAfterEffectOnNextEffect, makeAny( pEffect->IsAfterEffectOnNext() ? sal_True : sal_False ) );
                 [ #  # ]
    1308         [ #  # ]:          0 :         addValue( pSet, nHandleDimColor, pEffect->getDimColor() );
    1309 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleIterateType, makeAny( pEffect->getIterateType() ) );
    1310                 :            : 
    1311                 :            :         // convert absolute time to percentage value
    1312                 :            :         // This calculation is done in float to avoid some rounding artifacts.
    1313                 :          0 :         float fIterateInterval = (float)pEffect->getIterateInterval();
    1314         [ #  # ]:          0 :         if( pEffect->getDuration() )
    1315                 :          0 :             fIterateInterval = (float)(fIterateInterval / pEffect->getDuration() );
    1316                 :          0 :         fIterateInterval *= 100.0;
    1317 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleIterateInterval, makeAny( (double)fIterateInterval ) );
    1318                 :            : 
    1319 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleBegin, makeAny( pEffect->getBegin() ) );
    1320 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleDuration, makeAny( pEffect->getDuration() ) );
    1321 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleStart, makeAny( pEffect->getNodeType() ) );
    1322 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleRepeat, makeAny( pEffect->getRepeatCount() ) );
                 [ #  # ]
    1323 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleEnd, pEffect->getEnd() );
    1324 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleRewind, makeAny( pEffect->getFill() ) );
                 [ #  # ]
    1325                 :            : 
    1326 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandlePresetId, makeAny( pEffect->getPresetId() ) );
    1327                 :            : 
    1328 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleHasText, makeAny( (sal_Bool)pEffect->hasText() ) );
    1329                 :            : 
    1330 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleHasVisibleShape, Any( hasVisibleShape( pEffect->getTargetShape() ) ) );
         [ #  # ][ #  # ]
    1331                 :            : 
    1332                 :          0 :         Any aSoundSource;
    1333         [ #  # ]:          0 :         if( pEffect->getAudio().is() )
    1334                 :            :         {
    1335 [ #  # ][ #  # ]:          0 :             aSoundSource = pEffect->getAudio()->getSource();
    1336 [ #  # ][ #  # ]:          0 :             addValue( pSet, nHandleSoundVolumne, makeAny( pEffect->getAudio()->getVolume() ) );
         [ #  # ][ #  # ]
    1337                 :            : // todo     addValue( pSet, nHandleSoundEndAfterSlide, makeAny( pEffect->getAudio()->getEndAfterSlide() ) );
    1338                 :            : // this is now stored at the XCommand parameter sequence
    1339                 :            :         }
    1340         [ #  # ]:          0 :         else if( pEffect->getCommand() == EffectCommands::STOPAUDIO )
    1341                 :            :         {
    1342         [ #  # ]:          0 :             aSoundSource = makeAny( (sal_Bool)sal_True );
    1343                 :            :         }
    1344         [ #  # ]:          0 :         addValue( pSet, nHandleSoundURL, aSoundSource );
    1345                 :            : 
    1346                 :          0 :         sal_Int32 nGroupId = pEffect->getGroupId();
    1347         [ #  # ]:          0 :         CustomAnimationTextGroupPtr pTextGroup;
    1348         [ #  # ]:          0 :         if( nGroupId != -1 )
    1349 [ #  # ][ #  # ]:          0 :             pTextGroup = pEffectSequence->findGroup( nGroupId );
                 [ #  # ]
    1350                 :            : 
    1351 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleTextGrouping, makeAny( pTextGroup.get() ? pTextGroup->getTextGrouping() : (sal_Int32)-1 ) );
                 [ #  # ]
    1352 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleAnimateForm, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getAnimateForm() : sal_True ) );
                 [ #  # ]
    1353 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleTextGroupingAuto, makeAny( pTextGroup.get() ? pTextGroup->getTextGroupingAuto() : (double)-1.0 ) );
                 [ #  # ]
    1354 [ #  # ][ #  # ]:          0 :         addValue( pSet, nHandleTextReverse, makeAny( pTextGroup.get() ? (sal_Bool)pTextGroup->getTextReverse() : sal_False ) );
                 [ #  # ]
    1355                 :            : 
    1356         [ #  # ]:          0 :         if( pEffectSequence->getSequenceType() == EffectNodeType::INTERACTIVE_SEQUENCE  )
    1357                 :            :         {
    1358                 :          0 :             InteractiveSequence* pIS = static_cast< InteractiveSequence* >( pEffectSequence );
    1359 [ #  # ][ #  # ]:          0 :             addValue( pSet, nHandleTrigger, makeAny( pIS->getTriggerShape() ) );
                 [ #  # ]
    1360                 :            :         }
    1361                 :            : 
    1362         [ #  # ]:          0 :         CustomAnimationPresetPtr pDescriptor = rPresets.getEffectDescriptor( pEffect->getPresetId() );
    1363         [ #  # ]:          0 :         if( pDescriptor.get() )
    1364                 :            :         {
    1365                 :          0 :             sal_Int32 nType = nPropertyTypeNone;
    1366                 :            : 
    1367         [ #  # ]:          0 :             UStringList aProperties( pDescriptor->getProperties() );
    1368         [ #  # ]:          0 :             if( aProperties.size() >= 1 )
    1369 [ #  # ][ #  # ]:          0 :                 nType = getPropertyType( aProperties.front() );
    1370                 :            : 
    1371         [ #  # ]:          0 :             if( nType != nPropertyTypeNone )
    1372                 :            :             {
    1373 [ #  # ][ #  # ]:          0 :                 addValue( pSet, nHandleProperty1Type, makeAny( nType ) );
    1374 [ #  # ][ #  # ]:          0 :                 addValue( pSet, nHandleProperty1Value, getProperty1Value( nType, pEffect ) );
         [ #  # ][ #  # ]
    1375                 :            :             }
    1376                 :            : 
    1377 [ #  # ][ #  # ]:          0 :             if( pDescriptor->hasProperty( "Accelerate" ) )
    1378                 :            :             {
    1379 [ #  # ][ #  # ]:          0 :                 addValue( pSet, nHandleAccelerate, makeAny( pEffect->getAcceleration() ) );
    1380                 :            :             }
    1381                 :            : 
    1382 [ #  # ][ #  # ]:          0 :             if( pDescriptor->hasProperty( "Decelerate" ) )
    1383                 :            :             {
    1384 [ #  # ][ #  # ]:          0 :                 addValue( pSet, nHandleDecelerate, makeAny( pEffect->getDecelerate() ) );
    1385                 :            :             }
    1386                 :            : 
    1387 [ #  # ][ #  # ]:          0 :             if( pDescriptor->hasProperty( "AutoReverse" ) )
    1388                 :            :             {
    1389 [ #  # ][ #  # ]:          0 :                 addValue( pSet, nHandleAutoReverse, makeAny( pEffect->getAutoReverse() ) );
    1390                 :          0 :             }
    1391                 :            :         }
    1392 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
    1393                 :            : 
    1394 [ #  # ][ #  # ]:          0 :     addValue( pSet, nHandleMaxParaDepth, makeAny( nMaxParaDepth ) );
    1395                 :            : 
    1396                 :          0 :     return pSet;
    1397                 :            : }
    1398                 :            : 
    1399                 :          0 : void CustomAnimationPane::changeSelection( STLPropertySet* pResultSet, STLPropertySet* pOldSet )
    1400                 :            : {
    1401                 :            :     // change selected effect
    1402                 :          0 :     bool bChanged = false;
    1403                 :            : 
    1404         [ #  # ]:          0 :     MainSequenceRebuildGuard aGuard( mpMainSequence );
    1405                 :            : 
    1406                 :          0 :     EffectSequence::iterator aIter( maListSelection.begin() );
    1407                 :          0 :     const EffectSequence::iterator aEnd( maListSelection.end() );
    1408         [ #  # ]:          0 :     while( aIter != aEnd )
    1409                 :            :     {
    1410         [ #  # ]:          0 :         CustomAnimationEffectPtr pEffect = (*aIter++);
    1411                 :            : 
    1412                 :            :         DBG_ASSERT( pEffect->getEffectSequence(), "sd::CustomAnimationPane::changeSelection(), dead effect in selection!" );
    1413         [ #  # ]:          0 :         if( !pEffect->getEffectSequence() )
    1414                 :          0 :             continue;
    1415                 :            : 
    1416                 :          0 :         double fDuration = 0.0; // we might need this for iterate-interval
    1417 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
    1418                 :            :         {
    1419         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleDuration ) >>= fDuration;
    1420                 :            :         }
    1421                 :            :         else
    1422                 :            :         {
    1423                 :          0 :             fDuration = pEffect->getDuration();
    1424                 :            :         }
    1425                 :            : 
    1426 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleIterateType ) == STLPropertyState_DIRECT )
    1427                 :            :         {
    1428                 :          0 :             sal_Int16 nIterateType = 0;
    1429         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleIterateType ) >>= nIterateType;
    1430         [ #  # ]:          0 :             if( pEffect->getIterateType() != nIterateType )
    1431                 :            :             {
    1432         [ #  # ]:          0 :                 pEffect->setIterateType( nIterateType );
    1433                 :          0 :                 bChanged = true;
    1434                 :            :             }
    1435                 :            :         }
    1436                 :            : 
    1437         [ #  # ]:          0 :         if( pEffect->getIterateType() )
    1438                 :            :         {
    1439 [ #  # ][ #  # ]:          0 :             if( pResultSet->getPropertyState( nHandleIterateInterval ) == STLPropertyState_DIRECT )
    1440                 :            :             {
    1441                 :          0 :                 double fIterateInterval = 0.0;
    1442         [ #  # ]:          0 :                 pResultSet->getPropertyValue( nHandleIterateInterval ) >>= fIterateInterval;
    1443         [ #  # ]:          0 :                 if( pEffect->getIterateInterval() != fIterateInterval )
    1444                 :            :                 {
    1445                 :          0 :                     const double f = fIterateInterval * pEffect->getDuration() / 100;
    1446         [ #  # ]:          0 :                     pEffect->setIterateInterval( f );
    1447                 :          0 :                     bChanged = true;
    1448                 :            :                 }
    1449                 :            :             }
    1450                 :            :         }
    1451                 :            : 
    1452 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleBegin ) == STLPropertyState_DIRECT )
    1453                 :            :         {
    1454                 :          0 :             double fBegin = 0.0;
    1455         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleBegin ) >>= fBegin;
    1456         [ #  # ]:          0 :             if( pEffect->getBegin() != fBegin )
    1457                 :            :             {
    1458         [ #  # ]:          0 :                 pEffect->setBegin( fBegin );
    1459                 :          0 :                 bChanged = true;
    1460                 :            :             }
    1461                 :            :         }
    1462                 :            : 
    1463 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleDuration ) == STLPropertyState_DIRECT )
    1464                 :            :         {
    1465         [ #  # ]:          0 :             if( pEffect->getDuration() != fDuration )
    1466                 :            :             {
    1467         [ #  # ]:          0 :                 pEffect->setDuration( fDuration );
    1468                 :          0 :                 bChanged = true;
    1469                 :            :             }
    1470                 :            :         }
    1471                 :            : 
    1472 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleStart ) == STLPropertyState_DIRECT )
    1473                 :            :         {
    1474                 :          0 :             sal_Int16 nNodeType = 0;
    1475         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleStart ) >>= nNodeType;
    1476         [ #  # ]:          0 :             if( pEffect->getNodeType() != nNodeType )
    1477                 :            :             {
    1478         [ #  # ]:          0 :                 pEffect->setNodeType( nNodeType );
    1479                 :          0 :                 bChanged = true;
    1480                 :            :             }
    1481                 :            :         }
    1482                 :            : 
    1483 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleRepeat ) == STLPropertyState_DIRECT )
    1484                 :            :         {
    1485         [ #  # ]:          0 :             Any aRepeatCount( pResultSet->getPropertyValue( nHandleRepeat ) );
    1486 [ #  # ][ #  # ]:          0 :             if( aRepeatCount != pEffect->getRepeatCount() )
    1487                 :            :             {
    1488         [ #  # ]:          0 :                 pEffect->setRepeatCount( aRepeatCount );
    1489                 :          0 :                 bChanged = true;
    1490                 :          0 :             }
    1491                 :            :         }
    1492                 :            : 
    1493 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleEnd ) == STLPropertyState_DIRECT )
    1494                 :            :         {
    1495         [ #  # ]:          0 :             Any aEndValue( pResultSet->getPropertyValue( nHandleEnd ) );
    1496 [ #  # ][ #  # ]:          0 :             if( pEffect->getEnd() != aEndValue )
    1497                 :            :             {
    1498         [ #  # ]:          0 :                 pEffect->setEnd( aEndValue );
    1499                 :          0 :                 bChanged = true;
    1500                 :          0 :             }
    1501                 :            :         }
    1502                 :            : 
    1503 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleRewind ) == STLPropertyState_DIRECT )
    1504                 :            :         {
    1505                 :          0 :             sal_Int16 nFill = 0;
    1506         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleRewind ) >>= nFill;
    1507 [ #  # ][ #  # ]:          0 :             if( pEffect->getFill() != nFill )
    1508                 :            :             {
    1509         [ #  # ]:          0 :                 pEffect->setFill( nFill );
    1510                 :          0 :                 bChanged = true;
    1511                 :            :             }
    1512                 :            :         }
    1513                 :            : 
    1514 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleHasAfterEffect ) == STLPropertyState_DIRECT )
    1515                 :            :         {
    1516                 :          0 :             sal_Bool bHasAfterEffect = sal_False;
    1517 [ #  # ][ #  # ]:          0 :             if( pResultSet->getPropertyValue( nHandleHasAfterEffect )  >>= bHasAfterEffect )
    1518                 :            :             {
    1519         [ #  # ]:          0 :                 if( pEffect->hasAfterEffect() != bHasAfterEffect )
    1520                 :            :                 {
    1521                 :          0 :                     pEffect->setHasAfterEffect( bHasAfterEffect );
    1522                 :          0 :                     bChanged = true;
    1523                 :            :                 }
    1524                 :            :             }
    1525                 :            :         }
    1526                 :            : 
    1527 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleAfterEffectOnNextEffect ) == STLPropertyState_DIRECT )
    1528                 :            :         {
    1529                 :          0 :             sal_Bool bAfterEffectOnNextEffect = sal_False;
    1530 [ #  # ][ #  # ]:          0 :             if( (pResultSet->getPropertyValue( nHandleAfterEffectOnNextEffect ) >>= bAfterEffectOnNextEffect) && ((pEffect->IsAfterEffectOnNext() ? sal_True : sal_False) != bAfterEffectOnNextEffect) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1531                 :            :             {
    1532                 :          0 :                 pEffect->setAfterEffectOnNext( bAfterEffectOnNextEffect );
    1533                 :          0 :                 bChanged = true;
    1534                 :            :             }
    1535                 :            :         }
    1536                 :            : 
    1537 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleDimColor ) == STLPropertyState_DIRECT )
    1538                 :            :         {
    1539         [ #  # ]:          0 :             Any aDimColor( pResultSet->getPropertyValue( nHandleDimColor ) );
    1540         [ #  # ]:          0 :             if( pEffect->getDimColor() != aDimColor )
    1541                 :            :             {
    1542                 :          0 :                 pEffect->setDimColor( aDimColor );
    1543                 :          0 :                 bChanged = true;
    1544                 :          0 :             }
    1545                 :            :         }
    1546                 :            : 
    1547 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleAccelerate ) == STLPropertyState_DIRECT )
    1548                 :            :         {
    1549                 :          0 :             double fAccelerate = 0.0;
    1550         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleAccelerate ) >>= fAccelerate;
    1551         [ #  # ]:          0 :             if( pEffect->getAcceleration() != fAccelerate )
    1552                 :            :             {
    1553         [ #  # ]:          0 :                 pEffect->setAcceleration( fAccelerate );
    1554                 :          0 :                 bChanged = true;
    1555                 :            :             }
    1556                 :            :         }
    1557                 :            : 
    1558 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleDecelerate ) == STLPropertyState_DIRECT )
    1559                 :            :         {
    1560                 :          0 :             double fDecelerate = 0.0;
    1561         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleDecelerate ) >>= fDecelerate;
    1562         [ #  # ]:          0 :             if( pEffect->getDecelerate() != fDecelerate )
    1563                 :            :             {
    1564         [ #  # ]:          0 :                 pEffect->setDecelerate( fDecelerate );
    1565                 :          0 :                 bChanged = true;
    1566                 :            :             }
    1567                 :            :         }
    1568                 :            : 
    1569 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleAutoReverse ) == STLPropertyState_DIRECT )
    1570                 :            :         {
    1571                 :          0 :             sal_Bool bAutoReverse = sal_False;
    1572         [ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleAutoReverse ) >>= bAutoReverse;
    1573         [ #  # ]:          0 :             if( pEffect->getAutoReverse() != bAutoReverse )
    1574                 :            :             {
    1575         [ #  # ]:          0 :                 pEffect->setAutoReverse( bAutoReverse );
    1576                 :          0 :                 bChanged = true;
    1577                 :            :             }
    1578                 :            :         }
    1579                 :            : 
    1580 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleProperty1Value ) == STLPropertyState_DIRECT )
    1581                 :            :         {
    1582                 :          0 :             sal_Int32 nType = 0;
    1583         [ #  # ]:          0 :             pOldSet->getPropertyValue( nHandleProperty1Type ) >>= nType;
    1584                 :            : 
    1585 [ #  # ][ #  # ]:          0 :             bChanged |= setProperty1Value( nType, pEffect, pResultSet->getPropertyValue( nHandleProperty1Value ) );
         [ #  # ][ #  # ]
    1586                 :            :         }
    1587                 :            : 
    1588 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleSoundURL ) == STLPropertyState_DIRECT )
    1589                 :            :         {
    1590         [ #  # ]:          0 :             const Any aSoundSource( pResultSet->getPropertyValue( nHandleSoundURL ) );
    1591                 :            : 
    1592 [ #  # ][ #  # ]:          0 :             if( aSoundSource.getValueType() == ::getCppuType((const sal_Bool*)0) )
    1593                 :            :             {
    1594         [ #  # ]:          0 :                 pEffect->setStopAudio();
    1595                 :          0 :                 bChanged = true;
    1596                 :            :             }
    1597                 :            :             else
    1598                 :            :             {
    1599                 :          0 :                 OUString aSoundURL;
    1600                 :          0 :                 aSoundSource >>= aSoundURL;
    1601                 :            : 
    1602         [ #  # ]:          0 :                 if( !aSoundURL.isEmpty() )
    1603                 :            :                 {
    1604         [ #  # ]:          0 :                     if( !pEffect->getAudio().is() )
    1605                 :            :                     {
    1606         [ #  # ]:          0 :                         pEffect->createAudio( aSoundSource );
    1607                 :          0 :                         bChanged = true;
    1608                 :            :                     }
    1609                 :            :                     else
    1610                 :            :                     {
    1611 [ #  # ][ #  # ]:          0 :                         if( pEffect->getAudio()->getSource() != aSoundSource )
                 [ #  # ]
    1612                 :            :                         {
    1613 [ #  # ][ #  # ]:          0 :                             pEffect->getAudio()->setSource( aSoundSource );
    1614                 :          0 :                             bChanged = true;
    1615                 :            :                         }
    1616                 :            :                     }
    1617                 :            :                 }
    1618                 :            :                 else
    1619                 :            :                 {
    1620 [ #  # ][ #  # ]:          0 :                     if( pEffect->getAudio().is() || pEffect->getStopAudio() )
         [ #  # ][ #  # ]
    1621                 :            :                     {
    1622         [ #  # ]:          0 :                         pEffect->removeAudio();
    1623                 :          0 :                         bChanged = true;
    1624                 :            :                     }
    1625                 :          0 :                 }
    1626                 :          0 :             }
    1627                 :            :         }
    1628                 :            : 
    1629 [ #  # ][ #  # ]:          0 :         if( pResultSet->getPropertyState( nHandleTrigger ) == STLPropertyState_DIRECT )
    1630                 :            :         {
    1631                 :          0 :             Reference< XShape > xTriggerShape;
    1632 [ #  # ][ #  # ]:          0 :             pResultSet->getPropertyValue( nHandleTrigger ) >>= xTriggerShape;
    1633         [ #  # ]:          0 :             bChanged |= mpMainSequence->setTrigger( pEffect, xTriggerShape );
    1634                 :            :         }
    1635 [ #  # ][ #  # ]:          0 :     }
    1636                 :            : 
    1637         [ #  # ]:          0 :     const bool bHasTextGrouping = pResultSet->getPropertyState( nHandleTextGrouping ) == STLPropertyState_DIRECT;
    1638         [ #  # ]:          0 :     const bool bHasAnimateForm = pResultSet->getPropertyState( nHandleAnimateForm ) == STLPropertyState_DIRECT;
    1639         [ #  # ]:          0 :     const bool bHasTextGroupingAuto = pResultSet->getPropertyState( nHandleTextGroupingAuto ) == STLPropertyState_DIRECT;
    1640         [ #  # ]:          0 :     const bool bHasTextReverse = pResultSet->getPropertyState( nHandleTextReverse ) == STLPropertyState_DIRECT;
    1641                 :            : 
    1642 [ #  # ][ #  # ]:          0 :     if( bHasTextGrouping || bHasAnimateForm || bHasTextGroupingAuto || bHasTextReverse )
         [ #  # ][ #  # ]
    1643                 :            :     {
    1644                 :            :         // we need to do a second pass for text grouping options
    1645                 :            :         // since changing them can cause effects to be removed
    1646                 :            :         // or replaced, we do this after we aplied all other options
    1647                 :            :         // above
    1648                 :            : 
    1649                 :          0 :         sal_Int32 nTextGrouping = 0;
    1650                 :          0 :         sal_Bool bAnimateForm = sal_True, bTextReverse = sal_False;
    1651                 :          0 :         double fTextGroupingAuto = -1.0;
    1652                 :            : 
    1653         [ #  # ]:          0 :         if( bHasTextGrouping )
    1654         [ #  # ]:          0 :             pResultSet->getPropertyValue(nHandleTextGrouping) >>= nTextGrouping;
    1655                 :            : 
    1656         [ #  # ]:          0 :         if( bHasAnimateForm )
    1657         [ #  # ]:          0 :             pResultSet->getPropertyValue(nHandleAnimateForm) >>= bAnimateForm;
    1658                 :            : 
    1659         [ #  # ]:          0 :         if( bHasTextGroupingAuto )
    1660         [ #  # ]:          0 :             pResultSet->getPropertyValue(nHandleTextGroupingAuto) >>= fTextGroupingAuto;
    1661                 :            : 
    1662         [ #  # ]:          0 :         if( bHasTextReverse )
    1663         [ #  # ]:          0 :             pResultSet->getPropertyValue(nHandleTextReverse) >>= bTextReverse;
    1664                 :            : 
    1665         [ #  # ]:          0 :         EffectSequence const aSelectedEffects( maListSelection );
    1666                 :          0 :         EffectSequence::const_iterator iter( aSelectedEffects.begin() );
    1667                 :          0 :         const EffectSequence::const_iterator iEnd( aSelectedEffects.end() );
    1668         [ #  # ]:          0 :         while( iter != iEnd )
    1669                 :            :         {
    1670                 :          0 :             CustomAnimationEffectPtr const& pEffect = (*iter++);
    1671                 :            : 
    1672                 :          0 :             EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
    1673         [ #  # ]:          0 :             if( !pEffectSequence )
    1674                 :          0 :                 pEffectSequence = mpMainSequence.get();
    1675                 :            : 
    1676                 :          0 :             sal_Int32 nGroupId = pEffect->getGroupId();
    1677         [ #  # ]:          0 :             CustomAnimationTextGroupPtr pTextGroup;
    1678         [ #  # ]:          0 :             if( (nGroupId != -1) )
    1679                 :            :             {
    1680                 :            :                 // use existing group
    1681 [ #  # ][ #  # ]:          0 :                 pTextGroup = pEffectSequence->findGroup( nGroupId );
                 [ #  # ]
    1682                 :            :             }
    1683                 :            :             else
    1684                 :            :             {
    1685                 :            :                 // somethings changed so we need a group now
    1686 [ #  # ][ #  # ]:          0 :                 pTextGroup = pEffectSequence->createTextGroup( pEffect, nTextGrouping, fTextGroupingAuto, bAnimateForm, bTextReverse );
         [ #  # ][ #  # ]
                 [ #  # ]
    1687                 :          0 :                 bChanged = true;
    1688                 :            :             }
    1689                 :            : 
    1690         [ #  # ]:          0 :             if( bHasTextGrouping )
    1691                 :            :             {
    1692         [ #  # ]:          0 :                 if( (pTextGroup->getTextGrouping() != nTextGrouping) )
    1693                 :            :                 {
    1694 [ #  # ][ #  # ]:          0 :                     pEffectSequence->setTextGrouping( pTextGroup, nTextGrouping );
                 [ #  # ]
    1695                 :          0 :                     bChanged = true;
    1696                 :            :                 }
    1697                 :            :             }
    1698                 :            : 
    1699         [ #  # ]:          0 :             if( bHasAnimateForm )
    1700                 :            :             {
    1701         [ #  # ]:          0 :                 if( pTextGroup->getAnimateForm() != bAnimateForm )
    1702                 :            :                 {
    1703 [ #  # ][ #  # ]:          0 :                     pEffectSequence->setAnimateForm( pTextGroup, bAnimateForm );
                 [ #  # ]
    1704                 :          0 :                     bChanged = true;
    1705                 :            :                 }
    1706                 :            :             }
    1707                 :            : 
    1708         [ #  # ]:          0 :             if( bHasTextGroupingAuto )
    1709                 :            :             {
    1710         [ #  # ]:          0 :                 if( pTextGroup->getTextGroupingAuto() != fTextGroupingAuto )
    1711                 :            :                 {
    1712 [ #  # ][ #  # ]:          0 :                     pEffectSequence->setTextGroupingAuto( pTextGroup, fTextGroupingAuto );
                 [ #  # ]
    1713                 :          0 :                     bChanged = true;
    1714                 :            :                 }
    1715                 :            :             }
    1716                 :            : 
    1717         [ #  # ]:          0 :             if( bHasTextReverse )
    1718                 :            :             {
    1719         [ #  # ]:          0 :                 if( pTextGroup->getTextReverse() != bTextReverse )
    1720                 :            :                 {
    1721 [ #  # ][ #  # ]:          0 :                     pEffectSequence->setTextReverse( pTextGroup, bTextReverse );
                 [ #  # ]
    1722                 :          0 :                     bChanged = true;
    1723                 :            :                 }
    1724                 :            :             }
    1725         [ #  # ]:          0 :         }
    1726                 :            :     }
    1727                 :            : 
    1728         [ #  # ]:          0 :     if( bChanged )
    1729                 :            :     {
    1730         [ #  # ]:          0 :         mpMainSequence->rebuild();
    1731         [ #  # ]:          0 :         updateControls();
    1732 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
    1733         [ #  # ]:          0 :     }
    1734                 :          0 : }
    1735                 :            : 
    1736                 :          0 : void CustomAnimationPane::showOptions( sal_uInt16 nPage /* = 0 */ )
    1737                 :            : {
    1738                 :          0 :     STLPropertySet* pSet = createSelectionSet();
    1739                 :            : 
    1740         [ #  # ]:          0 :     CustomAnimationDialog* pDlg = new CustomAnimationDialog( this, pSet, nPage );
    1741         [ #  # ]:          0 :     if( pDlg->Execute() )
    1742                 :            :     {
    1743                 :          0 :         addUndo();
    1744                 :          0 :         changeSelection( pDlg->getResultSet(), pSet );
    1745                 :          0 :         updateControls();
    1746                 :            :     }
    1747                 :            : 
    1748         [ #  # ]:          0 :     delete pDlg;
    1749                 :          0 : }
    1750                 :            : 
    1751                 :          0 : void CustomAnimationPane::onChangeCurrentPage()
    1752                 :            : {
    1753         [ #  # ]:          0 :     if( mxView.is() ) try
    1754                 :            :     {
    1755 [ #  # ][ #  # ]:          0 :         Reference< XDrawPage > xNewPage( mxView->getCurrentPage() );
    1756 [ #  # ][ #  # ]:          0 :         if( xNewPage != mxCurrentPage )
    1757                 :            :         {
    1758         [ #  # ]:          0 :             mxCurrentPage = xNewPage;
    1759         [ #  # ]:          0 :             SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
    1760         [ #  # ]:          0 :             if( pPage )
    1761                 :            :             {
    1762 [ #  # ][ #  # ]:          0 :                 mpMainSequence = pPage->getMainSequence();
                 [ #  # ]
    1763 [ #  # ][ #  # ]:          0 :                 mpCustomAnimationList->update( mpMainSequence );
                 [ #  # ]
    1764                 :            :             }
    1765         [ #  # ]:          0 :             updateControls();
    1766         [ #  # ]:          0 :         }
    1767                 :            :     }
    1768                 :          0 :     catch( Exception& )
    1769                 :            :     {
    1770                 :            :         OSL_FAIL( "sd::CustomAnimationPane::onChangeCurrentPage(), exception caught!" );
    1771                 :            :     }
    1772                 :          0 : }
    1773                 :            : 
    1774                 :          0 : bool getTextSelection( const Any& rSelection, Reference< XShape >& xShape, std::list< sal_Int16 >& rParaList )
    1775                 :            : {
    1776                 :          0 :     Reference< XTextRange > xSelectedText;
    1777         [ #  # ]:          0 :     rSelection >>= xSelectedText;
    1778         [ #  # ]:          0 :     if( xSelectedText.is() ) try
    1779                 :            :     {
    1780 [ #  # ][ #  # ]:          0 :         xShape.set( xSelectedText->getText(), UNO_QUERY_THROW );
                 [ #  # ]
    1781                 :            : 
    1782         [ #  # ]:          0 :         Reference< XTextRangeCompare > xTextRangeCompare( xShape, UNO_QUERY_THROW );
    1783         [ #  # ]:          0 :         Reference< XEnumerationAccess > xParaEnumAccess( xShape, UNO_QUERY_THROW );
    1784 [ #  # ][ #  # ]:          0 :         Reference< XEnumeration > xParaEnum( xParaEnumAccess->createEnumeration(), UNO_QUERY_THROW );
                 [ #  # ]
    1785                 :          0 :         Reference< XTextRange > xRange;
    1786 [ #  # ][ #  # ]:          0 :         Reference< XTextRange > xStart( xSelectedText->getStart() );
    1787 [ #  # ][ #  # ]:          0 :         Reference< XTextRange > xEnd( xSelectedText->getEnd() );
    1788                 :            : 
    1789 [ #  # ][ #  # ]:          0 :         if( xTextRangeCompare->compareRegionEnds( xStart, xEnd ) < 0 )
                 [ #  # ]
    1790                 :            :         {
    1791                 :          0 :             Reference< XTextRange > xTemp( xStart );
    1792         [ #  # ]:          0 :             xStart = xEnd;
    1793         [ #  # ]:          0 :             xEnd = xTemp;
    1794                 :            :         }
    1795                 :            : 
    1796                 :          0 :         sal_Int16 nPara = 0;
    1797 [ #  # ][ #  # ]:          0 :         while( xParaEnum->hasMoreElements() )
                 [ #  # ]
    1798                 :            :         {
    1799 [ #  # ][ #  # ]:          0 :             xParaEnum->nextElement() >>= xRange;
                 [ #  # ]
    1800                 :            : 
    1801                 :            :             // break if start of selection is prior to end of current paragraph
    1802 [ #  # ][ #  # ]:          0 :             if( xRange.is() && (xTextRangeCompare->compareRegionEnds( xStart, xRange ) >= 0 ) )
         [ #  # ][ #  # ]
                 [ #  # ]
    1803                 :          0 :                 break;
    1804                 :            : 
    1805                 :          0 :             nPara++;
    1806                 :            :         }
    1807                 :            : 
    1808         [ #  # ]:          0 :         while( xRange.is() )
    1809                 :            :         {
    1810 [ #  # ][ #  # ]:          0 :             if( xRange.is() && !xRange->getString().isEmpty() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1811         [ #  # ]:          0 :                 rParaList.push_back( nPara );
    1812                 :            : 
    1813                 :            :             // break if end of selection is before or at end of current paragraph
    1814 [ #  # ][ #  # ]:          0 :             if( xRange.is() && xTextRangeCompare->compareRegionEnds( xEnd, xRange ) >= 0 )
         [ #  # ][ #  # ]
                 [ #  # ]
    1815                 :          0 :                 break;
    1816                 :            : 
    1817                 :          0 :             nPara++;
    1818                 :            : 
    1819 [ #  # ][ #  # ]:          0 :             if( xParaEnum->hasMoreElements() )
                 [ #  # ]
    1820 [ #  # ][ #  # ]:          0 :                 xParaEnum->nextElement() >>= xRange;
                 [ #  # ]
    1821                 :            :             else
    1822                 :          0 :                 xRange.clear();
    1823                 :            :         }
    1824                 :            : 
    1825         [ #  # ]:          0 :         return true;
    1826                 :            :     }
    1827         [ #  # ]:          0 :     catch( Exception& )
    1828                 :            :     {
    1829                 :            :         OSL_FAIL( "sd::CustomAnimationPane::getTextSelection(), exception caught!" );
    1830                 :            :     }
    1831                 :            : 
    1832                 :          0 :     return false;
    1833                 :            : }
    1834                 :            : 
    1835                 :          0 : void CustomAnimationPane::onChange( bool bCreate )
    1836                 :            : {
    1837                 :          0 :     bool bHasText = true;
    1838                 :            : 
    1839                 :            :     // first create vector of targets for dialog preview
    1840         [ #  # ]:          0 :     std::vector< Any > aTargets;
    1841                 :          0 :     OUString sPresetId;
    1842                 :          0 :     double fDuration = 2.0f;
    1843                 :            : 
    1844         [ #  # ]:          0 :     if( bCreate )
    1845                 :            :     {
    1846                 :            :         // gather shapes from the selection
    1847         [ #  # ]:          0 :         Reference< XSelectionSupplier >  xSel( mxView, UNO_QUERY_THROW );
    1848 [ #  # ][ #  # ]:          0 :         maViewSelection = xSel->getSelection();
    1849                 :            : 
    1850 [ #  # ][ #  # ]:          0 :         if( maViewSelection.getValueType() == ::getCppuType((const Reference< XShapes >*)0) )
    1851                 :            :         {
    1852                 :          0 :             Reference< XIndexAccess > xShapes;
    1853         [ #  # ]:          0 :             maViewSelection >>= xShapes;
    1854                 :            : 
    1855 [ #  # ][ #  # ]:          0 :             sal_Int32 nCount = xShapes->getCount();
    1856                 :            :             sal_Int32 nIndex;
    1857         [ #  # ]:          0 :             for( nIndex = 0; nIndex < nCount; nIndex++ )
    1858                 :            :             {
    1859 [ #  # ][ #  # ]:          0 :                 Any aTarget( xShapes->getByIndex( nIndex ) );
    1860         [ #  # ]:          0 :                 aTargets.push_back( aTarget );
    1861         [ #  # ]:          0 :                 if( bHasText )
    1862                 :            :                 {
    1863                 :          0 :                     Reference< XText > xText;
    1864         [ #  # ]:          0 :                     aTarget >>= xText;
    1865 [ #  # ][ #  # ]:          0 :                     if( !xText.is() || xText->getString().isEmpty() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1866                 :          0 :                         bHasText = false;
    1867                 :            :                 }
    1868                 :          0 :             }
    1869                 :            :         }
    1870 [ #  # ][ #  # ]:          0 :         else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XShape >*)0) )
    1871                 :            :         {
    1872         [ #  # ]:          0 :             aTargets.push_back( maViewSelection );
    1873                 :          0 :             Reference< XText > xText;
    1874         [ #  # ]:          0 :             maViewSelection >>= xText;
    1875 [ #  # ][ #  # ]:          0 :             if( !xText.is() || xText->getString().isEmpty() )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
    1876                 :          0 :                 bHasText = false;
    1877                 :            :         }
    1878 [ #  # ][ #  # ]:          0 :         else if ( maViewSelection.getValueType() == ::getCppuType((const Reference< XTextCursor >*)0) )
    1879                 :            :         {
    1880                 :          0 :             Reference< XShape > xShape;
    1881         [ #  # ]:          0 :             std::list< sal_Int16 > aParaList;
    1882 [ #  # ][ #  # ]:          0 :             if( getTextSelection( maViewSelection, xShape, aParaList ) )
    1883                 :            :             {
    1884         [ #  # ]:          0 :                 ParagraphTarget aParaTarget;
    1885         [ #  # ]:          0 :                 aParaTarget.Shape = xShape;
    1886                 :            : 
    1887                 :          0 :                 std::list< sal_Int16 >::iterator aIter( aParaList.begin() );
    1888 [ #  # ][ #  # ]:          0 :                 for( ; aIter != aParaList.end(); ++aIter )
                 [ #  # ]
    1889                 :            :                 {
    1890         [ #  # ]:          0 :                     aParaTarget.Paragraph = (*aIter);
    1891 [ #  # ][ #  # ]:          0 :                     aTargets.push_back( makeAny( aParaTarget ) );
    1892         [ #  # ]:          0 :                    }
    1893                 :          0 :             }
    1894                 :            :         }
    1895                 :            :         else
    1896                 :            :         {
    1897                 :            :             OSL_FAIL("sd::CustomAnimationPane::onChange(), unknown view selection!" );
    1898                 :          0 :             return;
    1899         [ #  # ]:          0 :         }
    1900                 :            :     }
    1901                 :            :     else
    1902                 :            :     {
    1903                 :            :         // get selected effect
    1904                 :          0 :         EffectSequence::iterator aIter( maListSelection.begin() );
    1905                 :          0 :         const EffectSequence::iterator aEnd( maListSelection.end() );
    1906         [ #  # ]:          0 :         while( aIter != aEnd )
    1907                 :            :         {
    1908 [ #  # ][ #  # ]:          0 :             if( !bHasText || !(*aIter)->hasText() )
                 [ #  # ]
    1909                 :          0 :                 bHasText = false;
    1910                 :            : 
    1911         [ #  # ]:          0 :             if( sPresetId.isEmpty() )
    1912                 :            :             {
    1913                 :          0 :                 sPresetId = (*aIter)->getPresetId();
    1914                 :          0 :                 fDuration = (*aIter)->getDuration();
    1915                 :            :             }
    1916                 :            : 
    1917         [ #  # ]:          0 :             aTargets.push_back( (*aIter++)->getTarget() );
    1918                 :            :         }
    1919                 :            :     }
    1920                 :            : 
    1921 [ #  # ][ #  # ]:          0 :     CustomAnimationCreateDialog* pDlg = new CustomAnimationCreateDialog( this, this, aTargets, bHasText, sPresetId, fDuration );
    1922 [ #  # ][ #  # ]:          0 :     if( pDlg->Execute() )
    1923                 :            :     {
    1924         [ #  # ]:          0 :         addUndo();
    1925         [ #  # ]:          0 :         fDuration = pDlg->getSelectedDuration();
    1926         [ #  # ]:          0 :         CustomAnimationPresetPtr pDescriptor = pDlg->getSelectedPreset();
    1927         [ #  # ]:          0 :         if( pDescriptor.get() )
    1928                 :            :         {
    1929         [ #  # ]:          0 :             if( bCreate )
    1930                 :            :             {
    1931         [ #  # ]:          0 :                 mpCustomAnimationList->SelectAll( sal_False );
    1932                 :            : 
    1933                 :            :                 // gather shapes from the selection
    1934                 :          0 :                 std::vector< Any >::iterator aIter( aTargets.begin() );
    1935                 :          0 :                 const std::vector< Any >::iterator aEnd( aTargets.end() );
    1936                 :          0 :                 bool bFirst = true;
    1937 [ #  # ][ #  # ]:          0 :                 for( ; aIter != aEnd; ++aIter )
    1938                 :            :                 {
    1939         [ #  # ]:          0 :                     CustomAnimationEffectPtr pCreated = mpMainSequence->append( pDescriptor, (*aIter), fDuration );
    1940                 :            : 
    1941                 :            :                     // if only one shape with text and no fill or outline is selected, animate only by first level paragraphs
    1942 [ #  # ][ #  # ]:          0 :                     if( bHasText && (aTargets.size() == 1) )
                 [ #  # ]
    1943                 :            :                     {
    1944         [ #  # ]:          0 :                         Reference< XShape > xShape( (*aIter), UNO_QUERY );
    1945 [ #  # ][ #  # ]:          0 :                         if( xShape.is() && !hasVisibleShape( xShape ) )
         [ #  # ][ #  # ]
    1946                 :            :                         {
    1947 [ #  # ][ #  # ]:          0 :                             mpMainSequence->createTextGroup( pCreated, 1, -1.0, sal_False, sal_False );
         [ #  # ][ #  # ]
    1948                 :          0 :                         }
    1949                 :            :                     }
    1950                 :            : 
    1951         [ #  # ]:          0 :                     if( bFirst )
    1952                 :          0 :                         bFirst = false;
    1953                 :            :                     else
    1954         [ #  # ]:          0 :                         pCreated->setNodeType( EffectNodeType::WITH_PREVIOUS );
    1955                 :            : 
    1956         [ #  # ]:          0 :                     if( pCreated.get() )
    1957                 :            :                     {
    1958 [ #  # ][ #  # ]:          0 :                         mpCustomAnimationList->select( pCreated );
                 [ #  # ]
    1959                 :            :                     }
    1960         [ #  # ]:          0 :                 }
    1961                 :            :             }
    1962                 :            :             else
    1963                 :            :             {
    1964         [ #  # ]:          0 :                 MainSequenceRebuildGuard aGuard( mpMainSequence );
    1965                 :            : 
    1966                 :            :                 // get selected effect
    1967                 :          0 :                 EffectSequence::iterator aIter( maListSelection.begin() );
    1968                 :          0 :                 const EffectSequence::iterator aEnd( maListSelection.end() );
    1969         [ #  # ]:          0 :                 while( aIter != aEnd )
    1970                 :            :                 {
    1971         [ #  # ]:          0 :                     CustomAnimationEffectPtr pEffect = (*aIter++);
    1972                 :            : 
    1973                 :          0 :                     EffectSequenceHelper* pEffectSequence = pEffect->getEffectSequence();
    1974         [ #  # ]:          0 :                     if( !pEffectSequence )
    1975                 :          0 :                         pEffectSequence = mpMainSequence.get();
    1976                 :            : 
    1977         [ #  # ]:          0 :                     pEffectSequence->replace( pEffect, pDescriptor, fDuration );
    1978 [ #  # ][ #  # ]:          0 :                 }
    1979                 :            :             }
    1980                 :            :         }
    1981                 :            :         else
    1982                 :            :         {
    1983         [ #  # ]:          0 :             PathKind eKind = pDlg->getCreatePathKind();
    1984         [ #  # ]:          0 :             if( eKind != NONE )
    1985         [ #  # ]:          0 :                 createPath( eKind, aTargets, fDuration );
    1986                 :            :         }
    1987 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
                 [ #  # ]
    1988                 :            :     }
    1989                 :            : 
    1990 [ #  # ][ #  # ]:          0 :     delete pDlg;
    1991                 :            : 
    1992         [ #  # ]:          0 :     updateControls();
    1993                 :            : 
    1994                 :            :     // stop running preview from dialog
    1995 [ #  # ][ #  # ]:          0 :     SlideShow::Stop( mrBase );
                 [ #  # ]
    1996                 :            : }
    1997                 :            : 
    1998                 :          0 : void CustomAnimationPane::createPath( PathKind eKind, std::vector< Any >& rTargets, double fDuration)
    1999                 :            : {
    2000                 :          0 :     sal_uInt16 nSID = 0;
    2001                 :            : 
    2002   [ #  #  #  # ]:          0 :     switch( eKind )
    2003                 :            :     {
    2004                 :          0 :     case CURVE:     nSID = SID_DRAW_BEZIER_NOFILL; break;
    2005                 :          0 :     case POLYGON:   nSID = SID_DRAW_POLYGON_NOFILL; break;
    2006                 :          0 :     case FREEFORM:  nSID = SID_DRAW_FREELINE_NOFILL; break;
    2007                 :          0 :     default: break;
    2008                 :            :     }
    2009                 :            : 
    2010         [ #  # ]:          0 :     if( nSID )
    2011                 :            :     {
    2012                 :            :         DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
    2013 [ #  # ][ #  # ]:          0 :             FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
                 [ #  # ]
    2014                 :            : 
    2015         [ #  # ]:          0 :         if( pViewShell )
    2016                 :            :         {
    2017                 :          0 :             DrawView* pView = pViewShell->GetDrawView();
    2018         [ #  # ]:          0 :             if( pView )
    2019         [ #  # ]:          0 :                 pView->UnmarkAllObj();
    2020                 :            : 
    2021 [ #  # ][ #  # ]:          0 :             std::vector< Any > aTargets( 1, Any( fDuration ) );
    2022         [ #  # ]:          0 :             aTargets.insert( aTargets.end(), rTargets.begin(), rTargets.end() );
    2023         [ #  # ]:          0 :             Sequence< Any > aTargetSequence( comphelper::containerToSequence( aTargets ) );
    2024 [ #  # ][ #  # ]:          0 :             const SfxUnoAnyItem aItem( SID_ADD_MOTION_PATH, Any( aTargetSequence ) );
    2025 [ #  # ][ #  # ]:          0 :             pViewShell->GetViewFrame()->GetDispatcher()->Execute( nSID, SFX_CALLMODE_ASYNCHRON, &aItem, 0 );
         [ #  # ][ #  # ]
    2026                 :            :         }
    2027                 :            :     }
    2028                 :          0 : }
    2029                 :            : 
    2030                 :          0 : void CustomAnimationPane::onRemove()
    2031                 :            : {
    2032         [ #  # ]:          0 :    if( !maListSelection.empty() )
    2033                 :            :     {
    2034         [ #  # ]:          0 :         addUndo();
    2035                 :            : 
    2036         [ #  # ]:          0 :         MainSequenceRebuildGuard aGuard( mpMainSequence );
    2037                 :            : 
    2038         [ #  # ]:          0 :         EffectSequence aList( maListSelection );
    2039                 :            : 
    2040                 :          0 :         EffectSequence::iterator aIter( aList.begin() );
    2041                 :          0 :         const EffectSequence::iterator aEnd( aList.end() );
    2042         [ #  # ]:          0 :         while( aIter != aEnd )
    2043                 :            :         {
    2044         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2045         [ #  # ]:          0 :             if( pEffect->getEffectSequence() )
    2046         [ #  # ]:          0 :                 pEffect->getEffectSequence()->remove( pEffect );
    2047         [ #  # ]:          0 :         }
    2048                 :            : 
    2049                 :          0 :         maListSelection.clear();
    2050 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
                 [ #  # ]
    2051                 :            :     }
    2052                 :          0 : }
    2053                 :            : 
    2054                 :          0 : void CustomAnimationPane::remove( CustomAnimationEffectPtr& pEffect )
    2055                 :            : {
    2056         [ #  # ]:          0 :     if( pEffect->getEffectSequence() )
    2057                 :            :     {
    2058                 :          0 :         addUndo();
    2059                 :          0 :         pEffect->getEffectSequence()->remove( pEffect );
    2060                 :          0 :         mrBase.GetDocShell()->SetModified();
    2061                 :            :     }
    2062                 :          0 : }
    2063                 :            : 
    2064                 :          0 : void CustomAnimationPane::onChangeStart()
    2065                 :            : {
    2066         [ #  # ]:          0 :     if( mpLBStart->GetSelectEntryCount() == 1 )
    2067                 :            :     {
    2068                 :            :         sal_Int16 nNodeType;
    2069                 :          0 :         sal_uInt16 nPos= mpLBStart->GetSelectEntryPos();
    2070   [ #  #  #  # ]:          0 :         switch( nPos )
    2071                 :            :         {
    2072                 :          0 :         case 0: nNodeType = EffectNodeType::ON_CLICK; break;
    2073                 :          0 :         case 1: nNodeType = EffectNodeType::WITH_PREVIOUS; break;
    2074                 :          0 :         case 2: nNodeType = EffectNodeType::AFTER_PREVIOUS; break;
    2075                 :            :         default:
    2076                 :          0 :             return;
    2077                 :            :         }
    2078                 :            : 
    2079                 :          0 :         onChangeStart( nNodeType );
    2080                 :            :     }
    2081                 :            : }
    2082                 :            : 
    2083                 :          0 : void CustomAnimationPane::onChangeStart( sal_Int16 nNodeType )
    2084                 :            : {
    2085         [ #  # ]:          0 :     addUndo();
    2086                 :            : 
    2087         [ #  # ]:          0 :     MainSequenceRebuildGuard aGuard( mpMainSequence );
    2088                 :            : 
    2089                 :          0 :     bool bNeedRebuild = false;
    2090                 :            : 
    2091                 :          0 :     EffectSequence::iterator aIter( maListSelection.begin() );
    2092                 :          0 :     const EffectSequence::iterator aEnd( maListSelection.end() );
    2093         [ #  # ]:          0 :     while( aIter != aEnd )
    2094                 :            :     {
    2095         [ #  # ]:          0 :         CustomAnimationEffectPtr pEffect = (*aIter++);
    2096         [ #  # ]:          0 :         if( pEffect->getNodeType() != nNodeType )
    2097                 :            :         {
    2098         [ #  # ]:          0 :             pEffect->setNodeType( nNodeType );
    2099                 :          0 :             bNeedRebuild = true;
    2100                 :            :         }
    2101         [ #  # ]:          0 :     }
    2102                 :            : 
    2103         [ #  # ]:          0 :     if( bNeedRebuild )
    2104                 :            :     {
    2105         [ #  # ]:          0 :         mpMainSequence->rebuild();
    2106         [ #  # ]:          0 :         updateControls();
    2107 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
    2108         [ #  # ]:          0 :     }
    2109                 :          0 : }
    2110                 :            : 
    2111                 :          0 : void CustomAnimationPane::onChangeProperty()
    2112                 :            : {
    2113         [ #  # ]:          0 :     if( mpLBProperty->getSubControl() )
    2114                 :            :     {
    2115         [ #  # ]:          0 :         addUndo();
    2116                 :            : 
    2117         [ #  # ]:          0 :         MainSequenceRebuildGuard aGuard( mpMainSequence );
    2118                 :            : 
    2119         [ #  # ]:          0 :         const Any aValue( mpLBProperty->getSubControl()->getValue() );
    2120                 :            : 
    2121                 :          0 :         bool bNeedUpdate = false;
    2122                 :            : 
    2123                 :            :         // change selected effect
    2124                 :          0 :         EffectSequence::iterator aIter( maListSelection.begin() );
    2125                 :          0 :         const EffectSequence::iterator aEnd( maListSelection.end() );
    2126         [ #  # ]:          0 :         while( aIter != aEnd )
    2127                 :            :         {
    2128         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2129                 :            : 
    2130 [ #  # ][ #  # ]:          0 :             if( setProperty1Value( mnPropertyType, pEffect, aValue ) )
         [ #  # ][ #  # ]
    2131                 :          0 :                 bNeedUpdate = true;
    2132         [ #  # ]:          0 :         }
    2133                 :            : 
    2134         [ #  # ]:          0 :         if( bNeedUpdate )
    2135                 :            :         {
    2136         [ #  # ]:          0 :             mpMainSequence->rebuild();
    2137         [ #  # ]:          0 :             updateControls();
    2138 [ #  # ][ #  # ]:          0 :             mrBase.GetDocShell()->SetModified();
    2139                 :            :         }
    2140                 :            : 
    2141 [ #  # ][ #  # ]:          0 :         onPreview( false );
    2142                 :            :     }
    2143                 :          0 : }
    2144                 :            : 
    2145                 :          0 : void CustomAnimationPane::onChangeSpeed()
    2146                 :            : {
    2147         [ #  # ]:          0 :     if( mpCBSpeed->GetSelectEntryCount() == 1 )
    2148                 :            :     {
    2149         [ #  # ]:          0 :         addUndo();
    2150                 :            : 
    2151         [ #  # ]:          0 :         MainSequenceRebuildGuard aGuard( mpMainSequence );
    2152                 :            : 
    2153                 :            :         double fDuration;
    2154                 :            : 
    2155         [ #  # ]:          0 :         sal_uInt16 nPos= mpCBSpeed->GetSelectEntryPos();
    2156                 :            : 
    2157   [ #  #  #  #  :          0 :         switch( nPos )
                   #  # ]
    2158                 :            :         {
    2159                 :          0 :         case 0: fDuration = 5.0; break;
    2160                 :          0 :         case 1: fDuration = 3.0; break;
    2161                 :          0 :         case 2: fDuration = 2.0; break;
    2162                 :          0 :         case 3: fDuration = 1.0; break;
    2163                 :          0 :         case 4: fDuration = 0.5; break;
    2164                 :            :         default:
    2165                 :          0 :             return;
    2166                 :            :         }
    2167                 :            : 
    2168                 :            :         // change selected effect
    2169                 :          0 :         EffectSequence::iterator aIter( maListSelection.begin() );
    2170                 :          0 :         const EffectSequence::iterator aEnd( maListSelection.end() );
    2171         [ #  # ]:          0 :         while( aIter != aEnd )
    2172                 :            :         {
    2173         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2174         [ #  # ]:          0 :             pEffect->setDuration( fDuration );
    2175         [ #  # ]:          0 :         }
    2176                 :            : 
    2177         [ #  # ]:          0 :         mpMainSequence->rebuild();
    2178         [ #  # ]:          0 :         updateControls();
    2179 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
    2180                 :            : 
    2181 [ #  # ][ #  # ]:          0 :         onPreview( false );
                 [ #  # ]
    2182                 :            :     }
    2183                 :            : }
    2184                 :            : 
    2185                 :            : /// this link is called when the property box is modified by the user
    2186                 :          0 : IMPL_LINK_NOARG(CustomAnimationPane, implPropertyHdl)
    2187                 :            : {
    2188                 :          0 :     onChangeProperty();
    2189                 :          0 :     return 0;
    2190                 :            : }
    2191                 :            : 
    2192                 :            : /// this link is called when one of the controls is modified
    2193                 :          0 : IMPL_LINK( CustomAnimationPane, implControlHdl, Control*, pControl )
    2194                 :            : {
    2195         [ #  # ]:          0 :     if( pControl == mpPBAddEffect )
    2196                 :          0 :         onChange(true);
    2197         [ #  # ]:          0 :     else if( pControl == mpPBChangeEffect )
    2198                 :          0 :         onChange(false);
    2199         [ #  # ]:          0 :     else if( pControl == mpPBRemoveEffect )
    2200                 :          0 :         onRemove();
    2201         [ #  # ]:          0 :     else if( pControl == mpLBStart )
    2202                 :          0 :         onChangeStart();
    2203         [ #  # ]:          0 :     else if( pControl == mpCBSpeed )
    2204                 :          0 :         onChangeSpeed();
    2205         [ #  # ]:          0 :     else if( pControl == mpPBPropertyMore )
    2206                 :          0 :         showOptions();
    2207         [ #  # ]:          0 :     else if( pControl == mpPBMoveUp )
    2208                 :          0 :         moveSelection( true );
    2209         [ #  # ]:          0 :     else if( pControl == mpPBMoveDown )
    2210                 :          0 :         moveSelection( false );
    2211         [ #  # ]:          0 :     else if( pControl == mpPBPlay )
    2212                 :          0 :         onPreview( true );
    2213         [ #  # ]:          0 :     else if( pControl == mpPBSlideShow )
    2214                 :            :     {
    2215                 :          0 :         mrBase.StartPresentation();
    2216                 :            :     }
    2217         [ #  # ]:          0 :     else if( pControl == mpCBAutoPreview )
    2218                 :            :     {
    2219                 :          0 :         SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
    2220         [ #  # ]:          0 :         pOptions->SetPreviewChangedEffects( mpCBAutoPreview->IsChecked() ? sal_True : sal_False );
    2221                 :            :     }
    2222                 :            : 
    2223                 :          0 :     updateControls();
    2224                 :            : 
    2225                 :          0 :     return 0;
    2226                 :            : }
    2227                 :            : 
    2228                 :          0 : IMPL_LINK_NOARG(CustomAnimationPane, lateInitCallback)
    2229                 :            : {
    2230                 :            :     // Call getPresets() to initiate the (expensive) construction of the
    2231                 :            :     // presets list.
    2232                 :          0 :     getPresets();
    2233                 :            : 
    2234                 :            :     // update selection and control states
    2235                 :          0 :     onSelectionChanged();
    2236                 :            : 
    2237                 :          0 :     return 0;
    2238                 :            : }
    2239                 :            : 
    2240                 :          0 : void CustomAnimationPane::moveSelection( bool bUp )
    2241                 :            : {
    2242         [ #  # ]:          0 :     if( maListSelection.empty() )
    2243                 :            :         return;
    2244                 :            : 
    2245         [ #  # ]:          0 :     EffectSequenceHelper* pSequence = maListSelection.front()->getEffectSequence();
    2246         [ #  # ]:          0 :     if( pSequence == 0 )
    2247                 :            :         return;
    2248                 :            : 
    2249         [ #  # ]:          0 :     addUndo();
    2250                 :            : 
    2251                 :          0 :     bool bChanged = false;
    2252                 :            : 
    2253         [ #  # ]:          0 :     MainSequenceRebuildGuard aGuard( mpMainSequence );
    2254                 :          0 :     EffectSequence& rEffectSequence = pSequence->getSequence();
    2255                 :            : 
    2256         [ #  # ]:          0 :     if( bUp )
    2257                 :            :     {
    2258                 :          0 :         EffectSequence::iterator aIter( maListSelection.begin() );
    2259                 :          0 :         const EffectSequence::iterator aEnd( maListSelection.end() );
    2260                 :            : 
    2261         [ #  # ]:          0 :         while( aIter != aEnd )
    2262                 :            :         {
    2263         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2264                 :            : 
    2265         [ #  # ]:          0 :             EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
    2266         [ #  # ]:          0 :             if( aEffectPos != rEffectSequence.end() )
    2267                 :            :             {
    2268         [ #  # ]:          0 :                 EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
    2269                 :            : 
    2270         [ #  # ]:          0 :                 if( aInsertPos != rEffectSequence.begin() )
    2271                 :            :                 {
    2272                 :          0 :                     --aInsertPos;
    2273 [ #  # ][ #  # ]:          0 :                     while( (aInsertPos != rEffectSequence.begin()) && !mpCustomAnimationList->isExpanded(*aInsertPos))
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    2274                 :          0 :                         --aInsertPos;
    2275                 :            : 
    2276         [ #  # ]:          0 :                     rEffectSequence.insert( aInsertPos, pEffect );
    2277                 :            :                 }
    2278                 :            :                 else
    2279                 :            :                 {
    2280         [ #  # ]:          0 :                     rEffectSequence.push_front( pEffect );
    2281                 :            :                 }
    2282                 :          0 :                 bChanged = true;
    2283                 :            :             }
    2284         [ #  # ]:          0 :         }
    2285                 :            :     }
    2286                 :            :     else
    2287                 :            :     {
    2288                 :          0 :         EffectSequence::reverse_iterator aIter( maListSelection.rbegin() );
    2289                 :          0 :         const EffectSequence::reverse_iterator aEnd( maListSelection.rend() );
    2290                 :            : 
    2291 [ #  # ][ #  # ]:          0 :         while( aIter != aEnd )
    2292                 :            :         {
    2293         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2294                 :            : 
    2295         [ #  # ]:          0 :             EffectSequence::iterator aEffectPos( pSequence->find( pEffect ) );
    2296         [ #  # ]:          0 :             if( aEffectPos != rEffectSequence.end() )
    2297                 :            :             {
    2298         [ #  # ]:          0 :                 EffectSequence::iterator aInsertPos( rEffectSequence.erase( aEffectPos ) );
    2299                 :            : 
    2300         [ #  # ]:          0 :                 if( aInsertPos != rEffectSequence.end() )
    2301                 :            :                 {
    2302                 :          0 :                     ++aInsertPos;
    2303 [ #  # ][ #  # ]:          0 :                     while( (aInsertPos != rEffectSequence.end()) && !mpCustomAnimationList->isExpanded(*aInsertPos))
         [ #  # ][ #  # ]
           [ #  #  #  # ]
    2304                 :          0 :                         ++aInsertPos;
    2305                 :            : 
    2306         [ #  # ]:          0 :                     rEffectSequence.insert( aInsertPos, pEffect );
    2307                 :            :                 }
    2308                 :            :                 else
    2309                 :            :                 {
    2310         [ #  # ]:          0 :                     rEffectSequence.push_back( pEffect );
    2311                 :            :                 }
    2312                 :          0 :                 bChanged = true;
    2313                 :            :             }
    2314         [ #  # ]:          0 :         }
    2315                 :            :     }
    2316                 :            : 
    2317         [ #  # ]:          0 :     if( bChanged )
    2318                 :            :     {
    2319         [ #  # ]:          0 :         mpMainSequence->rebuild();
    2320         [ #  # ]:          0 :         updateControls();
    2321 [ #  # ][ #  # ]:          0 :         mrBase.GetDocShell()->SetModified();
    2322         [ #  # ]:          0 :     }
    2323                 :            : }
    2324                 :            : 
    2325                 :          0 : void CustomAnimationPane::onPreview( bool bForcePreview )
    2326                 :            : {
    2327 [ #  # ][ #  # ]:          0 :     if( !bForcePreview && !mpCBAutoPreview->IsChecked() )
                 [ #  # ]
    2328                 :          0 :         return;
    2329                 :            : 
    2330         [ #  # ]:          0 :     if( maListSelection.empty() )
    2331                 :            :     {
    2332                 :          0 :         rtl::Reference< MotionPathTag > xMotionPathTag;
    2333                 :          0 :         MotionPathTagVector::iterator aIter;
    2334 [ #  # ][ #  # ]:          0 :         for( aIter = maMotionPathTags.begin(); aIter != maMotionPathTags.end(); ++aIter )
    2335                 :            :         {
    2336 [ #  # ][ #  # ]:          0 :             if( (*aIter)->isSelected() )
    2337                 :            :             {
    2338         [ #  # ]:          0 :                 xMotionPathTag = (*aIter);
    2339                 :          0 :                 break;
    2340                 :            :             }
    2341                 :            :         }
    2342                 :            : 
    2343         [ #  # ]:          0 :         if( xMotionPathTag.is() )
    2344                 :            :         {
    2345 [ #  # ][ #  # ]:          0 :             MainSequencePtr pSequence( new MainSequence() );
                 [ #  # ]
    2346 [ #  # ][ #  # ]:          0 :             pSequence->append( xMotionPathTag->getEffect()->clone() );
                 [ #  # ]
    2347 [ #  # ][ #  # ]:          0 :             preview( pSequence->getRootNode() );
                 [ #  # ]
    2348                 :            :         }
    2349                 :            :         else
    2350                 :            :         {
    2351         [ #  # ]:          0 :             Reference< XAnimationNodeSupplier > xNodeSupplier( mxCurrentPage, UNO_QUERY );
    2352         [ #  # ]:          0 :             if( !xNodeSupplier.is() )
    2353                 :            :                 return;
    2354                 :            : 
    2355 [ #  # ][ #  # ]:          0 :             preview( xNodeSupplier->getAnimationNode() );
         [ #  # ][ #  # ]
    2356         [ #  # ]:          0 :         }
    2357                 :            :     }
    2358                 :            :     else
    2359                 :            :     {
    2360 [ #  # ][ #  # ]:          0 :         MainSequencePtr pSequence( new MainSequence() );
                 [ #  # ]
    2361                 :            : 
    2362                 :          0 :         EffectSequence::iterator aIter( maListSelection.begin() );
    2363                 :          0 :         const EffectSequence::iterator aEnd( maListSelection.end() );
    2364                 :            : 
    2365         [ #  # ]:          0 :         while( aIter != aEnd )
    2366                 :            :         {
    2367         [ #  # ]:          0 :             CustomAnimationEffectPtr pEffect = (*aIter++);
    2368 [ #  # ][ #  # ]:          0 :             pSequence->append( pEffect->clone() );
                 [ #  # ]
    2369         [ #  # ]:          0 :         }
    2370                 :            : 
    2371 [ #  # ][ #  # ]:          0 :         preview( pSequence->getRootNode() );
                 [ #  # ]
    2372                 :            :     }
    2373                 :            : }
    2374                 :            : 
    2375                 :          0 : void CustomAnimationPane::preview( const Reference< XAnimationNode >& xAnimationNode )
    2376                 :            : {
    2377 [ #  # ][ #  # ]:          0 :     Reference< XTimeContainer > xRoot(::comphelper::getProcessServiceFactory()->createInstance("com.sun.star.animations.ParallelTimeContainer"), UNO_QUERY);
         [ #  # ][ #  # ]
    2378         [ #  # ]:          0 :     if( xRoot.is() )
    2379                 :            :     {
    2380         [ #  # ]:          0 :         Sequence< ::com::sun::star::beans::NamedValue > aUserData( 1 );
    2381         [ #  # ]:          0 :         aUserData[0].Name = "node-type";
    2382 [ #  # ][ #  # ]:          0 :         aUserData[0].Value <<= ::com::sun::star::presentation::EffectNodeType::TIMING_ROOT;
    2383 [ #  # ][ #  # ]:          0 :         xRoot->setUserData( aUserData );
    2384 [ #  # ][ #  # ]:          0 :         xRoot->appendChild( xAnimationNode );
    2385                 :            : 
    2386         [ #  # ]:          0 :         Reference< XAnimationNode > xNode( xRoot, UNO_QUERY );
    2387 [ #  # ][ #  # ]:          0 :         SlideShow::StartPreview( mrBase, mxCurrentPage, xNode );
    2388                 :          0 :     }
    2389                 :          0 : }
    2390                 :            : 
    2391                 :            : 
    2392                 :            : // ICustomAnimationListController
    2393                 :          0 : void CustomAnimationPane::onSelect()
    2394                 :            : {
    2395         [ #  # ]:          0 :     maListSelection = mpCustomAnimationList->getSelection();
    2396                 :          0 :     updateControls();
    2397                 :          0 :     markShapesFromSelectedEffects();
    2398                 :          0 : }
    2399                 :            : 
    2400                 :            : 
    2401                 :            : 
    2402                 :            : 
    2403                 :          0 : const CustomAnimationPresets& CustomAnimationPane::getPresets (void)
    2404                 :            : {
    2405         [ #  # ]:          0 :     if (mpCustomAnimationPresets == NULL)
    2406                 :          0 :         mpCustomAnimationPresets = &CustomAnimationPresets::getCustomAnimationPresets();
    2407                 :          0 :     return *mpCustomAnimationPresets;
    2408                 :            : }
    2409                 :            : 
    2410                 :            : 
    2411                 :            : 
    2412                 :          0 : void CustomAnimationPane::markShapesFromSelectedEffects()
    2413                 :            : {
    2414         [ #  # ]:          0 :     if( !maSelectionLock.isLocked() )
    2415                 :            :     {
    2416                 :          0 :         ScopeLockGuard aGuard( maSelectionLock );
    2417                 :            :         DrawViewShell* pViewShell = dynamic_cast< DrawViewShell* >(
    2418 [ #  # ][ #  # ]:          0 :             FrameworkHelper::Instance(mrBase)->GetViewShell(FrameworkHelper::msCenterPaneURL).get());
         [ #  # ][ #  # ]
                 [ #  # ]
    2419         [ #  # ]:          0 :         DrawView* pView = pViewShell ? pViewShell->GetDrawView() : NULL;
    2420                 :            : 
    2421         [ #  # ]:          0 :         if( pView )
    2422                 :            :         {
    2423         [ #  # ]:          0 :             pView->UnmarkAllObj();
    2424                 :          0 :             EffectSequence::iterator aIter( maListSelection.begin() );
    2425                 :          0 :             const EffectSequence::iterator aEnd( maListSelection.end() );
    2426         [ #  # ]:          0 :             while( aIter != aEnd )
    2427                 :            :             {
    2428         [ #  # ]:          0 :                 CustomAnimationEffectPtr pEffect = (*aIter++);
    2429                 :            : 
    2430         [ #  # ]:          0 :                 Reference< XShape > xShape( pEffect->getTargetShape() );
    2431                 :          0 :                 SdrObject* pObj = GetSdrObjectFromXShape( xShape );
    2432         [ #  # ]:          0 :                 if( pObj )
    2433         [ #  # ]:          0 :                     pView->MarkObj(pObj, pView->GetSdrPageView(), sal_False, sal_False);
    2434         [ #  # ]:          0 :             }
    2435                 :          0 :         }
    2436                 :            :     }
    2437                 :          0 : }
    2438                 :            : 
    2439                 :            : 
    2440                 :          0 : void CustomAnimationPane::updatePathFromMotionPathTag( const rtl::Reference< MotionPathTag >& xTag )
    2441                 :            : {
    2442         [ #  # ]:          0 :     MainSequenceRebuildGuard aGuard( mpMainSequence );
    2443         [ #  # ]:          0 :     if( xTag.is() )
    2444                 :            :     {
    2445                 :          0 :         SdrPathObj* pPathObj = xTag->getPathObj();
    2446         [ #  # ]:          0 :         CustomAnimationEffectPtr pEffect = xTag->getEffect();
    2447 [ #  # ][ #  # ]:          0 :         if( (pPathObj != 0) && pEffect.get() != 0 )
                 [ #  # ]
    2448                 :            :         {
    2449 [ #  # ][ #  # ]:          0 :             ::svl::IUndoManager* pManager = mrBase.GetDocShell()->GetUndoManager();
    2450         [ #  # ]:          0 :             if( pManager )
    2451                 :            :             {
    2452         [ #  # ]:          0 :                 SdPage* pPage = SdPage::getImplementation( mxCurrentPage );
    2453         [ #  # ]:          0 :                 if( pPage )
    2454 [ #  # ][ #  # ]:          0 :                     pManager->AddUndoAction( new UndoAnimationPath( mrBase.GetDocShell()->GetDoc(), pPage, pEffect->getNode() ) );
         [ #  # ][ #  # ]
                 [ #  # ]
    2455                 :            :             }
    2456                 :            : 
    2457         [ #  # ]:          0 :             pEffect->updatePathFromSdrPathObj( *pPathObj );
    2458         [ #  # ]:          0 :         }
    2459         [ #  # ]:          0 :     }
    2460                 :          0 : }
    2461                 :            : 
    2462                 :            : // ====================================================================
    2463                 :            : 
    2464                 :          0 : ::Window * createCustomAnimationPanel( ::Window* pParent, ViewShellBase& rBase )
    2465                 :            : {
    2466                 :          0 :     DialogListBox* pWindow = 0;
    2467                 :            : 
    2468                 :          0 :     DrawDocShell* pDocSh = rBase.GetDocShell();
    2469         [ #  # ]:          0 :     if( pDocSh )
    2470                 :            :     {
    2471 [ #  # ][ #  # ]:          0 :         pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL );
    2472                 :            : 
    2473 [ #  # ][ #  # ]:          0 :         Size aMinSize( pWindow->LogicToPixel( Size( 80, 256 ), MAP_APPFONT ) );
                 [ #  # ]
    2474 [ #  # ][ #  # ]:          0 :         ::Window* pPaneWindow = new CustomAnimationPane( pWindow, rBase, aMinSize );
    2475         [ #  # ]:          0 :         pWindow->SetChildWindow( pPaneWindow, aMinSize );
    2476 [ #  # ][ #  # ]:          0 :         pWindow->SetText( pPaneWindow->GetText() );
                 [ #  # ]
    2477                 :            :     }
    2478                 :            : 
    2479                 :          0 :     return pWindow;
    2480                 :            : }
    2481                 :            : 
    2482                 :            : 
    2483                 :            : 
    2484                 :            : }
    2485                 :            : 
    2486                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10