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

Generated by: LCOV version 1.11