1*5b190011SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*5b190011SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*5b190011SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*5b190011SAndrew Rist * distributed with this work for additional information 6*5b190011SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*5b190011SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*5b190011SAndrew Rist * "License"); you may not use this file except in compliance 9*5b190011SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*5b190011SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*5b190011SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*5b190011SAndrew Rist * software distributed under the License is distributed on an 15*5b190011SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*5b190011SAndrew Rist * KIND, either express or implied. See the License for the 17*5b190011SAndrew Rist * specific language governing permissions and limitations 18*5b190011SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*5b190011SAndrew Rist *************************************************************/ 21*5b190011SAndrew Rist 22*5b190011SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_sd.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir //#include <com/sun/star/frame/XController.hpp> 28cdf0e10cSrcweir #include <com/sun/star/beans/PropertyAttribute.hpp> 29cdf0e10cSrcweir #include <com/sun/star/drawing/framework/XControllerManager.hpp> 30cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp> 31cdf0e10cSrcweir #include <comphelper/serviceinfohelper.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir #include <cppuhelper/bootstrap.hxx> 34cdf0e10cSrcweir 35cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 36cdf0e10cSrcweir #include <vos/mutex.hxx> 37cdf0e10cSrcweir 38cdf0e10cSrcweir #include <vcl/svapp.hxx> 39cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 40cdf0e10cSrcweir #include <svx/svdpool.hxx> 41cdf0e10cSrcweir #include <svl/itemprop.hxx> 42cdf0e10cSrcweir 43cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 44cdf0e10cSrcweir 45cdf0e10cSrcweir #include <toolkit/unohlp.hxx> 46cdf0e10cSrcweir #include <svx/unoprov.hxx> 47cdf0e10cSrcweir 48cdf0e10cSrcweir #include "framework/FrameworkHelper.hxx" 49cdf0e10cSrcweir 50cdf0e10cSrcweir #include "FrameView.hxx" 51cdf0e10cSrcweir #include "unomodel.hxx" 52cdf0e10cSrcweir #include "slideshow.hxx" 53cdf0e10cSrcweir #include "slideshowimpl.hxx" 54cdf0e10cSrcweir #include "sdattr.hrc" 55cdf0e10cSrcweir #include "FactoryIds.hxx" 56cdf0e10cSrcweir #include "ViewShell.hxx" 57cdf0e10cSrcweir #include "SlideShowRestarter.hxx" 58cdf0e10cSrcweir #include "DrawController.hxx" 59cdf0e10cSrcweir #include <boost/bind.hpp> 60cdf0e10cSrcweir 61cdf0e10cSrcweir using ::com::sun::star::presentation::XSlideShowController; 62cdf0e10cSrcweir using ::com::sun::star::container::XIndexAccess; 63cdf0e10cSrcweir using ::sd::framework::FrameworkHelper; 64cdf0e10cSrcweir using ::rtl::OUString; 65cdf0e10cSrcweir using ::com::sun::star::awt::XWindow; 66cdf0e10cSrcweir using namespace ::sd; 67cdf0e10cSrcweir using namespace ::cppu; 68cdf0e10cSrcweir using namespace ::vos; 69cdf0e10cSrcweir using namespace ::com::sun::star::uno; 70cdf0e10cSrcweir using namespace ::com::sun::star::presentation; 71cdf0e10cSrcweir using namespace ::com::sun::star::drawing; 72cdf0e10cSrcweir using namespace ::com::sun::star::beans; 73cdf0e10cSrcweir using namespace ::com::sun::star::lang; 74cdf0e10cSrcweir using namespace ::com::sun::star::animations; 75cdf0e10cSrcweir using namespace ::com::sun::star::drawing::framework; 76cdf0e10cSrcweir 77cdf0e10cSrcweir extern String getUiNameFromPageApiNameImpl( const ::rtl::OUString& rApiName ); 78cdf0e10cSrcweir 79cdf0e10cSrcweir #define C2U(x) OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) 80cdf0e10cSrcweir 81cdf0e10cSrcweir 82cdf0e10cSrcweir namespace { 83cdf0e10cSrcweir /** This local version of the work window overloads DataChanged() so that it 84cdf0e10cSrcweir can restart the slide show when a display is added or removed. 85cdf0e10cSrcweir */ 86cdf0e10cSrcweir class FullScreenWorkWindow : public WorkWindow 87cdf0e10cSrcweir { 88cdf0e10cSrcweir public: 89cdf0e10cSrcweir FullScreenWorkWindow ( 90cdf0e10cSrcweir const ::rtl::Reference<SlideShow>& rpSlideShow, 91cdf0e10cSrcweir ViewShellBase* pViewShellBase) 92cdf0e10cSrcweir : WorkWindow(NULL, WB_HIDE | WB_CLIPCHILDREN), 93cdf0e10cSrcweir mpRestarter(new SlideShowRestarter(rpSlideShow, pViewShellBase)) 94cdf0e10cSrcweir {} 95cdf0e10cSrcweir 96cdf0e10cSrcweir 97cdf0e10cSrcweir virtual void DataChanged (const DataChangedEvent& rEvent) 98cdf0e10cSrcweir { 99cdf0e10cSrcweir if (rEvent.GetType() == DATACHANGED_DISPLAY) 100cdf0e10cSrcweir { 101cdf0e10cSrcweir mpRestarter->Restart(); 102cdf0e10cSrcweir } 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir private: 106cdf0e10cSrcweir ::boost::shared_ptr<SlideShowRestarter> mpRestarter; 107cdf0e10cSrcweir }; 108cdf0e10cSrcweir 109cdf0e10cSrcweir /** Return the default display id (or -1 when that can not be 110cdf0e10cSrcweir determined.) 111cdf0e10cSrcweir */ 112cdf0e10cSrcweir sal_Int32 GetDefaultDisplay (void) 113cdf0e10cSrcweir { 114cdf0e10cSrcweir try 115cdf0e10cSrcweir { 116cdf0e10cSrcweir Reference< XMultiServiceFactory > xFactory(::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW ); 117cdf0e10cSrcweir Reference< XPropertySet > xMonProps(xFactory->createInstance(OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), UNO_QUERY_THROW ); 118cdf0e10cSrcweir const OUString sPropertyName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) ); 119cdf0e10cSrcweir sal_Int32 nPrimaryIndex (-1); 120cdf0e10cSrcweir if (xMonProps->getPropertyValue( sPropertyName ) >>= nPrimaryIndex) 121cdf0e10cSrcweir return nPrimaryIndex; 122cdf0e10cSrcweir } 123cdf0e10cSrcweir catch( Exception& ) 124cdf0e10cSrcweir { 125cdf0e10cSrcweir } 126cdf0e10cSrcweir return -1; 127cdf0e10cSrcweir } 128cdf0e10cSrcweir } 129cdf0e10cSrcweir 130cdf0e10cSrcweir 131cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////// 132cdf0e10cSrcweir // -------------------------------------------------------------------- 133cdf0e10cSrcweir 134cdf0e10cSrcweir const SfxItemPropertyMapEntry* ImplGetPresentationPropertyMap() 135cdf0e10cSrcweir { 136cdf0e10cSrcweir // NOTE: First member must be sorted 137cdf0e10cSrcweir static const SfxItemPropertyMapEntry aPresentationPropertyMap_Impl[] = 138cdf0e10cSrcweir { 139cdf0e10cSrcweir { MAP_CHAR_LEN("AllowAnimations"), ATTR_PRESENT_ANIMATION_ALLOWED, &::getBooleanCppuType(), 0, 0 }, 140cdf0e10cSrcweir { MAP_CHAR_LEN("CustomShow"), ATTR_PRESENT_CUSTOMSHOW, &::getCppuType((const OUString*)0), 0, 0 }, 141cdf0e10cSrcweir { MAP_CHAR_LEN("Display"), ATTR_PRESENT_DISPLAY, &::getCppuType((const sal_Int32*)0), 0, 0 }, 142cdf0e10cSrcweir { MAP_CHAR_LEN("FirstPage"), ATTR_PRESENT_DIANAME, &::getCppuType((const OUString*)0), 0, 0 }, 143cdf0e10cSrcweir { MAP_CHAR_LEN("IsAlwaysOnTop"), ATTR_PRESENT_ALWAYS_ON_TOP, &::getBooleanCppuType(), 0, 0 }, 144cdf0e10cSrcweir { MAP_CHAR_LEN("IsAutomatic"), ATTR_PRESENT_MANUEL, &::getBooleanCppuType(), 0, 0 }, 145cdf0e10cSrcweir { MAP_CHAR_LEN("IsEndless"), ATTR_PRESENT_ENDLESS, &::getBooleanCppuType(), 0, 0 }, 146cdf0e10cSrcweir { MAP_CHAR_LEN("IsFullScreen"), ATTR_PRESENT_FULLSCREEN, &::getBooleanCppuType(), 0, 0 }, 147cdf0e10cSrcweir { MAP_CHAR_LEN("IsShowAll"), ATTR_PRESENT_ALL, &::getBooleanCppuType(), 0, 0 }, 148cdf0e10cSrcweir { MAP_CHAR_LEN("IsMouseVisible"), ATTR_PRESENT_MOUSE, &::getBooleanCppuType(), 0, 0 }, 149cdf0e10cSrcweir { MAP_CHAR_LEN("IsShowLogo"), ATTR_PRESENT_SHOW_PAUSELOGO, &::getBooleanCppuType(), 0, 0 }, 150cdf0e10cSrcweir { MAP_CHAR_LEN("IsTransitionOnClick"), ATTR_PRESENT_CHANGE_PAGE, &::getBooleanCppuType(), 0, 0 }, 151cdf0e10cSrcweir { MAP_CHAR_LEN("Pause"), ATTR_PRESENT_PAUSE_TIMEOUT, &::getCppuType((const sal_Int32*)0), 0, 0 }, 152cdf0e10cSrcweir { MAP_CHAR_LEN("StartWithNavigator"), ATTR_PRESENT_NAVIGATOR, &::getBooleanCppuType(), 0, 0 }, 153cdf0e10cSrcweir { MAP_CHAR_LEN("UsePen"), ATTR_PRESENT_PEN, &::getBooleanCppuType(), 0, 0 }, 154cdf0e10cSrcweir { 0,0,0,0,0,0} 155cdf0e10cSrcweir }; 156cdf0e10cSrcweir 157cdf0e10cSrcweir return aPresentationPropertyMap_Impl; 158cdf0e10cSrcweir } 159cdf0e10cSrcweir 160cdf0e10cSrcweir //SfxItemPropertyMap map_impl[] = { { 0,0,0,0,0,0 } }; 161cdf0e10cSrcweir 162cdf0e10cSrcweir // -------------------------------------------------------------------- 163cdf0e10cSrcweir // class SlideShow 164cdf0e10cSrcweir // -------------------------------------------------------------------- 165cdf0e10cSrcweir 166cdf0e10cSrcweir SlideShow::SlideShow( SdDrawDocument* pDoc ) 167cdf0e10cSrcweir : SlideshowBase( m_aMutex ) 168cdf0e10cSrcweir , maPropSet(ImplGetPresentationPropertyMap(), SdrObject::GetGlobalDrawObjectItemPool()) 169cdf0e10cSrcweir , mbIsInStartup(false) 170cdf0e10cSrcweir , mpDoc( pDoc ) 171cdf0e10cSrcweir , mpCurrentViewShellBase( 0 ) 172cdf0e10cSrcweir , mpFullScreenViewShellBase( 0 ) 173cdf0e10cSrcweir , mpFullScreenFrameView( 0 ) 174cdf0e10cSrcweir , mnInPlaceConfigEvent( 0 ) 175cdf0e10cSrcweir { 176cdf0e10cSrcweir } 177cdf0e10cSrcweir 178cdf0e10cSrcweir // -------------------------------------------------------------------- 179cdf0e10cSrcweir 180cdf0e10cSrcweir void SlideShow::ThrowIfDisposed() throw (RuntimeException) 181cdf0e10cSrcweir { 182cdf0e10cSrcweir if( mpDoc == 0 ) 183cdf0e10cSrcweir throw DisposedException(); 184cdf0e10cSrcweir } 185cdf0e10cSrcweir 186cdf0e10cSrcweir // -------------------------------------------------------------------- 187cdf0e10cSrcweir 188cdf0e10cSrcweir /// used by the model to create a slideshow for it 189cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::Create( SdDrawDocument* pDoc ) 190cdf0e10cSrcweir { 191cdf0e10cSrcweir return new SlideShow( pDoc ); 192cdf0e10cSrcweir } 193cdf0e10cSrcweir 194cdf0e10cSrcweir // -------------------------------------------------------------------- 195cdf0e10cSrcweir 196cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::GetSlideShow( SdDrawDocument* pDocument ) 197cdf0e10cSrcweir { 198cdf0e10cSrcweir rtl::Reference< SlideShow > xRet; 199cdf0e10cSrcweir 200cdf0e10cSrcweir if( pDocument ) 201cdf0e10cSrcweir xRet = rtl::Reference< SlideShow >( dynamic_cast< SlideShow* >( pDocument->getPresentation().get() ) ); 202cdf0e10cSrcweir 203cdf0e10cSrcweir return xRet; 204cdf0e10cSrcweir } 205cdf0e10cSrcweir 206cdf0e10cSrcweir // -------------------------------------------------------------------- 207cdf0e10cSrcweir 208cdf0e10cSrcweir rtl::Reference< SlideShow > SlideShow::GetSlideShow( ViewShellBase& rBase ) 209cdf0e10cSrcweir { 210cdf0e10cSrcweir return GetSlideShow( rBase.GetDocument() ); 211cdf0e10cSrcweir } 212cdf0e10cSrcweir 213cdf0e10cSrcweir // -------------------------------------------------------------------- 214cdf0e10cSrcweir 215cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > SlideShow::GetSlideShowController(ViewShellBase& rBase ) 216cdf0e10cSrcweir { 217cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) ); 218cdf0e10cSrcweir 219cdf0e10cSrcweir Reference< XSlideShowController > xRet; 220cdf0e10cSrcweir if( xSlideShow.is() ) 221cdf0e10cSrcweir xRet = xSlideShow->getController(); 222cdf0e10cSrcweir 223cdf0e10cSrcweir return xRet; 224cdf0e10cSrcweir } 225cdf0e10cSrcweir 226cdf0e10cSrcweir // -------------------------------------------------------------------- 227cdf0e10cSrcweir 228cdf0e10cSrcweir bool SlideShow::StartPreview( ViewShellBase& rBase, 229cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage >& xDrawPage, 230cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::animations::XAnimationNode >& xAnimationNode, 231cdf0e10cSrcweir ::Window* pParent /* = 0 */ ) 232cdf0e10cSrcweir { 233cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) ); 234cdf0e10cSrcweir if( xSlideShow.is() ) 235cdf0e10cSrcweir return xSlideShow->startPreview( xDrawPage, xAnimationNode, pParent ); 236cdf0e10cSrcweir 237cdf0e10cSrcweir return false; 238cdf0e10cSrcweir } 239cdf0e10cSrcweir 240cdf0e10cSrcweir // -------------------------------------------------------------------- 241cdf0e10cSrcweir 242cdf0e10cSrcweir void SlideShow::Stop( ViewShellBase& rBase ) 243cdf0e10cSrcweir { 244cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) ); 245cdf0e10cSrcweir if( xSlideShow.is() ) 246cdf0e10cSrcweir xSlideShow->end(); 247cdf0e10cSrcweir } 248cdf0e10cSrcweir 249cdf0e10cSrcweir // -------------------------------------------------------------------- 250cdf0e10cSrcweir 251cdf0e10cSrcweir bool SlideShow::IsRunning( ViewShellBase& rBase ) 252cdf0e10cSrcweir { 253cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rBase ) ); 254cdf0e10cSrcweir return xSlideShow.is() && xSlideShow->isRunning(); 255cdf0e10cSrcweir } 256cdf0e10cSrcweir 257cdf0e10cSrcweir // -------------------------------------------------------------------- 258cdf0e10cSrcweir 259cdf0e10cSrcweir bool SlideShow::IsRunning( ViewShell& rViewShell ) 260cdf0e10cSrcweir { 261cdf0e10cSrcweir rtl::Reference< SlideShow > xSlideShow( GetSlideShow( rViewShell.GetViewShellBase() ) ); 262cdf0e10cSrcweir return xSlideShow.is() && xSlideShow->isRunning() && (xSlideShow->mxController->getViewShell() == &rViewShell); 263cdf0e10cSrcweir } 264cdf0e10cSrcweir 265cdf0e10cSrcweir // -------------------------------------------------------------------- 266cdf0e10cSrcweir 267cdf0e10cSrcweir void SlideShow::CreateController( ViewShell* pViewSh, ::sd::View* pView, ::Window* pParentWindow ) 268cdf0e10cSrcweir { 269cdf0e10cSrcweir DBG_ASSERT( !mxController.is(), "sd::SlideShow::CreateController(), clean up old controller first!" ); 270cdf0e10cSrcweir 271cdf0e10cSrcweir Reference< XPresentation2 > xThis( this ); 272cdf0e10cSrcweir 273cdf0e10cSrcweir rtl::Reference<SlideshowImpl> xController ( 274cdf0e10cSrcweir new SlideshowImpl(xThis, pViewSh, pView, mpDoc, pParentWindow)); 275cdf0e10cSrcweir 276cdf0e10cSrcweir // Reset mbIsInStartup. From here mxController.is() is used to prevent 277cdf0e10cSrcweir // multiple slide show instances for one document. 278cdf0e10cSrcweir mxController = xController; 279cdf0e10cSrcweir mbIsInStartup = false; 280cdf0e10cSrcweir } 281cdf0e10cSrcweir 282cdf0e10cSrcweir // -------------------------------------------------------------------- 283cdf0e10cSrcweir // XServiceInfo 284cdf0e10cSrcweir // -------------------------------------------------------------------- 285cdf0e10cSrcweir 286cdf0e10cSrcweir OUString SAL_CALL SlideShow::getImplementationName( ) throw(RuntimeException) 287cdf0e10cSrcweir { 288cdf0e10cSrcweir return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.sd.SlideShow") ); 289cdf0e10cSrcweir } 290cdf0e10cSrcweir 291cdf0e10cSrcweir // -------------------------------------------------------------------- 292cdf0e10cSrcweir 293cdf0e10cSrcweir sal_Bool SAL_CALL SlideShow::supportsService( const OUString& ServiceName ) throw(RuntimeException) 294cdf0e10cSrcweir { 295cdf0e10cSrcweir return comphelper::ServiceInfoHelper::supportsService( ServiceName, getSupportedServiceNames( ) ); 296cdf0e10cSrcweir } 297cdf0e10cSrcweir 298cdf0e10cSrcweir // -------------------------------------------------------------------- 299cdf0e10cSrcweir 300cdf0e10cSrcweir Sequence< OUString > SAL_CALL SlideShow::getSupportedServiceNames( ) throw(RuntimeException) 301cdf0e10cSrcweir { 302cdf0e10cSrcweir OUString aService( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.presentation.Presentation") ); 303cdf0e10cSrcweir Sequence< OUString > aSeq( &aService, 1 ); 304cdf0e10cSrcweir return aSeq; 305cdf0e10cSrcweir } 306cdf0e10cSrcweir 307cdf0e10cSrcweir // -------------------------------------------------------------------- 308cdf0e10cSrcweir // XPropertySet 309cdf0e10cSrcweir // -------------------------------------------------------------------- 310cdf0e10cSrcweir 311cdf0e10cSrcweir Reference< XPropertySetInfo > SAL_CALL SlideShow::getPropertySetInfo() throw(RuntimeException) 312cdf0e10cSrcweir { 313cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 314cdf0e10cSrcweir static Reference< XPropertySetInfo > xInfo = maPropSet.getPropertySetInfo(); 315cdf0e10cSrcweir return xInfo; 316cdf0e10cSrcweir } 317cdf0e10cSrcweir 318cdf0e10cSrcweir // -------------------------------------------------------------------- 319cdf0e10cSrcweir 320cdf0e10cSrcweir void SAL_CALL SlideShow::setPropertyValue( const OUString& aPropertyName, const Any& aValue ) throw(UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException) 321cdf0e10cSrcweir { 322cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 323cdf0e10cSrcweir ThrowIfDisposed(); 324cdf0e10cSrcweir 325cdf0e10cSrcweir sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings(); 326cdf0e10cSrcweir 327cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(aPropertyName); 328cdf0e10cSrcweir 329cdf0e10cSrcweir if( pEntry && ((pEntry->nFlags & PropertyAttribute::READONLY) != 0) ) 330cdf0e10cSrcweir throw PropertyVetoException(); 331cdf0e10cSrcweir 332cdf0e10cSrcweir bool bValuesChanged = false; 333cdf0e10cSrcweir bool bIllegalArgument = true; 334cdf0e10cSrcweir 335cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 ) 336cdf0e10cSrcweir { 337cdf0e10cSrcweir case ATTR_PRESENT_ALL: 338cdf0e10cSrcweir { 339cdf0e10cSrcweir sal_Bool bVal = sal_False; 340cdf0e10cSrcweir 341cdf0e10cSrcweir if( aValue >>= bVal ) 342cdf0e10cSrcweir { 343cdf0e10cSrcweir bIllegalArgument = false; 344cdf0e10cSrcweir 345cdf0e10cSrcweir if( rPresSettings.mbAll != bVal ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir rPresSettings.mbAll = bVal; 348cdf0e10cSrcweir bValuesChanged = true; 349cdf0e10cSrcweir if( bVal ) 350cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_False; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir } 353cdf0e10cSrcweir break; 354cdf0e10cSrcweir } 355cdf0e10cSrcweir case ATTR_PRESENT_CHANGE_PAGE: 356cdf0e10cSrcweir { 357cdf0e10cSrcweir sal_Bool bVal = sal_False; 358cdf0e10cSrcweir 359cdf0e10cSrcweir if( aValue >>= bVal ) 360cdf0e10cSrcweir { 361cdf0e10cSrcweir bIllegalArgument = false; 362cdf0e10cSrcweir 363cdf0e10cSrcweir if( bVal == rPresSettings.mbLockedPages ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir bValuesChanged = true; 366cdf0e10cSrcweir rPresSettings.mbLockedPages = !bVal; 367cdf0e10cSrcweir } 368cdf0e10cSrcweir } 369cdf0e10cSrcweir break; 370cdf0e10cSrcweir } 371cdf0e10cSrcweir 372cdf0e10cSrcweir case ATTR_PRESENT_ANIMATION_ALLOWED: 373cdf0e10cSrcweir { 374cdf0e10cSrcweir sal_Bool bVal = sal_False; 375cdf0e10cSrcweir 376cdf0e10cSrcweir if( aValue >>= bVal ) 377cdf0e10cSrcweir { 378cdf0e10cSrcweir bIllegalArgument = false; 379cdf0e10cSrcweir 380cdf0e10cSrcweir if(rPresSettings.mbAnimationAllowed != bVal) 381cdf0e10cSrcweir { 382cdf0e10cSrcweir bValuesChanged = true; 383cdf0e10cSrcweir rPresSettings.mbAnimationAllowed = bVal; 384cdf0e10cSrcweir } 385cdf0e10cSrcweir } 386cdf0e10cSrcweir break; 387cdf0e10cSrcweir } 388cdf0e10cSrcweir case ATTR_PRESENT_CUSTOMSHOW: 389cdf0e10cSrcweir { 390cdf0e10cSrcweir OUString aShow; 391cdf0e10cSrcweir if( aValue >>= aShow ) 392cdf0e10cSrcweir { 393cdf0e10cSrcweir bIllegalArgument = false; 394cdf0e10cSrcweir 395cdf0e10cSrcweir const String aShowName( aShow ); 396cdf0e10cSrcweir 397cdf0e10cSrcweir List* pCustomShowList = mpDoc->GetCustomShowList(sal_False); 398cdf0e10cSrcweir if(pCustomShowList) 399cdf0e10cSrcweir { 400cdf0e10cSrcweir SdCustomShow* pCustomShow; 401cdf0e10cSrcweir for( pCustomShow = (SdCustomShow*) pCustomShowList->First(); pCustomShow != NULL; pCustomShow = (SdCustomShow*) pCustomShowList->Next() ) 402cdf0e10cSrcweir { 403cdf0e10cSrcweir if( pCustomShow->GetName() == aShowName ) 404cdf0e10cSrcweir break; 405cdf0e10cSrcweir } 406cdf0e10cSrcweir 407cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_True; 408cdf0e10cSrcweir bValuesChanged = true; 409cdf0e10cSrcweir } 410cdf0e10cSrcweir } 411cdf0e10cSrcweir break; 412cdf0e10cSrcweir } 413cdf0e10cSrcweir case ATTR_PRESENT_ENDLESS: 414cdf0e10cSrcweir { 415cdf0e10cSrcweir sal_Bool bVal = sal_False; 416cdf0e10cSrcweir 417cdf0e10cSrcweir if( aValue >>= bVal ) 418cdf0e10cSrcweir { 419cdf0e10cSrcweir bIllegalArgument = false; 420cdf0e10cSrcweir 421cdf0e10cSrcweir if( rPresSettings.mbEndless != bVal) 422cdf0e10cSrcweir { 423cdf0e10cSrcweir bValuesChanged = true; 424cdf0e10cSrcweir rPresSettings.mbEndless = bVal; 425cdf0e10cSrcweir } 426cdf0e10cSrcweir } 427cdf0e10cSrcweir break; 428cdf0e10cSrcweir } 429cdf0e10cSrcweir case ATTR_PRESENT_FULLSCREEN: 430cdf0e10cSrcweir { 431cdf0e10cSrcweir sal_Bool bVal = sal_False; 432cdf0e10cSrcweir 433cdf0e10cSrcweir if( aValue >>= bVal ) 434cdf0e10cSrcweir { 435cdf0e10cSrcweir bIllegalArgument = false; 436cdf0e10cSrcweir if( rPresSettings.mbFullScreen != bVal) 437cdf0e10cSrcweir { 438cdf0e10cSrcweir bValuesChanged = true; 439cdf0e10cSrcweir rPresSettings.mbFullScreen = bVal; 440cdf0e10cSrcweir } 441cdf0e10cSrcweir } 442cdf0e10cSrcweir break; 443cdf0e10cSrcweir } 444cdf0e10cSrcweir case ATTR_PRESENT_DIANAME: 445cdf0e10cSrcweir { 446cdf0e10cSrcweir OUString aPresPage; 447cdf0e10cSrcweir aValue >>= aPresPage; 448cdf0e10cSrcweir bIllegalArgument = false; 449cdf0e10cSrcweir if( (rPresSettings.maPresPage != aPresPage) || !rPresSettings.mbCustomShow || !rPresSettings.mbAll ) 450cdf0e10cSrcweir { 451cdf0e10cSrcweir bValuesChanged = true; 452cdf0e10cSrcweir rPresSettings.maPresPage = getUiNameFromPageApiNameImpl(aPresPage); 453cdf0e10cSrcweir rPresSettings.mbCustomShow = sal_False; 454cdf0e10cSrcweir rPresSettings.mbAll = sal_False; 455cdf0e10cSrcweir } 456cdf0e10cSrcweir break; 457cdf0e10cSrcweir } 458cdf0e10cSrcweir case ATTR_PRESENT_MANUEL: 459cdf0e10cSrcweir { 460cdf0e10cSrcweir sal_Bool bVal = sal_False; 461cdf0e10cSrcweir 462cdf0e10cSrcweir if( aValue >>= bVal ) 463cdf0e10cSrcweir { 464cdf0e10cSrcweir bIllegalArgument = false; 465cdf0e10cSrcweir 466cdf0e10cSrcweir if( rPresSettings.mbManual != bVal) 467cdf0e10cSrcweir { 468cdf0e10cSrcweir bValuesChanged = true; 469cdf0e10cSrcweir rPresSettings.mbManual = bVal; 470cdf0e10cSrcweir } 471cdf0e10cSrcweir } 472cdf0e10cSrcweir break; 473cdf0e10cSrcweir } 474cdf0e10cSrcweir case ATTR_PRESENT_MOUSE: 475cdf0e10cSrcweir { 476cdf0e10cSrcweir sal_Bool bVal = sal_False; 477cdf0e10cSrcweir 478cdf0e10cSrcweir if( aValue >>= bVal ) 479cdf0e10cSrcweir { 480cdf0e10cSrcweir bIllegalArgument = false; 481cdf0e10cSrcweir if( rPresSettings.mbMouseVisible != bVal) 482cdf0e10cSrcweir { 483cdf0e10cSrcweir bValuesChanged = true; 484cdf0e10cSrcweir rPresSettings.mbMouseVisible = bVal; 485cdf0e10cSrcweir } 486cdf0e10cSrcweir } 487cdf0e10cSrcweir break; 488cdf0e10cSrcweir } 489cdf0e10cSrcweir case ATTR_PRESENT_ALWAYS_ON_TOP: 490cdf0e10cSrcweir { 491cdf0e10cSrcweir sal_Bool bVal = sal_False; 492cdf0e10cSrcweir 493cdf0e10cSrcweir if( aValue >>= bVal ) 494cdf0e10cSrcweir { 495cdf0e10cSrcweir bIllegalArgument = false; 496cdf0e10cSrcweir 497cdf0e10cSrcweir if( rPresSettings.mbAlwaysOnTop != bVal) 498cdf0e10cSrcweir { 499cdf0e10cSrcweir bValuesChanged = true; 500cdf0e10cSrcweir rPresSettings.mbAlwaysOnTop = bVal; 501cdf0e10cSrcweir } 502cdf0e10cSrcweir } 503cdf0e10cSrcweir break; 504cdf0e10cSrcweir } 505cdf0e10cSrcweir case ATTR_PRESENT_NAVIGATOR: 506cdf0e10cSrcweir { 507cdf0e10cSrcweir sal_Bool bVal = sal_False; 508cdf0e10cSrcweir 509cdf0e10cSrcweir if( aValue >>= bVal ) 510cdf0e10cSrcweir { 511cdf0e10cSrcweir bIllegalArgument = false; 512cdf0e10cSrcweir 513cdf0e10cSrcweir if( rPresSettings.mbStartWithNavigator != bVal) 514cdf0e10cSrcweir { 515cdf0e10cSrcweir bValuesChanged = true; 516cdf0e10cSrcweir rPresSettings.mbStartWithNavigator = bVal; 517cdf0e10cSrcweir } 518cdf0e10cSrcweir } 519cdf0e10cSrcweir break; 520cdf0e10cSrcweir } 521cdf0e10cSrcweir case ATTR_PRESENT_PEN: 522cdf0e10cSrcweir { 523cdf0e10cSrcweir sal_Bool bVal = sal_False; 524cdf0e10cSrcweir 525cdf0e10cSrcweir if( aValue >>= bVal ) 526cdf0e10cSrcweir { 527cdf0e10cSrcweir bIllegalArgument = false; 528cdf0e10cSrcweir 529cdf0e10cSrcweir if(rPresSettings.mbMouseAsPen != bVal) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir bValuesChanged = true; 532cdf0e10cSrcweir rPresSettings.mbMouseAsPen = bVal; 533cdf0e10cSrcweir } 534cdf0e10cSrcweir } 535cdf0e10cSrcweir break; 536cdf0e10cSrcweir } 537cdf0e10cSrcweir case ATTR_PRESENT_PAUSE_TIMEOUT: 538cdf0e10cSrcweir { 539cdf0e10cSrcweir sal_Int32 nValue = 0; 540cdf0e10cSrcweir if( (aValue >>= nValue) && (nValue >= 0) ) 541cdf0e10cSrcweir { 542cdf0e10cSrcweir bIllegalArgument = false; 543cdf0e10cSrcweir if( rPresSettings.mnPauseTimeout != nValue ) 544cdf0e10cSrcweir { 545cdf0e10cSrcweir bValuesChanged = true; 546cdf0e10cSrcweir rPresSettings.mnPauseTimeout = nValue; 547cdf0e10cSrcweir } 548cdf0e10cSrcweir } 549cdf0e10cSrcweir break; 550cdf0e10cSrcweir } 551cdf0e10cSrcweir case ATTR_PRESENT_SHOW_PAUSELOGO: 552cdf0e10cSrcweir { 553cdf0e10cSrcweir sal_Bool bVal = sal_False; 554cdf0e10cSrcweir 555cdf0e10cSrcweir if( aValue >>= bVal ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir bIllegalArgument = false; 558cdf0e10cSrcweir 559cdf0e10cSrcweir if( rPresSettings.mbShowPauseLogo != bVal ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir bValuesChanged = true; 562cdf0e10cSrcweir rPresSettings.mbShowPauseLogo = bVal; 563cdf0e10cSrcweir } 564cdf0e10cSrcweir } 565cdf0e10cSrcweir break; 566cdf0e10cSrcweir } 567cdf0e10cSrcweir case ATTR_PRESENT_DISPLAY: 568cdf0e10cSrcweir { 569cdf0e10cSrcweir sal_Int32 nDisplay = 0; 570cdf0e10cSrcweir if( aValue >>= nDisplay ) 571cdf0e10cSrcweir { 572cdf0e10cSrcweir // Convert value to true display id. 573cdf0e10cSrcweir if (nDisplay == 0) 574cdf0e10cSrcweir nDisplay = GetDefaultDisplay(); 575cdf0e10cSrcweir else if (nDisplay < 0) 576cdf0e10cSrcweir nDisplay = -1; 577cdf0e10cSrcweir else 578cdf0e10cSrcweir --nDisplay; 579cdf0e10cSrcweir 580cdf0e10cSrcweir bIllegalArgument = false; 581cdf0e10cSrcweir 582cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); 583cdf0e10cSrcweir pOptions->SetDisplay( nDisplay ); 584cdf0e10cSrcweir } 585cdf0e10cSrcweir break; 586cdf0e10cSrcweir } 587cdf0e10cSrcweir 588cdf0e10cSrcweir default: 589cdf0e10cSrcweir throw UnknownPropertyException(); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir if( bIllegalArgument ) 593cdf0e10cSrcweir throw IllegalArgumentException(); 594cdf0e10cSrcweir 595cdf0e10cSrcweir if( bValuesChanged ) 596cdf0e10cSrcweir mpDoc->SetChanged( true ); 597cdf0e10cSrcweir } 598cdf0e10cSrcweir 599cdf0e10cSrcweir // -------------------------------------------------------------------- 600cdf0e10cSrcweir 601cdf0e10cSrcweir Any SAL_CALL SlideShow::getPropertyValue( const OUString& PropertyName ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 602cdf0e10cSrcweir { 603cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 604cdf0e10cSrcweir ThrowIfDisposed(); 605cdf0e10cSrcweir 606cdf0e10cSrcweir const sd::PresentationSettings& rPresSettings = mpDoc->getPresentationSettings(); 607cdf0e10cSrcweir 608cdf0e10cSrcweir const SfxItemPropertySimpleEntry* pEntry = maPropSet.getPropertyMapEntry(PropertyName); 609cdf0e10cSrcweir 610cdf0e10cSrcweir switch( pEntry ? pEntry->nWID : -1 ) 611cdf0e10cSrcweir { 612cdf0e10cSrcweir case ATTR_PRESENT_ALL: 613cdf0e10cSrcweir return Any( (sal_Bool) ( !rPresSettings.mbCustomShow && rPresSettings.mbAll ) ); 614cdf0e10cSrcweir case ATTR_PRESENT_CHANGE_PAGE: 615cdf0e10cSrcweir return Any( (sal_Bool) !rPresSettings.mbLockedPages ); 616cdf0e10cSrcweir case ATTR_PRESENT_ANIMATION_ALLOWED: 617cdf0e10cSrcweir return Any( rPresSettings.mbAnimationAllowed ); 618cdf0e10cSrcweir case ATTR_PRESENT_CUSTOMSHOW: 619cdf0e10cSrcweir { 620cdf0e10cSrcweir List* pList = mpDoc->GetCustomShowList(sal_False); 621cdf0e10cSrcweir SdCustomShow* pShow = (pList && rPresSettings.mbCustomShow)?(SdCustomShow*)pList->GetCurObject():NULL; 622cdf0e10cSrcweir OUString aShowName; 623cdf0e10cSrcweir 624cdf0e10cSrcweir if(pShow) 625cdf0e10cSrcweir aShowName = pShow->GetName(); 626cdf0e10cSrcweir 627cdf0e10cSrcweir return Any( aShowName ); 628cdf0e10cSrcweir } 629cdf0e10cSrcweir case ATTR_PRESENT_ENDLESS: 630cdf0e10cSrcweir return Any( rPresSettings.mbEndless ); 631cdf0e10cSrcweir case ATTR_PRESENT_FULLSCREEN: 632cdf0e10cSrcweir return Any( rPresSettings.mbFullScreen ); 633cdf0e10cSrcweir case ATTR_PRESENT_DIANAME: 634cdf0e10cSrcweir { 635cdf0e10cSrcweir OUString aSlideName; 636cdf0e10cSrcweir 637cdf0e10cSrcweir if( !rPresSettings.mbCustomShow && !rPresSettings.mbAll ) 638cdf0e10cSrcweir aSlideName = getPageApiNameFromUiName( rPresSettings.maPresPage ); 639cdf0e10cSrcweir 640cdf0e10cSrcweir return Any( aSlideName ); 641cdf0e10cSrcweir } 642cdf0e10cSrcweir case ATTR_PRESENT_MANUEL: 643cdf0e10cSrcweir return Any( rPresSettings.mbManual ); 644cdf0e10cSrcweir case ATTR_PRESENT_MOUSE: 645cdf0e10cSrcweir return Any( rPresSettings.mbMouseVisible ); 646cdf0e10cSrcweir case ATTR_PRESENT_ALWAYS_ON_TOP: 647cdf0e10cSrcweir return Any( rPresSettings.mbAlwaysOnTop ); 648cdf0e10cSrcweir case ATTR_PRESENT_NAVIGATOR: 649cdf0e10cSrcweir return Any( rPresSettings.mbStartWithNavigator ); 650cdf0e10cSrcweir case ATTR_PRESENT_PEN: 651cdf0e10cSrcweir return Any( rPresSettings.mbMouseAsPen ); 652cdf0e10cSrcweir case ATTR_PRESENT_PAUSE_TIMEOUT: 653cdf0e10cSrcweir return Any( rPresSettings.mnPauseTimeout ); 654cdf0e10cSrcweir case ATTR_PRESENT_SHOW_PAUSELOGO: 655cdf0e10cSrcweir return Any( rPresSettings.mbShowPauseLogo ); 656cdf0e10cSrcweir case ATTR_PRESENT_DISPLAY: 657cdf0e10cSrcweir { 658cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); 659cdf0e10cSrcweir const sal_Int32 nDisplay (pOptions->GetDisplay()); 660cdf0e10cSrcweir // Convert true display id to the previously used schema. 661cdf0e10cSrcweir if (nDisplay == GetDefaultDisplay()) 662cdf0e10cSrcweir return Any(sal_Int32(0)); 663cdf0e10cSrcweir else if (nDisplay < 0) 664cdf0e10cSrcweir return Any(sal_Int32(-1)); 665cdf0e10cSrcweir else 666cdf0e10cSrcweir return Any(nDisplay+1); 667cdf0e10cSrcweir } 668cdf0e10cSrcweir 669cdf0e10cSrcweir default: 670cdf0e10cSrcweir throw UnknownPropertyException(); 671cdf0e10cSrcweir } 672cdf0e10cSrcweir } 673cdf0e10cSrcweir 674cdf0e10cSrcweir // -------------------------------------------------------------------- 675cdf0e10cSrcweir 676cdf0e10cSrcweir void SAL_CALL SlideShow::addPropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 677cdf0e10cSrcweir { 678cdf0e10cSrcweir } 679cdf0e10cSrcweir 680cdf0e10cSrcweir // -------------------------------------------------------------------- 681cdf0e10cSrcweir 682cdf0e10cSrcweir void SAL_CALL SlideShow::removePropertyChangeListener( const OUString& , const Reference< XPropertyChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 683cdf0e10cSrcweir { 684cdf0e10cSrcweir } 685cdf0e10cSrcweir 686cdf0e10cSrcweir // -------------------------------------------------------------------- 687cdf0e10cSrcweir 688cdf0e10cSrcweir void SAL_CALL SlideShow::addVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 689cdf0e10cSrcweir { 690cdf0e10cSrcweir } 691cdf0e10cSrcweir 692cdf0e10cSrcweir // -------------------------------------------------------------------- 693cdf0e10cSrcweir 694cdf0e10cSrcweir void SAL_CALL SlideShow::removeVetoableChangeListener( const OUString& , const Reference< XVetoableChangeListener >& ) throw(UnknownPropertyException, WrappedTargetException, RuntimeException) 695cdf0e10cSrcweir { 696cdf0e10cSrcweir } 697cdf0e10cSrcweir 698cdf0e10cSrcweir // -------------------------------------------------------------------- 699cdf0e10cSrcweir // XPresentation 700cdf0e10cSrcweir // -------------------------------------------------------------------- 701cdf0e10cSrcweir 702cdf0e10cSrcweir void SAL_CALL SlideShow::start() throw(RuntimeException) 703cdf0e10cSrcweir { 704cdf0e10cSrcweir const Sequence< PropertyValue > aArguments; 705cdf0e10cSrcweir startWithArguments( aArguments ); 706cdf0e10cSrcweir } 707cdf0e10cSrcweir 708cdf0e10cSrcweir // -------------------------------------------------------------------- 709cdf0e10cSrcweir 710cdf0e10cSrcweir void SAL_CALL SlideShow::end() throw(RuntimeException) 711cdf0e10cSrcweir { 712cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 713cdf0e10cSrcweir 714cdf0e10cSrcweir // The mbIsInStartup flag should have been reset during the start of the 715cdf0e10cSrcweir // slide show. Reset it here just in case that something has horribly 716cdf0e10cSrcweir // gone wrong. 717cdf0e10cSrcweir OSL_ASSERT(!mbIsInStartup); 718cdf0e10cSrcweir mbIsInStartup = false; 719cdf0e10cSrcweir 720cdf0e10cSrcweir rtl::Reference< SlideshowImpl > xController( mxController ); 721cdf0e10cSrcweir if( xController.is() ) 722cdf0e10cSrcweir { 723cdf0e10cSrcweir mxController.clear(); 724cdf0e10cSrcweir 725cdf0e10cSrcweir if( mpFullScreenFrameView ) 726cdf0e10cSrcweir { 727cdf0e10cSrcweir delete mpFullScreenFrameView; 728cdf0e10cSrcweir mpFullScreenFrameView = 0; 729cdf0e10cSrcweir } 730cdf0e10cSrcweir 731cdf0e10cSrcweir ViewShellBase* pFullScreenViewShellBase = mpFullScreenViewShellBase; 732cdf0e10cSrcweir mpFullScreenViewShellBase = 0; 733cdf0e10cSrcweir 73480f2ae65SPedro Giffuni // dispose before fullscreen window changes screens 73580f2ae65SPedro Giffuni // (potentially). If this needs to be moved behind 73680f2ae65SPedro Giffuni // pWorkWindow->StartPresentationMode() again, read issue 73780f2ae65SPedro Giffuni // i94007 & implement the solution outlined there. 73880f2ae65SPedro Giffuni xController->dispose(); 73980f2ae65SPedro Giffuni 740cdf0e10cSrcweir if( pFullScreenViewShellBase ) 741cdf0e10cSrcweir { 742cdf0e10cSrcweir PresentationViewShell* pShell = dynamic_cast<PresentationViewShell*>(pFullScreenViewShellBase->GetMainViewShell().get()); 743cdf0e10cSrcweir 744cdf0e10cSrcweir if( pShell && pShell->GetViewFrame() ) 745cdf0e10cSrcweir { 746cdf0e10cSrcweir WorkWindow* pWorkWindow = dynamic_cast<WorkWindow*>(pShell->GetViewFrame()->GetTopFrame().GetWindow().GetParent()); 747cdf0e10cSrcweir if( pWorkWindow ) 748cdf0e10cSrcweir { 749cdf0e10cSrcweir pWorkWindow->StartPresentationMode( sal_False, isAlwaysOnTop() ); 750cdf0e10cSrcweir } 751cdf0e10cSrcweir } 752cdf0e10cSrcweir } 753cdf0e10cSrcweir 754cdf0e10cSrcweir if( pFullScreenViewShellBase ) 755cdf0e10cSrcweir { 756cdf0e10cSrcweir PresentationViewShell* pShell = NULL; 757cdf0e10cSrcweir { 758cdf0e10cSrcweir // Get the shell pointer in its own scope to be sure that 759cdf0e10cSrcweir // the shared_ptr to the shell is released before DoClose() 760cdf0e10cSrcweir // is called. 761cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pSharedView (pFullScreenViewShellBase->GetMainViewShell()); 762cdf0e10cSrcweir pShell = dynamic_cast<PresentationViewShell*>(pSharedView.get()); 763cdf0e10cSrcweir } 764cdf0e10cSrcweir if( pShell && pShell->GetViewFrame() ) 765cdf0e10cSrcweir pShell->GetViewFrame()->DoClose(); 766cdf0e10cSrcweir } 767cdf0e10cSrcweir else if( mpCurrentViewShellBase ) 768cdf0e10cSrcweir { 769cdf0e10cSrcweir ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get(); 770cdf0e10cSrcweir 771cdf0e10cSrcweir if( pViewShell ) 772cdf0e10cSrcweir { 773cdf0e10cSrcweir FrameView* pFrameView = pViewShell->GetFrameView(); 774cdf0e10cSrcweir 775cdf0e10cSrcweir if( pFrameView && (pFrameView->GetPresentationViewShellId() != SID_VIEWSHELL0) ) 776cdf0e10cSrcweir { 777cdf0e10cSrcweir ViewShell::ShellType ePreviousType (pFrameView->GetPreviousViewShellType()); 778cdf0e10cSrcweir pFrameView->SetPreviousViewShellType(ViewShell::ST_NONE); 779cdf0e10cSrcweir 780cdf0e10cSrcweir pFrameView->SetPresentationViewShellId(SID_VIEWSHELL0); 781cdf0e10cSrcweir pFrameView->SetSlotId(SID_OBJECT_SELECT); 782cdf0e10cSrcweir pFrameView->SetPreviousViewShellType(pViewShell->GetShellType()); 783cdf0e10cSrcweir 784cdf0e10cSrcweir framework::FrameworkHelper::Instance(*mpCurrentViewShellBase)->RequestView( 785cdf0e10cSrcweir framework::FrameworkHelper::GetViewURL(ePreviousType), 786cdf0e10cSrcweir framework::FrameworkHelper::msCenterPaneURL); 787cdf0e10cSrcweir 788cdf0e10cSrcweir pViewShell->GetViewFrame()->GetBindings().InvalidateAll( sal_True ); 789cdf0e10cSrcweir } 790cdf0e10cSrcweir } 791cdf0e10cSrcweir } 792cdf0e10cSrcweir 793cdf0e10cSrcweir if( mpCurrentViewShellBase ) 794cdf0e10cSrcweir { 795cdf0e10cSrcweir ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get(); 796cdf0e10cSrcweir if( pViewShell ) 797cdf0e10cSrcweir { 798cdf0e10cSrcweir // invalidate the view shell so the presentation slot will be re-enabled 799cdf0e10cSrcweir // and the rehersing will be updated 800cdf0e10cSrcweir pViewShell->Invalidate(); 801cdf0e10cSrcweir 802cdf0e10cSrcweir if( xController->meAnimationMode ==ANIMATIONMODE_SHOW ) 803cdf0e10cSrcweir { 804cdf0e10cSrcweir // switch to the previously visible Slide 805cdf0e10cSrcweir DrawViewShell* pDrawViewShell = dynamic_cast<DrawViewShell*>( pViewShell ); 806cdf0e10cSrcweir if( pDrawViewShell ) 807cdf0e10cSrcweir pDrawViewShell->SwitchPage( (sal_uInt16)xController->getRestoreSlide() ); 808cdf0e10cSrcweir else 809cdf0e10cSrcweir { 810cdf0e10cSrcweir Reference<XDrawView> xDrawView ( 811cdf0e10cSrcweir Reference<XWeak>(&mpCurrentViewShellBase->GetDrawController()), UNO_QUERY); 812cdf0e10cSrcweir if (xDrawView.is()) 813cdf0e10cSrcweir xDrawView->setCurrentPage( 814cdf0e10cSrcweir Reference<XDrawPage>( 815cdf0e10cSrcweir mpDoc->GetSdPage(xController->getRestoreSlide(), PK_STANDARD)->getUnoPage(), 816cdf0e10cSrcweir UNO_QUERY)); 817cdf0e10cSrcweir } 818cdf0e10cSrcweir } 819cdf0e10cSrcweir } 820cdf0e10cSrcweir } 821cdf0e10cSrcweir mpCurrentViewShellBase = 0; 822cdf0e10cSrcweir } 823cdf0e10cSrcweir } 824cdf0e10cSrcweir 825cdf0e10cSrcweir // -------------------------------------------------------------------- 826cdf0e10cSrcweir 827cdf0e10cSrcweir void SAL_CALL SlideShow::rehearseTimings() throw(RuntimeException) 828cdf0e10cSrcweir { 829cdf0e10cSrcweir Sequence< PropertyValue > aArguments(1); 830cdf0e10cSrcweir aArguments[0].Name = C2U("RehearseTimings"); 831cdf0e10cSrcweir aArguments[0].Value <<= sal_True; 832cdf0e10cSrcweir startWithArguments( aArguments ); 833cdf0e10cSrcweir } 834cdf0e10cSrcweir 835cdf0e10cSrcweir // -------------------------------------------------------------------- 836cdf0e10cSrcweir // XPresentation2 837cdf0e10cSrcweir // -------------------------------------------------------------------- 838cdf0e10cSrcweir 839cdf0e10cSrcweir void SAL_CALL SlideShow::startWithArguments( const Sequence< PropertyValue >& rArguments ) throw (RuntimeException) 840cdf0e10cSrcweir { 841cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 842cdf0e10cSrcweir ThrowIfDisposed(); 843cdf0e10cSrcweir 844cdf0e10cSrcweir // Stop a running show before starting a new one. 845cdf0e10cSrcweir if( mxController.is() ) 846cdf0e10cSrcweir { 847cdf0e10cSrcweir OSL_ASSERT(!mbIsInStartup); 848cdf0e10cSrcweir end(); 849cdf0e10cSrcweir } 850cdf0e10cSrcweir else if (mbIsInStartup) 851cdf0e10cSrcweir { 852cdf0e10cSrcweir // We are already somewhere in process of starting a slide show but 853cdf0e10cSrcweir // have not yet got to the point where mxController is set. There 854cdf0e10cSrcweir // is not yet a slide show to end so return silently. 855cdf0e10cSrcweir return; 856cdf0e10cSrcweir } 857cdf0e10cSrcweir 858cdf0e10cSrcweir // Prevent multiple instance of the SlideShow class for one document. 859cdf0e10cSrcweir mbIsInStartup = true; 860cdf0e10cSrcweir 861cdf0e10cSrcweir mxCurrentSettings.reset( new PresentationSettingsEx( mpDoc->getPresentationSettings() ) ); 862cdf0e10cSrcweir mxCurrentSettings->SetArguments( rArguments ); 863cdf0e10cSrcweir 864cdf0e10cSrcweir // if there is no view shell base set, use the current one or the first using this document 865cdf0e10cSrcweir if( mpCurrentViewShellBase == 0 ) 866cdf0e10cSrcweir { 867cdf0e10cSrcweir // first check current 868cdf0e10cSrcweir ::sd::ViewShellBase* pBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::Current() ); 869cdf0e10cSrcweir if( pBase && pBase->GetDocument() == mpDoc ) 870cdf0e10cSrcweir { 871cdf0e10cSrcweir mpCurrentViewShellBase = pBase; 872cdf0e10cSrcweir } 873cdf0e10cSrcweir else 874cdf0e10cSrcweir { 875cdf0e10cSrcweir // current is not ours, so get first from ours 876cdf0e10cSrcweir mpCurrentViewShellBase = ::sd::ViewShellBase::GetViewShellBase( SfxViewFrame::GetFirst( mpDoc->GetDocSh() ) ); 877cdf0e10cSrcweir } 878cdf0e10cSrcweir } 879cdf0e10cSrcweir 88030d43537SHerbert Dürr // #118456# make sure TextEdit changes get pushed to model. 88130d43537SHerbert Dürr // mpDrawView is tested against NULL above already. 88230d43537SHerbert Dürr if(mpCurrentViewShellBase) 88330d43537SHerbert Dürr { 88430d43537SHerbert Dürr ViewShell* pViewShell = mpCurrentViewShellBase->GetMainViewShell().get(); 88530d43537SHerbert Dürr 88630d43537SHerbert Dürr if(pViewShell && pViewShell->GetView()) 88730d43537SHerbert Dürr { 88830d43537SHerbert Dürr pViewShell->GetView()->SdrEndTextEdit(); 88930d43537SHerbert Dürr } 89030d43537SHerbert Dürr } 89130d43537SHerbert Dürr 892cdf0e10cSrcweir // Start either a full-screen or an in-place show. 893cdf0e10cSrcweir if(mxCurrentSettings->mbFullScreen && !mxCurrentSettings->mbPreview) 894cdf0e10cSrcweir StartFullscreenPresentation(); 895cdf0e10cSrcweir else 896cdf0e10cSrcweir StartInPlacePresentation(); 897cdf0e10cSrcweir } 898cdf0e10cSrcweir 899cdf0e10cSrcweir // -------------------------------------------------------------------- 900cdf0e10cSrcweir 901cdf0e10cSrcweir ::sal_Bool SAL_CALL SlideShow::isRunning( ) throw (RuntimeException) 902cdf0e10cSrcweir { 903cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 904cdf0e10cSrcweir return mxController.is() && mxController->isRunning(); 905cdf0e10cSrcweir } 906cdf0e10cSrcweir 907cdf0e10cSrcweir // -------------------------------------------------------------------- 908cdf0e10cSrcweir 909cdf0e10cSrcweir Reference< XSlideShowController > SAL_CALL SlideShow::getController( ) throw (RuntimeException) 910cdf0e10cSrcweir { 911cdf0e10cSrcweir ThrowIfDisposed(); 912cdf0e10cSrcweir 913cdf0e10cSrcweir Reference< XSlideShowController > xController( mxController.get() ); 914cdf0e10cSrcweir return xController; 915cdf0e10cSrcweir } 916cdf0e10cSrcweir 917cdf0e10cSrcweir // -------------------------------------------------------------------- 918cdf0e10cSrcweir // XComponent 919cdf0e10cSrcweir // -------------------------------------------------------------------- 920cdf0e10cSrcweir 921cdf0e10cSrcweir void SAL_CALL SlideShow::disposing (void) 922cdf0e10cSrcweir { 923cdf0e10cSrcweir OGuard aGuard( Application::GetSolarMutex() ); 924cdf0e10cSrcweir 925cdf0e10cSrcweir if( mnInPlaceConfigEvent ) 926cdf0e10cSrcweir { 927cdf0e10cSrcweir Application::RemoveUserEvent( mnInPlaceConfigEvent ); 928cdf0e10cSrcweir mnInPlaceConfigEvent = 0; 929cdf0e10cSrcweir } 930cdf0e10cSrcweir 931cdf0e10cSrcweir if( mxController.is() ) 932cdf0e10cSrcweir { 933cdf0e10cSrcweir mxController->dispose(); 934cdf0e10cSrcweir mxController.clear(); 935cdf0e10cSrcweir } 936cdf0e10cSrcweir 937cdf0e10cSrcweir mpCurrentViewShellBase = 0; 938cdf0e10cSrcweir mpFullScreenViewShellBase = 0; 939cdf0e10cSrcweir mpDoc = 0; 940cdf0e10cSrcweir } 941cdf0e10cSrcweir 942cdf0e10cSrcweir // --------------------------------------------------------- 943cdf0e10cSrcweir 944cdf0e10cSrcweir bool SlideShow::startPreview( const Reference< XDrawPage >& xDrawPage, const Reference< XAnimationNode >& xAnimationNode, ::Window* pParent ) 945cdf0e10cSrcweir { 946cdf0e10cSrcweir Sequence< PropertyValue > aArguments(4); 947cdf0e10cSrcweir 948cdf0e10cSrcweir aArguments[0].Name = C2U("Preview"); 949cdf0e10cSrcweir aArguments[0].Value <<= sal_True; 950cdf0e10cSrcweir 951cdf0e10cSrcweir aArguments[1].Name = C2U("FirstPage"); 952cdf0e10cSrcweir aArguments[1].Value <<= xDrawPage; 953cdf0e10cSrcweir 954cdf0e10cSrcweir aArguments[2].Name = C2U("AnimationNode"); 955cdf0e10cSrcweir aArguments[2].Value <<= xAnimationNode; 956cdf0e10cSrcweir 957cdf0e10cSrcweir Reference< XWindow > xParentWindow; 958cdf0e10cSrcweir if( pParent ) 959cdf0e10cSrcweir xParentWindow = VCLUnoHelper::GetInterface( pParent ); 960cdf0e10cSrcweir 961cdf0e10cSrcweir aArguments[3].Name = C2U("ParentWindow"); 962cdf0e10cSrcweir aArguments[3].Value <<= xParentWindow; 963cdf0e10cSrcweir 964cdf0e10cSrcweir startWithArguments( aArguments ); 965cdf0e10cSrcweir 966cdf0e10cSrcweir return true; 967cdf0e10cSrcweir } 968cdf0e10cSrcweir 969cdf0e10cSrcweir // --------------------------------------------------------- 970cdf0e10cSrcweir 971cdf0e10cSrcweir ShowWindow* SlideShow::getShowWindow() 972cdf0e10cSrcweir { 973cdf0e10cSrcweir return mxController.is() ? mxController->mpShowWindow : 0; 974cdf0e10cSrcweir } 975cdf0e10cSrcweir 976cdf0e10cSrcweir // --------------------------------------------------------- 977cdf0e10cSrcweir 978cdf0e10cSrcweir int SlideShow::getAnimationMode() 979cdf0e10cSrcweir { 980cdf0e10cSrcweir return mxController.is() ? mxController->meAnimationMode : ANIMATIONMODE_SHOW; 981cdf0e10cSrcweir } 982cdf0e10cSrcweir 983cdf0e10cSrcweir // --------------------------------------------------------- 984cdf0e10cSrcweir 985cdf0e10cSrcweir void SlideShow::jumpToPageIndex( sal_Int32 nPageIndex ) 986cdf0e10cSrcweir { 987cdf0e10cSrcweir if( mxController.is() ) 988cdf0e10cSrcweir mxController->displaySlideIndex( nPageIndex ); 989cdf0e10cSrcweir } 990cdf0e10cSrcweir 991cdf0e10cSrcweir // --------------------------------------------------------- 992cdf0e10cSrcweir 993cdf0e10cSrcweir void SlideShow::jumpToPageNumber( sal_Int32 nPageNumber ) 994cdf0e10cSrcweir { 995cdf0e10cSrcweir if( mxController.is() ) 996cdf0e10cSrcweir mxController->displaySlideNumber( nPageNumber ); 997cdf0e10cSrcweir } 998cdf0e10cSrcweir 999cdf0e10cSrcweir // --------------------------------------------------------- 1000cdf0e10cSrcweir 1001cdf0e10cSrcweir sal_Int32 SlideShow::getCurrentPageNumber() 1002cdf0e10cSrcweir { 1003cdf0e10cSrcweir return mxController.is() ? mxController->getCurrentSlideNumber() : 0; 1004cdf0e10cSrcweir } 1005cdf0e10cSrcweir 1006cdf0e10cSrcweir // --------------------------------------------------------- 1007cdf0e10cSrcweir 1008cdf0e10cSrcweir void SlideShow::jumpToBookmark( const OUString& sBookmark ) 1009cdf0e10cSrcweir { 1010cdf0e10cSrcweir if( mxController.is() ) 1011cdf0e10cSrcweir mxController->jumpToBookmark( sBookmark ); 1012cdf0e10cSrcweir } 1013cdf0e10cSrcweir 1014cdf0e10cSrcweir // --------------------------------------------------------- 1015cdf0e10cSrcweir 1016cdf0e10cSrcweir bool SlideShow::isFullScreen() 1017cdf0e10cSrcweir { 1018cdf0e10cSrcweir return mxController.is() ? mxController->maPresSettings.mbFullScreen : false; 1019cdf0e10cSrcweir } 1020cdf0e10cSrcweir 1021cdf0e10cSrcweir // --------------------------------------------------------- 1022cdf0e10cSrcweir 1023cdf0e10cSrcweir void SlideShow::resize( const Size &rSize ) 1024cdf0e10cSrcweir { 1025cdf0e10cSrcweir if( mxController.is() ) 1026cdf0e10cSrcweir mxController->resize( rSize ); 1027cdf0e10cSrcweir } 1028cdf0e10cSrcweir 1029cdf0e10cSrcweir // --------------------------------------------------------- 1030cdf0e10cSrcweir 1031cdf0e10cSrcweir void SlideShow::activate( ViewShellBase& rBase ) 1032cdf0e10cSrcweir { 1033cdf0e10cSrcweir if( (mpFullScreenViewShellBase == &rBase) && !mxController.is() ) 1034cdf0e10cSrcweir { 1035cdf0e10cSrcweir ::boost::shared_ptr<PresentationViewShell> pShell = ::boost::dynamic_pointer_cast<PresentationViewShell>(rBase.GetMainViewShell()); 1036cdf0e10cSrcweir if(pShell.get() != NULL) 1037cdf0e10cSrcweir { 1038cdf0e10cSrcweir pShell->FinishInitialization( mpFullScreenFrameView ); 1039cdf0e10cSrcweir mpFullScreenFrameView = 0; 1040cdf0e10cSrcweir 1041cdf0e10cSrcweir CreateController( pShell.get(), pShell->GetView(), rBase.GetViewWindow() ); 1042cdf0e10cSrcweir 1043cdf0e10cSrcweir if( mxController->startShow(mxCurrentSettings.get()) ) 1044cdf0e10cSrcweir { 1045cdf0e10cSrcweir pShell->Resize(); 1046cdf0e10cSrcweir } 1047cdf0e10cSrcweir else 1048cdf0e10cSrcweir { 1049cdf0e10cSrcweir end(); 1050cdf0e10cSrcweir return; 1051cdf0e10cSrcweir } 1052cdf0e10cSrcweir } 1053cdf0e10cSrcweir } 1054cdf0e10cSrcweir 1055cdf0e10cSrcweir if( mxController.is() ) 1056cdf0e10cSrcweir mxController->activate(); 1057cdf0e10cSrcweir } 1058cdf0e10cSrcweir 1059cdf0e10cSrcweir // --------------------------------------------------------- 1060cdf0e10cSrcweir 1061cdf0e10cSrcweir void SlideShow::deactivate( ViewShellBase& /*rBase*/ ) 1062cdf0e10cSrcweir { 1063cdf0e10cSrcweir mxController->deactivate(); 1064cdf0e10cSrcweir } 1065cdf0e10cSrcweir 1066cdf0e10cSrcweir // --------------------------------------------------------- 1067cdf0e10cSrcweir 1068cdf0e10cSrcweir bool SlideShow::keyInput(const KeyEvent& rKEvt) 1069cdf0e10cSrcweir { 1070cdf0e10cSrcweir return mxController.is() ? mxController->keyInput(rKEvt) : false; 1071cdf0e10cSrcweir } 1072cdf0e10cSrcweir 1073cdf0e10cSrcweir // --------------------------------------------------------- 1074cdf0e10cSrcweir 1075cdf0e10cSrcweir void SlideShow::paint( const Rectangle& rRect ) 1076cdf0e10cSrcweir { 1077cdf0e10cSrcweir if( mxController.is() ) 1078cdf0e10cSrcweir mxController->paint( rRect ); 1079cdf0e10cSrcweir } 1080cdf0e10cSrcweir 1081cdf0e10cSrcweir // --------------------------------------------------------- 1082cdf0e10cSrcweir 1083cdf0e10cSrcweir bool SlideShow::isAlwaysOnTop() 1084cdf0e10cSrcweir { 1085cdf0e10cSrcweir return mxController.is() ? mxController->maPresSettings.mbAlwaysOnTop : false; 1086cdf0e10cSrcweir } 1087cdf0e10cSrcweir 1088cdf0e10cSrcweir // --------------------------------------------------------- 1089cdf0e10cSrcweir 1090cdf0e10cSrcweir bool SlideShow::pause( bool bPause ) 1091cdf0e10cSrcweir { 1092cdf0e10cSrcweir if( mxController.is() ) 1093cdf0e10cSrcweir { 1094cdf0e10cSrcweir if( bPause ) 1095cdf0e10cSrcweir mxController->pause(); 1096cdf0e10cSrcweir else 1097cdf0e10cSrcweir mxController->resume(); 1098cdf0e10cSrcweir } 1099cdf0e10cSrcweir return true; 1100cdf0e10cSrcweir } 1101cdf0e10cSrcweir 1102cdf0e10cSrcweir // --------------------------------------------------------- 1103cdf0e10cSrcweir 1104cdf0e10cSrcweir void SlideShow::receiveRequest(SfxRequest& rReq) 1105cdf0e10cSrcweir { 1106cdf0e10cSrcweir if( mxController.is() ) 1107cdf0e10cSrcweir mxController->receiveRequest( rReq ); 1108cdf0e10cSrcweir } 1109cdf0e10cSrcweir 1110cdf0e10cSrcweir // --------------------------------------------------------- 1111cdf0e10cSrcweir 1112cdf0e10cSrcweir sal_Int32 SlideShow::getFirstPageNumber() 1113cdf0e10cSrcweir { 1114cdf0e10cSrcweir return mxController.is() ? mxController->getFirstSlideNumber() : 0; 1115cdf0e10cSrcweir } 1116cdf0e10cSrcweir 1117cdf0e10cSrcweir // --------------------------------------------------------- 1118cdf0e10cSrcweir 1119cdf0e10cSrcweir sal_Int32 SlideShow::getLastPageNumber() 1120cdf0e10cSrcweir { 1121cdf0e10cSrcweir return mxController.is() ? mxController->getLastSlideNumber() : 0; 1122cdf0e10cSrcweir } 1123cdf0e10cSrcweir 1124cdf0e10cSrcweir // --------------------------------------------------------- 1125cdf0e10cSrcweir 1126cdf0e10cSrcweir bool SlideShow::isEndless() 1127cdf0e10cSrcweir { 1128cdf0e10cSrcweir return mxController.is() ? mxController->isEndless() : false; 1129cdf0e10cSrcweir } 1130cdf0e10cSrcweir 1131cdf0e10cSrcweir // --------------------------------------------------------- 1132cdf0e10cSrcweir 1133cdf0e10cSrcweir bool SlideShow::isDrawingPossible() 1134cdf0e10cSrcweir { 1135cdf0e10cSrcweir return mxController.is() ? mxController->getUsePen() : false; 1136cdf0e10cSrcweir } 1137cdf0e10cSrcweir 1138cdf0e10cSrcweir // --------------------------------------------------------- 1139cdf0e10cSrcweir 1140cdf0e10cSrcweir void SlideShow::StartInPlacePresentationConfigurationCallback() 1141cdf0e10cSrcweir { 1142cdf0e10cSrcweir if( mnInPlaceConfigEvent != 0 ) 1143cdf0e10cSrcweir Application::RemoveUserEvent( mnInPlaceConfigEvent ); 1144cdf0e10cSrcweir 1145cdf0e10cSrcweir mnInPlaceConfigEvent = Application::PostUserEvent( LINK( this, SlideShow, StartInPlacePresentationConfigurationHdl ) ); 1146cdf0e10cSrcweir } 1147cdf0e10cSrcweir 1148cdf0e10cSrcweir // --------------------------------------------------------- 1149cdf0e10cSrcweir 1150cdf0e10cSrcweir IMPL_LINK( SlideShow, StartInPlacePresentationConfigurationHdl, void *, EMPTYARG ) 1151cdf0e10cSrcweir { 1152cdf0e10cSrcweir mnInPlaceConfigEvent = 0; 1153cdf0e10cSrcweir StartInPlacePresentation(); 1154cdf0e10cSrcweir return 0; 1155cdf0e10cSrcweir } 1156cdf0e10cSrcweir 1157cdf0e10cSrcweir // --------------------------------------------------------- 1158cdf0e10cSrcweir 1159cdf0e10cSrcweir void SlideShow::StartInPlacePresentation() 1160cdf0e10cSrcweir { 1161cdf0e10cSrcweir if( mpCurrentViewShellBase ) 1162cdf0e10cSrcweir { 1163cdf0e10cSrcweir // Save the current view shell type so that it can be restored after the 1164cdf0e10cSrcweir // show has ended. If there already is a saved shell type then that is 1165cdf0e10cSrcweir // not overwritten. 1166cdf0e10cSrcweir 1167cdf0e10cSrcweir ViewShell::ShellType eShell = ViewShell::ST_NONE; 1168cdf0e10cSrcweir 1169cdf0e10cSrcweir ::boost::shared_ptr<FrameworkHelper> pHelper(FrameworkHelper::Instance(*mpCurrentViewShellBase)); 1170cdf0e10cSrcweir ::boost::shared_ptr<ViewShell> pMainViewShell(pHelper->GetViewShell(FrameworkHelper::msCenterPaneURL)); 1171cdf0e10cSrcweir 1172cdf0e10cSrcweir if( pMainViewShell.get() ) 1173cdf0e10cSrcweir eShell = pMainViewShell->GetShellType(); 1174cdf0e10cSrcweir 1175cdf0e10cSrcweir if( eShell != ViewShell::ST_IMPRESS ) 1176cdf0e10cSrcweir { 1177cdf0e10cSrcweir // Switch temporary to a DrawViewShell which supports the in-place presentation. 1178cdf0e10cSrcweir 1179cdf0e10cSrcweir if( pMainViewShell.get() ) 1180cdf0e10cSrcweir { 1181cdf0e10cSrcweir FrameView* pFrameView = pMainViewShell->GetFrameView(); 1182cdf0e10cSrcweir pFrameView->SetPresentationViewShellId(SID_VIEWSHELL1); 1183cdf0e10cSrcweir pFrameView->SetPreviousViewShellType (pMainViewShell->GetShellType()); 1184cdf0e10cSrcweir pFrameView->SetPageKind (PK_STANDARD); 1185cdf0e10cSrcweir } 1186cdf0e10cSrcweir 1187cdf0e10cSrcweir pHelper->RequestView( FrameworkHelper::msImpressViewURL, FrameworkHelper::msCenterPaneURL ); 1188cdf0e10cSrcweir pHelper->RunOnConfigurationEvent( FrameworkHelper::msConfigurationUpdateEndEvent, ::boost::bind(&SlideShow::StartInPlacePresentationConfigurationCallback, this) ); 1189cdf0e10cSrcweir return; 1190cdf0e10cSrcweir } 1191cdf0e10cSrcweir else 1192cdf0e10cSrcweir { 1193cdf0e10cSrcweir ::Window* pParentWindow = mxCurrentSettings->mpParentWindow; 1194cdf0e10cSrcweir if( pParentWindow == 0 ) 1195cdf0e10cSrcweir pParentWindow = mpCurrentViewShellBase->GetViewWindow(); 1196cdf0e10cSrcweir 1197cdf0e10cSrcweir CreateController( pMainViewShell.get(), pMainViewShell->GetView(), pParentWindow ); 1198cdf0e10cSrcweir } 1199cdf0e10cSrcweir } 1200cdf0e10cSrcweir else if( mxCurrentSettings->mpParentWindow ) 1201cdf0e10cSrcweir { 1202cdf0e10cSrcweir // no current view shell, but parent window 1203cdf0e10cSrcweir CreateController( 0, 0, mxCurrentSettings->mpParentWindow ); 1204cdf0e10cSrcweir } 1205cdf0e10cSrcweir 1206cdf0e10cSrcweir if( mxController.is() ) 1207cdf0e10cSrcweir { 1208cdf0e10cSrcweir sal_Bool bSuccess = sal_False; 1209cdf0e10cSrcweir if( mxCurrentSettings.get() && mxCurrentSettings->mbPreview ) 1210cdf0e10cSrcweir { 1211cdf0e10cSrcweir bSuccess = mxController->startPreview(mxCurrentSettings->mxStartPage, mxCurrentSettings->mxAnimationNode, mxCurrentSettings->mpParentWindow ); 1212cdf0e10cSrcweir } 1213cdf0e10cSrcweir else 1214cdf0e10cSrcweir { 1215cdf0e10cSrcweir bSuccess = mxController->startShow(mxCurrentSettings.get()); 1216cdf0e10cSrcweir } 1217cdf0e10cSrcweir 1218cdf0e10cSrcweir if( !bSuccess ) 1219cdf0e10cSrcweir end(); 1220cdf0e10cSrcweir } 1221cdf0e10cSrcweir } 1222cdf0e10cSrcweir 1223cdf0e10cSrcweir // --------------------------------------------------------- 1224cdf0e10cSrcweir 1225cdf0e10cSrcweir void SlideShow::StartFullscreenPresentation( ) 1226cdf0e10cSrcweir { 1227cdf0e10cSrcweir // Create the top level window in which the PresentationViewShell(Base) 1228cdf0e10cSrcweir // will be created. This is done here explicitly so that we can make it 1229cdf0e10cSrcweir // fullscreen. 1230cdf0e10cSrcweir const sal_Int32 nDisplay (GetDisplay()); 1231cdf0e10cSrcweir WorkWindow* pWorkWindow = new FullScreenWorkWindow(this, mpCurrentViewShellBase); 1232cdf0e10cSrcweir pWorkWindow->SetBackground(Wallpaper(COL_BLACK)); 1233cdf0e10cSrcweir pWorkWindow->StartPresentationMode( sal_True, mpDoc->getPresentationSettings().mbAlwaysOnTop ? PRESENTATION_HIDEALLAPPS : 0, nDisplay); 1234cdf0e10cSrcweir // pWorkWindow->ShowFullScreenMode(sal_False, nDisplay); 1235cdf0e10cSrcweir 1236cdf0e10cSrcweir if (pWorkWindow->IsVisible()) 1237cdf0e10cSrcweir { 1238cdf0e10cSrcweir // Initialize the new presentation view shell with a copy of the 1239cdf0e10cSrcweir // frame view of the current view shell. This avoids that 1240cdf0e10cSrcweir // changes made by the presentation have an effect on the other 1241cdf0e10cSrcweir // view shells. 1242cdf0e10cSrcweir FrameView* pOriginalFrameView = mpCurrentViewShellBase ? mpCurrentViewShellBase->GetMainViewShell()->GetFrameView() : 0; 1243cdf0e10cSrcweir 1244cdf0e10cSrcweir if( mpFullScreenFrameView ) 1245cdf0e10cSrcweir delete mpFullScreenFrameView; 1246cdf0e10cSrcweir mpFullScreenFrameView = new FrameView(mpDoc, pOriginalFrameView); 1247cdf0e10cSrcweir 1248cdf0e10cSrcweir // Reference<XController> xController; 1249cdf0e10cSrcweir 1250cdf0e10cSrcweir // The new frame is created hidden. To make it visible and activate the 1251cdf0e10cSrcweir // new view shell--a prerequisite to process slot calls and initialize 1252cdf0e10cSrcweir // its panes--a GrabFocus() has to be called later on. 1253cdf0e10cSrcweir SfxFrame* pNewFrame = SfxFrame::Create( *mpDoc->GetDocSh(), *pWorkWindow, PRESENTATION_FACTORY_ID, true ); 1254cdf0e10cSrcweir pNewFrame->SetPresentationMode(sal_True); 1255cdf0e10cSrcweir 1256cdf0e10cSrcweir mpFullScreenViewShellBase = static_cast<ViewShellBase*>(pNewFrame->GetCurrentViewFrame()->GetViewShell()); 1257cdf0e10cSrcweir if(mpFullScreenViewShellBase != NULL) 1258cdf0e10cSrcweir { 1259cdf0e10cSrcweir // The following GrabFocus() is responsible for activating the 1260cdf0e10cSrcweir // new view shell. Without it the screen remains blank (under 1261cdf0e10cSrcweir // Windows and some Linux variants.) 1262cdf0e10cSrcweir mpFullScreenViewShellBase->GetWindow()->GrabFocus(); 1263cdf0e10cSrcweir } 1264cdf0e10cSrcweir } 1265cdf0e10cSrcweir } 1266cdf0e10cSrcweir 1267cdf0e10cSrcweir // --------------------------------------------------------- 1268cdf0e10cSrcweir 1269cdf0e10cSrcweir sal_Int32 SlideShow::GetDisplay() 1270cdf0e10cSrcweir 1271cdf0e10cSrcweir { 1272cdf0e10cSrcweir sal_Int32 nDisplay = 0; 1273cdf0e10cSrcweir 1274cdf0e10cSrcweir SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS); 1275cdf0e10cSrcweir if( pOptions ) 1276cdf0e10cSrcweir nDisplay = pOptions->GetDisplay(); 1277cdf0e10cSrcweir 1278cdf0e10cSrcweir return nDisplay; 1279cdf0e10cSrcweir } 1280cdf0e10cSrcweir 1281cdf0e10cSrcweir // --------------------------------------------------------- 1282cdf0e10cSrcweir 1283cdf0e10cSrcweir 1284cdf0e10cSrcweir bool SlideShow::dependsOn( ViewShellBase* pViewShellBase ) 1285cdf0e10cSrcweir { 1286cdf0e10cSrcweir return mxController.is() && (pViewShellBase == mpCurrentViewShellBase) && mpFullScreenViewShellBase; 1287cdf0e10cSrcweir } 1288cdf0e10cSrcweir 1289cdf0e10cSrcweir // --------------------------------------------------------- 1290cdf0e10cSrcweir 1291cdf0e10cSrcweir Reference< XPresentation2 > CreatePresentation( const SdDrawDocument& rDocument ) 1292cdf0e10cSrcweir { 1293cdf0e10cSrcweir return Reference< XPresentation2 >( SlideShow::Create( const_cast< SdDrawDocument* >( &rDocument ) ).get() ); 1294cdf0e10cSrcweir } 1295cdf0e10cSrcweir 1296cdf0e10cSrcweir // --------------------------------------------------------- 1297cdf0e10cSrcweir 1298