LCOV - code coverage report
Current view: top level - sd/source/ui/slideshow - slideshow.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 96 546 17.6 %
Date: 2014-04-11 Functions: 17 67 25.4 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.10