LCOV - code coverage report
Current view: top level - sd/source/ui/animations - SlideTransitionPane.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 623 0.0 %
Date: 2012-08-25 Functions: 0 65 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 1042 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                 :            : #include <com/sun/star/animations/XAnimationNode.hpp>
      30                 :            : 
      31                 :            : #include "SlideTransitionPane.hxx"
      32                 :            : #include "SlideTransitionPane.hrc"
      33                 :            : #include "CustomAnimation.hrc"
      34                 :            : 
      35                 :            : #include "TransitionPreset.hxx"
      36                 :            : #include "sdresid.hxx"
      37                 :            : #include "ViewShellBase.hxx"
      38                 :            : #include "DrawDocShell.hxx"
      39                 :            : #include "SlideSorterViewShell.hxx"
      40                 :            : #include "drawdoc.hxx"
      41                 :            : #include "filedlg.hxx"
      42                 :            : #include "strings.hrc"
      43                 :            : #include "DrawController.hxx"
      44                 :            : #include <com/sun/star/beans/XPropertySet.hpp>
      45                 :            : 
      46                 :            : #include <svtools/controldims.hrc>
      47                 :            : #include <svx/gallery.hxx>
      48                 :            : #include <unotools/pathoptions.hxx>
      49                 :            : #include <vcl/msgbox.hxx>
      50                 :            : #include <tools/urlobj.hxx>
      51                 :            : #include "DrawViewShell.hxx"
      52                 :            : #include "slideshow.hxx"
      53                 :            : #include "drawview.hxx"
      54                 :            : #include "sdundogr.hxx"
      55                 :            : #include "undoanim.hxx"
      56                 :            : #include "optsitem.hxx"
      57                 :            : #include "sddll.hxx"
      58                 :            : #include "framework/FrameworkHelper.hxx"
      59                 :            : 
      60                 :            : #include "DialogListBox.hxx"
      61                 :            : 
      62                 :            : #include <algorithm>
      63                 :            : #include <memory>
      64                 :            : 
      65                 :            : 
      66                 :            : using namespace ::com::sun::star;
      67                 :            : 
      68                 :            : using ::com::sun::star::uno::Reference;
      69                 :            : using ::com::sun::star::uno::Sequence;
      70                 :            : using ::rtl::OUString;
      71                 :            : using ::com::sun::star::uno::RuntimeException;
      72                 :            : 
      73                 :            : using ::sd::framework::FrameworkHelper;
      74                 :            : 
      75                 :            : // ____________________________
      76                 :            : //
      77                 :            : // ::sd::impl::TransitionEffect
      78                 :            : // ____________________________
      79                 :            : 
      80                 :            : namespace sd
      81                 :            : {
      82                 :            : namespace impl
      83                 :            : {
      84                 :          0 : struct TransitionEffect
      85                 :            : {
      86                 :          0 :     TransitionEffect() :
      87                 :            :             mnType( 0 ),
      88                 :            :             mnSubType( 0 ),
      89                 :            :             mbDirection( sal_True ),
      90                 :          0 :             mnFadeColor( 0 )
      91                 :            :     {
      92                 :          0 :         init();
      93                 :          0 :     }
      94                 :          0 :     explicit TransitionEffect( const ::sd::TransitionPreset & rPreset ) :
      95                 :          0 :             mnType( rPreset.getTransition()),
      96                 :          0 :             mnSubType( rPreset.getSubtype()),
      97                 :          0 :             mbDirection( rPreset.getDirection()),
      98                 :          0 :             mnFadeColor( rPreset.getFadeColor())
      99                 :            :     {
     100                 :          0 :         init();
     101                 :          0 :     }
     102                 :            :     explicit TransitionEffect( sal_Int16 nType, sal_Int16 nSubType,
     103                 :            :                                sal_Bool  bDirection, sal_Int32 nFadeColor ) :
     104                 :            :             mnType( nType),
     105                 :            :             mnSubType( nSubType ),
     106                 :            :             mbDirection( bDirection ),
     107                 :            :             mnFadeColor( nFadeColor )
     108                 :            :     {
     109                 :            :         init();
     110                 :            :     }
     111                 :          0 :     explicit TransitionEffect( const SdPage & rPage ) :
     112                 :          0 :             mnType( rPage.getTransitionType() ),
     113                 :          0 :             mnSubType( rPage.getTransitionSubtype() ),
     114                 :          0 :             mbDirection( rPage.getTransitionDirection() ),
     115                 :          0 :             mnFadeColor( rPage.getTransitionFadeColor() )
     116                 :            :     {
     117                 :          0 :         init();
     118                 :            : 
     119         [ #  # ]:          0 :         mfDuration = rPage.getTransitionDuration();
     120                 :          0 :         mnTime = rPage.GetTime();
     121                 :          0 :         mePresChange = rPage.GetPresChange();
     122                 :          0 :         mbSoundOn = rPage.IsSoundOn();
     123 [ #  # ][ #  # ]:          0 :         maSound = rPage.GetSoundFile();
                 [ #  # ]
     124                 :          0 :         mbLoopSound = rPage.IsLoopSound();
     125                 :          0 :         mbStopSound = rPage.IsStopSound();
     126                 :          0 :     }
     127                 :            : 
     128                 :          0 :     void init()
     129                 :            :     {
     130                 :          0 :         mfDuration = 2.0;
     131                 :          0 :         mnTime = 0;
     132                 :          0 :         mePresChange = PRESCHANGE_MANUAL;
     133                 :          0 :         mbSoundOn = sal_False;
     134                 :          0 :         mbLoopSound = sal_False;
     135                 :          0 :         mbStopSound = sal_False;
     136                 :            : 
     137                 :          0 :         mbEffectAmbiguous = false;
     138                 :          0 :         mbDurationAmbiguous = false;
     139                 :          0 :         mbTimeAmbiguous = false;
     140                 :          0 :         mbPresChangeAmbiguous = false;
     141                 :          0 :         mbSoundAmbiguous = false;
     142                 :          0 :         mbLoopSoundAmbiguous = false;
     143                 :          0 :     }
     144                 :            : 
     145                 :          0 :     void setAllAmbiguous()
     146                 :            :     {
     147                 :          0 :         mbEffectAmbiguous = true;
     148                 :          0 :         mbDurationAmbiguous = true;
     149                 :          0 :         mbTimeAmbiguous = true;
     150                 :          0 :         mbPresChangeAmbiguous = true;
     151                 :          0 :         mbSoundAmbiguous = true;
     152                 :          0 :         mbLoopSoundAmbiguous = true;
     153                 :          0 :     }
     154                 :            : 
     155                 :          0 :     bool operator == ( const ::sd::TransitionPreset & rPreset ) const
     156                 :            :     {
     157                 :            :         return
     158                 :          0 :             (mnType == rPreset.getTransition()) &&
     159                 :          0 :             (mnSubType == rPreset.getSubtype()) &&
     160                 :          0 :             (mbDirection == rPreset.getDirection()) &&
     161 [ #  # ][ #  #  :          0 :             (mnFadeColor ==  rPreset.getFadeColor());
             #  #  #  # ]
     162                 :            :     }
     163                 :            : 
     164                 :          0 :     void applyTo( SdPage & rOutPage ) const
     165                 :            :     {
     166         [ #  # ]:          0 :         if( ! mbEffectAmbiguous )
     167                 :            :         {
     168                 :          0 :             rOutPage.setTransitionType( mnType );
     169                 :          0 :             rOutPage.setTransitionSubtype( mnSubType );
     170                 :          0 :             rOutPage.setTransitionDirection( mbDirection );
     171                 :          0 :             rOutPage.setTransitionFadeColor( mnFadeColor );
     172                 :            :         }
     173                 :            : 
     174         [ #  # ]:          0 :         if( ! mbDurationAmbiguous )
     175                 :          0 :             rOutPage.setTransitionDuration( mfDuration );
     176         [ #  # ]:          0 :         if( ! mbTimeAmbiguous )
     177                 :          0 :             rOutPage.SetTime( mnTime );
     178         [ #  # ]:          0 :         if( ! mbPresChangeAmbiguous )
     179                 :          0 :             rOutPage.SetPresChange( mePresChange );
     180         [ #  # ]:          0 :         if( ! mbSoundAmbiguous )
     181                 :            :         {
     182         [ #  # ]:          0 :             if( mbStopSound )
     183                 :            :             {
     184                 :          0 :                 rOutPage.SetStopSound( sal_True );
     185                 :          0 :                 rOutPage.SetSound( sal_False );
     186                 :            :             }
     187                 :            :             else
     188                 :            :             {
     189                 :          0 :                 rOutPage.SetStopSound( sal_False );
     190                 :          0 :                 rOutPage.SetSound( mbSoundOn );
     191                 :          0 :                 rOutPage.SetSoundFile( maSound );
     192                 :            :             }
     193                 :            :         }
     194         [ #  # ]:          0 :         if( ! mbLoopSoundAmbiguous )
     195                 :          0 :             rOutPage.SetLoopSound( mbLoopSound );
     196                 :          0 :     }
     197                 :            : 
     198                 :          0 :     void compareWith( const SdPage & rPage )
     199                 :            :     {
     200         [ #  # ]:          0 :         TransitionEffect aOtherEffect( rPage );
     201                 :            :         mbEffectAmbiguous = mbEffectAmbiguous || aOtherEffect.mbEffectAmbiguous
     202                 :            :                                               || (mnType != aOtherEffect.mnType)
     203                 :            :                                               || (mnSubType != aOtherEffect.mnSubType)
     204                 :            :                                               || (mbDirection != aOtherEffect.mbDirection)
     205 [ #  # ][ #  # ]:          0 :                                               || (mnFadeColor != aOtherEffect.mnFadeColor);
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     206                 :            : 
     207 [ #  # ][ #  # ]:          0 :         mbDurationAmbiguous = mbDurationAmbiguous || aOtherEffect.mbDurationAmbiguous || mfDuration != aOtherEffect.mfDuration;
                 [ #  # ]
     208 [ #  # ][ #  # ]:          0 :         mbTimeAmbiguous = mbTimeAmbiguous || aOtherEffect.mbTimeAmbiguous || mnTime != aOtherEffect.mnTime;
                 [ #  # ]
     209 [ #  # ][ #  # ]:          0 :         mbPresChangeAmbiguous = mbPresChangeAmbiguous || aOtherEffect.mbPresChangeAmbiguous || mePresChange != aOtherEffect.mePresChange;
                 [ #  # ]
     210 [ #  # ][ #  # ]:          0 :         mbSoundAmbiguous = mbSoundAmbiguous || aOtherEffect.mbSoundAmbiguous || mbSoundOn != aOtherEffect.mbSoundOn;
                 [ #  # ]
     211                 :            : #if 0
     212                 :            :                         // Weird leftover isolated expression with no effect, introduced in 2007 in
     213                 :            :                         // CWS impress122. Ifdeffed out to avoid compiler warning, kept here in case
     214                 :            :                         // somebody who understands this code notices and understands what the
     215                 :            :                         // "right" thing to do might be.
     216                 :            :                         (!mbStopSound && !aOtherEffect.mbStopSound && maSound != aOtherEffect.maSound) || (mbStopSound != aOtherEffect.mbStopSound);
     217                 :            : #endif
     218 [ #  # ][ #  # ]:          0 :         mbLoopSoundAmbiguous = mbLoopSoundAmbiguous || aOtherEffect.mbLoopSoundAmbiguous || mbLoopSound != aOtherEffect.mbLoopSound;
         [ #  # ][ #  # ]
     219                 :          0 :     }
     220                 :            : 
     221                 :            :     // effect
     222                 :            :     sal_Int16 mnType;
     223                 :            :     sal_Int16 mnSubType;
     224                 :            :     sal_Bool  mbDirection;
     225                 :            :     sal_Int32 mnFadeColor;
     226                 :            : 
     227                 :            :     // other settings
     228                 :            :     double      mfDuration;
     229                 :            :     sal_uLong       mnTime;
     230                 :            :     PresChange  mePresChange;
     231                 :            :     sal_Bool        mbSoundOn;
     232                 :            :     String      maSound;
     233                 :            :     bool        mbLoopSound;
     234                 :            :     bool        mbStopSound;
     235                 :            : 
     236                 :            :     bool mbEffectAmbiguous;
     237                 :            :     bool mbDurationAmbiguous;
     238                 :            :     bool mbTimeAmbiguous;
     239                 :            :     bool mbPresChangeAmbiguous;
     240                 :            :     bool mbSoundAmbiguous;
     241                 :            :     bool mbLoopSoundAmbiguous;
     242                 :            : };
     243                 :            : 
     244                 :            : } // namespace impl
     245                 :            : } // namespace sd
     246                 :            : 
     247                 :            : // ______________________
     248                 :            : //
     249                 :            : // Local Helper Functions
     250                 :            : // ______________________
     251                 :            : 
     252                 :            : namespace
     253                 :            : {
     254                 :            : 
     255                 :          0 : void lcl_ApplyToPages(
     256                 :            :     const ::sd::slidesorter::SharedPageSelection& rpPages,
     257                 :            :     const ::sd::impl::TransitionEffect & rEffect )
     258                 :            : {
     259         [ #  # ]:          0 :     ::std::vector< SdPage * >::const_iterator aIt( rpPages->begin());
     260         [ #  # ]:          0 :     const ::std::vector< SdPage * >::const_iterator aEndIt( rpPages->end());
     261 [ #  # ][ #  # ]:          0 :     for( ; aIt != aEndIt; ++aIt )
     262                 :            :     {
     263         [ #  # ]:          0 :         rEffect.applyTo( *(*aIt) );
     264                 :            :     }
     265                 :          0 : }
     266                 :            : 
     267                 :          0 : void lcl_CreateUndoForPages(
     268                 :            :     const ::sd::slidesorter::SharedPageSelection& rpPages,
     269                 :            :     ::sd::ViewShellBase& rBase )
     270                 :            : {
     271                 :          0 :     ::sd::DrawDocShell* pDocSh      = rBase.GetDocShell();
     272                 :          0 :     ::svl::IUndoManager* pManager   = pDocSh->GetUndoManager();
     273                 :          0 :     SdDrawDocument* pDoc            = pDocSh->GetDoc();
     274 [ #  # ][ #  # ]:          0 :     if( pManager && pDocSh && pDoc )
                 [ #  # ]
     275                 :            :     {
     276 [ #  # ][ #  # ]:          0 :         String aComment( SdResId(STR_UNDO_SLIDE_PARAMS) );
     277         [ #  # ]:          0 :         pManager->EnterListAction(aComment, aComment);
     278 [ #  # ][ #  # ]:          0 :         SdUndoGroup* pUndoGroup = new SdUndoGroup( pDoc );
     279         [ #  # ]:          0 :         pUndoGroup->SetComment( aComment );
     280                 :            : 
     281         [ #  # ]:          0 :         ::std::vector< SdPage * >::const_iterator aIt( rpPages->begin());
     282         [ #  # ]:          0 :         const ::std::vector< SdPage * >::const_iterator aEndIt( rpPages->end());
     283 [ #  # ][ #  # ]:          0 :         for( ; aIt != aEndIt; ++aIt )
     284                 :            :         {
     285 [ #  # ][ #  # ]:          0 :             pUndoGroup->AddAction( new sd::UndoTransition( pDoc, (*aIt) ) );
                 [ #  # ]
     286                 :            :         }
     287                 :            : 
     288         [ #  # ]:          0 :         pManager->AddUndoAction( pUndoGroup );
     289 [ #  # ][ #  # ]:          0 :         pManager->LeaveListAction();
     290                 :            :     }
     291                 :          0 : }
     292                 :            : 
     293                 :          0 : sal_uInt16 lcl_getTransitionEffectIndex(
     294                 :            :     SdDrawDocument * pDoc,
     295                 :            :     const ::sd::impl::TransitionEffect & rTransition )
     296                 :            : {
     297                 :            :     // first entry: "<none>"
     298                 :          0 :     sal_uInt16 nResultIndex = LISTBOX_ENTRY_NOTFOUND;
     299                 :            : 
     300         [ #  # ]:          0 :     if( pDoc )
     301                 :            :     {
     302                 :          0 :         sal_uInt16 nCurrentIndex = 0;
     303         [ #  # ]:          0 :         const ::sd::TransitionPresetList & rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
     304                 :          0 :         ::sd::TransitionPresetList::const_iterator aIt( rPresetList.begin());
     305                 :          0 :         const ::sd::TransitionPresetList::const_iterator aEndIt( rPresetList.end());
     306         [ #  # ]:          0 :         for( ; aIt != aEndIt; ++aIt, ++nCurrentIndex )
     307                 :            :         {
     308         [ #  # ]:          0 :             if( rTransition.operator==( *(*aIt) ))
     309                 :            :             {
     310                 :          0 :                 nResultIndex = nCurrentIndex;
     311                 :          0 :                 break;
     312                 :            :             }
     313                 :            :         }
     314                 :            :     }
     315                 :            : 
     316                 :          0 :     return nResultIndex;
     317                 :            : }
     318                 :            : 
     319                 :          0 : ::sd::TransitionPresetPtr lcl_getTransitionPresetByUIName(
     320                 :            :     SdDrawDocument * pDoc,
     321                 :            :     const OUString & rUIName )
     322                 :            : {
     323                 :          0 :     ::sd::TransitionPresetPtr pResult;
     324         [ #  # ]:          0 :     if( pDoc )
     325                 :            :     {
     326         [ #  # ]:          0 :         const ::sd::TransitionPresetList& rPresetList = ::sd::TransitionPreset::getTransitionPresetList();
     327                 :          0 :         ::sd::TransitionPresetList::const_iterator aIter( rPresetList.begin() );
     328                 :          0 :         const ::sd::TransitionPresetList::const_iterator aEnd( rPresetList.end() );
     329         [ #  # ]:          0 :         for( ; aIter != aEnd; ++aIter )
     330                 :            :         {
     331         [ #  # ]:          0 :             if( (*aIter)->getUIName().equals( rUIName ))
     332                 :            :             {
     333         [ #  # ]:          0 :                 pResult = *aIter;
     334                 :          0 :                 break;
     335                 :            :             }
     336                 :            :         }
     337                 :            :     }
     338                 :            : 
     339                 :          0 :     return pResult;
     340                 :            : }
     341                 :            : 
     342                 :          0 : struct lcl_EqualsSoundFileName : public ::std::unary_function< String, bool >
     343                 :            : {
     344                 :          0 :     explicit lcl_EqualsSoundFileName( const String & rStr ) :
     345                 :          0 :             maStr( rStr )
     346                 :          0 :     {}
     347                 :            : 
     348                 :          0 :     bool operator() ( const String & rStr ) const
     349                 :            :     {
     350                 :            :         // note: formerly this was a case insensitive search for all
     351                 :            :         // platforms. It seems more sensible to do this platform-dependent
     352                 :            : #if defined( WNT )
     353                 :            :         return maStr.EqualsIgnoreCaseAscii( rStr );
     354                 :            : #else
     355                 :          0 :         return maStr.Equals( rStr );
     356                 :            : #endif
     357                 :            :     }
     358                 :            : 
     359                 :            : private:
     360                 :            :     String maStr;
     361                 :            : };
     362                 :            : 
     363                 :            : // returns -1 if no object was found
     364                 :          0 : bool lcl_findSoundInList( const ::std::vector< String > & rSoundList,
     365                 :            :                           const String & rFileName,
     366                 :            :                           ::std::vector< String >::size_type & rOutPosition )
     367                 :            : {
     368                 :            :     ::std::vector< String >::const_iterator aIt =
     369                 :            :           ::std::find_if( rSoundList.begin(), rSoundList.end(),
     370 [ #  # ][ #  # ]:          0 :                           lcl_EqualsSoundFileName( rFileName ));
                 [ #  # ]
     371 [ #  # ][ #  # ]:          0 :     if( aIt != rSoundList.end())
     372                 :            :     {
     373         [ #  # ]:          0 :         rOutPosition = ::std::distance( rSoundList.begin(), aIt );
     374                 :          0 :         return true;
     375                 :            :     }
     376                 :            : 
     377                 :          0 :     return false;
     378                 :            : }
     379                 :            : 
     380                 :          0 : String lcl_getSoundFileURL(
     381                 :            :     const ::std::vector< String > & rSoundList,
     382                 :            :     const ListBox & rListBox )
     383                 :            : {
     384                 :          0 :     String aResult;
     385                 :            : 
     386 [ #  # ][ #  # ]:          0 :     if( rListBox.GetSelectEntryCount() > 0 )
     387                 :            :     {
     388         [ #  # ]:          0 :         sal_uInt16 nPos = rListBox.GetSelectEntryPos();
     389                 :            :         // the first three entries are no actual sounds
     390         [ #  # ]:          0 :         if( nPos >= 3 )
     391                 :            :         {
     392                 :            :             DBG_ASSERT( (sal_uInt32)(rListBox.GetEntryCount() - 3) == rSoundList.size(),
     393                 :            :                         "Sound list-box is not synchronized to sound list" );
     394                 :          0 :             nPos -= 3;
     395         [ #  # ]:          0 :             if( rSoundList.size() > nPos )
     396 [ #  # ][ #  # ]:          0 :                 aResult = rSoundList[ nPos ];
     397                 :            :         }
     398                 :            :     }
     399                 :            : 
     400                 :          0 :     return aResult;
     401                 :            : }
     402                 :            : 
     403                 :            : struct lcl_AppendSoundToListBox : public ::std::unary_function< String, void >
     404                 :            : {
     405                 :          0 :     lcl_AppendSoundToListBox( ListBox & rListBox ) :
     406                 :          0 :             mrListBox( rListBox )
     407                 :          0 :     {}
     408                 :            : 
     409                 :          0 :     void operator() ( const String & rString ) const
     410                 :            :     {
     411 [ #  # ][ #  # ]:          0 :         INetURLObject aURL( rString );
     412 [ #  # ][ #  # ]:          0 :         mrListBox.InsertEntry( aURL.GetBase(), LISTBOX_APPEND );
         [ #  # ][ #  # ]
                 [ #  # ]
     413                 :          0 :     }
     414                 :            : 
     415                 :            : private:
     416                 :            :     ListBox & mrListBox;
     417                 :            : };
     418                 :            : 
     419                 :          0 : void lcl_FillSoundListBox(
     420                 :            :     const ::std::vector< String > & rSoundList,
     421                 :            :     ListBox & rOutListBox )
     422                 :            : {
     423                 :          0 :     sal_uInt16 nCount = rOutListBox.GetEntryCount();
     424                 :            : 
     425                 :            :     // keep first three entries
     426         [ #  # ]:          0 :     for( sal_uInt16 i=nCount - 1; i>=3; --i )
     427                 :          0 :         rOutListBox.RemoveEntry( i );
     428                 :            : 
     429                 :            :     ::std::for_each( rSoundList.begin(), rSoundList.end(),
     430         [ #  # ]:          0 :                      lcl_AppendSoundToListBox( rOutListBox ));
     431                 :          0 : }
     432                 :            : 
     433                 :            : } // anonymous namespace
     434                 :            : 
     435                 :            : namespace sd
     436                 :            : {
     437                 :            : 
     438                 :            : // ___________________
     439                 :            : //
     440                 :            : // SlideTransitionPane
     441                 :            : // ___________________
     442                 :            : 
     443                 :          0 : SlideTransitionPane::SlideTransitionPane(
     444                 :            :     ::Window * pParent,
     445                 :            :     ViewShellBase & rBase,
     446                 :            :     const Size& rMinSize,
     447                 :            :     SdDrawDocument* pDoc ) :
     448                 :            :         Control( pParent, SdResId( DLG_SLIDE_TRANSITION_PANE ) ),
     449                 :            : 
     450                 :            :         mrBase( rBase ),
     451                 :            :         mpDrawDoc( pDoc ),
     452                 :            :         maMinSize( rMinSize ),
     453                 :            :         maFL_APPLY_TRANSITION( this, SdResId( FL_APPLY_TRANSITION ) ),
     454                 :            :         maLB_SLIDE_TRANSITIONS( this, SdResId( LB_SLIDE_TRANSITIONS ) ),
     455                 :            :         maFL_MODIFY_TRANSITION( this, SdResId( FL_MODIFY_TRANSITION ) ),
     456                 :            :         maFT_SPEED( this, SdResId( FT_SPEED ) ),
     457                 :            :         maLB_SPEED( this, SdResId( LB_SPEED ) ),
     458                 :            :         maFT_SOUND( this, SdResId( FT_SOUND ) ),
     459                 :            :         maLB_SOUND( this, SdResId( LB_SOUND ) ),
     460                 :            :         maCB_LOOP_SOUND( this, SdResId( CB_LOOP_SOUND ) ),
     461                 :            :         maFL_ADVANCE_SLIDE( this, SdResId( FL_ADVANCE_SLIDE ) ),
     462                 :            :         maRB_ADVANCE_ON_MOUSE( this, SdResId( RB_ADVANCE_ON_MOUSE ) ),
     463                 :            :         maRB_ADVANCE_AUTO( this, SdResId( RB_ADVANCE_AUTO ) ),
     464                 :            :         maMF_ADVANCE_AUTO_AFTER( this, SdResId( MF_ADVANCE_AUTO_AFTER ) ),
     465                 :            :         maFL_EMPTY1( this, SdResId( FL_EMPTY1 ) ),
     466                 :            :         maPB_APPLY_TO_ALL( this, SdResId( PB_APPLY_TO_ALL ) ),
     467                 :            :         maPB_PLAY( this, SdResId( PB_PLAY ) ),
     468                 :            :         maPB_SLIDE_SHOW( this, SdResId( PB_SLIDE_SHOW ) ),
     469                 :            :         maFL_EMPTY2( this, SdResId( FL_EMPTY2 ) ),
     470                 :            :         maCB_AUTO_PREVIEW( this, SdResId( CB_AUTO_PREVIEW ) ),
     471                 :            : 
     472                 :            :         maSTR_NO_TRANSITION( SdResId( STR_NO_TRANSITION ) ),
     473                 :            :         mbHasSelection( false ),
     474                 :            :         mbUpdatingControls( false ),
     475                 :            :         mbIsMainViewChangePending( false ),
     476 [ #  # ][ #  # ]:          0 :         maLateInitTimer()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     477                 :            : {
     478                 :            :     // use no resource ids from here on
     479         [ #  # ]:          0 :     FreeResource();
     480                 :            : 
     481                 :            :     // use bold font for group headings (same font for all fixed lines):
     482         [ #  # ]:          0 :     Font font( maFL_APPLY_TRANSITION.GetFont() );
     483         [ #  # ]:          0 :     font.SetWeight( WEIGHT_BOLD );
     484         [ #  # ]:          0 :     maFL_APPLY_TRANSITION.SetFont( font );
     485         [ #  # ]:          0 :     maFL_MODIFY_TRANSITION.SetFont( font );
     486         [ #  # ]:          0 :     maFL_ADVANCE_SLIDE.SetFont( font );
     487                 :            : 
     488         [ #  # ]:          0 :     if( pDoc )
     489 [ #  # ][ #  # ]:          0 :         mxModel.set( pDoc->getUnoModel(), uno::UNO_QUERY );
     490                 :            :     // TODO: get correct view
     491         [ #  # ]:          0 :     if( mxModel.is())
     492 [ #  # ][ #  # ]:          0 :         mxView.set( mxModel->getCurrentController(), uno::UNO_QUERY );
                 [ #  # ]
     493                 :            : 
     494                 :            :     // fill list box of slide transitions
     495         [ #  # ]:          0 :     maLB_SLIDE_TRANSITIONS.InsertEntry( maSTR_NO_TRANSITION );
     496                 :            : 
     497                 :            :     // set defaults
     498         [ #  # ]:          0 :     maCB_AUTO_PREVIEW.Check();      // automatic preview on
     499                 :            : 
     500                 :            :     // update control states before adding handlers
     501         [ #  # ]:          0 :     updateLayout();
     502         [ #  # ]:          0 :     updateControls();
     503                 :            : 
     504                 :            :     // set handlers
     505         [ #  # ]:          0 :     maPB_APPLY_TO_ALL.SetClickHdl( LINK( this, SlideTransitionPane, ApplyToAllButtonClicked ));
     506         [ #  # ]:          0 :     maPB_PLAY.SetClickHdl( LINK( this, SlideTransitionPane, PlayButtonClicked ));
     507         [ #  # ]:          0 :     maPB_SLIDE_SHOW.SetClickHdl( LINK( this, SlideTransitionPane, SlideShowButtonClicked ));
     508                 :            : 
     509         [ #  # ]:          0 :     maLB_SLIDE_TRANSITIONS.SetSelectHdl( LINK( this, SlideTransitionPane, TransitionSelected ));
     510                 :            : 
     511         [ #  # ]:          0 :     maLB_SPEED.SetSelectHdl( LINK( this, SlideTransitionPane, SpeedListBoxSelected ));
     512         [ #  # ]:          0 :     maLB_SOUND.SetSelectHdl( LINK( this, SlideTransitionPane, SoundListBoxSelected ));
     513         [ #  # ]:          0 :     maCB_LOOP_SOUND.SetClickHdl( LINK( this, SlideTransitionPane, LoopSoundBoxChecked ));
     514                 :            : 
     515         [ #  # ]:          0 :     maRB_ADVANCE_ON_MOUSE.SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled ));
     516         [ #  # ]:          0 :     maRB_ADVANCE_AUTO.SetToggleHdl( LINK( this, SlideTransitionPane, AdvanceSlideRadioButtonToggled ));
     517         [ #  # ]:          0 :     maMF_ADVANCE_AUTO_AFTER.SetModifyHdl( LINK( this, SlideTransitionPane, AdvanceTimeModified ));
     518         [ #  # ]:          0 :     maCB_AUTO_PREVIEW.SetClickHdl( LINK( this, SlideTransitionPane, AutoPreviewClicked ));
     519         [ #  # ]:          0 :     addListener();
     520                 :            : 
     521         [ #  # ]:          0 :     maLateInitTimer.SetTimeout(200);
     522         [ #  # ]:          0 :     maLateInitTimer.SetTimeoutHdl(LINK(this, SlideTransitionPane, LateInitCallback));
     523 [ #  # ][ #  # ]:          0 :     maLateInitTimer.Start();
     524                 :          0 : }
     525                 :            : 
     526 [ #  # ][ #  # ]:          0 : SlideTransitionPane::~SlideTransitionPane()
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     527                 :            : {
     528         [ #  # ]:          0 :     maLateInitTimer.Stop();
     529         [ #  # ]:          0 :     removeListener();
     530         [ #  # ]:          0 : }
     531                 :            : 
     532                 :          0 : void SlideTransitionPane::Resize()
     533                 :            : {
     534                 :          0 :     updateLayout();
     535                 :          0 : }
     536                 :            : 
     537                 :          0 : void SlideTransitionPane::onSelectionChanged()
     538                 :            : {
     539                 :          0 :     updateControls();
     540                 :          0 : }
     541                 :            : 
     542                 :          0 : void SlideTransitionPane::onChangeCurrentPage()
     543                 :            : {
     544                 :          0 :     updateControls();
     545                 :          0 : }
     546                 :            : 
     547                 :          0 : ::sd::slidesorter::SharedPageSelection SlideTransitionPane::getSelectedPages (void) const
     548                 :            : {
     549                 :            :     ::sd::slidesorter::SlideSorterViewShell * pSlideSorterViewShell
     550                 :          0 :         = ::sd::slidesorter::SlideSorterViewShell::GetSlideSorter(mrBase);
     551                 :          0 :     ::boost::shared_ptr<sd::slidesorter::SlideSorterViewShell::PageSelection> pSelection;
     552                 :            : 
     553         [ #  # ]:          0 :     if( pSlideSorterViewShell )
     554                 :            :     {
     555 [ #  # ][ #  # ]:          0 :         pSelection = pSlideSorterViewShell->GetPageSelection();
                 [ #  # ]
     556                 :            :     }
     557                 :            :     else
     558                 :            :     {
     559 [ #  # ][ #  # ]:          0 :         pSelection.reset(new sd::slidesorter::SlideSorterViewShell::PageSelection());
                 [ #  # ]
     560         [ #  # ]:          0 :         if( mxView.is() )
     561                 :            :         {
     562 [ #  # ][ #  # ]:          0 :             SdPage* pPage = SdPage::getImplementation( mxView->getCurrentPage() );
                 [ #  # ]
     563         [ #  # ]:          0 :             if( pPage )
     564         [ #  # ]:          0 :                 pSelection->push_back(pPage);
     565                 :            :         }
     566                 :            :     }
     567                 :            : 
     568                 :          0 :     return pSelection;
     569                 :            : }
     570                 :            : 
     571                 :          0 : void SlideTransitionPane::updateLayout()
     572                 :            : {
     573         [ #  # ]:          0 :     ::Size aPaneSize( GetSizePixel() );
     574         [ #  # ]:          0 :     if( aPaneSize.Width() < maMinSize.Width() )
     575                 :          0 :         aPaneSize.Width() = maMinSize.Width();
     576                 :            : 
     577         [ #  # ]:          0 :     if( aPaneSize.Height() < maMinSize.Height() )
     578                 :          0 :         aPaneSize.Height() = maMinSize.Height();
     579                 :            : 
     580                 :            :     // start layouting elements from bottom to top.  The remaining space is used
     581                 :            :     // for the topmost list box
     582 [ #  # ][ #  # ]:          0 :     ::Point aOffset( LogicToPixel( Point( 3, 3 ), MAP_APPFONT ) );
                 [ #  # ]
     583                 :          0 :     long nOffsetX = aOffset.getX();
     584                 :          0 :     long nOffsetY = aOffset.getY();
     585 [ #  # ][ #  # ]:          0 :     long nOffsetBtnX = LogicToPixel( Point( 6, 1 ), MAP_APPFONT ).getX();
                 [ #  # ]
     586                 :            : 
     587 [ #  # ][ #  # ]:          0 :     const long nMinCtrlWidth = LogicToPixel( ::Point( 32, 1 ), MAP_APPFONT ).getX();
                 [ #  # ]
     588 [ #  # ][ #  # ]:          0 :     const long nTextIndent = LogicToPixel( ::Point( RSC_SP_CHK_TEXTINDENT, 1 ), MAP_APPFONT ).getX();
                 [ #  # ]
     589                 :            : 
     590                 :          0 :     ::Point aUpperLeft( nOffsetX, aPaneSize.getHeight() - nOffsetY );
     591                 :          0 :     long nMaxWidth = aPaneSize.getWidth() - 2 * nOffsetX;
     592                 :            : 
     593                 :            :     // auto preview check-box
     594         [ #  # ]:          0 :     ::Size aCtrlSize = maCB_AUTO_PREVIEW.GetSizePixel();
     595         [ #  # ]:          0 :     aCtrlSize.setWidth( maCB_AUTO_PREVIEW.CalcMinimumSize( nMaxWidth ).getWidth());
     596                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     597         [ #  # ]:          0 :     maCB_AUTO_PREVIEW.SetPosSizePixel( aUpperLeft, aCtrlSize );
     598                 :            : 
     599                 :            :     // fixed line above check-box
     600         [ #  # ]:          0 :     aCtrlSize = maFL_EMPTY2.GetSizePixel();
     601                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     602                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     603         [ #  # ]:          0 :     maFL_EMPTY2.SetPosSizePixel( aUpperLeft, aCtrlSize );
     604                 :            : 
     605                 :            :     // buttons "Play" and "Slide Show"
     606         [ #  # ]:          0 :     long nPlayButtonWidth = maPB_PLAY.CalcMinimumSize().getWidth() + 2 * nOffsetBtnX;
     607         [ #  # ]:          0 :     long nSlideShowButtonWidth = maPB_SLIDE_SHOW.CalcMinimumSize().getWidth() + 2 * nOffsetBtnX;
     608                 :            : 
     609         [ #  # ]:          0 :     if( (nPlayButtonWidth + nSlideShowButtonWidth + nOffsetX) <= nMaxWidth )
     610                 :            :     {
     611                 :            :         // place buttons side by side
     612         [ #  # ]:          0 :         aCtrlSize = maPB_PLAY.GetSizePixel();
     613                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     614                 :          0 :         aCtrlSize.setWidth( nPlayButtonWidth );
     615         [ #  # ]:          0 :         maPB_PLAY.SetPosSizePixel( aUpperLeft, aCtrlSize );
     616                 :            : 
     617                 :          0 :         aUpperLeft.setX( aUpperLeft.getX() + nPlayButtonWidth + nOffsetX );
     618                 :          0 :         aCtrlSize.setWidth( nSlideShowButtonWidth );
     619         [ #  # ]:          0 :         maPB_SLIDE_SHOW.SetPosSizePixel( aUpperLeft, aCtrlSize );
     620                 :          0 :         aUpperLeft.setX( nOffsetX );
     621                 :            :     }
     622                 :            :     else
     623                 :            :     {
     624                 :            :         // place buttons on top of each other
     625         [ #  # ]:          0 :         aCtrlSize = maPB_SLIDE_SHOW.GetSizePixel();
     626                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     627                 :          0 :         aCtrlSize.setWidth( nSlideShowButtonWidth );
     628         [ #  # ]:          0 :         maPB_SLIDE_SHOW.SetPosSizePixel( aUpperLeft, aCtrlSize );
     629                 :            : 
     630         [ #  # ]:          0 :         aCtrlSize = maPB_PLAY.GetSizePixel();
     631                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     632                 :          0 :         aCtrlSize.setWidth( nPlayButtonWidth );
     633         [ #  # ]:          0 :         maPB_PLAY.SetPosSizePixel( aUpperLeft, aCtrlSize );
     634                 :            :     }
     635                 :            : 
     636                 :            :     // "Apply to All Slides" button
     637         [ #  # ]:          0 :     aCtrlSize = maPB_APPLY_TO_ALL.GetSizePixel();
     638         [ #  # ]:          0 :     aCtrlSize.setWidth( maPB_APPLY_TO_ALL.CalcMinimumSize( nMaxWidth ).getWidth() + 2 * nOffsetBtnX );
     639                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     640         [ #  # ]:          0 :     maPB_APPLY_TO_ALL.SetPosSizePixel( aUpperLeft, aCtrlSize );
     641                 :            : 
     642                 :            :     // fixed line above "Apply to All Slides" button
     643         [ #  # ]:          0 :     aCtrlSize = maFL_EMPTY1.GetSizePixel();
     644                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     645                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     646         [ #  # ]:          0 :     maFL_EMPTY1.SetPosSizePixel( aUpperLeft, aCtrlSize );
     647                 :            : 
     648                 :            :     // advance automatically after ... seconds
     649         [ #  # ]:          0 :     long nItemWidth = maRB_ADVANCE_AUTO.CalcMinimumSize().getWidth();
     650                 :            : 
     651         [ #  # ]:          0 :     if( (nItemWidth + nMinCtrlWidth + nOffsetX) <= nMaxWidth )
     652                 :            :     {
     653                 :          0 :         long nBase = aUpperLeft.getY();
     654                 :            : 
     655                 :            :         // place controls side by side
     656         [ #  # ]:          0 :         aCtrlSize = maRB_ADVANCE_AUTO.GetSizePixel();
     657                 :          0 :         aUpperLeft.setY( nBase - aCtrlSize.getHeight());
     658                 :          0 :         aCtrlSize.setWidth( nItemWidth );
     659         [ #  # ]:          0 :         maRB_ADVANCE_AUTO.SetPosSizePixel( aUpperLeft, aCtrlSize );
     660                 :            : 
     661         [ #  # ]:          0 :         aCtrlSize = maMF_ADVANCE_AUTO_AFTER.GetSizePixel();
     662                 :          0 :         aUpperLeft.setY( nBase - aCtrlSize.getHeight() );
     663                 :          0 :         aUpperLeft.setX( aUpperLeft.getX() + nItemWidth + nOffsetX );
     664                 :          0 :         aCtrlSize.setWidth( nMinCtrlWidth );
     665         [ #  # ]:          0 :         maMF_ADVANCE_AUTO_AFTER.SetPosSizePixel( aUpperLeft, aCtrlSize );
     666                 :          0 :         aUpperLeft.setX( nOffsetX );
     667                 :            :     }
     668                 :            :     else
     669                 :            :     {
     670                 :            :         // place controls on top of each other
     671         [ #  # ]:          0 :         aCtrlSize = maMF_ADVANCE_AUTO_AFTER.GetSizePixel();
     672                 :          0 :         aUpperLeft.setX( nOffsetX + nTextIndent );
     673                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     674                 :          0 :         aCtrlSize.setWidth( nMinCtrlWidth );
     675         [ #  # ]:          0 :         maMF_ADVANCE_AUTO_AFTER.SetPosSizePixel( aUpperLeft, aCtrlSize );
     676                 :            : 
     677         [ #  # ]:          0 :         aCtrlSize = maRB_ADVANCE_AUTO.GetSizePixel();
     678                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     679                 :          0 :         aUpperLeft.setX( nOffsetX );
     680                 :          0 :         aCtrlSize.setWidth( nItemWidth );
     681         [ #  # ]:          0 :         maRB_ADVANCE_AUTO.SetPosSizePixel( aUpperLeft, aCtrlSize );
     682                 :          0 :         aUpperLeft.setX( nOffsetX );
     683                 :            :     }
     684                 :            : 
     685                 :            :     // check box "On mouse click"
     686         [ #  # ]:          0 :     aCtrlSize = maRB_ADVANCE_ON_MOUSE.GetSizePixel();
     687                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     688                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     689         [ #  # ]:          0 :     maRB_ADVANCE_ON_MOUSE.SetPosSizePixel( aUpperLeft, aCtrlSize );
     690                 :            : 
     691                 :            :     // fixed line "Advance slide"
     692         [ #  # ]:          0 :     aCtrlSize = maFL_ADVANCE_SLIDE.GetSizePixel();
     693                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     694                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     695         [ #  # ]:          0 :     maFL_ADVANCE_SLIDE.SetPosSizePixel( aUpperLeft, aCtrlSize );
     696                 :            : 
     697                 :            :     // check box "Loop until next sound"
     698         [ #  # ]:          0 :     long nFTSpeedWidth = maFT_SPEED.CalcMinimumSize().getWidth() + 2 * nOffsetX;
     699         [ #  # ]:          0 :     long nFTSoundWidth = maFT_SOUND.CalcMinimumSize().getWidth() + 2 * nOffsetX;
     700         [ #  # ]:          0 :     long nIndent = ::std::max( nFTSoundWidth, nFTSpeedWidth );
     701                 :            : 
     702                 :          0 :     bool bStack = ( (nIndent + nMinCtrlWidth + nOffsetX) > nMaxWidth );
     703                 :            : 
     704         [ #  # ]:          0 :     if( bStack )
     705                 :          0 :         nIndent = nTextIndent;
     706                 :            : 
     707         [ #  # ]:          0 :     aCtrlSize = maCB_LOOP_SOUND.GetSizePixel();
     708                 :          0 :     aCtrlSize.setWidth( nMaxWidth - nIndent );
     709                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     710                 :          0 :     aUpperLeft.setX( nIndent );
     711         [ #  # ]:          0 :     maCB_LOOP_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
     712                 :            : 
     713         [ #  # ]:          0 :     aCtrlSize = maLB_SOUND.GetSizePixel();
     714         [ #  # ]:          0 :     aCtrlSize.setWidth( ::std::max( nMaxWidth - nIndent, nMinCtrlWidth ) );
     715                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     716         [ #  # ]:          0 :     maLB_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
     717         [ #  # ]:          0 :     maLB_SOUND.SetDropDownLineCount( 8 );
     718                 :          0 :     aUpperLeft.setX( nOffsetX );
     719                 :            : 
     720         [ #  # ]:          0 :     aCtrlSize = maFT_SOUND.GetSizePixel();
     721         [ #  # ]:          0 :     if( bStack )
     722                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     723                 :          0 :     aCtrlSize.setWidth( nFTSoundWidth - 2 * nOffsetX );
     724         [ #  # ]:          0 :     maFT_SOUND.SetPosSizePixel( aUpperLeft, aCtrlSize );
     725                 :            : 
     726                 :          0 :     aUpperLeft.setX( nIndent );
     727         [ #  # ]:          0 :     aCtrlSize = maLB_SPEED.GetSizePixel();
     728         [ #  # ]:          0 :     aCtrlSize.setWidth( ::std::max( nMaxWidth - nIndent, nMinCtrlWidth ) );
     729                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     730         [ #  # ]:          0 :     maLB_SPEED.SetPosSizePixel( aUpperLeft, aCtrlSize );
     731         [ #  # ]:          0 :     maLB_SPEED.SetDropDownLineCount( 3 );
     732                 :          0 :     aUpperLeft.setX( nOffsetX );
     733                 :            : 
     734         [ #  # ]:          0 :     aCtrlSize = maFT_SPEED.GetSizePixel();
     735         [ #  # ]:          0 :     if( bStack )
     736                 :          0 :         aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight());
     737                 :          0 :     aCtrlSize.setWidth( nFTSpeedWidth - 2 * nOffsetX );
     738         [ #  # ]:          0 :     maFT_SPEED.SetPosSizePixel( aUpperLeft, aCtrlSize );
     739                 :            : 
     740                 :            :     // fixed line "Modify Transition"
     741         [ #  # ]:          0 :     aCtrlSize = maFL_MODIFY_TRANSITION.GetSizePixel();
     742                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     743                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - aCtrlSize.getHeight() - nOffsetY );
     744         [ #  # ]:          0 :     maFL_MODIFY_TRANSITION.SetPosSizePixel( aUpperLeft, aCtrlSize );
     745                 :            : 
     746                 :            :     // fixed line "Apply to selected slides"
     747         [ #  # ]:          0 :     aCtrlSize = maFL_APPLY_TRANSITION.GetSizePixel();
     748                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     749                 :          0 :     ::Point aUpperLeftCorner( nOffsetX, nOffsetY );
     750         [ #  # ]:          0 :     maFL_APPLY_TRANSITION.SetPosSizePixel( aUpperLeftCorner, aCtrlSize );
     751                 :          0 :     aUpperLeftCorner.setY( aUpperLeftCorner.getY() + aCtrlSize.getHeight() + nOffsetY );
     752                 :          0 :     aUpperLeft.setY( aUpperLeft.getY() - nOffsetY );
     753                 :            : 
     754                 :            :     // list box slide transitions
     755                 :          0 :     aCtrlSize.setWidth( nMaxWidth );
     756                 :          0 :     aCtrlSize.setHeight( aUpperLeft.getY() - aUpperLeftCorner.getY() );
     757         [ #  # ]:          0 :     maLB_SLIDE_TRANSITIONS.SetPosSizePixel( aUpperLeftCorner, aCtrlSize );
     758                 :          0 : }
     759                 :            : 
     760                 :          0 : void SlideTransitionPane::updateControls()
     761                 :            : {
     762         [ #  # ]:          0 :     ::sd::slidesorter::SharedPageSelection pSelectedPages(getSelectedPages());
     763         [ #  # ]:          0 :     if( pSelectedPages->empty())
     764                 :            :     {
     765                 :          0 :         mbHasSelection = false;
     766                 :          0 :         return;
     767                 :            :     }
     768                 :          0 :     mbHasSelection = true;
     769                 :            : 
     770                 :            :     DBG_ASSERT( ! mbUpdatingControls, "Multiple Control Updates" );
     771                 :          0 :     mbUpdatingControls = true;
     772                 :            : 
     773                 :            :     // get model data for first page
     774         [ #  # ]:          0 :     SdPage * pFirstPage = pSelectedPages->front();
     775                 :            :     DBG_ASSERT( pFirstPage, "Invalid Page" );
     776                 :            : 
     777         [ #  # ]:          0 :     impl::TransitionEffect aEffect( *pFirstPage );
     778                 :            : 
     779                 :            :     // merge with other pages
     780                 :            :     ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aIt(
     781         [ #  # ]:          0 :         pSelectedPages->begin());
     782                 :            :     ::sd::slidesorter::SlideSorterViewShell::PageSelection::const_iterator aEndIt(
     783         [ #  # ]:          0 :         pSelectedPages->end());
     784                 :            : 
     785                 :            :     // start with second page (note aIt != aEndIt, because ! aSelectedPages.empty())
     786 [ #  # ][ #  # ]:          0 :     for( ++aIt ;aIt != aEndIt; ++aIt )
     787                 :            :     {
     788         [ #  # ]:          0 :         if( *aIt )
     789         [ #  # ]:          0 :             aEffect.compareWith( *(*aIt) );
     790                 :            :     }
     791                 :            : 
     792                 :            :     // detect current slide effect
     793         [ #  # ]:          0 :     if( aEffect.mbEffectAmbiguous )
     794         [ #  # ]:          0 :         maLB_SLIDE_TRANSITIONS.SetNoSelection();
     795                 :            :     else
     796                 :            :     {
     797                 :            :         // ToDo: That 0 is "no transition" is documented nowhere except in the
     798                 :            :         // CTOR of sdpage
     799         [ #  # ]:          0 :         if( aEffect.mnType == 0 )
     800         [ #  # ]:          0 :             maLB_SLIDE_TRANSITIONS.SelectEntryPos( 0 );
     801                 :            :         else
     802                 :            :         {
     803         [ #  # ]:          0 :             sal_uInt16 nEntry = lcl_getTransitionEffectIndex( mpDrawDoc, aEffect );
     804         [ #  # ]:          0 :             if( nEntry == LISTBOX_ENTRY_NOTFOUND )
     805         [ #  # ]:          0 :                 maLB_SLIDE_TRANSITIONS.SetNoSelection();
     806                 :            :             else
     807                 :            :             {
     808                 :            :                 // first entry in list is "none", so add 1 after translation
     809 [ #  # ][ #  # ]:          0 :                 if( m_aPresetIndexes.find( nEntry ) != m_aPresetIndexes.end())
                 [ #  # ]
     810 [ #  # ][ #  # ]:          0 :                     maLB_SLIDE_TRANSITIONS.SelectEntryPos( m_aPresetIndexes[ nEntry ] + 1 );
     811                 :            :                 else
     812         [ #  # ]:          0 :                     maLB_SLIDE_TRANSITIONS.SetNoSelection();
     813                 :            :             }
     814                 :            :         }
     815                 :            :     }
     816                 :            : 
     817         [ #  # ]:          0 :     if( aEffect.mbDurationAmbiguous )
     818         [ #  # ]:          0 :         maLB_SPEED.SetNoSelection();
     819                 :            :     else
     820                 :            :         maLB_SPEED.SelectEntryPos(
     821                 :            :             (aEffect.mfDuration > 2.0 )
     822                 :            :             ? 0 : (aEffect.mfDuration < 2.0)
     823 [ #  # ][ #  # ]:          0 :             ? 2 : 1 );       // else FADE_SPEED_FAST
                 [ #  # ]
     824                 :            : 
     825         [ #  # ]:          0 :     if( aEffect.mbSoundAmbiguous )
     826                 :            :     {
     827         [ #  # ]:          0 :         maLB_SOUND.SetNoSelection();
     828         [ #  # ]:          0 :         maCurrentSoundFile.Erase();
     829                 :            :     }
     830                 :            :     else
     831                 :            :     {
     832         [ #  # ]:          0 :         maCurrentSoundFile.Erase();
     833         [ #  # ]:          0 :         if( aEffect.mbStopSound )
     834                 :            :         {
     835         [ #  # ]:          0 :             maLB_SOUND.SelectEntryPos( 1 );
     836                 :            :         }
     837 [ #  # ][ #  # ]:          0 :         else if( aEffect.mbSoundOn && aEffect.maSound.Len() > 0 )
                 [ #  # ]
     838                 :            :         {
     839                 :          0 :             tSoundListType::size_type nPos = 0;
     840 [ #  # ][ #  # ]:          0 :             if( lcl_findSoundInList( maSoundList, aEffect.maSound, nPos ))
     841                 :            :             {
     842                 :            :                 // skip first three entries
     843         [ #  # ]:          0 :                 maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
     844         [ #  # ]:          0 :                 maCurrentSoundFile = aEffect.maSound;
     845                 :            :             }
     846                 :            :         }
     847                 :            :         else
     848                 :            :         {
     849         [ #  # ]:          0 :             maLB_SOUND.SelectEntryPos( 0 );
     850                 :            :         }
     851                 :            :     }
     852                 :            : 
     853         [ #  # ]:          0 :     if( aEffect.mbLoopSoundAmbiguous )
     854                 :            :     {
     855         [ #  # ]:          0 :         maCB_LOOP_SOUND.SetState( STATE_DONTKNOW );
     856                 :            :     }
     857                 :            :     else
     858                 :            :     {
     859         [ #  # ]:          0 :         maCB_LOOP_SOUND.Check( aEffect.mbLoopSound );
     860                 :            :     }
     861                 :            : 
     862         [ #  # ]:          0 :     if( aEffect.mbPresChangeAmbiguous )
     863                 :            :     {
     864         [ #  # ]:          0 :         maRB_ADVANCE_ON_MOUSE.Check( sal_False );
     865         [ #  # ]:          0 :         maRB_ADVANCE_AUTO.Check( sal_False );
     866                 :            :     }
     867                 :            :     else
     868                 :            :     {
     869         [ #  # ]:          0 :         maRB_ADVANCE_ON_MOUSE.Check( aEffect.mePresChange == PRESCHANGE_MANUAL );
     870         [ #  # ]:          0 :         maRB_ADVANCE_AUTO.Check( aEffect.mePresChange == PRESCHANGE_AUTO );
     871         [ #  # ]:          0 :         maMF_ADVANCE_AUTO_AFTER.SetValue( aEffect.mnTime );
     872                 :            :     }
     873                 :            : 
     874 [ #  # ][ #  # ]:          0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     875 [ #  # ][ #  # ]:          0 :     maCB_AUTO_PREVIEW.Check( pOptions->IsPreviewTransitions() == sal_True );
     876                 :            : 
     877                 :          0 :     mbUpdatingControls = false;
     878                 :            : 
     879 [ #  # ][ #  # ]:          0 :     updateControlState();
         [ #  # ][ #  # ]
     880                 :            : }
     881                 :            : 
     882                 :          0 : void SlideTransitionPane::updateControlState()
     883                 :            : {
     884                 :          0 :     maLB_SLIDE_TRANSITIONS.Enable( mbHasSelection );
     885                 :          0 :     maLB_SPEED.Enable( mbHasSelection );
     886                 :          0 :     maLB_SOUND.Enable( mbHasSelection );
     887 [ #  # ][ #  # ]:          0 :     maCB_LOOP_SOUND.Enable( mbHasSelection && (maLB_SOUND.GetSelectEntryPos() > 2));
     888                 :          0 :     maRB_ADVANCE_ON_MOUSE.Enable( mbHasSelection );
     889                 :          0 :     maRB_ADVANCE_AUTO.Enable( mbHasSelection );
     890 [ #  # ][ #  # ]:          0 :     maMF_ADVANCE_AUTO_AFTER.Enable( mbHasSelection && maRB_ADVANCE_AUTO.IsChecked());
     891                 :            : 
     892                 :          0 :     maPB_APPLY_TO_ALL.Enable( mbHasSelection );
     893                 :          0 :     maPB_PLAY.Enable( mbHasSelection );
     894                 :          0 :     maCB_AUTO_PREVIEW.Enable( mbHasSelection );
     895                 :          0 : }
     896                 :            : 
     897                 :          0 : void SlideTransitionPane::updateSoundList()
     898                 :            : {
     899         [ #  # ]:          0 :     ::std::vector< String > aSoundList;
     900                 :            : 
     901         [ #  # ]:          0 :     GalleryExplorer::FillObjList( GALLERY_THEME_SOUNDS, aSoundList );
     902         [ #  # ]:          0 :     GalleryExplorer::FillObjList( GALLERY_THEME_USERSOUNDS, aSoundList );
     903                 :            : 
     904                 :          0 :     size_t nCount = aSoundList.size();
     905                 :          0 :     maSoundList.clear();
     906         [ #  # ]:          0 :     maSoundList.reserve( nCount );
     907         [ #  # ]:          0 :     for( size_t i =0 ; i < nCount; ++i )
     908                 :            :     {
     909                 :            :         // store copy of string in member list
     910 [ #  # ][ #  # ]:          0 :         maSoundList.push_back( aSoundList[ i ] );
     911                 :            :     }
     912                 :            : 
     913         [ #  # ]:          0 :     lcl_FillSoundListBox( maSoundList, maLB_SOUND );
     914                 :          0 : }
     915                 :            : 
     916                 :          0 : void SlideTransitionPane::openSoundFileDialog()
     917                 :            : {
     918 [ #  # ][ #  # ]:          0 :     if( ! maLB_SOUND.IsEnabled())
     919                 :          0 :         return;
     920                 :            : 
     921         [ #  # ]:          0 :     SdOpenSoundFileDialog aFileDialog;
     922                 :            : 
     923         [ #  # ]:          0 :     String aFile;
     924                 :            :     DBG_ASSERT( maLB_SOUND.GetSelectEntryPos() == 2,
     925                 :            :                 "Dialog should only open when \"Other sound\" is selected" );
     926 [ #  # ][ #  # ]:          0 :     aFile = SvtPathOptions().GetGraphicPath();
         [ #  # ][ #  # ]
     927                 :            : 
     928         [ #  # ]:          0 :     aFileDialog.SetPath( aFile );
     929                 :            : 
     930                 :          0 :     bool bValidSoundFile( false );
     931                 :          0 :     bool bQuitLoop( false );
     932                 :            : 
     933 [ #  # ][ #  # ]:          0 :     while( ! bQuitLoop &&
                 [ #  # ]
     934         [ #  # ]:          0 :            aFileDialog.Execute() == ERRCODE_NONE )
     935                 :            :     {
     936 [ #  # ][ #  # ]:          0 :         aFile = aFileDialog.GetPath();
                 [ #  # ]
     937                 :          0 :         tSoundListType::size_type nPos = 0;
     938         [ #  # ]:          0 :         bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
     939                 :            : 
     940         [ #  # ]:          0 :         if( bValidSoundFile )
     941                 :            :         {
     942                 :          0 :             bQuitLoop = true;
     943                 :            :         }
     944                 :            :         else // not in sound list
     945                 :            :         {
     946                 :            :             // try to insert into gallery
     947 [ #  # ][ #  # ]:          0 :             if( GalleryExplorer::InsertURL( GALLERY_THEME_USERSOUNDS, aFile, SGA_FORMAT_SOUND ) )
     948                 :            :             {
     949         [ #  # ]:          0 :                 updateSoundList();
     950         [ #  # ]:          0 :                 bValidSoundFile = lcl_findSoundInList( maSoundList, aFile, nPos );
     951                 :            :                 DBG_ASSERT( bValidSoundFile, "Adding sound to gallery failed" );
     952                 :            : 
     953                 :          0 :                 bQuitLoop = true;
     954                 :            :             }
     955                 :            :             else
     956                 :            :             {
     957 [ #  # ][ #  # ]:          0 :                 String aStrWarning(SdResId(STR_WARNING_NOSOUNDFILE));
     958                 :          0 :                 rtl::OUString aStr('%');
     959 [ #  # ][ #  # ]:          0 :                 aStrWarning.SearchAndReplace( aStr , aFile );
                 [ #  # ]
     960         [ #  # ]:          0 :                 WarningBox aWarningBox( NULL, WB_3DLOOK | WB_RETRY_CANCEL, aStrWarning );
     961         [ #  # ]:          0 :                 aWarningBox.SetModalInputMode (sal_True);
     962         [ #  # ]:          0 :                 bQuitLoop = (aWarningBox.Execute() != RET_RETRY);
     963                 :            : 
     964 [ #  # ][ #  # ]:          0 :                 bValidSoundFile = false;
     965                 :            :             }
     966                 :            :         }
     967                 :            : 
     968         [ #  # ]:          0 :         if( bValidSoundFile )
     969                 :            :             // skip first three entries in list
     970         [ #  # ]:          0 :             maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
     971                 :            :     }
     972                 :            : 
     973         [ #  # ]:          0 :     if( ! bValidSoundFile )
     974                 :            :     {
     975         [ #  # ]:          0 :         if( maCurrentSoundFile.Len() > 0 )
     976                 :            :         {
     977                 :          0 :             tSoundListType::size_type nPos = 0;
     978 [ #  # ][ #  # ]:          0 :             if( lcl_findSoundInList( maSoundList, maCurrentSoundFile, nPos ))
     979         [ #  # ]:          0 :                 maLB_SOUND.SelectEntryPos( (sal_uInt16)nPos + 3 );
     980                 :            :             else
     981         [ #  # ]:          0 :                 maLB_SOUND.SelectEntryPos( 0 );  // NONE
     982                 :            :         }
     983                 :            :         else
     984         [ #  # ]:          0 :             maLB_SOUND.SelectEntryPos( 0 );  // NONE
     985 [ #  # ][ #  # ]:          0 :     }
     986                 :            : }
     987                 :            : 
     988                 :          0 : impl::TransitionEffect SlideTransitionPane::getTransitionEffectFromControls() const
     989                 :            : {
     990                 :          0 :     impl::TransitionEffect aResult;
     991                 :          0 :     aResult.setAllAmbiguous();
     992                 :            : 
     993                 :            :     // check first (aResult might be overwritten)
     994 [ #  # ][ #  # ]:          0 :     if( maLB_SLIDE_TRANSITIONS.IsEnabled() &&
         [ #  # ][ #  # ]
     995         [ #  # ]:          0 :         maLB_SLIDE_TRANSITIONS.GetSelectEntryCount() > 0 )
     996                 :            :     {
     997                 :            :         TransitionPresetPtr pPreset = lcl_getTransitionPresetByUIName(
     998 [ #  # ][ #  # ]:          0 :             mpDrawDoc, OUString( maLB_SLIDE_TRANSITIONS.GetSelectEntry()));
         [ #  # ][ #  # ]
     999                 :            : 
    1000         [ #  # ]:          0 :         if( pPreset.get())
    1001                 :            :         {
    1002 [ #  # ][ #  # ]:          0 :             aResult = impl::TransitionEffect( *pPreset );
                 [ #  # ]
    1003                 :          0 :             aResult.setAllAmbiguous();
    1004                 :            :         }
    1005                 :            :         else
    1006                 :            :         {
    1007                 :          0 :             aResult.mnType = 0;
    1008                 :            :         }
    1009         [ #  # ]:          0 :         aResult.mbEffectAmbiguous = false;
    1010                 :            :     }
    1011                 :            : 
    1012                 :            :     // speed
    1013 [ #  # ][ #  # ]:          0 :     if( maLB_SPEED.IsEnabled() &&
         [ #  # ][ #  # ]
    1014         [ #  # ]:          0 :         maLB_SPEED.GetSelectEntryCount() > 0 )
    1015                 :            :     {
    1016         [ #  # ]:          0 :         sal_uInt16 nPos = maLB_SPEED.GetSelectEntryPos();
    1017                 :            :         aResult.mfDuration = (nPos == 0)
    1018                 :            :             ? 3.0
    1019                 :            :             : (nPos == 1)
    1020                 :            :             ? 2.0
    1021 [ #  # ][ #  # ]:          0 :             : 1.0;   // nPos == 2
    1022                 :            :         DBG_ASSERT( aResult.mfDuration != 1.0 || nPos == 2, "Invalid Listbox Entry" );
    1023                 :            : 
    1024                 :          0 :         aResult.mbDurationAmbiguous = false;
    1025                 :            :     }
    1026                 :            : 
    1027                 :            :     // slide-advance mode
    1028 [ #  # ][ #  # ]:          0 :     if( maRB_ADVANCE_ON_MOUSE.IsEnabled() && maRB_ADVANCE_AUTO.IsEnabled() &&
         [ #  # ][ #  #  
             #  #  #  # ]
                 [ #  # ]
    1029                 :          0 :         (maRB_ADVANCE_ON_MOUSE.IsChecked() || maRB_ADVANCE_AUTO.IsChecked()))
    1030                 :            :     {
    1031         [ #  # ]:          0 :         if( maRB_ADVANCE_ON_MOUSE.IsChecked())
    1032                 :          0 :             aResult.mePresChange = PRESCHANGE_MANUAL;
    1033                 :            :         else
    1034                 :            :         {
    1035                 :          0 :             aResult.mePresChange = PRESCHANGE_AUTO;
    1036 [ #  # ][ #  # ]:          0 :             if( maMF_ADVANCE_AUTO_AFTER.IsEnabled())
    1037                 :            :             {
    1038         [ #  # ]:          0 :                 aResult.mnTime = static_cast<long>(maMF_ADVANCE_AUTO_AFTER.GetValue());
    1039                 :          0 :                 aResult.mbTimeAmbiguous = false;
    1040                 :            :             }
    1041                 :            :         }
    1042                 :            : 
    1043                 :          0 :         aResult.mbPresChangeAmbiguous = false;
    1044                 :            :     }
    1045                 :            : 
    1046                 :            :     // sound
    1047 [ #  # ][ #  # ]:          0 :     if( maLB_SOUND.IsEnabled())
    1048                 :            :     {
    1049         [ #  # ]:          0 :         maCurrentSoundFile.Erase();
    1050 [ #  # ][ #  # ]:          0 :         if( maLB_SOUND.GetSelectEntryCount() > 0 )
    1051                 :            :         {
    1052         [ #  # ]:          0 :             sal_uInt16 nPos = maLB_SOUND.GetSelectEntryPos();
    1053                 :          0 :             aResult.mbStopSound = nPos == 1;
    1054                 :          0 :             aResult.mbSoundOn = nPos > 1;
    1055         [ #  # ]:          0 :             if( aResult.mbStopSound )
    1056                 :            :             {
    1057         [ #  # ]:          0 :                 aResult.maSound = OUString();
    1058                 :          0 :                 aResult.mbSoundAmbiguous = false;
    1059                 :            :             }
    1060                 :            :             else
    1061                 :            :             {
    1062 [ #  # ][ #  # ]:          0 :                 aResult.maSound = lcl_getSoundFileURL( maSoundList, maLB_SOUND );
                 [ #  # ]
    1063                 :          0 :                 aResult.mbSoundAmbiguous = false;
    1064         [ #  # ]:          0 :                 maCurrentSoundFile = aResult.maSound;
    1065                 :            :             }
    1066                 :            :         }
    1067                 :            :     }
    1068                 :            : 
    1069                 :            :     // sound loop
    1070 [ #  # ][ #  # ]:          0 :     if( maCB_LOOP_SOUND.IsEnabled() )
    1071                 :            :     {
    1072         [ #  # ]:          0 :         aResult.mbLoopSound = maCB_LOOP_SOUND.IsChecked();
    1073                 :          0 :         aResult.mbLoopSoundAmbiguous = false;
    1074                 :            :     }
    1075                 :            : 
    1076                 :          0 :     return aResult;
    1077                 :            : }
    1078                 :            : 
    1079                 :          0 : void SlideTransitionPane::applyToSelectedPages()
    1080                 :            : {
    1081         [ #  # ]:          0 :     if( ! mbUpdatingControls )
    1082                 :            :     {
    1083         [ #  # ]:          0 :         ::sd::slidesorter::SharedPageSelection pSelectedPages( getSelectedPages());
    1084         [ #  # ]:          0 :         if( ! pSelectedPages->empty())
    1085                 :            :         {
    1086         [ #  # ]:          0 :             lcl_CreateUndoForPages( pSelectedPages, mrBase );
    1087 [ #  # ][ #  # ]:          0 :             lcl_ApplyToPages( pSelectedPages, getTransitionEffectFromControls() );
                 [ #  # ]
    1088 [ #  # ][ #  # ]:          0 :             mrBase.GetDocShell()->SetModified();
    1089                 :            :         }
    1090 [ #  # ][ #  # ]:          0 :         if( maCB_AUTO_PREVIEW.IsEnabled() &&
         [ #  # ][ #  # ]
    1091         [ #  # ]:          0 :             maCB_AUTO_PREVIEW.IsChecked())
    1092                 :            :         {
    1093         [ #  # ]:          0 :             playCurrentEffect();
    1094         [ #  # ]:          0 :         }
    1095                 :            :     }
    1096                 :          0 : }
    1097                 :            : 
    1098                 :          0 : void SlideTransitionPane::playCurrentEffect()
    1099                 :            : {
    1100         [ #  # ]:          0 :     if( mxView.is() )
    1101                 :            :     {
    1102                 :            : 
    1103                 :          0 :         Reference< ::com::sun::star::animations::XAnimationNode > xNode;
    1104 [ #  # ][ #  # ]:          0 :         SlideShow::StartPreview( mrBase, mxView->getCurrentPage(), xNode );
                 [ #  # ]
    1105                 :            :     }
    1106                 :          0 : }
    1107                 :            : 
    1108                 :          0 : void SlideTransitionPane::addListener()
    1109                 :            : {
    1110         [ #  # ]:          0 :     Link aLink( LINK(this,SlideTransitionPane,EventMultiplexerListener) );
    1111                 :            :     mrBase.GetEventMultiplexer()->AddEventListener (
    1112                 :            :         aLink,
    1113                 :            :         tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION
    1114                 :            :         | tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION
    1115                 :            :         | tools::EventMultiplexerEvent::EID_CURRENT_PAGE
    1116                 :            :         | tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED
    1117                 :            :         | tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED
    1118 [ #  # ][ #  # ]:          0 :         | tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED);
                 [ #  # ]
    1119                 :          0 : }
    1120                 :            : 
    1121                 :          0 : void SlideTransitionPane::removeListener()
    1122                 :            : {
    1123         [ #  # ]:          0 :     Link aLink( LINK(this,SlideTransitionPane,EventMultiplexerListener) );
    1124 [ #  # ][ #  # ]:          0 :     mrBase.GetEventMultiplexer()->RemoveEventListener( aLink );
                 [ #  # ]
    1125                 :          0 : }
    1126                 :            : 
    1127                 :          0 : IMPL_LINK(SlideTransitionPane,EventMultiplexerListener,
    1128                 :            :     tools::EventMultiplexerEvent*,pEvent)
    1129                 :            : {
    1130   [ #  #  #  #  :          0 :     switch (pEvent->meEventId)
                   #  # ]
    1131                 :            :     {
    1132                 :            :         case tools::EventMultiplexerEvent::EID_EDIT_VIEW_SELECTION:
    1133                 :          0 :             onSelectionChanged();
    1134                 :          0 :             break;
    1135                 :            : 
    1136                 :            :         case tools::EventMultiplexerEvent::EID_CURRENT_PAGE:
    1137                 :            :         case tools::EventMultiplexerEvent::EID_SLIDE_SORTER_SELECTION:
    1138                 :          0 :             onChangeCurrentPage();
    1139                 :          0 :             break;
    1140                 :            : 
    1141                 :            :         case tools::EventMultiplexerEvent::EID_MAIN_VIEW_REMOVED:
    1142         [ #  # ]:          0 :             mxView = Reference<drawing::XDrawView>();
    1143                 :          0 :             onSelectionChanged();
    1144                 :          0 :             onChangeCurrentPage();
    1145                 :          0 :             break;
    1146                 :            : 
    1147                 :            :         case tools::EventMultiplexerEvent::EID_MAIN_VIEW_ADDED:
    1148                 :          0 :             mbIsMainViewChangePending = true;
    1149                 :          0 :             break;
    1150                 :            : 
    1151                 :            :         case tools::EventMultiplexerEvent::EID_CONFIGURATION_UPDATED:
    1152         [ #  # ]:          0 :             if (mbIsMainViewChangePending)
    1153                 :            :             {
    1154                 :          0 :                 mbIsMainViewChangePending = false;
    1155                 :            : 
    1156                 :            :                 // At this moment the controller may not yet been set at
    1157                 :            :                 // model or ViewShellBase.  Take it from the view shell
    1158                 :            :                 // passed with the event.
    1159         [ #  # ]:          0 :                 if (mrBase.GetMainViewShell() != NULL)
    1160                 :            :                 {
    1161 [ #  # ][ #  # ]:          0 :                     mxView = Reference<drawing::XDrawView>::query(mrBase.GetController());
    1162                 :          0 :                     onSelectionChanged();
    1163                 :          0 :                     onChangeCurrentPage();
    1164                 :            :                 }
    1165                 :            :             }
    1166                 :          0 :             break;
    1167                 :            : 
    1168                 :            :         default:
    1169                 :          0 :             break;
    1170                 :            :     }
    1171                 :          0 :     return 0;
    1172                 :            : }
    1173                 :            : 
    1174                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, ApplyToAllButtonClicked)
    1175                 :            : {
    1176                 :            :     DBG_ASSERT( mpDrawDoc, "Invalid Draw Document!" );
    1177         [ #  # ]:          0 :     if( !mpDrawDoc )
    1178                 :          0 :         return 0;
    1179                 :            : 
    1180                 :            :     ::sd::slidesorter::SharedPageSelection pPages (
    1181 [ #  # ][ #  # ]:          0 :         new ::sd::slidesorter::SlideSorterViewShell::PageSelection());
                 [ #  # ]
    1182                 :            : 
    1183         [ #  # ]:          0 :     sal_uInt16 nPageCount = mpDrawDoc->GetSdPageCount( PK_STANDARD );
    1184         [ #  # ]:          0 :     pPages->reserve( nPageCount );
    1185         [ #  # ]:          0 :     for( sal_uInt16 i=0; i<nPageCount; ++i )
    1186                 :            :     {
    1187         [ #  # ]:          0 :         SdPage * pPage = mpDrawDoc->GetSdPage( i, PK_STANDARD );
    1188         [ #  # ]:          0 :         if( pPage )
    1189         [ #  # ]:          0 :             pPages->push_back( pPage );
    1190                 :            :     }
    1191                 :            : 
    1192         [ #  # ]:          0 :     if( ! pPages->empty())
    1193                 :            :     {
    1194         [ #  # ]:          0 :         lcl_CreateUndoForPages( pPages, mrBase );
    1195 [ #  # ][ #  # ]:          0 :         lcl_ApplyToPages( pPages, getTransitionEffectFromControls() );
                 [ #  # ]
    1196                 :            :     }
    1197                 :            : 
    1198         [ #  # ]:          0 :     return 0;
    1199                 :            : }
    1200                 :            : 
    1201                 :            : 
    1202                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, PlayButtonClicked)
    1203                 :            : {
    1204                 :          0 :     playCurrentEffect();
    1205                 :          0 :     return 0;
    1206                 :            : }
    1207                 :            : 
    1208                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, SlideShowButtonClicked)
    1209                 :            : {
    1210                 :          0 :     mrBase.StartPresentation();
    1211                 :          0 :     return 0;
    1212                 :            : }
    1213                 :            : 
    1214                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, TransitionSelected)
    1215                 :            : {
    1216                 :          0 :     applyToSelectedPages();
    1217                 :          0 :     return 0;
    1218                 :            : }
    1219                 :            : 
    1220                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, AdvanceSlideRadioButtonToggled)
    1221                 :            : {
    1222                 :          0 :     updateControlState();
    1223                 :          0 :     applyToSelectedPages();
    1224                 :          0 :     return 0;
    1225                 :            : }
    1226                 :            : 
    1227                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, AdvanceTimeModified)
    1228                 :            : {
    1229                 :          0 :     applyToSelectedPages();
    1230                 :          0 :     return 0;
    1231                 :            : }
    1232                 :            : 
    1233                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, SpeedListBoxSelected)
    1234                 :            : {
    1235                 :          0 :     applyToSelectedPages();
    1236                 :          0 :     return 0;
    1237                 :            : }
    1238                 :            : 
    1239                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, SoundListBoxSelected)
    1240                 :            : {
    1241         [ #  # ]:          0 :     if( maLB_SOUND.GetSelectEntryCount() )
    1242                 :            :     {
    1243                 :          0 :         sal_uInt16 nPos = maLB_SOUND.GetSelectEntryPos();
    1244         [ #  # ]:          0 :         if( nPos == 2 )
    1245                 :            :         {
    1246                 :            :             // other sound ...
    1247                 :          0 :             openSoundFileDialog();
    1248                 :            :         }
    1249                 :            :     }
    1250                 :          0 :     updateControlState();
    1251                 :          0 :     applyToSelectedPages();
    1252                 :          0 :     return 0;
    1253                 :            : }
    1254                 :            : 
    1255                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, LoopSoundBoxChecked)
    1256                 :            : {
    1257                 :          0 :     applyToSelectedPages();
    1258                 :          0 :     return 0;
    1259                 :            : }
    1260                 :            : 
    1261                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, AutoPreviewClicked)
    1262                 :            : {
    1263                 :          0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
    1264         [ #  # ]:          0 :     pOptions->SetPreviewTransitions( maCB_AUTO_PREVIEW.IsChecked() ? sal_True : sal_False );
    1265                 :          0 :     return 0;
    1266                 :            : }
    1267                 :            : 
    1268                 :          0 : IMPL_LINK_NOARG(SlideTransitionPane, LateInitCallback)
    1269                 :            : {
    1270         [ #  # ]:          0 :     const TransitionPresetList& rPresetList = TransitionPreset::getTransitionPresetList();
    1271                 :          0 :     TransitionPresetList::const_iterator aIter( rPresetList.begin() );
    1272                 :          0 :     const TransitionPresetList::const_iterator aEnd( rPresetList.end() );
    1273                 :          0 :     sal_uInt16 nIndex = 0;
    1274                 :          0 :     ::std::size_t nUIIndex = 0;
    1275         [ #  # ]:          0 :     while( aIter != aEnd )
    1276                 :            :     {
    1277         [ #  # ]:          0 :         TransitionPresetPtr pPreset = (*aIter++);
    1278                 :          0 :         const OUString aUIName( pPreset->getUIName() );
    1279         [ #  # ]:          0 :          if( !aUIName.isEmpty() )
    1280                 :            :         {
    1281 [ #  # ][ #  # ]:          0 :             maLB_SLIDE_TRANSITIONS.InsertEntry( aUIName );
                 [ #  # ]
    1282         [ #  # ]:          0 :             m_aPresetIndexes[ nIndex ] = (sal_uInt16)nUIIndex;
    1283                 :          0 :             ++nUIIndex;
    1284                 :            :         }
    1285                 :          0 :         ++nIndex;
    1286         [ #  # ]:          0 :     }
    1287                 :            : 
    1288         [ #  # ]:          0 :     updateSoundList();
    1289         [ #  # ]:          0 :     updateControls();
    1290                 :            : 
    1291                 :          0 :     return 0;
    1292                 :            : }
    1293                 :            : 
    1294                 :          0 : ::Window * createSlideTransitionPanel( ::Window* pParent, ViewShellBase& rBase )
    1295                 :            : {
    1296                 :          0 :     DialogListBox* pWindow = 0;
    1297                 :            : 
    1298                 :          0 :     DrawDocShell* pDocSh = rBase.GetDocShell();
    1299         [ #  # ]:          0 :     if( pDocSh )
    1300                 :            :     {
    1301 [ #  # ][ #  # ]:          0 :         pWindow = new DialogListBox( pParent, WB_CLIPCHILDREN|WB_TABSTOP|WB_AUTOHSCROLL );
    1302                 :            : 
    1303 [ #  # ][ #  # ]:          0 :         Size aMinSize( pWindow->LogicToPixel( Size( 72, 216 ), MAP_APPFONT ) );
                 [ #  # ]
    1304 [ #  # ][ #  # ]:          0 :         ::Window* pPaneWindow = new SlideTransitionPane( pWindow, rBase, aMinSize, pDocSh->GetDoc() );
                 [ #  # ]
    1305         [ #  # ]:          0 :         pWindow->SetChildWindow( pPaneWindow, aMinSize );
    1306 [ #  # ][ #  # ]:          0 :         pWindow->SetText( pPaneWindow->GetText() );
                 [ #  # ]
    1307                 :            :     }
    1308                 :            : 
    1309                 :          0 :     return pWindow;
    1310                 :            : }
    1311                 :            : 
    1312                 :            : 
    1313                 :            : } //  namespace sd
    1314                 :            : 
    1315                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10