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