LCOV - code coverage report
Current view: top level - sd/source/ui/slideshow - slideshowimpl.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 1 1608 0.1 %
Date: 2014-04-11 Functions: 2 159 1.3 %
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/frame/theAutoRecovery.hpp>
      21             : #include <com/sun/star/frame/XComponentLoader.hpp>
      22             : #include <com/sun/star/lang/XInitialization.hpp>
      23             : #include <com/sun/star/document/XEventsSupplier.hpp>
      24             : #include <com/sun/star/drawing/XMasterPageTarget.hpp>
      25             : #include <com/sun/star/container/XNameReplace.hpp>
      26             : #include <com/sun/star/beans/PropertyValue.hpp>
      27             : #include <com/sun/star/beans/XPropertySetInfo.hpp>
      28             : #include <com/sun/star/beans/XPropertySet.hpp>
      29             : #include <com/sun/star/awt/SystemPointer.hpp>
      30             : #include <com/sun/star/util/URLTransformer.hpp>
      31             : #include <com/sun/star/util/XURLTransformer.hpp>
      32             : #include <com/sun/star/frame/XDispatch.hpp>
      33             : #include <com/sun/star/frame/XLayoutManager.hpp>
      34             : #include <com/sun/star/presentation/SlideShow.hpp>
      35             : #include <svl/aeitem.hxx>
      36             : #include <svl/urihelper.hxx>
      37             : 
      38             : #include <toolkit/helper/vclunohelper.hxx>
      39             : 
      40             : #include <sfx2/infobar.hxx>
      41             : #include <sfx2/imagemgr.hxx>
      42             : #include <sfx2/request.hxx>
      43             : #include <sfx2/docfile.hxx>
      44             : #include <sfx2/app.hxx>
      45             : #include <svx/unoapi.hxx>
      46             : #include <svx/svdoole2.hxx>
      47             : 
      48             : // for child window ids
      49             : #include <sfx2/templdlg.hxx>
      50             : #include <svx/f3dchild.hxx>
      51             : #include <svx/imapdlg.hxx>
      52             : #include <svx/fontwork.hxx>
      53             : #include <svx/SvxColorChildWindow.hxx>
      54             : #include <svx/bmpmask.hxx>
      55             : #include <svx/srchdlg.hxx>
      56             : #include <svx/hyperdlg.hxx>
      57             : #include <svx/galbrws.hxx>
      58             : #include "NavigatorChildWindow.hxx"
      59             : #include "AnimationChildWindow.hxx"
      60             : #include <slideshowimpl.hxx>
      61             : #include <slideshowviewimpl.hxx>
      62             : #include <pgjump.hxx>
      63             : #include "PaneHider.hxx"
      64             : 
      65             : #include "glob.hrc"
      66             : #include "res_bmp.hrc"
      67             : #include "sdresid.hxx"
      68             : #include "vcl/canvastools.hxx"
      69             : #include <vcl/settings.hxx>
      70             : 
      71             : #include "comphelper/anytostring.hxx"
      72             : #include "cppuhelper/exc_hlp.hxx"
      73             : #include "rtl/ref.hxx"
      74             : #include "slideshow.hrc"
      75             : #include "canvas/elapsedtime.hxx"
      76             : #include "avmedia/mediawindow.hxx"
      77             : #include "svtools/colrdlg.hxx"
      78             : #include "RemoteServer.hxx"
      79             : #include "customshowlist.hxx"
      80             : 
      81             : #include <boost/bind.hpp>
      82             : 
      83             : using ::cppu::OInterfaceContainerHelper;
      84             : using ::comphelper::ImplementationReference;
      85             : using ::com::sun::star::animations::XAnimationNode;
      86             : using ::com::sun::star::animations::XAnimationListener;
      87             : using ::com::sun::star::awt::XWindow;
      88             : using namespace ::com::sun::star;
      89             : using namespace ::com::sun::star::lang;
      90             : using namespace ::com::sun::star::uno;
      91             : using namespace ::com::sun::star::drawing;
      92             : using namespace ::com::sun::star::container;
      93             : using namespace ::com::sun::star::document;
      94             : using namespace ::com::sun::star::presentation;
      95             : using namespace ::com::sun::star::beans;
      96             : 
      97             : extern void NotifyDocumentEvent( SdDrawDocument* pDocument, const OUString& rEventName );
      98             : extern OUString getUiNameFromPageApiNameImpl( const OUString& rApiName );
      99             : 
     100             : namespace sd
     101             : {
     102             : /** Slots, which will be disabled in the slide show and are managed by Sfx.
     103             :     Have to be sorted in the order of the SIDs */
     104             : static sal_uInt16 const pAllowed[] =
     105             : {
     106             :     SID_OPENDOC                             , //     5501   ///< that internally jumps work
     107             :     SID_JUMPTOMARK                          , //     5598
     108             :     SID_OPENHYPERLINK                       , //     6676
     109             :     SID_NAVIGATOR                           , //    10366
     110             :     SID_PRESENTATION_END                    , //    27218
     111             :     SID_NAVIGATOR_PAGENAME                  , //    27287
     112             :     SID_NAVIGATOR_STATE                     , //    27288
     113             :     SID_NAVIGATOR_INIT                      , //    27289
     114             :     SID_NAVIGATOR_PEN                       , //    27291
     115             :     SID_NAVIGATOR_PAGE                      , //    27292
     116             :     SID_NAVIGATOR_OBJECT                      //    27293
     117             : };
     118             : 
     119             : 
     120           0 : class AnimationSlideController
     121             : {
     122             : public:
     123             :     enum Mode { ALL, FROM, CUSTOM, PREVIEW };
     124             : 
     125             : public:
     126             :     AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode );
     127             : 
     128           0 :     void setStartSlideNumber( sal_Int32 nSlideNumber ) { mnStartSlideNumber = nSlideNumber; }
     129             :     sal_Int32 getStartSlideIndex() const;
     130             : 
     131             :     sal_Int32 getCurrentSlideNumber() const;
     132             :     sal_Int32 getCurrentSlideIndex() const;
     133             : 
     134           0 :     sal_Int32 getSlideIndexCount() const { return maSlideNumbers.size(); }
     135           0 :     sal_Int32 getSlideNumberCount() const { return mnSlideCount; }
     136             : 
     137             :     sal_Int32 getSlideNumber( sal_Int32 nSlideIndex ) const;
     138             : 
     139             :     void insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible = true );
     140             :     void setPreviewNode( const Reference< XAnimationNode >& xPreviewNode );
     141             : 
     142             :     bool jumpToSlideIndex( sal_Int32 nNewSlideIndex );
     143             :     bool jumpToSlideNumber( sal_Int32 nNewSlideIndex );
     144             : 
     145             :     bool nextSlide();
     146             :     bool previousSlide();
     147             : 
     148             :     void displayCurrentSlide( const Reference< XSlideShow >& xShow,
     149             :                               const Reference< XDrawPagesSupplier>& xDrawPages,
     150             :                               const bool bSkipAllMainSequenceEffects );
     151             : 
     152             :     sal_Int32 getNextSlideIndex() const;
     153             :     sal_Int32 getPreviousSlideIndex() const;
     154             : 
     155             :     bool isVisibleSlideNumber( sal_Int32 nSlideNumber ) const;
     156             : 
     157             :     Reference< XDrawPage > getSlideByNumber( sal_Int32 nSlideNumber ) const;
     158             : 
     159             :     sal_Int32 getNextSlideNumber() const;
     160             : 
     161           0 :     bool hasSlides() const { return !maSlideNumbers.empty(); }
     162             : 
     163             : private:
     164             :     bool getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode );
     165             :     sal_Int32 findSlideIndex( sal_Int32 nSlideNumber ) const;
     166             : 
     167           0 :     bool isValidIndex( sal_Int32 nIndex ) const { return (nIndex >= 0) && (nIndex < (sal_Int32)maSlideNumbers.size()); }
     168           0 :     bool isValidSlideNumber( sal_Int32 nSlideNumber ) const { return (nSlideNumber >= 0) && (nSlideNumber < mnSlideCount); }
     169             : 
     170             : private:
     171             :     Mode meMode;
     172             :     sal_Int32 mnStartSlideNumber;
     173             :     std::vector< sal_Int32 > maSlideNumbers;
     174             :     std::vector< bool > maSlideVisible;
     175             :     std::vector< bool > maSlideVisited;
     176             :     Reference< XAnimationNode > mxPreviewNode;
     177             :     sal_Int32 mnSlideCount;
     178             :     sal_Int32 mnCurrentSlideIndex;
     179             :     sal_Int32 mnHiddenSlideNumber;
     180             :     Reference< XIndexAccess > mxSlides;
     181             : };
     182             : 
     183           0 : Reference< XDrawPage > AnimationSlideController::getSlideByNumber( sal_Int32 nSlideNumber ) const
     184             : {
     185           0 :     Reference< XDrawPage > xSlide;
     186           0 :     if( mxSlides.is() && (nSlideNumber >= 0) && (nSlideNumber < mxSlides->getCount()) )
     187           0 :         mxSlides->getByIndex( nSlideNumber ) >>= xSlide;
     188           0 :     return xSlide;
     189             : }
     190             : 
     191           0 : bool AnimationSlideController::isVisibleSlideNumber( sal_Int32 nSlideNumber ) const
     192             : {
     193           0 :     sal_Int32 nIndex = findSlideIndex( nSlideNumber );
     194             : 
     195           0 :     if( nIndex != -1 )
     196           0 :         return maSlideVisible[ nIndex ];
     197             :     else
     198           0 :         return false;
     199             : }
     200             : 
     201             : 
     202           0 : void AnimationSlideController::setPreviewNode( const Reference< XAnimationNode >& xPreviewNode )
     203             : {
     204           0 :     mxPreviewNode = xPreviewNode;
     205           0 : }
     206             : 
     207           0 : AnimationSlideController::AnimationSlideController( Reference< XIndexAccess > xSlides, Mode eMode  )
     208             : :   meMode( eMode )
     209             : ,   mnStartSlideNumber(-1)
     210             : ,   mnSlideCount( 0 )
     211             : ,   mnCurrentSlideIndex(0)
     212             : ,   mnHiddenSlideNumber( -1 )
     213           0 : ,   mxSlides( xSlides )
     214             : {
     215           0 :     if( mxSlides.is() )
     216           0 :         mnSlideCount = xSlides->getCount();
     217           0 : }
     218             : 
     219           0 : sal_Int32 AnimationSlideController::getStartSlideIndex() const
     220             : {
     221           0 :     if( mnStartSlideNumber >= 0 )
     222             :     {
     223             :         sal_Int32 nIndex;
     224           0 :         const sal_Int32 nCount = maSlideNumbers.size();
     225             : 
     226           0 :         for( nIndex = 0; nIndex < nCount; nIndex++ )
     227             :         {
     228           0 :             if( maSlideNumbers[nIndex] == mnStartSlideNumber )
     229           0 :                 return nIndex;
     230             :         }
     231             :     }
     232             : 
     233           0 :     return 0;
     234             : }
     235             : 
     236           0 : sal_Int32 AnimationSlideController::getCurrentSlideNumber() const
     237             : {
     238           0 :     if( mnHiddenSlideNumber != -1 )
     239           0 :         return mnHiddenSlideNumber;
     240           0 :     else if( !maSlideNumbers.empty() )
     241           0 :         return maSlideNumbers[mnCurrentSlideIndex];
     242             :     else
     243           0 :         return 0;
     244             : }
     245             : 
     246           0 : sal_Int32 AnimationSlideController::getCurrentSlideIndex() const
     247             : {
     248           0 :     if( mnHiddenSlideNumber != -1 )
     249           0 :         return -1;
     250             :     else
     251           0 :         return mnCurrentSlideIndex;
     252             : }
     253             : 
     254           0 : bool AnimationSlideController::jumpToSlideIndex( sal_Int32 nNewSlideIndex )
     255             : {
     256           0 :     if( isValidIndex( nNewSlideIndex ) )
     257             :     {
     258           0 :         mnCurrentSlideIndex = nNewSlideIndex;
     259           0 :         mnHiddenSlideNumber = -1;
     260           0 :         maSlideVisited[mnCurrentSlideIndex] = true;
     261           0 :         return true;
     262             :     }
     263             :     else
     264             :     {
     265           0 :         return false;
     266             :     }
     267             : }
     268             : 
     269           0 : bool AnimationSlideController::jumpToSlideNumber( sal_Int32 nNewSlideNumber )
     270             : {
     271           0 :     sal_Int32 nIndex = findSlideIndex( nNewSlideNumber );
     272           0 :     if( isValidIndex( nIndex ) )
     273             :     {
     274           0 :         return jumpToSlideIndex( nIndex );
     275             :     }
     276           0 :     else if( (nNewSlideNumber >= 0) && (nNewSlideNumber < mnSlideCount) )
     277             :     {
     278             :         // jump to a hidden slide
     279           0 :         mnHiddenSlideNumber = nNewSlideNumber;
     280           0 :         return true;
     281             :     }
     282             :     else
     283             :     {
     284           0 :         return false;
     285             :     }
     286             : }
     287             : 
     288           0 : sal_Int32 AnimationSlideController::getSlideNumber( sal_Int32 nSlideIndex ) const
     289             : {
     290           0 :     if( isValidIndex( nSlideIndex ) )
     291           0 :         return maSlideNumbers[nSlideIndex];
     292             :     else
     293           0 :         return -1;
     294             : }
     295             : 
     296           0 : void AnimationSlideController::insertSlideNumber( sal_Int32 nSlideNumber, bool bVisible /* = true */ )
     297             : {
     298             :     DBG_ASSERT( isValidSlideNumber( nSlideNumber ), "sd::AnimationSlideController::insertSlideNumber(), illegal index" );
     299           0 :     if( isValidSlideNumber( nSlideNumber ) )
     300             :     {
     301           0 :         maSlideNumbers.push_back( nSlideNumber );
     302           0 :         maSlideVisible.push_back( bVisible );
     303           0 :         maSlideVisited.push_back( false );
     304             :     }
     305           0 : }
     306             : 
     307           0 : bool AnimationSlideController::getSlideAPI( sal_Int32 nSlideNumber, Reference< XDrawPage >& xSlide, Reference< XAnimationNode >& xAnimNode )
     308             : {
     309           0 :     if( isValidSlideNumber( nSlideNumber ) ) try
     310             :     {
     311           0 :         xSlide = Reference< XDrawPage >( mxSlides->getByIndex(nSlideNumber), UNO_QUERY_THROW );
     312             : 
     313           0 :         if( meMode == PREVIEW )
     314             :         {
     315           0 :             xAnimNode = mxPreviewNode;
     316             :         }
     317             :         else
     318             :         {
     319           0 :                Reference< animations::XAnimationNodeSupplier > xAnimNodeSupplier( xSlide, UNO_QUERY_THROW );
     320           0 :             xAnimNode = xAnimNodeSupplier->getAnimationNode();
     321             :         }
     322             : 
     323           0 :         return true;
     324             :     }
     325           0 :     catch( Exception& )
     326             :     {
     327             :         OSL_FAIL(
     328             :             OString(OString("sd::AnimationSlideController::getSlideAPI(), "
     329             :                     "exception caught: ") +
     330             :             OUStringToOString(
     331             :                 comphelper::anyToString( cppu::getCaughtException() ),
     332             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
     333             : 
     334             :     }
     335             : 
     336           0 :     return false;
     337             : }
     338             : 
     339           0 : sal_Int32 AnimationSlideController::findSlideIndex( sal_Int32 nSlideNumber ) const
     340             : {
     341             :     sal_Int32 nIndex;
     342           0 :     const sal_Int32 nCount = maSlideNumbers.size();
     343             : 
     344           0 :     for( nIndex = 0; nIndex < nCount; nIndex++ )
     345             :     {
     346           0 :         if( maSlideNumbers[nIndex] == nSlideNumber )
     347           0 :             return nIndex;
     348             :     }
     349             : 
     350           0 :     return -1;
     351             : }
     352             : 
     353           0 : sal_Int32 AnimationSlideController::getNextSlideIndex() const
     354             : {
     355           0 :     switch( meMode )
     356             :     {
     357             :     case ALL:
     358             :         {
     359           0 :             sal_Int32 nNewSlideIndex = mnCurrentSlideIndex + 1;
     360           0 :             if( isValidIndex( nNewSlideIndex ) )
     361             :             {
     362             :                 // if the current slide is not excluded, make sure the
     363             :                 // next slide is also not excluded.
     364             :                 // if the current slide is excluded, we want to go
     365             :                 // to the next slide, even if this is also excluded.
     366           0 :                 if( maSlideVisible[mnCurrentSlideIndex] )
     367             :                 {
     368           0 :                     while( isValidIndex( nNewSlideIndex ) )
     369             :                     {
     370           0 :                         if( maSlideVisible[nNewSlideIndex] )
     371           0 :                             break;
     372             : 
     373           0 :                         nNewSlideIndex++;
     374             :                     }
     375             :                 }
     376             :             }
     377           0 :             return isValidIndex( nNewSlideIndex ) ? nNewSlideIndex : -1;
     378             :         }
     379             : 
     380             :     case FROM:
     381             :     case CUSTOM:
     382           0 :         return mnHiddenSlideNumber == -1 ? mnCurrentSlideIndex + 1 : mnCurrentSlideIndex;
     383             : 
     384             :     default:
     385             :     case PREVIEW:
     386           0 :         return -1;
     387             : 
     388             :     }
     389             : }
     390             : 
     391           0 : sal_Int32 AnimationSlideController::getNextSlideNumber() const
     392             : {
     393           0 :     sal_Int32 nNextSlideIndex = getNextSlideIndex();
     394           0 :     if( isValidIndex( nNextSlideIndex ) )
     395             :     {
     396           0 :         return maSlideNumbers[nNextSlideIndex];
     397             :     }
     398             :     else
     399             :     {
     400           0 :         return -1;
     401             :     }
     402             : }
     403             : 
     404             : 
     405           0 : bool AnimationSlideController::nextSlide()
     406             : {
     407           0 :     return jumpToSlideIndex( getNextSlideIndex() );
     408             : }
     409             : 
     410           0 : sal_Int32 AnimationSlideController::getPreviousSlideIndex() const
     411             : {
     412           0 :     sal_Int32 nNewSlideIndex = mnCurrentSlideIndex - 1;
     413             : 
     414           0 :     switch( meMode )
     415             :     {
     416             :         case ALL:
     417             :         {
     418             :             // make sure the previous slide is visible
     419             :             // or was already visited
     420           0 :             while( isValidIndex( nNewSlideIndex ) )
     421             :             {
     422           0 :                 if( maSlideVisible[nNewSlideIndex] || maSlideVisited[nNewSlideIndex] )
     423           0 :                     break;
     424             : 
     425           0 :                 nNewSlideIndex--;
     426             :             }
     427             : 
     428           0 :             break;
     429             :         }
     430             : 
     431             :         case PREVIEW:
     432           0 :             return -1;
     433             : 
     434             :         default:
     435           0 :             break;
     436             :     }
     437             : 
     438           0 :     return nNewSlideIndex;
     439             : }
     440             : 
     441           0 : bool AnimationSlideController::previousSlide()
     442             : {
     443           0 :     return jumpToSlideIndex( getPreviousSlideIndex() );
     444             : }
     445             : 
     446           0 : void AnimationSlideController::displayCurrentSlide( const Reference< XSlideShow >& xShow,
     447             :                                                     const Reference< XDrawPagesSupplier>& xDrawPages,
     448             :                                                     const bool bSkipAllMainSequenceEffects )
     449             : {
     450           0 :     const sal_Int32 nCurrentSlideNumber = getCurrentSlideNumber();
     451             : 
     452           0 :     if( xShow.is() && (nCurrentSlideNumber != -1 ) )
     453             :     {
     454           0 :         Reference< XDrawPage > xSlide;
     455           0 :         Reference< XAnimationNode > xAnimNode;
     456           0 :         ::std::vector<PropertyValue> aProperties;
     457             : 
     458           0 :         const sal_Int32 nNextSlideNumber = getNextSlideNumber();
     459           0 :         if( getSlideAPI( nNextSlideNumber, xSlide, xAnimNode )  )
     460             :         {
     461           0 :             Sequence< Any > aValue(2);
     462           0 :             aValue[0] <<= xSlide;
     463           0 :             aValue[1] <<= xAnimNode;
     464             :             aProperties.push_back(
     465             :                 PropertyValue( "Prefetch" ,
     466             :                     -1,
     467             :                     Any(aValue),
     468           0 :                     PropertyState_DIRECT_VALUE));
     469             :         }
     470           0 :         if (bSkipAllMainSequenceEffects)
     471             :         {
     472             :             // Add one property that prevents the slide transition from being
     473             :             // shown (to speed up the transition to the previous slide) and
     474             :             // one to show all main sequence effects so that the user can
     475             :             // continue to undo effects.
     476             :             aProperties.push_back(
     477             :                 PropertyValue( "SkipAllMainSequenceEffects",
     478             :                     -1,
     479             :                     Any(sal_True),
     480           0 :                     PropertyState_DIRECT_VALUE));
     481             :             aProperties.push_back(
     482             :                 PropertyValue("SkipSlideTransition",
     483             :                     -1,
     484             :                     Any(sal_True),
     485           0 :                     PropertyState_DIRECT_VALUE));
     486             :         }
     487             : 
     488             :         // Convert vector into uno Sequence.
     489           0 :         Sequence< PropertyValue > aPropertySequence (aProperties.size());
     490           0 :         for (int nIndex=0,nCount=aProperties.size();nIndex<nCount; ++nIndex)
     491           0 :             aPropertySequence[nIndex] = aProperties[nIndex];
     492             : 
     493           0 :         if( getSlideAPI( nCurrentSlideNumber, xSlide, xAnimNode ) )
     494           0 :             xShow->displaySlide( xSlide, xDrawPages, xAnimNode, aPropertySequence );
     495             :     }
     496           0 : }
     497             : 
     498             : 
     499             : 
     500             : 
     501             : 
     502           0 : SlideshowImpl::SlideshowImpl( const Reference< XPresentation2 >& xPresentation, ViewShell* pViewSh, ::sd::View* pView, SdDrawDocument* pDoc, ::Window* pParentWindow )
     503             : : SlideshowImplBase( m_aMutex )
     504             : , mxModel(pDoc->getUnoModel(),UNO_QUERY_THROW)
     505             : , mpView(pView)
     506             : , mpViewShell(pViewSh)
     507           0 : , mpDocSh(pDoc->GetDocSh())
     508             : , mpDoc(pDoc)
     509             : , mpNewAttr(0)
     510             : , mpParentWindow(pParentWindow)
     511             : , mpShowWindow(0)
     512             : , mpTimeButton(0)
     513             : , mnRestoreSlide(0)
     514             : , maPresSize( -1, -1 )
     515             : , meAnimationMode(ANIMATIONMODE_SHOW)
     516             : , mpOldActiveWindow(0)
     517             : , mnChildMask( 0 )
     518             : , mbGridVisible(false)
     519             : , mbBordVisible(false)
     520             : , mbSlideBorderVisible(false)
     521             : , mbSetOnlineSpelling(false)
     522             : , mbDisposed(false)
     523             : , mbRehearseTimings(false)
     524             : , mbDesignMode(false)
     525             : , mbIsPaused(false)
     526             : , mbWasPaused(false)
     527             : , mbInputFreeze(false)
     528             : , mbActive(sal_False)
     529           0 : , maPresSettings( pDoc->getPresentationSettings() )
     530             : , mnUserPaintColor( 0x80ff0000L )
     531             : , mbUsePen(false)
     532             : , mdUserPaintStrokeWidth ( 150.0 )
     533             : #ifdef ENABLE_ERASER_UI
     534             : , mbSwitchEraserMode(false)
     535             : , mnEraseInkSize(100)
     536             : #endif
     537             : , mnEntryCounter(0)
     538             : , mnLastSlideNumber(-1)
     539             : , msOnClick( "OnClick" )
     540             : , msBookmark( "Bookmark" )
     541             : , msVerb( "Verb" )
     542             : , mnEndShowEvent(0)
     543             : , mnContextMenuEvent(0)
     544             : , mnUpdateEvent(0)
     545           0 : , mxPresentation( xPresentation )
     546             : {
     547           0 :     if( mpViewShell )
     548           0 :         mpOldActiveWindow = mpViewShell->GetActiveWindow();
     549             : 
     550           0 :     maUpdateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, updateHdl));
     551             : 
     552           0 :     maDeactivateTimer.SetTimeoutHdl(LINK(this, SlideshowImpl, deactivateHdl));
     553           0 :     maDeactivateTimer.SetTimeout( 20 );
     554             : 
     555           0 :     maInputFreezeTimer.SetTimeoutHdl( LINK( this, SlideshowImpl, ReadyForNextInputHdl ) );
     556           0 :     maInputFreezeTimer.SetTimeout( 20 );
     557             : 
     558           0 :     SvtSaveOptions aOptions;
     559             : 
     560             :         // no autosave during show
     561           0 :     if( aOptions.IsAutoSave() )
     562           0 :         mbAutoSaveWasOn = true;
     563             : 
     564           0 :     Application::AddEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
     565             : 
     566           0 :     mbUsePen = maPresSettings.mbMouseAsPen;
     567             : 
     568           0 :     SdOptions* pOptions = SD_MOD()->GetSdOptions(DOCUMENT_TYPE_IMPRESS);
     569           0 :     if( pOptions )
     570             :     {
     571           0 :         mnUserPaintColor = pOptions->GetPresentationPenColor();
     572           0 :         mdUserPaintStrokeWidth = pOptions->GetPresentationPenWidth();
     573           0 :     }
     574           0 : }
     575             : 
     576           0 : SlideshowImpl::~SlideshowImpl()
     577             : {
     578           0 :     SdModule *pModule = SD_MOD();
     579             :     //rhbz#806663 SlideshowImpl can outlive SdModule
     580             :     SdOptions* pOptions = pModule ?
     581           0 :         pModule->GetSdOptions(DOCUMENT_TYPE_IMPRESS) : NULL;
     582           0 :     if( pOptions )
     583             :     {
     584           0 :         pOptions->SetPresentationPenColor(mnUserPaintColor);
     585           0 :         pOptions->SetPresentationPenWidth(mdUserPaintStrokeWidth);
     586             :     }
     587             : 
     588           0 :     Application::RemoveEventListener( LINK( this, SlideshowImpl, EventListenerHdl ) );
     589             : 
     590           0 :     maDeactivateTimer.Stop();
     591             : 
     592           0 :     if( !mbDisposed )
     593             :     {
     594             :         OSL_FAIL("SlideshowImpl::~SlideshowImpl(), component was not disposed!");
     595           0 :         disposing();
     596             :     }
     597           0 : }
     598             : 
     599           0 : void SAL_CALL SlideshowImpl::disposing()
     600             : {
     601             : #ifdef ENABLE_SDREMOTE
     602           0 :     RemoteServer::presentationStopped();
     603             : #endif
     604           0 :     if( mxShow.is() && mpDoc )
     605           0 :         NotifyDocumentEvent( mpDoc, "OnEndPresentation" );
     606             : 
     607           0 :     if( mbAutoSaveWasOn )
     608           0 :         setAutoSaveState( true );
     609             : 
     610           0 :     if( mnEndShowEvent )
     611           0 :         Application::RemoveUserEvent( mnEndShowEvent );
     612           0 :     if( mnContextMenuEvent )
     613           0 :         Application::RemoveUserEvent( mnContextMenuEvent );
     614             : 
     615           0 :     maInputFreezeTimer.Stop();
     616             : 
     617           0 :     SolarMutexGuard aSolarGuard;
     618             : 
     619           0 :     if( !mxShow.is() )
     620           0 :         return;
     621             : 
     622           0 :     if( mxPresentation.is() )
     623           0 :         mxPresentation->end();
     624             : 
     625           0 :     maUpdateTimer.Stop();
     626             : 
     627           0 :     if( mnUpdateEvent )
     628             :     {
     629           0 :         Application::RemoveUserEvent( mnUpdateEvent );
     630           0 :         mnUpdateEvent = 0;
     631             :     }
     632             : 
     633           0 :     removeShapeEvents();
     634             : 
     635           0 :     if( mxListenerProxy.is() )
     636           0 :         mxListenerProxy->removeAsSlideShowListener();
     637             : 
     638             :     try
     639             :     {
     640           0 :         if( mxView.is() )
     641           0 :             mxShow->removeView( mxView.getRef() );
     642             : 
     643           0 :         Reference< XComponent > xComponent( mxShow, UNO_QUERY );
     644           0 :         if( xComponent.is() )
     645           0 :             xComponent->dispose();
     646             : 
     647           0 :         if( mxView.is() )
     648           0 :             mxView->dispose();
     649             :     }
     650           0 :     catch( Exception& )
     651             :     {
     652             :         OSL_FAIL(
     653             :             OString(OString("sd::SlideshowImpl::stop(), "
     654             :                     "exception caught: ") +
     655             :             OUStringToOString(
     656             :                 comphelper::anyToString( cppu::getCaughtException() ),
     657             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
     658             : 
     659             :     }
     660             : 
     661           0 :     mxShow.clear();
     662           0 :     mxView.reset();
     663           0 :     mxListenerProxy.clear();
     664           0 :     mpSlideController.reset();
     665             : 
     666             :     // take DrawView from presentation window, but give the old window back
     667           0 :     if( mpShowWindow && mpView )
     668           0 :         mpView->DeleteWindowFromPaintView( mpShowWindow );
     669             : 
     670           0 :     if( mpView )
     671           0 :         mpView->SetAnimationPause( false );
     672             : 
     673           0 :     if( mpViewShell )
     674             :     {
     675           0 :         mpViewShell->SetActiveWindow(mpOldActiveWindow);
     676           0 :         if (mpShowWindow)
     677           0 :             mpShowWindow->SetViewShell( NULL );
     678             :     }
     679             : 
     680           0 :     if( mpView )
     681           0 :         mpView->InvalidateAllWin();
     682             : 
     683           0 :     if( maPresSettings.mbFullScreen )
     684             :     {
     685             : #ifndef DISABLE_SCRIPTING
     686             :         // restore StarBASICErrorHdl
     687           0 :         StarBASIC::SetGlobalErrorHdl(maStarBASICGlobalErrorHdl);
     688           0 :         maStarBASICGlobalErrorHdl = Link();
     689             : #endif
     690             :     }
     691             :     else
     692             :     {
     693           0 :         if( mpShowWindow )
     694           0 :             mpShowWindow->Hide();
     695             :     }
     696             : 
     697           0 :     if( meAnimationMode == ANIMATIONMODE_SHOW )
     698             :     {
     699           0 :         mpDocSh->SetSlotFilter();
     700           0 :         mpDocSh->ApplySlotFilter();
     701             : 
     702           0 :         Help::EnableContextHelp();
     703           0 :         Help::EnableExtHelp();
     704             : 
     705           0 :         showChildWindows();
     706           0 :         mnChildMask = 0UL;
     707             :     }
     708             : 
     709             :     // show current window again
     710           0 :     if( mpViewShell && !mpViewShell->ISA(PresentationViewShell))
     711             :     {
     712           0 :         if( meAnimationMode == ANIMATIONMODE_SHOW )
     713             :         {
     714           0 :             mpViewShell->GetViewShellBase().ShowUIControls (true);
     715           0 :             mpPaneHider.reset();
     716             :         }
     717           0 :         else if( meAnimationMode == ANIMATIONMODE_PREVIEW )
     718             :         {
     719           0 :             mpViewShell->ShowUIControls (true);
     720             :         }
     721             :     }
     722             : 
     723           0 :     if( mpTimeButton )
     724             :     {
     725           0 :         mpTimeButton->Hide();
     726           0 :         delete mpTimeButton;
     727           0 :         mpTimeButton = 0;
     728             :     }
     729             : 
     730           0 :     if( mpShowWindow )
     731           0 :         mpShowWindow->Hide();
     732             : 
     733           0 :     if ( mpViewShell )
     734             :     {
     735           0 :         if( meAnimationMode == ANIMATIONMODE_SHOW )
     736             :         {
     737           0 :             ::sd::Window* pActWin = mpViewShell->GetActiveWindow();
     738             : 
     739           0 :             if (pActWin)
     740             :             {
     741           0 :                 Size aVisSizePixel = pActWin->GetOutputSizePixel();
     742           0 :                 Rectangle aVisAreaWin = pActWin->PixelToLogic( Rectangle( Point(0,0), aVisSizePixel) );
     743           0 :                 mpViewShell->VisAreaChanged(aVisAreaWin);
     744           0 :                 if (mpView)
     745           0 :                     mpView->VisAreaChanged(pActWin);
     746           0 :                 pActWin->GrabFocus();
     747             :             }
     748             :         }
     749             : 
     750             :         // restart the custom show dialog if he started us
     751           0 :         if( mpViewShell->IsStartShowWithDialog() && getDispatcher() )
     752             :         {
     753           0 :             mpViewShell->SetStartShowWithDialog( sal_False );
     754           0 :             getDispatcher()->Execute( SID_CUSTOMSHOW_DLG, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD );
     755             :         }
     756             : 
     757           0 :         mpViewShell->GetViewShellBase().UpdateBorder(true);
     758             :     }
     759             : 
     760           0 :     if( mpShowWindow )
     761             :     {
     762           0 :         delete mpShowWindow;
     763           0 :         mpShowWindow = 0;
     764             :     }
     765             : 
     766           0 :     setActiveXToolbarsVisible( sal_True );
     767             : 
     768           0 :     Application::DisableNoYieldMode();
     769           0 :     Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
     770             : 
     771           0 :     mbDisposed = true;
     772             : }
     773             : 
     774           0 : bool SlideshowImpl::startPreview(
     775             :         const Reference< XDrawPage >& xDrawPage,
     776             :         const Reference< XAnimationNode >& xAnimationNode,
     777             :         ::Window* pParent )
     778             : {
     779           0 :     bool bRet = false;
     780             : 
     781             :     try
     782             :     {
     783           0 :         const Reference<lang::XServiceInfo> xServiceInfo( xDrawPage, UNO_QUERY );
     784           0 :         if (xServiceInfo.is()) {
     785             :             const Sequence<OUString> supportedServices(
     786           0 :                 xServiceInfo->getSupportedServiceNames() );
     787           0 :             for ( sal_Int32 pos = supportedServices.getLength(); pos--; ) {
     788           0 :                 if ( supportedServices[pos] == "com.sun.star.drawing.MasterPage" ) {
     789             :                     OSL_FAIL("sd::SlideshowImpl::startPreview() "
     790             :                               "not allowed on master page!");
     791           0 :                     return false;
     792             :                 }
     793           0 :             }
     794             :         }
     795             : 
     796           0 :         mxPreviewDrawPage = xDrawPage;
     797           0 :         mxPreviewAnimationNode = xAnimationNode;
     798           0 :         meAnimationMode = ANIMATIONMODE_PREVIEW;
     799             : 
     800           0 :         maPresSettings.mbAll = sal_False;
     801           0 :         maPresSettings.mbEndless = sal_False;
     802           0 :         maPresSettings.mbCustomShow = sal_False;
     803           0 :         maPresSettings.mbManual = sal_False;
     804           0 :         maPresSettings.mbMouseVisible = sal_False;
     805           0 :         maPresSettings.mbMouseAsPen = sal_False;
     806           0 :         maPresSettings.mbLockedPages = sal_False;
     807           0 :         maPresSettings.mbAlwaysOnTop = sal_False;
     808           0 :         maPresSettings.mbFullScreen = sal_False;
     809           0 :         maPresSettings.mbAnimationAllowed = sal_True;
     810           0 :         maPresSettings.mnPauseTimeout = 0;
     811           0 :         maPresSettings.mbShowPauseLogo = sal_False;
     812           0 :         maPresSettings.mbStartWithNavigator = sal_False;
     813             : 
     814           0 :         Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
     815           0 :         Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
     816           0 :         mpSlideController.reset( new AnimationSlideController( xSlides, AnimationSlideController::PREVIEW ) );
     817             : 
     818           0 :         sal_Int32 nSlideNumber = 0;
     819           0 :         Reference< XPropertySet > xSet( mxPreviewDrawPage, UNO_QUERY_THROW );
     820           0 :         xSet->getPropertyValue( "Number" ) >>= nSlideNumber;
     821           0 :         mpSlideController->insertSlideNumber( nSlideNumber-1 );
     822           0 :         mpSlideController->setPreviewNode( xAnimationNode );
     823             : 
     824           0 :         mpShowWindow = new ShowWindow( this, ((pParent == 0) && mpViewShell) ?  mpParentWindow : pParent );
     825           0 :         if( mpViewShell )
     826             :         {
     827           0 :             mpViewShell->SetActiveWindow( mpShowWindow );
     828           0 :             mpShowWindow->SetViewShell (mpViewShell);
     829           0 :             mpViewShell->ShowUIControls (false);
     830             :         }
     831             : 
     832           0 :         if( mpView )
     833             :         {
     834           0 :             mpView->AddWindowToPaintView( mpShowWindow );
     835           0 :             mpView->SetAnimationPause( true );
     836             :         }
     837             : 
     838             :         // call resize handler
     839           0 :         if( pParent )
     840             :         {
     841           0 :             maPresSize = pParent->GetSizePixel();
     842             :         }
     843           0 :         else if( mpViewShell )
     844             :         {
     845           0 :             Rectangle aContentRect (mpViewShell->GetViewShellBase().getClientRectangle());
     846           0 :             if (Application::GetSettings().GetLayoutRTL())
     847             :             {
     848           0 :                 aContentRect.Left() = aContentRect.Right();
     849           0 :                 aContentRect.Right() += aContentRect.Right();
     850             :             }
     851           0 :             maPresSize = aContentRect.GetSize();
     852           0 :             mpShowWindow->SetPosPixel( aContentRect.TopLeft() );
     853             :         }
     854             :         else
     855             :         {
     856             :             OSL_FAIL("sd::SlideshowImpl::startPreview(), I need either a parent window or a viewshell!");
     857             :         }
     858           0 :         resize( maPresSize );
     859             : 
     860           0 :         sal_Int32 nPropertyCount = 1;
     861           0 :         if( mxPreviewAnimationNode.is() )
     862           0 :             nPropertyCount++;
     863             : 
     864           0 :         Sequence< beans::PropertyValue > aProperties(nPropertyCount);
     865           0 :         aProperties[0].Name = "AutomaticAdvancement";
     866           0 :         aProperties[0].Value = uno::makeAny( (double)1.0 ); // one second timeout
     867             : 
     868           0 :         if( mxPreviewAnimationNode.is() )
     869             :         {
     870           0 :             aProperties[1].Name = "NoSlideTransitions";
     871           0 :             aProperties[1].Value = uno::makeAny( sal_True );
     872             :         }
     873             : 
     874           0 :         bRet = startShowImpl( aProperties );
     875             : 
     876           0 :         if( mpShowWindow != 0 && meAnimationMode == ANIMATIONMODE_PREVIEW )
     877           0 :             mpShowWindow->SetPreviewMode();
     878             : 
     879             :     }
     880           0 :     catch( Exception& )
     881             :     {
     882             :         OSL_FAIL(
     883             :             OString(OString("sd::SlideshowImpl::startPreview(), "
     884             :                      "exception caught: ") +
     885             :              OUStringToOString(
     886             :                  comphelper::anyToString( cppu::getCaughtException() ),
     887             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
     888           0 :         bRet = false;
     889             :     }
     890             : 
     891           0 :     return bRet;
     892             : }
     893             : 
     894           0 : bool SlideshowImpl::startShow( PresentationSettingsEx* pPresSettings )
     895             : {
     896           0 :     const rtl::Reference<SlideshowImpl> this_(this);
     897             : 
     898             :     DBG_ASSERT( !mxShow.is(), "sd::SlideshowImpl::startShow(), called twice!" );
     899           0 :     if( mxShow.is() )
     900           0 :         return true;
     901             :     DBG_ASSERT( mpParentWindow!=NULL, "sd::SlideshowImpl::startShow() called without parent window" );
     902           0 :     if (mpParentWindow == NULL)
     903           0 :         return false;
     904             : 
     905             :     // Autoplay (pps/ppsx)
     906           0 :     if (mpViewShell->GetDoc()->IsStartWithPresentation()){
     907           0 :         mpViewShell->GetDoc()->SetExitAfterPresenting(true);
     908             :     }
     909             : 
     910           0 :     bool bRet = false;
     911             : 
     912             :     try
     913             :     {
     914           0 :         if( pPresSettings )
     915             :         {
     916           0 :             maPresSettings = *pPresSettings;
     917           0 :             mbRehearseTimings = pPresSettings->mbRehearseTimings;
     918             :         }
     919             : 
     920             : 
     921             : 
     922           0 :         OUString  aPresSlide( maPresSettings.maPresPage );
     923           0 :         SdPage* pStartPage = mpViewShell->GetActualPage();
     924           0 :         bool    bStartWithActualSlide =  pStartPage;
     925             : 
     926             :         // times should be measured?
     927           0 :         if( mbRehearseTimings )
     928             :         {
     929           0 :             maPresSettings.mbEndless = sal_False;
     930           0 :             maPresSettings.mbManual = sal_True;
     931           0 :             maPresSettings.mbMouseVisible = sal_True;
     932           0 :             maPresSettings.mbMouseAsPen = sal_False;
     933           0 :             maPresSettings.mnPauseTimeout = 0;
     934           0 :             maPresSettings.mbShowPauseLogo = sal_False;
     935           0 :             maPresSettings.mbStartWithNavigator = sal_False;
     936             :         }
     937             : 
     938           0 :         if( pStartPage )
     939             :         {
     940           0 :             if( pStartPage->GetPageKind() == PK_NOTES )
     941             :             {
     942             :                 // we are in notes page mode, so get
     943             :                 // the corresponding draw page
     944           0 :                 const sal_uInt16 nPgNum = ( pStartPage->GetPageNum() - 2 ) >> 1;
     945           0 :                 pStartPage = mpDoc->GetSdPage( nPgNum, PK_STANDARD );
     946             :             }
     947             :         }
     948             : 
     949           0 :         if( bStartWithActualSlide )
     950             :         {
     951           0 :             if ( aPresSlide.isEmpty())
     952             :             {
     953             :                 // no preset slide yet, so pick current on one
     954           0 :                 aPresSlide = pStartPage->GetName();
     955             :                 // if the starting slide is hidden, we can't set slide controller to ALL mode
     956           0 :                 maPresSettings.mbAll = !pStartPage->IsExcluded();
     957             :             }
     958             : 
     959           0 :             if( meAnimationMode != ANIMATIONMODE_SHOW )
     960             :             {
     961           0 :                 if( pStartPage->GetPageKind() == PK_STANDARD )
     962             :                 {
     963           0 :                     maPresSettings.mbAll = false;
     964             :                 }
     965             :                 else
     966             :                 {
     967           0 :                     bStartWithActualSlide = false;
     968             :                 }
     969             :             }
     970             :         }
     971             :         else
     972             :         {
     973           0 :             if( !pStartPage || pStartPage->GetPageKind() != PK_STANDARD )
     974             :             {
     975           0 :                 bStartWithActualSlide = false;
     976             :             }
     977             :         }
     978             : 
     979             :         // build page list
     980           0 :         createSlideList( maPresSettings.mbAll, aPresSlide );
     981             : 
     982             :         // remember Slide number from where the show was started
     983           0 :         if( pStartPage )
     984           0 :             mnRestoreSlide = ( pStartPage->GetPageNum() - 1 ) / 2;
     985             : 
     986           0 :         if( mpSlideController->hasSlides() )
     987             :         {
     988             :             // hide child windows
     989           0 :             hideChildWindows();
     990             : 
     991           0 :             mpShowWindow = new ShowWindow( this, mpParentWindow );
     992           0 :             mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
     993           0 :             if( mpViewShell )
     994             :             {
     995           0 :                 mpViewShell->SetActiveWindow( mpShowWindow );
     996           0 :                 mpShowWindow->SetViewShell (mpViewShell);
     997           0 :                 mpViewShell->GetViewShellBase().ShowUIControls (false);
     998             :                 // Hide the side panes for in-place presentations.
     999           0 :                 if ( ! maPresSettings.mbFullScreen)
    1000           0 :                     mpPaneHider.reset(new PaneHider(*mpViewShell,this));
    1001             : 
    1002           0 :                 if( getViewFrame() )
    1003           0 :                     getViewFrame()->SetChildWindow( SID_NAVIGATOR, maPresSettings.mbStartWithNavigator );
    1004             :             }
    1005             : 
    1006             :             // these Slots are forbiden in other views for this document
    1007           0 :             if( mpDocSh )
    1008             :             {
    1009           0 :                 mpDocSh->SetSlotFilter( sal_True, sizeof( pAllowed ) / sizeof( sal_uInt16 ), pAllowed );
    1010           0 :                 mpDocSh->ApplySlotFilter();
    1011             :             }
    1012             : 
    1013           0 :             Help::DisableContextHelp();
    1014           0 :             Help::DisableExtHelp();
    1015             : 
    1016           0 :             if( maPresSettings.mbFullScreen )
    1017             :             {
    1018             : #ifndef DISABLE_SCRIPTING
    1019             :                 // disable basic ide error handling
    1020           0 :                 maStarBASICGlobalErrorHdl = StarBASIC::GetGlobalErrorHdl();
    1021           0 :                 StarBASIC::SetGlobalErrorHdl( Link() );
    1022             : #endif
    1023             :             }
    1024             : 
    1025             :             // call resize handler
    1026           0 :             maPresSize = mpParentWindow->GetSizePixel();
    1027           0 :             if( !maPresSettings.mbFullScreen && mpViewShell )
    1028             :             {
    1029           0 :                 const Rectangle& aClientRect = mpViewShell->GetViewShellBase().getClientRectangle();
    1030           0 :                 maPresSize = aClientRect.GetSize();
    1031           0 :                 mpShowWindow->SetPosPixel( aClientRect.TopLeft() );
    1032           0 :                 resize( maPresSize );
    1033             :             }
    1034             : 
    1035             :             // #i41824#
    1036             :             // Note: In FullScreen Mode the OS (window manager) sends a resize to
    1037             :             // the WorkWindow once it actually resized it to full size.  The
    1038             :             // WorkWindow propagates the resize to the DrawViewShell which calls
    1039             :             // resize() at the SlideShow (this).  Calling resize here results in a
    1040             :             // temporary display of a black window in the window's default size
    1041             : 
    1042           0 :             if( mpView )
    1043             :             {
    1044           0 :                 mpView->AddWindowToPaintView( mpShowWindow );
    1045           0 :                 mpView->SetAnimationPause( true );
    1046             :             }
    1047             : 
    1048           0 :             SfxBindings* pBindings = getBindings();
    1049           0 :             if( pBindings )
    1050             :             {
    1051           0 :                 pBindings->Invalidate( SID_PRESENTATION );
    1052           0 :                 pBindings->Invalidate( SID_REHEARSE_TIMINGS );
    1053             :             }
    1054             : 
    1055             :             // Defer the sd::ShowWindow's GrabFocus to SlideShow::activate. so that the accessible event can be fired correctly.
    1056             :             //mpShowWindow->GrabFocus();
    1057             : 
    1058           0 :             std::vector<beans::PropertyValue> aProperties;
    1059           0 :             aProperties.reserve( 4 );
    1060             : 
    1061             :             aProperties.push_back(
    1062             :                 beans::PropertyValue( "AdvanceOnClick" ,
    1063             :                     -1, Any( ! (maPresSettings.mbLockedPages != sal_False) ),
    1064           0 :                     beans::PropertyState_DIRECT_VALUE ) );
    1065             : 
    1066             :             aProperties.push_back(
    1067             :                 beans::PropertyValue( "ImageAnimationsAllowed" ,
    1068             :                     -1, Any( maPresSettings.mbAnimationAllowed != sal_False ),
    1069           0 :                     beans::PropertyState_DIRECT_VALUE ) );
    1070             : 
    1071             :             const sal_Bool bZOrderEnabled(
    1072           0 :                 SD_MOD()->GetSdOptions( mpDoc->GetDocumentType() )->IsSlideshowRespectZOrder() );
    1073             :             aProperties.push_back(
    1074             :                 beans::PropertyValue( "DisableAnimationZOrder" ,
    1075             :                     -1, Any( bZOrderEnabled == sal_False ),
    1076           0 :                     beans::PropertyState_DIRECT_VALUE ) );
    1077             : 
    1078             :             aProperties.push_back(
    1079             :                 beans::PropertyValue( "ForceManualAdvance" ,
    1080             :                     -1, Any( maPresSettings.mbManual != sal_False ),
    1081           0 :                     beans::PropertyState_DIRECT_VALUE ) );
    1082             : 
    1083           0 :             if( mbUsePen )
    1084             :              {
    1085             :                 aProperties.push_back(
    1086             :                     beans::PropertyValue( "UserPaintColor" ,
    1087             :                         // User paint color is black by default.
    1088             :                         -1, Any( mnUserPaintColor ),
    1089           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    1090             : 
    1091             :                 aProperties.push_back(
    1092             :                     beans::PropertyValue( "UserPaintStrokeWidth" ,
    1093             :                         // User paint color is black by default.
    1094             :                         -1, Any( mdUserPaintStrokeWidth ),
    1095           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    1096             :             }
    1097             : 
    1098           0 :             if (mbRehearseTimings) {
    1099             :                 aProperties.push_back(
    1100             :                     beans::PropertyValue( "RehearseTimings" ,
    1101           0 :                         -1, Any(true), beans::PropertyState_DIRECT_VALUE ) );
    1102             :             }
    1103             : 
    1104             :             bRet = startShowImpl( Sequence<beans::PropertyValue>(
    1105           0 :                                       &aProperties[0], aProperties.size() ) );
    1106             : 
    1107             :         }
    1108             : 
    1109           0 :         setActiveXToolbarsVisible( sal_False );
    1110             :     }
    1111           0 :     catch( Exception& )
    1112             :     {
    1113             :         OSL_FAIL(
    1114             :             OString(OString("sd::SlideshowImpl::startShow(), "
    1115             :                      "exception caught: ") +
    1116             :              OUStringToOString(
    1117             :                  comphelper::anyToString( cppu::getCaughtException() ),
    1118             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
    1119           0 :         bRet = false;
    1120             :     }
    1121             : 
    1122           0 :     return bRet;
    1123             : }
    1124             : 
    1125           0 : bool SlideshowImpl::startShowImpl( const Sequence< beans::PropertyValue >& aProperties )
    1126             : {
    1127             :     try
    1128             :     {
    1129           0 :         mxShow = Reference< XSlideShow >( createSlideShow(), UNO_QUERY_THROW );
    1130           0 :         mxView = mxView.createFromQuery( new SlideShowView(
    1131             :                                              *mpShowWindow,
    1132             :                                              mpDoc,
    1133             :                                              meAnimationMode,
    1134             :                                              this,
    1135           0 :                                              maPresSettings.mbFullScreen) );
    1136             : 
    1137             :         // try add wait symbol to properties:
    1138             :         const Reference<rendering::XSpriteCanvas> xSpriteCanvas(
    1139           0 :             mxView->getCanvas() );
    1140           0 :         if (xSpriteCanvas.is())
    1141             :         {
    1142           0 :             BitmapEx waitSymbolBitmap( SdResId(BMP_WAIT_ICON) );
    1143             :             const Reference<rendering::XBitmap> xBitmap(
    1144             :                 vcl::unotools::xBitmapFromBitmapEx(
    1145           0 :                     xSpriteCanvas->getDevice(), waitSymbolBitmap ) );
    1146           0 :             if (xBitmap.is())
    1147             :             {
    1148           0 :                 mxShow->setProperty(
    1149             :                     beans::PropertyValue( "WaitSymbolBitmap" ,
    1150             :                         -1,
    1151             :                         makeAny( xBitmap ),
    1152           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    1153             :             }
    1154             : 
    1155           0 :             BitmapEx pointerSymbolBitmap( SdResId(BMP_POINTER_ICON) );
    1156             :             const Reference<rendering::XBitmap> xPointerBitmap(
    1157             :                 vcl::unotools::xBitmapFromBitmapEx(
    1158           0 :                     xSpriteCanvas->getDevice(), pointerSymbolBitmap ) );
    1159           0 :             if (xPointerBitmap.is())
    1160             :             {
    1161           0 :                 mxShow->setProperty(
    1162             :                     beans::PropertyValue( "PointerSymbolBitmap" ,
    1163             :                         -1,
    1164             :                         makeAny( xPointerBitmap ),
    1165           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    1166           0 :             }
    1167             :         }
    1168             : 
    1169           0 :         const sal_Int32 nCount = aProperties.getLength();
    1170             :         sal_Int32 nIndex;
    1171           0 :         for( nIndex = 0; nIndex < nCount; nIndex++ )
    1172           0 :             mxShow->setProperty( aProperties[nIndex] );
    1173             : 
    1174           0 :         mxShow->addView( mxView.getRef() );
    1175             : 
    1176           0 :         mxListenerProxy.set( new SlideShowListenerProxy( this, mxShow ) );
    1177           0 :         mxListenerProxy->addAsSlideShowListener();
    1178             : 
    1179             : 
    1180           0 :         NotifyDocumentEvent( mpDoc, "OnStartPresentation");
    1181           0 :         displaySlideIndex( mpSlideController->getStartSlideIndex() );
    1182             : 
    1183           0 :         return true;
    1184             :     }
    1185           0 :     catch( Exception& )
    1186             :     {
    1187             :         OSL_FAIL(
    1188             :             OString(OString("sd::SlideshowImpl::startShowImpl(), "
    1189             :                      "exception caught: ") +
    1190             :              OUStringToOString(
    1191             :                  comphelper::anyToString( cppu::getCaughtException() ),
    1192             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
    1193           0 :         return false;
    1194             :     }
    1195             : }
    1196             : 
    1197             : /** called only by the slideshow view when the first paint event occurs.
    1198             :     This actually starts the slideshow. */
    1199           0 : void SlideshowImpl::onFirstPaint()
    1200             : {
    1201           0 :     if( mpShowWindow )
    1202             :     {
    1203             :         /*
    1204             :         mpShowWindow->SetBackground( Wallpaper( Color( COL_BLACK ) ) );
    1205             :         mpShowWindow->Erase();
    1206             :         mpShowWindow->SetBackground();
    1207             :         */
    1208             :     }
    1209             : 
    1210           0 :     SolarMutexGuard aSolarGuard;
    1211           0 :     maUpdateTimer.SetTimeout( (sal_uLong)100 );
    1212           0 :     maUpdateTimer.Start();
    1213           0 : }
    1214             : 
    1215           0 : void SlideshowImpl::paint( const Rectangle& /* rRect */ )
    1216             : {
    1217           0 :     if( mxView.is() ) try
    1218             :     {
    1219           0 :         awt::PaintEvent aEvt;
    1220             :         // aEvt.UpdateRect = TODO
    1221           0 :         mxView->paint( aEvt );
    1222             :     }
    1223           0 :     catch( Exception& )
    1224             :     {
    1225             :         OSL_FAIL(
    1226             :             OString(OString("sd::SlideshowImpl::paint(), "
    1227             :                     "exception caught: ") +
    1228             :             OUStringToOString(
    1229             :                 comphelper::anyToString( cppu::getCaughtException() ),
    1230             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    1231             :     }
    1232           0 : }
    1233             : 
    1234             : 
    1235             : 
    1236           0 : void SAL_CALL SlideshowImpl::addSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException, std::exception)
    1237             : {
    1238           0 :     if( mxListenerProxy.is() )
    1239           0 :         mxListenerProxy->addSlideShowListener( xListener );
    1240           0 : }
    1241             : 
    1242             : 
    1243             : 
    1244           0 : void SAL_CALL SlideshowImpl::removeSlideShowListener( const Reference< XSlideShowListener >& xListener ) throw (RuntimeException, std::exception)
    1245             : {
    1246           0 :     if( mxListenerProxy.is() )
    1247           0 :         mxListenerProxy->removeSlideShowListener( xListener );
    1248           0 : }
    1249             : 
    1250             : 
    1251             : 
    1252           0 : void SlideshowImpl::slideEnded(const bool bReverse)
    1253             : {
    1254           0 :     if (bReverse)
    1255           0 :         gotoPreviousSlide(true);
    1256             :     else
    1257           0 :         gotoNextSlide();
    1258           0 : }
    1259             : 
    1260             : 
    1261             : 
    1262           0 : void SlideshowImpl::removeShapeEvents()
    1263             : {
    1264           0 :     if( mxShow.is() && mxListenerProxy.is() ) try
    1265             :     {
    1266           0 :         WrappedShapeEventImplMap::iterator aIter;
    1267           0 :         const WrappedShapeEventImplMap::iterator aEnd( maShapeEventMap.end() );
    1268             : 
    1269           0 :         for( aIter = maShapeEventMap.begin(); aIter != aEnd; ++aIter )
    1270             :         {
    1271           0 :             mxListenerProxy->removeShapeEventListener( (*aIter).first );
    1272           0 :             mxShow->setShapeCursor( (*aIter).first, awt::SystemPointer::ARROW );
    1273             :         }
    1274             : 
    1275           0 :         maShapeEventMap.clear();
    1276             :     }
    1277           0 :     catch( Exception& )
    1278             :     {
    1279             :         OSL_FAIL(
    1280             :             OString(OString("sd::SlideshowImpl::removeShapeEvents(), "
    1281             :                      "exception caught: ") +
    1282             :              OUStringToOString(
    1283             :                  comphelper::anyToString( cppu::getCaughtException() ),
    1284             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
    1285             :     }
    1286           0 : }
    1287             : 
    1288             : 
    1289             : 
    1290           0 : void SlideshowImpl::registerShapeEvents(sal_Int32 nSlideNumber)
    1291             : {
    1292           0 :     if( nSlideNumber >= 0 ) try
    1293             :     {
    1294           0 :         Reference< XDrawPagesSupplier > xDrawPages( mxModel, UNO_QUERY_THROW );
    1295           0 :         Reference< XIndexAccess > xPages( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
    1296             : 
    1297           0 :         Reference< XShapes > xDrawPage;
    1298           0 :         xPages->getByIndex(nSlideNumber) >>= xDrawPage;
    1299             : 
    1300           0 :         if( xDrawPage.is() )
    1301             :         {
    1302           0 :             Reference< XMasterPageTarget > xMasterPageTarget( xDrawPage, UNO_QUERY );
    1303           0 :             if( xMasterPageTarget.is() )
    1304             :             {
    1305           0 :                 Reference< XShapes > xMasterPage( xMasterPageTarget->getMasterPage(), UNO_QUERY );
    1306           0 :                 if( xMasterPage.is() )
    1307           0 :                     registerShapeEvents( xMasterPage );
    1308             :             }
    1309           0 :             registerShapeEvents( xDrawPage );
    1310           0 :         }
    1311             :     }
    1312           0 :     catch( Exception& )
    1313             :     {
    1314             :         OSL_FAIL(
    1315             :             OString(OString("sd::SlideshowImpl::registerShapeEvents(), "
    1316             :                      "exception caught: ") +
    1317             :              OUStringToOString(
    1318             :                  comphelper::anyToString( cppu::getCaughtException() ),
    1319             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
    1320             :     }
    1321           0 : }
    1322             : 
    1323             : 
    1324             : 
    1325           0 : void SlideshowImpl::registerShapeEvents( Reference< XShapes >& xShapes ) throw( Exception )
    1326             : {
    1327             :     try
    1328             :     {
    1329           0 :         const sal_Int32 nShapeCount = xShapes->getCount();
    1330             :         sal_Int32 nShape;
    1331           0 :         for( nShape = 0; nShape < nShapeCount; nShape++ )
    1332             :         {
    1333           0 :             Reference< XShape > xShape;
    1334           0 :             xShapes->getByIndex( nShape ) >>= xShape;
    1335             : 
    1336           0 :             if( xShape.is() && xShape->getShapeType() == "com.sun.star.drawing.GroupShape" )
    1337             :             {
    1338           0 :                 Reference< XShapes > xSubShapes( xShape, UNO_QUERY );
    1339           0 :                 if( xSubShapes.is() )
    1340           0 :                     registerShapeEvents( xSubShapes );
    1341             :             }
    1342             : 
    1343           0 :             Reference< XPropertySet > xSet( xShape, UNO_QUERY );
    1344           0 :             if( !xSet.is() )
    1345           0 :                 continue;
    1346             : 
    1347           0 :             Reference< XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
    1348           0 :             if( !xSetInfo.is() || !xSetInfo->hasPropertyByName( msOnClick ) )
    1349           0 :                 continue;
    1350             : 
    1351           0 :             WrappedShapeEventImplPtr pEvent( new WrappedShapeEventImpl );
    1352           0 :             xSet->getPropertyValue( msOnClick ) >>= pEvent->meClickAction;
    1353             : 
    1354           0 :             switch( pEvent->meClickAction )
    1355             :             {
    1356             :             case ClickAction_PREVPAGE:
    1357             :             case ClickAction_NEXTPAGE:
    1358             :             case ClickAction_FIRSTPAGE:
    1359             :             case ClickAction_LASTPAGE:
    1360             :             case ClickAction_STOPPRESENTATION:
    1361           0 :                 break;
    1362             :             case ClickAction_BOOKMARK:
    1363           0 :                 if( xSetInfo->hasPropertyByName( msBookmark ) )
    1364           0 :                     xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
    1365           0 :                 if( getSlideNumberForBookmark( pEvent->maStrBookmark ) == -1 )
    1366           0 :                     continue;
    1367           0 :                 break;
    1368             :             case ClickAction_DOCUMENT:
    1369             :             case ClickAction_SOUND:
    1370             :             case ClickAction_PROGRAM:
    1371             :             case ClickAction_MACRO:
    1372           0 :                 if( xSetInfo->hasPropertyByName( msBookmark ) )
    1373           0 :                     xSet->getPropertyValue( msBookmark ) >>= pEvent->maStrBookmark;
    1374           0 :                 break;
    1375             :             case ClickAction_VERB:
    1376           0 :                 if( xSetInfo->hasPropertyByName( msVerb ) )
    1377           0 :                     xSet->getPropertyValue( msVerb ) >>= pEvent->mnVerb;
    1378           0 :                 break;
    1379             :             default:
    1380           0 :                 continue; // skip all others
    1381             :             }
    1382             : 
    1383           0 :             maShapeEventMap[ xShape ] = pEvent;
    1384             : 
    1385           0 :             if( mxListenerProxy.is() )
    1386           0 :                 mxListenerProxy->addShapeEventListener( xShape );
    1387           0 :             mxShow->setShapeCursor( xShape, awt::SystemPointer::REFHAND );
    1388           0 :         }
    1389             :     }
    1390           0 :     catch( Exception& )
    1391             :     {
    1392             :         OSL_FAIL(
    1393             :             OString(OString("sd::SlideshowImpl::registerShapeEvents(), "
    1394             :                     "exception caught: ") +
    1395             :             OUStringToOString(
    1396             :                 comphelper::anyToString( cppu::getCaughtException() ),
    1397             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    1398             :     }
    1399           0 : }
    1400             : 
    1401             : 
    1402             : 
    1403           0 : void SlideshowImpl::displayCurrentSlide (const bool bSkipAllMainSequenceEffects)
    1404             : {
    1405           0 :     stopSound();
    1406           0 :     removeShapeEvents();
    1407             : 
    1408           0 :     if( mpSlideController.get() && mxShow.is() )
    1409             :     {
    1410             :         Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(),
    1411           0 :                                                     UNO_QUERY_THROW );
    1412           0 :         mpSlideController->displayCurrentSlide( mxShow, xDrawPages, bSkipAllMainSequenceEffects );
    1413           0 :         registerShapeEvents(mpSlideController->getCurrentSlideNumber());
    1414           0 :         update();
    1415             : 
    1416           0 :         SfxBindings* pBindings = getBindings();
    1417           0 :         if( pBindings )
    1418             :         {
    1419           0 :             pBindings->Invalidate( SID_NAVIGATOR_STATE );
    1420           0 :             pBindings->Invalidate( SID_NAVIGATOR_PAGENAME );
    1421           0 :         }
    1422             :     }
    1423             :     // send out page change event and notity to update all acc info for current page
    1424           0 :     if (mpViewShell)
    1425             :     {
    1426           0 :         sal_Int32 currentPageIndex = getCurrentSlideIndex();
    1427           0 :         mpViewShell->fireSwitchCurrentPage(currentPageIndex);
    1428           0 :         mpViewShell->NotifyAccUpdate();
    1429             :     }
    1430           0 : }
    1431             : 
    1432             : 
    1433             : 
    1434           0 : void SlideshowImpl::endPresentation()
    1435             : {
    1436           0 :     if( maPresSettings.mbMouseAsPen)
    1437             :     {
    1438           0 :         Reference< XMultiServiceFactory > xDocFactory(mpDoc->getUnoModel(), UNO_QUERY );
    1439           0 :         if( xDocFactory.is() )
    1440           0 :             mxShow->registerUserPaintPolygons(xDocFactory);
    1441             :     }
    1442             : 
    1443           0 :     if( !mnEndShowEvent )
    1444           0 :         mnEndShowEvent = Application::PostUserEvent( LINK(this, SlideshowImpl, endPresentationHdl) );
    1445           0 : }
    1446             : 
    1447             : 
    1448             : 
    1449           0 : IMPL_LINK_NOARG(SlideshowImpl, endPresentationHdl)
    1450             : {
    1451           0 :     mnEndShowEvent = 0;
    1452             : 
    1453           0 :     if( mxPresentation.is() )
    1454           0 :         mxPresentation->end();
    1455           0 :     return 0;
    1456             : }
    1457             : 
    1458             : 
    1459             : 
    1460           0 : void SAL_CALL SlideshowImpl::pause() throw (RuntimeException, std::exception)
    1461             : {
    1462           0 :     SolarMutexGuard aSolarGuard;
    1463             : 
    1464           0 :     if( !mbIsPaused ) try
    1465             :     {
    1466           0 :         mbIsPaused = true;
    1467           0 :         if( mxShow.is() )
    1468             :         {
    1469           0 :             mxShow->pause(sal_True);
    1470             : 
    1471           0 :             if( mxListenerProxy.is() )
    1472           0 :                 mxListenerProxy->paused();
    1473             :         }
    1474             :     }
    1475           0 :     catch( Exception& )
    1476             :     {
    1477             :         OSL_FAIL(
    1478             :             OString(OString("sd::SlideshowImpl::pause(), "
    1479             :                     "exception caught: ") +
    1480             :             OUStringToOString(
    1481             :                 comphelper::anyToString( cppu::getCaughtException() ),
    1482             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    1483           0 :     }
    1484           0 : }
    1485             : 
    1486             : 
    1487             : 
    1488           0 : void SAL_CALL SlideshowImpl::resume() throw (RuntimeException, std::exception)
    1489             : {
    1490           0 :     SolarMutexGuard aSolarGuard;
    1491             : 
    1492           0 :     if( mbIsPaused ) try
    1493             :     {
    1494           0 :         if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
    1495             :         {
    1496           0 :             mpShowWindow->RestartShow();
    1497             :         }
    1498             :         else
    1499             :         {
    1500           0 :             mbIsPaused = false;;
    1501           0 :             if( mxShow.is() )
    1502             :             {
    1503           0 :                 mxShow->pause(sal_False);
    1504           0 :                 update();
    1505             : 
    1506           0 :                 if( mxListenerProxy.is() )
    1507           0 :                     mxListenerProxy->resumed();
    1508             :             }
    1509             :         }
    1510             :     }
    1511           0 :     catch( Exception& )
    1512             :     {
    1513             :         OSL_FAIL(
    1514             :             OString(OString("sd::SlideshowImpl::resume(), "
    1515             :                     "exception caught: ") +
    1516             :             OUStringToOString(
    1517             :                 comphelper::anyToString( cppu::getCaughtException() ),
    1518             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    1519             :     }
    1520             : #ifdef ENABLE_SDREMOTE
    1521           0 :     RemoteServer::presentationStarted( this );
    1522             : #endif
    1523           0 : }
    1524             : 
    1525             : 
    1526             : 
    1527           0 : sal_Bool SAL_CALL SlideshowImpl::isPaused() throw (RuntimeException, std::exception)
    1528             : {
    1529           0 :     SolarMutexGuard aSolarGuard;
    1530           0 :     return mbIsPaused;
    1531             : }
    1532             : 
    1533             : 
    1534             : 
    1535           0 : void SAL_CALL SlideshowImpl::blankScreen( sal_Int32 nColor ) throw (RuntimeException, std::exception)
    1536             : {
    1537           0 :     SolarMutexGuard aSolarGuard;
    1538             : 
    1539           0 :     if( mpShowWindow && mpSlideController )
    1540             :     {
    1541           0 :         if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), nColor ) )
    1542             :         {
    1543           0 :             pause();
    1544             :         }
    1545           0 :     }
    1546           0 : }
    1547             : 
    1548             : 
    1549             : // XShapeEventListener
    1550             : 
    1551             : 
    1552           0 : void SlideshowImpl::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& /* aOriginalEvent */ )
    1553             : {
    1554           0 :     SolarMutexGuard aSolarGuard;
    1555             : 
    1556           0 :     WrappedShapeEventImplPtr pEvent = maShapeEventMap[xShape];
    1557           0 :     if( !pEvent.get() )
    1558           0 :         return;
    1559             : 
    1560           0 :     switch( pEvent->meClickAction )
    1561             :     {
    1562           0 :     case ClickAction_PREVPAGE:          gotoPreviousSlide();        break;
    1563           0 :     case ClickAction_NEXTPAGE:          gotoNextSlide();            break;
    1564           0 :     case ClickAction_FIRSTPAGE:         gotoFirstSlide();           break;
    1565           0 :     case ClickAction_LASTPAGE:          gotoLastSlide();            break;
    1566           0 :     case ClickAction_STOPPRESENTATION:  endPresentation();          break;
    1567             :     case ClickAction_BOOKMARK:
    1568             :     {
    1569           0 :         gotoBookmark( pEvent->maStrBookmark );
    1570             :     }
    1571           0 :     break;
    1572             :     case ClickAction_SOUND:
    1573             :     {
    1574             :         try
    1575             :         {
    1576           0 :             mxPlayer.set(avmedia::MediaWindow::createPlayer(pEvent->maStrBookmark, ""/*TODO?*/), uno::UNO_QUERY_THROW );
    1577           0 :             mxPlayer->start();
    1578             :         }
    1579           0 :         catch( uno::Exception& )
    1580             :         {
    1581             :             OSL_FAIL("sd::SlideshowImpl::click(), exception caught!" );
    1582             :         }
    1583             :     }
    1584           0 :     break;
    1585             : 
    1586             :     case ClickAction_DOCUMENT:
    1587             :     {
    1588           0 :         OUString aBookmark( pEvent->maStrBookmark );
    1589             : 
    1590           0 :         sal_Int32 nPos = aBookmark.indexOf( '#' );
    1591           0 :         if( nPos >= 0 )
    1592             :         {
    1593           0 :             OUString aURL( aBookmark.copy( 0, nPos+1 ) );
    1594           0 :             OUString aName( aBookmark.copy( nPos+1 ) );
    1595           0 :             aURL += getUiNameFromPageApiNameImpl( aName );
    1596           0 :             aBookmark = aURL;
    1597             :         }
    1598             : 
    1599           0 :         mpDocSh->OpenBookmark( aBookmark );
    1600             :     }
    1601           0 :     break;
    1602             : 
    1603             :     case ClickAction_PROGRAM:
    1604             :     {
    1605             :         INetURLObject aURL(
    1606             :             ::URIHelper::SmartRel2Abs(
    1607             :                 INetURLObject(mpDocSh->GetMedium()->GetBaseURL()),
    1608           0 :                 pEvent->maStrBookmark, ::URIHelper::GetMaybeFileHdl(), true,
    1609             :                 false, INetURLObject::WAS_ENCODED,
    1610           0 :                 INetURLObject::DECODE_UNAMBIGUOUS ) );
    1611             : 
    1612           0 :         if( INET_PROT_FILE == aURL.GetProtocol() )
    1613             :         {
    1614           0 :             SfxStringItem aUrl( SID_FILE_NAME, aURL.GetMainURL( INetURLObject::NO_DECODE ) );
    1615           0 :             SfxBoolItem aBrowsing( SID_BROWSE, true );
    1616             : 
    1617           0 :             SfxViewFrame* pViewFrm = SfxViewFrame::Current();
    1618           0 :             if (pViewFrm)
    1619             :                 pViewFrm->GetDispatcher()->Execute( SID_OPENDOC,
    1620             :                                               SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
    1621             :                                             &aUrl,
    1622             :                                             &aBrowsing,
    1623           0 :                                             0L );
    1624           0 :         }
    1625             :     }
    1626           0 :     break;
    1627             : 
    1628             :     case presentation::ClickAction_MACRO:
    1629             :     {
    1630           0 :         const OUString aMacro( pEvent->maStrBookmark );
    1631             : 
    1632           0 :         if ( SfxApplication::IsXScriptURL( aMacro ) )
    1633             :         {
    1634           0 :             Any aRet;
    1635           0 :             Sequence< sal_Int16 > aOutArgsIndex;
    1636           0 :             Sequence< Any > aOutArgs;
    1637           0 :             Sequence< Any >* pInArgs = new Sequence< Any >(0);
    1638           0 :             mpDocSh->CallXScript( aMacro, *pInArgs, aRet, aOutArgsIndex, aOutArgs);
    1639             :         }
    1640             :         else
    1641             :         {
    1642             :             // aMacro has the following syntax:
    1643             :             // "Macroname.Modulname.Libname.Documentname" or
    1644             :             // "Macroname.Modulname.Libname.Applicationname"
    1645           0 :             OUString aMacroName = aMacro.getToken(0, '.');
    1646           0 :             OUString aModulName = aMacro.getToken(1, '.');
    1647             : 
    1648             :             // todo: is the limitation still given that only
    1649             :             // Modulname+Macroname can be used here?
    1650           0 :             OUString aExecMacro = aModulName + "." + aMacroName;
    1651           0 :             mpDocSh->GetBasic()->Call(aExecMacro);
    1652           0 :         }
    1653             :     }
    1654           0 :     break;
    1655             : 
    1656             :     case ClickAction_VERB:
    1657             :     {
    1658             :         // todo, better do it async?
    1659           0 :         SdrObject* pObj = GetSdrObjectFromXShape( xShape );
    1660           0 :         SdrOle2Obj* pOleObject = PTR_CAST(SdrOle2Obj, pObj);
    1661           0 :         if (pOleObject && mpViewShell )
    1662           0 :             mpViewShell->ActivateObject(pOleObject, pEvent->mnVerb);
    1663             :     }
    1664           0 :     break;
    1665             :     default:
    1666           0 :         break;
    1667           0 :     }
    1668             : }
    1669             : 
    1670             : 
    1671             : 
    1672           0 : sal_Int32 SlideshowImpl::getSlideNumberForBookmark( const OUString& rStrBookmark )
    1673             : {
    1674             :     sal_Bool bIsMasterPage;
    1675           0 :     OUString aBookmark = getUiNameFromPageApiNameImpl( rStrBookmark );
    1676           0 :     sal_uInt16 nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
    1677             : 
    1678           0 :     if( nPgNum == SDRPAGE_NOTFOUND )
    1679             :     {
    1680             :         // Is the bookmark an object?
    1681           0 :         SdrObject* pObj = mpDoc->GetObj( aBookmark );
    1682             : 
    1683           0 :         if( pObj )
    1684             :         {
    1685           0 :             nPgNum = pObj->GetPage()->GetPageNum();
    1686           0 :             bIsMasterPage = (sal_Bool)pObj->GetPage()->IsMasterPage();
    1687             :         }
    1688             :     }
    1689             : 
    1690           0 :     if( (nPgNum == SDRPAGE_NOTFOUND) || bIsMasterPage || static_cast<SdPage*>(mpDoc->GetPage(nPgNum))->GetPageKind() != PK_STANDARD )
    1691           0 :         return -1;
    1692             : 
    1693           0 :     return ( nPgNum - 1) >> 1;
    1694             : }
    1695             : 
    1696             : 
    1697             : 
    1698           0 : void SlideshowImpl::hyperLinkClicked( OUString const& aHyperLink ) throw (RuntimeException)
    1699             : {
    1700           0 :     OUString aBookmark( aHyperLink );
    1701             : 
    1702           0 :     sal_Int32 nPos = aBookmark.indexOf( '#' );
    1703           0 :     if( nPos >= 0 )
    1704             :     {
    1705           0 :         OUString aURL( aBookmark.copy( 0, nPos+1 ) );
    1706           0 :         OUString aName( aBookmark.copy( nPos+1 ) );
    1707           0 :         aURL += getUiNameFromPageApiNameImpl( aName );
    1708           0 :         aBookmark = aURL;
    1709             :     }
    1710             : 
    1711           0 :     mpDocSh->OpenBookmark( aBookmark );
    1712           0 : }
    1713             : 
    1714             : 
    1715             : 
    1716           0 : void SlideshowImpl::displaySlideNumber( sal_Int32 nSlideNumber )
    1717             : {
    1718           0 :     if( mpSlideController.get() )
    1719             :     {
    1720           0 :         if( mpSlideController->jumpToSlideNumber( nSlideNumber ) )
    1721             :         {
    1722           0 :             displayCurrentSlide();
    1723             :         }
    1724             :     }
    1725           0 : }
    1726             : 
    1727             : 
    1728             : 
    1729             : /** nSlideIndex == -1 displays current slide again */
    1730           0 : void SlideshowImpl::displaySlideIndex( sal_Int32 nSlideIndex )
    1731             : {
    1732           0 :     if( mpSlideController.get() )
    1733             :     {
    1734           0 :         if( (nSlideIndex == -1) || mpSlideController->jumpToSlideIndex( nSlideIndex ) )
    1735             :         {
    1736           0 :             displayCurrentSlide();
    1737             :         }
    1738             :     }
    1739           0 : }
    1740             : 
    1741             : 
    1742             : 
    1743           0 : void SlideshowImpl::jumpToBookmark( const OUString& sBookmark )
    1744             : {
    1745           0 :     sal_Int32 nSlideNumber = getSlideNumberForBookmark( sBookmark );
    1746           0 :     if( nSlideNumber != -1 )
    1747           0 :         displaySlideNumber( nSlideNumber );
    1748           0 : }
    1749             : 
    1750             : 
    1751             : 
    1752           0 : sal_Int32 SlideshowImpl::getCurrentSlideNumber()
    1753             : {
    1754           0 :     return mpSlideController.get() ? mpSlideController->getCurrentSlideNumber() : -1;
    1755             : }
    1756             : 
    1757             : 
    1758             : 
    1759           0 : sal_Int32 SlideshowImpl::getFirstSlideNumber()
    1760             : {
    1761           0 :     sal_Int32 nRet = 0;
    1762           0 :     if( mpSlideController.get() )
    1763             :     {
    1764           0 :         sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
    1765           0 :         if( nSlideIndexCount >= 0 )
    1766             :         {
    1767           0 :             nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
    1768           0 :             while( nSlideIndexCount-- )
    1769             :             {
    1770           0 :                 sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
    1771           0 :                 if( nRet > nTemp )
    1772           0 :                     nRet = nTemp;
    1773             :             }
    1774             :         }
    1775             :     }
    1776             : 
    1777           0 :     return nRet;
    1778             : }
    1779             : 
    1780             : 
    1781             : 
    1782           0 : sal_Int32 SlideshowImpl::getLastSlideNumber()
    1783             : {
    1784           0 :     sal_Int32 nRet = 0;
    1785           0 :     if( mpSlideController.get() )
    1786             :     {
    1787           0 :         sal_Int32 nSlideIndexCount = mpSlideController->getSlideIndexCount() - 1;
    1788           0 :         if( nSlideIndexCount >= 0 )
    1789             :         {
    1790           0 :             nRet = mpSlideController->getSlideNumber( nSlideIndexCount );
    1791           0 :             while( nSlideIndexCount-- )
    1792             :             {
    1793           0 :                 sal_Int32 nTemp = mpSlideController->getSlideNumber( nSlideIndexCount );
    1794           0 :                 if( nRet < nTemp )
    1795           0 :                     nRet = nTemp;
    1796             :             }
    1797             :         }
    1798             :     }
    1799             : 
    1800           0 :     return nRet;
    1801             : }
    1802             : 
    1803             : 
    1804             : 
    1805           0 : sal_Bool SAL_CALL SlideshowImpl::isEndless() throw( RuntimeException, std::exception )
    1806             : {
    1807           0 :     SolarMutexGuard aSolarGuard;
    1808           0 :     return maPresSettings.mbEndless;
    1809             : }
    1810             : 
    1811             : 
    1812             : 
    1813           0 : double SlideshowImpl::update()
    1814             : {
    1815           0 :     startUpdateTimer();
    1816           0 :     return -1;
    1817             : }
    1818             : 
    1819             : 
    1820             : 
    1821           0 : void SlideshowImpl::startUpdateTimer()
    1822             : {
    1823           0 :     SolarMutexGuard aSolarGuard;
    1824           0 :     maUpdateTimer.SetTimeout( 0 );
    1825           0 :     maUpdateTimer.Start();
    1826           0 : }
    1827             : 
    1828             : 
    1829             : 
    1830             : /** this timer is called 20ms after a new slide was displayed.
    1831             :     This is used to unfreeze user input that was disabled after
    1832             :     slide change to skip input that was buffered during slide
    1833             :     transition preperation */
    1834           0 : IMPL_LINK_NOARG(SlideshowImpl, ReadyForNextInputHdl)
    1835             : {
    1836           0 :     mbInputFreeze = false;
    1837           0 :     return 0;
    1838             : }
    1839             : 
    1840             : 
    1841             : 
    1842             : /** if I catch someone someday who calls this method by hand
    1843             :     and not by using the timer, I will personaly punish this
    1844             :     person seriously, even if this person is me.
    1845             : */
    1846           0 : IMPL_LINK_NOARG(SlideshowImpl, updateHdl)
    1847             : {
    1848           0 :     mnUpdateEvent = 0;
    1849             : 
    1850           0 :     return updateSlideShow();
    1851             : }
    1852             : 
    1853             : 
    1854             : 
    1855             : 
    1856           0 : IMPL_LINK_NOARG(SlideshowImpl, PostYieldListener)
    1857             : {
    1858             :     // prevent me from deletion when recursing (App::Reschedule does)
    1859           0 :     const rtl::Reference<SlideshowImpl> this_(this);
    1860             : 
    1861           0 :     Application::DisableNoYieldMode();
    1862           0 :     Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
    1863           0 :     Application::Reschedule(true); // fix for fdo#32861 - process
    1864             :                                    // *all* outstanding events after
    1865             :                                    // yield is done.
    1866           0 :     if (mbDisposed)
    1867           0 :         return 0;
    1868           0 :     Application::Reschedule(true);
    1869           0 :     return updateSlideShow();
    1870             : }
    1871             : 
    1872             : 
    1873             : 
    1874             : 
    1875           0 : sal_Int32 SlideshowImpl::updateSlideShow (void)
    1876             : {
    1877             :     // prevent me from deletion when recursing (App::EnableYieldMode does)
    1878           0 :     const rtl::Reference<SlideshowImpl> this_(this);
    1879             : 
    1880           0 :     Reference< XSlideShow > xShow( mxShow );
    1881           0 :     if ( ! xShow.is())
    1882           0 :         return 0;
    1883             : 
    1884             :     try
    1885             :     {
    1886             :         // TODO(Q3): Evaluate under various systems and setups,
    1887             :         // whether this is really necessary. Under WinXP and Matrox
    1888             :         // G550, the frame rates were much more steadier with this
    1889             :         // tweak, although.
    1890             : 
    1891             :         // currently no solution, because this kills sound (at least on Windows)
    1892             : 
    1893           0 :         double fUpdate = 0.0;
    1894           0 :         if( !xShow->update(fUpdate) )
    1895           0 :             fUpdate = -1.0;
    1896             : 
    1897           0 :         if (mxShow.is() && (fUpdate >= 0.0))
    1898             :         {
    1899           0 :             if (::basegfx::fTools::equalZero(fUpdate))
    1900             :             {
    1901             :                 // Use post yield listener for short update intervalls.
    1902           0 :                 Application::EnableNoYieldMode();
    1903           0 :                 Application::AddPostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
    1904             :             }
    1905             :             else
    1906             :             {
    1907             :                 // Avoid busy loop when the previous call to update()
    1908             :                 // returns a small positive number but not 0 (which is
    1909             :                 // handled above).  Also, make sure that calls to update()
    1910             :                 // have a minimum frequency.
    1911             :                 // => Allow up to 60 frames per second.  Call at least once
    1912             :                 // every 4 seconds.
    1913             :                 const static sal_Int32 mnMaximumFrameCount (60);
    1914             :                 const static double mnMinimumTimeout (1.0 / mnMaximumFrameCount);
    1915             :                 const static double mnMaximumTimeout (4.0);
    1916           0 :                 fUpdate = ::basegfx::clamp(fUpdate, mnMinimumTimeout, mnMaximumTimeout);
    1917             : 
    1918             :                 // Make sure that the maximum frame count has not been set
    1919             :                 // too high (only then conversion to milliseconds and long
    1920             :                 // integer may lead to zero value.)
    1921             :                 OSL_ASSERT(static_cast<sal_uLong>(fUpdate * 1000.0) > 0);
    1922             : 
    1923           0 :                 Application::DisableNoYieldMode();
    1924           0 :                 Application::RemovePostYieldListener(LINK(this, SlideshowImpl, PostYieldListener));
    1925             : 
    1926             :                 // Use a timer for the asynchronous callback.
    1927           0 :                 maUpdateTimer.SetTimeout(static_cast<sal_uLong>(fUpdate * 1000.0));
    1928           0 :                 maUpdateTimer.Start();
    1929             :             }
    1930             :         }
    1931             :     }
    1932           0 :     catch( Exception& )
    1933             :     {
    1934             :         OSL_FAIL(
    1935             :             OString(OString("sd::SlideshowImpl::updateSlideShow(), exception caught: ")
    1936             :                 + OUStringToOString(
    1937             :                     comphelper::anyToString( cppu::getCaughtException() ),
    1938             :                     RTL_TEXTENCODING_UTF8 )).getStr() );
    1939             :     }
    1940           0 :     return 0;
    1941             : }
    1942             : 
    1943             : 
    1944             : 
    1945           0 : bool SlideshowImpl::keyInput(const KeyEvent& rKEvt)
    1946             : {
    1947           0 :     if( !mxShow.is() || mbInputFreeze )
    1948           0 :         return false;
    1949             : 
    1950           0 :     bool bRet = true;
    1951             : 
    1952             :     try
    1953             :     {
    1954           0 :         const int nKeyCode = rKEvt.GetKeyCode().GetCode();
    1955           0 :         switch( nKeyCode )
    1956             :         {
    1957             :             case awt::Key::CONTEXTMENU:
    1958           0 :                 if( !mnContextMenuEvent )
    1959             :                 {
    1960           0 :                     if( mpShowWindow )
    1961           0 :                         maPopupMousePos = mpShowWindow->GetPointerState().maPos;
    1962           0 :                     mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
    1963             :                 }
    1964           0 :                 break;
    1965             : 
    1966             :             // cancel show
    1967             :             case KEY_ESCAPE:
    1968             :             case KEY_SUBTRACT:
    1969             :                 // in case the user cancels the presentation, switch to current slide
    1970             :                 // in edit mode
    1971           0 :                 if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
    1972             :                 {
    1973           0 :                     if( mpSlideController->getCurrentSlideNumber() != -1 )
    1974           0 :                         mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
    1975             :                 }
    1976           0 :                 endPresentation();
    1977           0 :                 break;
    1978             : 
    1979             :             // advance show
    1980             :             case KEY_PAGEDOWN:
    1981           0 :                 if(rKEvt.GetKeyCode().IsMod2())
    1982             :                 {
    1983           0 :                     gotoNextSlide();
    1984           0 :                     break;
    1985             :                 }
    1986             :                 // warning, fall through!
    1987             :             case KEY_SPACE:
    1988             :             case KEY_RIGHT:
    1989             :             case KEY_DOWN:
    1990             :             case KEY_N:
    1991           0 :                 gotoNextEffect();
    1992           0 :                 break;
    1993             : 
    1994             :             case KEY_RETURN:
    1995             :             {
    1996           0 :                 if( !maCharBuffer.isEmpty() )
    1997             :                 {
    1998           0 :                     if( mpSlideController.get() )
    1999             :                     {
    2000           0 :                         if( mpSlideController->jumpToSlideNumber( maCharBuffer.toInt32() - 1 ) )
    2001           0 :                             displayCurrentSlide();
    2002             :                     }
    2003           0 :                     maCharBuffer = "";
    2004             :                 }
    2005             :                 else
    2006             :                 {
    2007           0 :                     gotoNextEffect();
    2008             :                 }
    2009             :             }
    2010           0 :             break;
    2011             : 
    2012             :             // numeric: add to buffer
    2013             :             case KEY_0:
    2014             :             case KEY_1:
    2015             :             case KEY_2:
    2016             :             case KEY_3:
    2017             :             case KEY_4:
    2018             :             case KEY_5:
    2019             :             case KEY_6:
    2020             :             case KEY_7:
    2021             :             case KEY_8:
    2022             :             case KEY_9:
    2023           0 :                 maCharBuffer += OUString( rKEvt.GetCharCode() );
    2024           0 :                 break;
    2025             : 
    2026             :             case KEY_PAGEUP:
    2027           0 :                 if(rKEvt.GetKeyCode().IsMod2())
    2028             :                 {
    2029           0 :                     gotoPreviousSlide();
    2030           0 :                     break;
    2031             :                 }
    2032             :                 // warning, fall through!
    2033             :             case KEY_LEFT:
    2034             :             case KEY_UP:
    2035             :             case KEY_P:
    2036             :             case KEY_BACKSPACE:
    2037           0 :                 gotoPreviousEffect();
    2038           0 :                 break;
    2039             : 
    2040             :             case KEY_HOME:
    2041           0 :                 gotoFirstSlide();
    2042           0 :                 break;
    2043             : 
    2044             :             case KEY_END:
    2045           0 :                 gotoLastSlide();
    2046           0 :                 break;
    2047             : 
    2048             :             case KEY_B:
    2049             :             case KEY_W:
    2050             :             case KEY_POINT:
    2051             :             case KEY_COMMA:
    2052             :             {
    2053           0 :                 blankScreen( ((nKeyCode == KEY_W ) || (nKeyCode == KEY_COMMA)) ? 0x00ffffff : 0x00000000 );
    2054             :             }
    2055           0 :             break;
    2056             : 
    2057             :             default:
    2058           0 :                 bRet = false;
    2059           0 :             break;
    2060             :         }
    2061             :     }
    2062           0 :     catch( Exception& )
    2063             :     {
    2064           0 :         bRet = false;
    2065             :         OSL_FAIL(
    2066             :             OString(OString("sd::SlideshowImpl::keyInput(), "
    2067             :                     "exception caught: ") +
    2068             :             OUStringToOString(
    2069             :                 comphelper::anyToString( cppu::getCaughtException() ),
    2070             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    2071             :     }
    2072             : 
    2073           0 :     return bRet;
    2074             : }
    2075             : 
    2076           0 : IMPL_LINK( SlideshowImpl, EventListenerHdl, VclSimpleEvent*, pEvent )
    2077             : {
    2078           0 :     if( !mxShow.is() || mbInputFreeze )
    2079           0 :         return 0;
    2080             : 
    2081           0 :     if( pEvent && (pEvent->GetId() == VCLEVENT_WINDOW_COMMAND) && static_cast<VclWindowEvent*>(pEvent)->GetData() )
    2082             :     {
    2083           0 :         const CommandEvent& rEvent = *(const CommandEvent*)static_cast<VclWindowEvent*>(pEvent)->GetData();
    2084             : 
    2085           0 :         if( rEvent.GetCommand() == COMMAND_MEDIA )
    2086             :         {
    2087           0 :             switch( rEvent.GetMediaCommand() )
    2088             :             {
    2089             : #if defined( MACOSX )
    2090             :             case MEDIA_COMMAND_MENU:
    2091             :                 if( !mnContextMenuEvent )
    2092             :                 {
    2093             :                 if( mpShowWindow )
    2094             :                     maPopupMousePos = mpShowWindow->GetPointerState().maPos;
    2095             :                 mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
    2096             :                 }
    2097             :                 break;
    2098             :             case MEDIA_COMMAND_VOLUME_DOWN:
    2099             :                 gotoPreviousSlide();
    2100             :                 break;
    2101             :             case MEDIA_COMMAND_VOLUME_UP:
    2102             :                 gotoNextEffect();
    2103             :                 break;
    2104             : #endif
    2105             :             case MEDIA_COMMAND_NEXTTRACK:
    2106           0 :                 gotoNextEffect();
    2107           0 :                 break;
    2108             :             case MEDIA_COMMAND_PAUSE:
    2109           0 :                 if( !mbIsPaused )
    2110           0 :                     blankScreen(0);
    2111           0 :                 break;
    2112             :             case MEDIA_COMMAND_PLAY:
    2113           0 :                 if( mbIsPaused )
    2114           0 :                     resume();
    2115           0 :                 break;
    2116             : 
    2117             :             case MEDIA_COMMAND_PLAY_PAUSE:
    2118           0 :                 if( mbIsPaused )
    2119           0 :                     resume();
    2120             :                 else
    2121           0 :                     blankScreen(0);
    2122           0 :                 break;
    2123             :             case MEDIA_COMMAND_PREVIOUSTRACK:
    2124           0 :                 gotoPreviousSlide();
    2125           0 :                 break;
    2126             :             case MEDIA_COMMAND_NEXTTRACK_HOLD:
    2127           0 :                 gotoLastSlide();
    2128           0 :                 break;
    2129             : 
    2130             :             case MEDIA_COMMAND_REWIND:
    2131           0 :                 gotoFirstSlide();
    2132           0 :                 break;
    2133             :             case MEDIA_COMMAND_STOP:
    2134             :                 // in case the user cancels the presentation, switch to current slide
    2135             :                 // in edit mode
    2136           0 :                 if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
    2137             :                 {
    2138           0 :                     if( mpSlideController->getCurrentSlideNumber() != -1 )
    2139           0 :                         mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
    2140             :                 }
    2141           0 :                 endPresentation();
    2142           0 :                 break;
    2143             :             }
    2144             :         }
    2145             :     }
    2146             : 
    2147           0 :     return 0;
    2148             : }
    2149             : 
    2150             : 
    2151             : 
    2152           0 : void SlideshowImpl::mouseButtonUp(const MouseEvent& rMEvt)
    2153             : {
    2154           0 :     if( rMEvt.IsRight() && !mnContextMenuEvent )
    2155             :     {
    2156           0 :         maPopupMousePos = rMEvt.GetPosPixel();
    2157           0 :         mnContextMenuEvent = Application::PostUserEvent( LINK( this, SlideshowImpl, ContextMenuHdl ) );
    2158             :     }
    2159           0 : }
    2160             : 
    2161             : 
    2162             : 
    2163           0 : IMPL_LINK_NOARG(SlideshowImpl, ContextMenuHdl)
    2164             : {
    2165           0 :     mnContextMenuEvent = 0;
    2166             : 
    2167           0 :     if( mpSlideController.get() == 0 )
    2168           0 :         return 0;
    2169             : 
    2170           0 :     mbWasPaused = mbIsPaused;
    2171           0 :     if( !mbWasPaused )
    2172           0 :         pause();
    2173             : 
    2174           0 :     PopupMenu* pMenu = new PopupMenu( SdResId( RID_SLIDESHOW_CONTEXTMENU ) );
    2175             : 
    2176             :     // Adding button to display if in Pen  mode
    2177           0 :     pMenu->CheckItem( CM_PEN_MODE, mbUsePen);
    2178             : 
    2179           0 :     const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    2180           0 :     pMenu->EnableItem( CM_NEXT_SLIDE, ( mpSlideController->getNextSlideIndex() != -1 ) );
    2181           0 :     pMenu->EnableItem( CM_PREV_SLIDE, ( mpSlideController->getPreviousSlideIndex() != -1 ) || (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) );
    2182           0 :     pMenu->EnableItem( CM_EDIT_PRESENTATION, mpViewShell->GetDoc()->IsStartWithPresentation());
    2183             : 
    2184           0 :     PopupMenu* pPageMenu = pMenu->GetPopupMenu( CM_GOTO );
    2185             : 
    2186           0 :     SfxViewFrame* pViewFrame = getViewFrame();
    2187           0 :     if( pViewFrame )
    2188             :     {
    2189           0 :         Reference< ::com::sun::star::frame::XFrame > xFrame( pViewFrame->GetFrame().GetFrameInterface() );
    2190           0 :         if( xFrame.is() )
    2191             :         {
    2192           0 :             pMenu->SetItemImage( CM_NEXT_SLIDE, GetImage( xFrame, "slot:10617" , false ) );
    2193           0 :             pMenu->SetItemImage( CM_PREV_SLIDE, GetImage( xFrame, "slot:10618" , false ) );
    2194             : 
    2195           0 :             if( pPageMenu )
    2196             :             {
    2197           0 :                 pPageMenu->SetItemImage( CM_FIRST_SLIDE, GetImage( xFrame, "slot:10616" , false ) );
    2198           0 :                 pPageMenu->SetItemImage( CM_LAST_SLIDE, GetImage( xFrame, "slot:10619" , false ) );
    2199             :             }
    2200           0 :         }
    2201             :     }
    2202             : 
    2203             :     // populate slide goto list
    2204           0 :     if( pPageMenu )
    2205             :     {
    2206           0 :         const sal_Int32 nPageNumberCount = mpSlideController->getSlideNumberCount();
    2207           0 :         if( nPageNumberCount <= 1 )
    2208             :         {
    2209           0 :             pMenu->EnableItem( CM_GOTO, false );
    2210             :         }
    2211             :         else
    2212             :         {
    2213           0 :             sal_Int32 nCurrentSlideNumber = mpSlideController->getCurrentSlideNumber();
    2214           0 :             if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    2215           0 :                 nCurrentSlideNumber = -1;
    2216             : 
    2217           0 :             pPageMenu->EnableItem( CM_FIRST_SLIDE, ( mpSlideController->getSlideNumber(0) != nCurrentSlideNumber ) );
    2218           0 :             pPageMenu->EnableItem( CM_LAST_SLIDE, ( mpSlideController->getSlideNumber( mpSlideController->getSlideIndexCount() - 1) != nCurrentSlideNumber ) );
    2219             : 
    2220             :             sal_Int32 nPageNumber;
    2221             : 
    2222           0 :             for( nPageNumber = 0; nPageNumber < nPageNumberCount; nPageNumber++ )
    2223             :             {
    2224           0 :                 if( mpSlideController->isVisibleSlideNumber( nPageNumber ) )
    2225             :                 {
    2226           0 :                     SdPage* pPage = mpDoc->GetSdPage((sal_uInt16)nPageNumber, PK_STANDARD);
    2227           0 :                     if (pPage)
    2228             :                     {
    2229           0 :                         pPageMenu->InsertItem( (sal_uInt16)(CM_SLIDES + nPageNumber), pPage->GetName() );
    2230           0 :                         if( nPageNumber == nCurrentSlideNumber )
    2231           0 :                             pPageMenu->CheckItem( (sal_uInt16)(CM_SLIDES + nPageNumber) );
    2232             :                     }
    2233             :                 }
    2234             :             }
    2235             :         }
    2236             :     }
    2237             : 
    2238           0 :     if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
    2239             :     {
    2240           0 :         PopupMenu* pBlankMenu = pMenu->GetPopupMenu( CM_SCREEN );
    2241           0 :         if( pBlankMenu )
    2242             :         {
    2243           0 :             pBlankMenu->CheckItem( ( mpShowWindow->GetBlankColor() == Color( COL_WHITE ) ) ? CM_SCREEN_WHITE : CM_SCREEN_BLACK  );
    2244             :         }
    2245             :     }
    2246             : 
    2247           0 :     PopupMenu* pWidthMenu = pMenu->GetPopupMenu( CM_WIDTH_PEN);
    2248             : 
    2249             :     // populate color width list
    2250           0 :     if( pWidthMenu )
    2251             :     {
    2252             :         sal_Int32 nIterator;
    2253             :         double nWidth;
    2254             : 
    2255           0 :         nWidth = 4.0;
    2256           0 :         for( nIterator = 1; nIterator < 6; nIterator++)
    2257             :         {
    2258           0 :             switch(nIterator)
    2259             :             {
    2260             :                 case 1:
    2261           0 :                     nWidth = 4.0;
    2262           0 :                     break;
    2263             :                 case 2:
    2264           0 :                     nWidth = 100.0;
    2265           0 :                     break;
    2266             :                 case 3:
    2267           0 :                     nWidth = 150.0;
    2268           0 :                     break;
    2269             :                 case 4:
    2270           0 :                     nWidth = 200.0;
    2271           0 :                     break;
    2272             :                 case 5:
    2273           0 :                     nWidth = 400.0;
    2274           0 :                     break;
    2275             :                 default:
    2276           0 :                     break;
    2277             :             }
    2278             : 
    2279           0 :             pWidthMenu->EnableItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator), true);
    2280           0 :             if( nWidth ==  mdUserPaintStrokeWidth)
    2281           0 :                 pWidthMenu->CheckItem( (sal_uInt16)(CM_WIDTH_PEN + nIterator) );
    2282             :         }
    2283             :     }
    2284             : 
    2285           0 :     pMenu->SetSelectHdl( LINK( this, SlideshowImpl, ContextMenuSelectHdl ) );
    2286           0 :     pMenu->Execute( mpShowWindow, maPopupMousePos );
    2287           0 :     delete pMenu;
    2288             : 
    2289           0 :     if( mxView.is() )
    2290           0 :         mxView->ignoreNextMouseReleased();
    2291             : 
    2292           0 :     if( !mbWasPaused )
    2293           0 :         resume();
    2294           0 :     return 0;
    2295             : }
    2296             : 
    2297             : 
    2298             : 
    2299           0 : IMPL_LINK( SlideshowImpl, ContextMenuSelectHdl, Menu *, pMenu )
    2300             : {
    2301           0 :     if( pMenu )
    2302             :     {
    2303           0 :         sal_uInt16 nMenuId = pMenu->GetCurItemId();
    2304             : 
    2305           0 :         switch( nMenuId )
    2306             :         {
    2307             :         case CM_PREV_SLIDE:
    2308           0 :             gotoPreviousSlide();
    2309           0 :             mbWasPaused = false;
    2310           0 :             break;
    2311             :         case CM_NEXT_SLIDE:
    2312           0 :             gotoNextSlide();
    2313           0 :             mbWasPaused = false;
    2314           0 :             break;
    2315             :         case CM_FIRST_SLIDE:
    2316           0 :             gotoFirstSlide();
    2317           0 :             mbWasPaused = false;
    2318           0 :             break;
    2319             :         case CM_LAST_SLIDE:
    2320           0 :             gotoLastSlide();
    2321           0 :             mbWasPaused = false;
    2322           0 :             break;
    2323             :         case CM_SCREEN_BLACK:
    2324             :         case CM_SCREEN_WHITE:
    2325             :         {
    2326           0 :             const Color aBlankColor( (nMenuId == CM_SCREEN_WHITE) ? COL_WHITE : COL_BLACK );
    2327           0 :             if( mbWasPaused )
    2328             :             {
    2329           0 :                 if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_BLANK )
    2330             :                 {
    2331           0 :                     if( mpShowWindow->GetBlankColor() == aBlankColor )
    2332             :                     {
    2333           0 :                         mbWasPaused = false;
    2334           0 :                         mpShowWindow->RestartShow();
    2335           0 :                         break;
    2336             :                     }
    2337             :                 }
    2338           0 :                 mpShowWindow->RestartShow();
    2339             :             }
    2340           0 :             if( mpShowWindow->SetBlankMode( mpSlideController->getCurrentSlideIndex(), aBlankColor ) )
    2341             :             {
    2342           0 :                 pause();
    2343           0 :                 mbWasPaused = true;
    2344             :             }
    2345             :         }
    2346           0 :         break;
    2347             :         case CM_COLOR_PEN:
    2348             :             {
    2349             :                 //Open a color picker based on SvColorDialog
    2350           0 :                 ::Color aColor( mnUserPaintColor );
    2351           0 :                 SvColorDialog aColorDlg( mpShowWindow);
    2352           0 :                 aColorDlg.SetColor( aColor );
    2353             : 
    2354           0 :                 if (aColorDlg.Execute() )
    2355             :                 {
    2356           0 :                     aColor = aColorDlg.GetColor();
    2357           0 :                     setPenColor(aColor.GetColor());
    2358             :                 }
    2359           0 :                 mbWasPaused = false;
    2360             :             }
    2361           0 :             break;
    2362             : 
    2363             :         case CM_WIDTH_PEN_VERY_THIN:
    2364             :             {
    2365           0 :                 setPenWidth(4.0);
    2366           0 :                 mbWasPaused = false;
    2367             :             }
    2368           0 :             break;
    2369             : 
    2370             :         case CM_WIDTH_PEN_THIN:
    2371             :             {
    2372           0 :                 setPenWidth(100.0);
    2373           0 :                 mbWasPaused = false;
    2374             :             }
    2375           0 :             break;
    2376             : 
    2377             :         case CM_WIDTH_PEN_NORMAL:
    2378             :             {
    2379           0 :                 setPenWidth(150.0);
    2380           0 :                 mbWasPaused = false;
    2381             :             }
    2382           0 :             break;
    2383             : 
    2384             :         case CM_WIDTH_PEN_THICK:
    2385             :             {
    2386           0 :                 setPenWidth(200.0);
    2387           0 :                 mbWasPaused = false;
    2388             :             }
    2389           0 :             break;
    2390             : 
    2391             :         case CM_WIDTH_PEN_VERY_THICK:
    2392             :             {
    2393           0 :                 setPenWidth(400.0);
    2394           0 :                 mbWasPaused = false;
    2395             :             }
    2396           0 :             break;
    2397             :         case CM_ERASE_ALLINK:
    2398             :             {
    2399           0 :                 setEraseAllInk(true);
    2400           0 :                     mbWasPaused = false;
    2401             :             }
    2402           0 :             break;
    2403             :         case CM_PEN_MODE:
    2404             :             {
    2405           0 :                 setUsePen(!mbUsePen);
    2406           0 :                 mbWasPaused = false;
    2407             :             }
    2408           0 :             break;
    2409             :         case CM_EDIT_PRESENTATION:
    2410             :             // When in autoplay mode (pps/ppsx), offer editing of the presentation
    2411             :             // Turn autostart off, else Impress will close when exiting the Presentation
    2412           0 :             mpViewShell->GetDoc()->SetExitAfterPresenting(false);
    2413           0 :             if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
    2414             :             {
    2415           0 :                 if( mpSlideController->getCurrentSlideNumber() != -1 )
    2416             :                 {
    2417           0 :                     mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
    2418             :                 }
    2419             :             }
    2420           0 :             endPresentation();
    2421           0 :             break;
    2422             :         case CM_ENDSHOW:
    2423             :             // in case the user cancels the presentation, switch to current slide
    2424             :             // in edit mode
    2425           0 :             if( mpSlideController.get() && (ANIMATIONMODE_SHOW == meAnimationMode) )
    2426             :             {
    2427           0 :                 if( mpSlideController->getCurrentSlideNumber() != -1 )
    2428             :                 {
    2429           0 :                     mnRestoreSlide = mpSlideController->getCurrentSlideNumber();
    2430             :                 }
    2431             :             }
    2432           0 :             endPresentation();
    2433           0 :             break;
    2434             :         default:
    2435           0 :             sal_Int32 nPageNumber = nMenuId - CM_SLIDES;
    2436           0 :             const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    2437           0 :             if( (eMode == SHOWWINDOWMODE_END) || (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    2438             :             {
    2439           0 :                 mpShowWindow->RestartShow( nPageNumber );
    2440             :             }
    2441           0 :             else if( nPageNumber != mpSlideController->getCurrentSlideNumber() )
    2442             :             {
    2443           0 :                 displaySlideNumber( nPageNumber );
    2444             :             }
    2445           0 :             mbWasPaused = false;
    2446           0 :             break;
    2447             :         }
    2448             :     }
    2449             : 
    2450           0 :     return 0;
    2451             : }
    2452             : 
    2453             : 
    2454             : 
    2455           0 : Reference< XSlideShow > SlideshowImpl::createSlideShow() const
    2456             : {
    2457           0 :     Reference< XSlideShow > xShow;
    2458             : 
    2459             :     try
    2460             :     {
    2461             :         Reference< uno::XComponentContext > xContext =
    2462           0 :             ::comphelper::getProcessComponentContext();
    2463             : 
    2464           0 :         xShow.set( presentation::SlideShow::create(xContext), UNO_QUERY_THROW );
    2465             :     }
    2466           0 :     catch( uno::Exception& )
    2467             :     {
    2468             :         OSL_FAIL(
    2469             :             OString(OString("sd::SlideshowImpl::createSlideShow(), "
    2470             :                      "exception caught: ") +
    2471             :              OUStringToOString(
    2472             :                  comphelper::anyToString( cppu::getCaughtException() ),
    2473             :                  RTL_TEXTENCODING_UTF8 )).getStr() );
    2474             :     }
    2475             : 
    2476           0 :     return xShow;
    2477             : }
    2478             : 
    2479             : 
    2480             : 
    2481           0 : void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide )
    2482             : {
    2483           0 :     const long nSlideCount = mpDoc->GetSdPageCount( PK_STANDARD );
    2484             : 
    2485           0 :     if( nSlideCount )
    2486             :     {
    2487             :         SdCustomShow*   pCustomShow;
    2488             : 
    2489           0 :         if( mpDoc->GetCustomShowList() && maPresSettings.mbCustomShow )
    2490           0 :             pCustomShow = mpDoc->GetCustomShowList()->GetCurObject();
    2491             :         else
    2492           0 :             pCustomShow = NULL;
    2493             : 
    2494             :         // create animation slide controller
    2495             :         AnimationSlideController::Mode eMode =
    2496           0 :             ( pCustomShow && pCustomShow->PagesVector().size() ) ? AnimationSlideController::CUSTOM :
    2497           0 :                 (bAll ? AnimationSlideController::ALL : AnimationSlideController::FROM);
    2498             : 
    2499           0 :         Reference< XDrawPagesSupplier > xDrawPages( mpDoc->getUnoModel(), UNO_QUERY_THROW );
    2500           0 :         Reference< XIndexAccess > xSlides( xDrawPages->getDrawPages(), UNO_QUERY_THROW );
    2501           0 :         mpSlideController.reset( new AnimationSlideController( xSlides, eMode ) );
    2502             : 
    2503           0 :         if( eMode != AnimationSlideController::CUSTOM )
    2504             :         {
    2505           0 :             sal_Int32 nFirstVisibleSlide = 0;
    2506             : 
    2507             : 
    2508             :             // normal presentation
    2509           0 :             if( !rPresSlide.isEmpty() )
    2510             :             {
    2511             :                 sal_Int32 nSlide;
    2512           0 :                 sal_Bool bTakeNextAvailable = sal_False;
    2513             : 
    2514           0 :                 for( nSlide = 0, nFirstVisibleSlide = -1;
    2515           0 :                     ( nSlide < nSlideCount ) && ( -1 == nFirstVisibleSlide ); nSlide++ )
    2516             :                 {
    2517           0 :                     SdPage* pTestSlide = mpDoc->GetSdPage( (sal_uInt16)nSlide, PK_STANDARD );
    2518             : 
    2519           0 :                     if( pTestSlide->GetName() == rPresSlide )
    2520             :                     {
    2521           0 :                         if( pTestSlide->IsExcluded() )
    2522           0 :                             bTakeNextAvailable = sal_True;
    2523             :                         else
    2524           0 :                             nFirstVisibleSlide = nSlide;
    2525             :                     }
    2526           0 :                     else if( bTakeNextAvailable && !pTestSlide->IsExcluded() )
    2527           0 :                         nFirstVisibleSlide = nSlide;
    2528             :                 }
    2529             : 
    2530           0 :                 if( -1 == nFirstVisibleSlide )
    2531           0 :                     nFirstVisibleSlide = 0;
    2532             :             }
    2533             : 
    2534           0 :             for( sal_Int32 i = 0; i < nSlideCount; i++ )
    2535             :             {
    2536           0 :                 bool bVisible = ( mpDoc->GetSdPage( (sal_uInt16)i, PK_STANDARD ) )->IsExcluded() ? false : true;
    2537           0 :                 if( bVisible || (eMode == AnimationSlideController::ALL) )
    2538           0 :                     mpSlideController->insertSlideNumber( i, bVisible );
    2539             :             }
    2540             : 
    2541           0 :             mpSlideController->setStartSlideNumber( nFirstVisibleSlide );
    2542             :         }
    2543             :         else
    2544             :         {
    2545           0 :             if( meAnimationMode != ANIMATIONMODE_SHOW && !rPresSlide.isEmpty() )
    2546             :             {
    2547             :                 sal_Int32 nSlide;
    2548           0 :                 for( nSlide = 0; nSlide < nSlideCount; nSlide++ )
    2549           0 :                     if( rPresSlide == mpDoc->GetSdPage( (sal_uInt16) nSlide, PK_STANDARD )->GetName() )
    2550           0 :                         break;
    2551             : 
    2552           0 :                 if( nSlide < nSlideCount )
    2553           0 :                     mpSlideController->insertSlideNumber( (sal_uInt16) nSlide );
    2554             :             }
    2555             : 
    2556           0 :             sal_Int32 nSlideIndex = 0;
    2557           0 :             for( SdCustomShow::PageVec::iterator it = pCustomShow->PagesVector().begin();
    2558           0 :                  it != pCustomShow->PagesVector().end(); ++it, nSlideIndex++ )
    2559             :             {
    2560           0 :                 const sal_uInt16 nSdSlide = ( ( (SdPage*) (*it) )->GetPageNum() - 1 ) / 2;
    2561             : 
    2562           0 :                 if( !( mpDoc->GetSdPage( nSdSlide, PK_STANDARD ) )->IsExcluded())
    2563           0 :                     mpSlideController->insertSlideNumber( nSdSlide );
    2564             :             }
    2565           0 :         }
    2566             :     }
    2567           0 : }
    2568             : 
    2569             : 
    2570             : 
    2571             : typedef sal_uInt16 (*FncGetChildWindowId)();
    2572             : 
    2573             : FncGetChildWindowId aShowChildren[] =
    2574             : {
    2575             :     &AnimationChildWindow::GetChildWindowId,
    2576             :     &Svx3DChildWindow::GetChildWindowId,
    2577             :     &SvxFontWorkChildWindow::GetChildWindowId,
    2578             :     &SvxColorChildWindow::GetChildWindowId,
    2579             :     &SvxSearchDialogWrapper::GetChildWindowId,
    2580             :     &SvxBmpMaskChildWindow::GetChildWindowId,
    2581             :     &SvxIMapDlgChildWindow::GetChildWindowId,
    2582             :     &SvxHlinkDlgWrapper::GetChildWindowId,
    2583             :     &SfxTemplateDialogWrapper::GetChildWindowId,
    2584             :     &GalleryChildWindow::GetChildWindowId,
    2585             :     &SfxInfoBarContainerChild::GetChildWindowId
    2586             : };
    2587             : 
    2588             : #define NAVIGATOR_CHILD_MASK        0x80000000UL
    2589             : 
    2590           0 : void SlideshowImpl::hideChildWindows()
    2591             : {
    2592           0 :     mnChildMask = 0UL;
    2593             : 
    2594           0 :     if( ANIMATIONMODE_SHOW == meAnimationMode )
    2595             :     {
    2596           0 :         SfxViewFrame* pViewFrame = getViewFrame();
    2597             : 
    2598           0 :         if( pViewFrame )
    2599             :         {
    2600           0 :             if( pViewFrame->GetChildWindow( SID_NAVIGATOR ) != NULL )
    2601           0 :                 mnChildMask |= NAVIGATOR_CHILD_MASK;
    2602             : 
    2603           0 :             for( sal_uLong i = 0, nCount = sizeof( aShowChildren ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
    2604             :             {
    2605           0 :                 const sal_uInt16 nId = ( *aShowChildren[ i ] )();
    2606             : 
    2607           0 :                 if( pViewFrame->GetChildWindow( nId ) )
    2608             :                 {
    2609           0 :                     pViewFrame->SetChildWindow( nId, false );
    2610           0 :                     mnChildMask |= 1 << i;
    2611             :                 }
    2612             :             }
    2613             :         }
    2614             :     }
    2615           0 : }
    2616             : 
    2617             : 
    2618             : 
    2619           0 : void SlideshowImpl::showChildWindows()
    2620             : {
    2621           0 :     if( ANIMATIONMODE_SHOW == meAnimationMode )
    2622             :     {
    2623           0 :         SfxViewFrame* pViewFrame = getViewFrame();
    2624           0 :         if( pViewFrame )
    2625             :         {
    2626           0 :             pViewFrame->SetChildWindow( SID_NAVIGATOR, ( mnChildMask & NAVIGATOR_CHILD_MASK ) != 0 );
    2627             : 
    2628           0 :             for( sal_uLong i = 0, nCount = sizeof( aShowChildren ) / sizeof( FncGetChildWindowId ); i < nCount; i++ )
    2629             :             {
    2630           0 :                 if( mnChildMask & ( 1 << i ) )
    2631           0 :                     pViewFrame->SetChildWindow( ( *aShowChildren[ i ] )(), true );
    2632             :             }
    2633             :         }
    2634             :     }
    2635           0 : }
    2636             : 
    2637             : 
    2638             : 
    2639           0 : SfxViewFrame* SlideshowImpl::getViewFrame() const
    2640             : {
    2641           0 :     return mpViewShell ? mpViewShell->GetViewFrame() : 0;
    2642             : }
    2643             : 
    2644             : 
    2645             : 
    2646           0 : SfxDispatcher* SlideshowImpl::getDispatcher() const
    2647             : {
    2648           0 :     return (mpViewShell && mpViewShell->GetViewFrame()) ? mpViewShell->GetViewFrame()->GetDispatcher() : 0;
    2649             : }
    2650             : 
    2651             : 
    2652             : 
    2653           0 : SfxBindings* SlideshowImpl::getBindings() const
    2654             : {
    2655           0 :     return (mpViewShell && mpViewShell->GetViewFrame()) ? &mpViewShell->GetViewFrame()->GetBindings() : 0;
    2656             : }
    2657             : 
    2658             : 
    2659             : 
    2660           0 : void SlideshowImpl::resize( const Size& rSize )
    2661             : {
    2662           0 :     maPresSize = rSize;
    2663             : 
    2664           0 :     if( mpShowWindow && (ANIMATIONMODE_VIEW != meAnimationMode) )
    2665             :     {
    2666           0 :         mpShowWindow->SetSizePixel( maPresSize );
    2667           0 :         mpShowWindow->Show();
    2668             :     }
    2669             : 
    2670           0 :     if( mxView.is() ) try
    2671             :     {
    2672           0 :         awt::WindowEvent aEvt;
    2673           0 :         mxView->windowResized(aEvt);
    2674             :     }
    2675           0 :     catch( Exception& )
    2676             :     {
    2677             :         OSL_FAIL(
    2678             :             OString(OString("sd::SlideshowImpl::resize(), "
    2679             :                     "exception caught: ") +
    2680             :             OUStringToOString(
    2681             :                 comphelper::anyToString( cppu::getCaughtException() ),
    2682             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    2683             :     }
    2684           0 : }
    2685             : 
    2686             : 
    2687             : 
    2688           0 : void SlideshowImpl::setActiveXToolbarsVisible( sal_Bool bVisible )
    2689             : {
    2690             :     // in case of ActiveX control the toolbars should not be visible if slide show runs in window mode
    2691             :     // actually it runs always in window mode in case of ActiveX control
    2692           0 :     if ( !maPresSettings.mbFullScreen && mpDocSh && mpDocSh->GetMedium() )
    2693             :     {
    2694           0 :         SFX_ITEMSET_ARG( mpDocSh->GetMedium()->GetItemSet(), pItem, SfxBoolItem, SID_VIEWONLY, false );
    2695           0 :         if ( pItem && pItem->GetValue() )
    2696             :         {
    2697             :             // this is a plugin/activex mode, no toolbars should be visible during slide show
    2698             :             // after the end of slide show they should be visible again
    2699           0 :             SfxViewFrame* pViewFrame = getViewFrame();
    2700           0 :             if( pViewFrame )
    2701             :             {
    2702             :                 try
    2703             :                 {
    2704           0 :                     Reference< frame::XLayoutManager > xLayoutManager;
    2705           0 :                     Reference< beans::XPropertySet > xFrameProps( pViewFrame->GetFrame().GetTopFrame().GetFrameInterface(), UNO_QUERY_THROW );
    2706           0 :                     if ( ( xFrameProps->getPropertyValue( "LayoutManager" )
    2707           0 :                                 >>= xLayoutManager )
    2708           0 :                       && xLayoutManager.is() )
    2709             :                     {
    2710           0 :                         xLayoutManager->setVisible( bVisible );
    2711           0 :                     }
    2712             :                 }
    2713           0 :                 catch( uno::Exception& )
    2714             :                 {}
    2715             :             }
    2716             :         }
    2717             :     }
    2718           0 : }
    2719             : 
    2720             : 
    2721             : 
    2722           0 : void SAL_CALL SlideshowImpl::activate() throw (RuntimeException, std::exception)
    2723             : {
    2724           0 :     SolarMutexGuard aSolarGuard;
    2725             : 
    2726           0 :     maDeactivateTimer.Stop();
    2727             : 
    2728           0 :     if( !mbActive && mxShow.is() )
    2729             :     {
    2730           0 :         mbActive = sal_True;
    2731             : 
    2732           0 :         if( ANIMATIONMODE_SHOW == meAnimationMode )
    2733             :         {
    2734           0 :             if( mbAutoSaveWasOn )
    2735           0 :                 setAutoSaveState( false );
    2736             : 
    2737           0 :             if( mpShowWindow )
    2738             :             {
    2739           0 :                 SfxViewFrame* pViewFrame = getViewFrame();
    2740           0 :                 SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : 0;
    2741             : 
    2742           0 :                 hideChildWindows();
    2743             : 
    2744           0 :                 if( pDispatcher )
    2745             :                 {
    2746             :                     // filter all forbiden slots
    2747           0 :                     pDispatcher->SetSlotFilter( true, sizeof(pAllowed) / sizeof(sal_uInt16), pAllowed );
    2748             :                 }
    2749             : 
    2750           0 :                 if( getBindings() )
    2751           0 :                     getBindings()->InvalidateAll(true);
    2752             : 
    2753           0 :                 mpShowWindow->GrabFocus();
    2754             :             }
    2755             :         }
    2756             : 
    2757           0 :         resume();
    2758           0 :     }
    2759           0 : }
    2760             : 
    2761             : 
    2762             : 
    2763           0 : void SAL_CALL SlideshowImpl::deactivate() throw (RuntimeException, std::exception)
    2764             : {
    2765           0 :     SolarMutexGuard aSolarGuard;
    2766             : 
    2767           0 :     if( mbActive && mxShow.is() )
    2768             :     {
    2769           0 :         maDeactivateTimer.Start();
    2770           0 :     }
    2771           0 : }
    2772             : 
    2773             : 
    2774             : 
    2775           0 : IMPL_LINK_NOARG(SlideshowImpl, deactivateHdl)
    2776             : {
    2777           0 :     if( mbActive && mxShow.is() )
    2778             :     {
    2779           0 :         mbActive = sal_False;
    2780             : 
    2781           0 :         pause();
    2782             : 
    2783           0 :         if( ANIMATIONMODE_SHOW == meAnimationMode )
    2784             :         {
    2785           0 :             if( mbAutoSaveWasOn )
    2786           0 :                 setAutoSaveState( true );
    2787             : 
    2788           0 :             if( mpShowWindow )
    2789             :             {
    2790           0 :                 showChildWindows();
    2791             :             }
    2792             :         }
    2793             :     }
    2794           0 :     return 0;
    2795             : }
    2796             : 
    2797             : 
    2798             : 
    2799           0 : sal_Bool SAL_CALL SlideshowImpl::isActive() throw (RuntimeException, std::exception)
    2800             : {
    2801           0 :     SolarMutexGuard aSolarGuard;
    2802           0 :     return mbActive;
    2803             : }
    2804             : 
    2805             : 
    2806             : 
    2807           0 : void SlideshowImpl::receiveRequest(SfxRequest& rReq)
    2808             : {
    2809           0 :     const SfxItemSet* pArgs      = rReq.GetArgs();
    2810             : 
    2811           0 :     switch ( rReq.GetSlot() )
    2812             :     {
    2813             :         case SID_NAVIGATOR_PEN:
    2814           0 :             setUsePen(!mbUsePen);
    2815           0 :         break;
    2816             : 
    2817             :         case SID_NAVIGATOR_PAGE:
    2818             :         {
    2819           0 :             PageJump    eJump = (PageJump)((SfxAllEnumItem&) pArgs->Get(SID_NAVIGATOR_PAGE)).GetValue();
    2820           0 :             switch( eJump )
    2821             :             {
    2822           0 :                 case PAGE_FIRST:        gotoFirstSlide(); break;
    2823           0 :                 case PAGE_LAST:         gotoLastSlide(); break;
    2824           0 :                 case PAGE_NEXT:         gotoNextSlide(); break;
    2825           0 :                 case PAGE_PREVIOUS:     gotoPreviousSlide(); break;
    2826           0 :                 case PAGE_NONE:         break;
    2827             :             }
    2828             :         }
    2829           0 :         break;
    2830             : 
    2831             :         case SID_NAVIGATOR_OBJECT:
    2832             :         {
    2833           0 :             const OUString aTarget( ((SfxStringItem&) pArgs->Get(SID_NAVIGATOR_OBJECT)).GetValue() );
    2834             : 
    2835             :             // is the bookmark a Slide?
    2836             :             sal_Bool        bIsMasterPage;
    2837           0 :             sal_uInt16      nPgNum = mpDoc->GetPageByName( aTarget, bIsMasterPage );
    2838           0 :             SdrObject*  pObj   = NULL;
    2839             : 
    2840           0 :             if( nPgNum == SDRPAGE_NOTFOUND )
    2841             :             {
    2842             :                 // is the bookmark an object?
    2843           0 :                 pObj = mpDoc->GetObj( aTarget );
    2844             : 
    2845           0 :                 if( pObj )
    2846           0 :                     nPgNum = pObj->GetPage()->GetPageNum();
    2847             :             }
    2848             : 
    2849           0 :             if( nPgNum != SDRPAGE_NOTFOUND )
    2850             :             {
    2851           0 :                 nPgNum = ( nPgNum - 1 ) >> 1;
    2852           0 :                 displaySlideNumber( nPgNum );
    2853           0 :             }
    2854             :         }
    2855           0 :         break;
    2856             :     }
    2857           0 : }
    2858             : 
    2859             : 
    2860             : 
    2861           0 : void SlideshowImpl::setAutoSaveState( bool bOn)
    2862             : {
    2863             :     try
    2864             :     {
    2865           0 :         uno::Reference<uno::XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
    2866             : 
    2867           0 :         uno::Reference< util::XURLTransformer > xParser(util::URLTransformer::create(xContext));
    2868           0 :         util::URL aURL;
    2869           0 :         aURL.Complete = "vnd.sun.star.autorecovery:/setAutoSaveState";
    2870           0 :         xParser->parseStrict(aURL);
    2871             : 
    2872           0 :         Sequence< beans::PropertyValue > aArgs(1);
    2873           0 :         aArgs[0].Name = "AutoSaveState";
    2874           0 :         aArgs[0].Value <<= bOn ? sal_True : sal_False;
    2875             : 
    2876           0 :         uno::Reference< frame::XDispatch > xAutoSave = frame::theAutoRecovery::get(xContext);
    2877           0 :         xAutoSave->dispatch(aURL, aArgs);
    2878             :     }
    2879           0 :     catch( Exception& )
    2880             :     {
    2881             :         OSL_FAIL("sd::SlideshowImpl::setAutoSaveState(), exception caught!");
    2882             :     }
    2883           0 : }
    2884             : 
    2885             : 
    2886             : 
    2887           0 : Reference< XDrawPage > SAL_CALL SlideshowImpl::getCurrentSlide() throw (RuntimeException, std::exception)
    2888             : {
    2889           0 :     SolarMutexGuard aSolarGuard;
    2890             : 
    2891           0 :     Reference< XDrawPage > xSlide;
    2892           0 :     if( mxShow.is() && mpSlideController.get() )
    2893             :     {
    2894           0 :         sal_Int32 nSlide = getCurrentSlideNumber();
    2895           0 :         if( (nSlide >= 0) && (nSlide < mpSlideController->getSlideNumberCount() ) )
    2896           0 :             xSlide = mpSlideController->getSlideByNumber( nSlide );
    2897             :     }
    2898             : 
    2899           0 :     return xSlide;
    2900             : }
    2901             : 
    2902             : 
    2903             : 
    2904           0 : sal_Int32 SAL_CALL SlideshowImpl::getNextSlideIndex() throw (RuntimeException, std::exception)
    2905             : {
    2906           0 :     SolarMutexGuard aSolarGuard;
    2907             : 
    2908           0 :     if( mxShow.is() )
    2909             :     {
    2910           0 :         return mpSlideController->getNextSlideIndex();
    2911             :     }
    2912             :     else
    2913             :     {
    2914           0 :         return -1;
    2915           0 :     }
    2916             : }
    2917             : 
    2918             : 
    2919             : 
    2920           0 : sal_Int32 SAL_CALL SlideshowImpl::getCurrentSlideIndex() throw (RuntimeException, std::exception)
    2921             : {
    2922           0 :     return mpSlideController.get() ? mpSlideController->getCurrentSlideIndex() : -1;
    2923             : }
    2924             : 
    2925             : 
    2926             : // ::com::sun::star::presentation::XSlideShowController:
    2927             : 
    2928             : 
    2929           0 : ::sal_Int32 SAL_CALL SlideshowImpl::getSlideCount() throw (RuntimeException, std::exception)
    2930             : {
    2931           0 :     return mpSlideController.get() ? mpSlideController->getSlideIndexCount() : 0;
    2932             : }
    2933             : 
    2934             : 
    2935             : 
    2936           0 : Reference< XDrawPage > SAL_CALL SlideshowImpl::getSlideByIndex(::sal_Int32 Index) throw (RuntimeException, css::lang::IndexOutOfBoundsException, std::exception)
    2937             : {
    2938           0 :     if( (mpSlideController.get() == 0 ) || (Index < 0) || (Index >= mpSlideController->getSlideIndexCount() ) )
    2939           0 :         throw IndexOutOfBoundsException();
    2940             : 
    2941           0 :     return mpSlideController->getSlideByNumber( mpSlideController->getSlideNumber( Index ) );
    2942             : }
    2943             : 
    2944           0 : sal_Bool SAL_CALL SlideshowImpl::getAlwaysOnTop() throw (RuntimeException, std::exception)
    2945             : {
    2946           0 :     SolarMutexGuard aSolarGuard;
    2947           0 :     return maPresSettings.mbAlwaysOnTop;
    2948             : }
    2949             : 
    2950             : 
    2951             : 
    2952           0 : void SAL_CALL SlideshowImpl::setAlwaysOnTop( sal_Bool bAlways ) throw (RuntimeException, std::exception)
    2953             : {
    2954           0 :     SolarMutexGuard aSolarGuard;
    2955           0 :     if( maPresSettings.mbAlwaysOnTop != bAlways )
    2956             :     {
    2957           0 :         maPresSettings.mbAlwaysOnTop = bAlways;
    2958             :         // todo, can this be changed while running?
    2959           0 :     }
    2960           0 : }
    2961             : 
    2962             : 
    2963             : 
    2964           0 : sal_Bool SAL_CALL SlideshowImpl::isFullScreen() throw (RuntimeException, std::exception)
    2965             : {
    2966           0 :     SolarMutexGuard aSolarGuard;
    2967           0 :     return maPresSettings.mbFullScreen;
    2968             : }
    2969             : 
    2970             : 
    2971             : 
    2972           0 : sal_Bool SAL_CALL SlideshowImpl::getMouseVisible() throw (RuntimeException, std::exception)
    2973             : {
    2974           0 :     SolarMutexGuard aSolarGuard;
    2975           0 :     return maPresSettings.mbMouseVisible;
    2976             : }
    2977             : 
    2978             : 
    2979             : 
    2980           0 : void SAL_CALL SlideshowImpl::setMouseVisible( sal_Bool bVisible ) throw (RuntimeException, std::exception)
    2981             : {
    2982           0 :     SolarMutexGuard aSolarGuard;
    2983           0 :     if( maPresSettings.mbMouseVisible != bVisible )
    2984             :     {
    2985           0 :         maPresSettings.mbMouseVisible = bVisible;
    2986           0 :         if( mpShowWindow )
    2987           0 :             mpShowWindow->SetMouseAutoHide( !maPresSettings.mbMouseVisible );
    2988           0 :     }
    2989           0 : }
    2990             : 
    2991             : 
    2992             : 
    2993           0 : sal_Bool SAL_CALL SlideshowImpl::getUsePen() throw (RuntimeException, std::exception)
    2994             : {
    2995           0 :     SolarMutexGuard aSolarGuard;
    2996           0 :     return mbUsePen;
    2997             : }
    2998             : 
    2999             : 
    3000             : 
    3001           0 : void SAL_CALL SlideshowImpl::setUsePen( sal_Bool bMouseAsPen ) throw (RuntimeException, std::exception)
    3002             : {
    3003           0 :     SolarMutexGuard aSolarGuard;
    3004           0 :     mbUsePen = bMouseAsPen;
    3005           0 :     if( mxShow.is() ) try
    3006             :     {
    3007             :         // For Pencolor;
    3008           0 :         Any aValue;
    3009           0 :         if( mbUsePen )
    3010           0 :             aValue <<= mnUserPaintColor;
    3011           0 :         beans::PropertyValue aPenProp;
    3012           0 :         aPenProp.Name = "UserPaintColor";
    3013           0 :         aPenProp.Value = aValue;
    3014           0 :         mxShow->setProperty( aPenProp );
    3015             : 
    3016             :         //for StrokeWidth :
    3017           0 :         if( mbUsePen )
    3018             :         {
    3019           0 :             beans::PropertyValue aPenPropWidth;
    3020           0 :             aPenPropWidth.Name = "UserPaintStrokeWidth";
    3021           0 :             aPenPropWidth.Value <<= mdUserPaintStrokeWidth;
    3022           0 :             mxShow->setProperty( aPenPropWidth );
    3023             : 
    3024             :             // for Pen Mode
    3025           0 :             beans::PropertyValue aPenPropSwitchPenMode;
    3026           0 :             aPenPropSwitchPenMode.Name = "SwitchPenMode";
    3027           0 :             aPenPropSwitchPenMode.Value <<= sal_True;
    3028           0 :             mxShow->setProperty( aPenPropSwitchPenMode );
    3029           0 :         }
    3030             :     }
    3031           0 :     catch( Exception& )
    3032             :     {
    3033             :         OSL_FAIL(
    3034             :             OString(OString("sd::SlideshowImpl::setUsePen(), "
    3035             :                     "exception caught: ") +
    3036             :             OUStringToOString(
    3037             :                 comphelper::anyToString( cppu::getCaughtException() ),
    3038             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    3039           0 :     }
    3040           0 : }
    3041             : 
    3042             : 
    3043             : 
    3044           0 : double SAL_CALL SlideshowImpl::getPenWidth() throw (RuntimeException, std::exception)
    3045             : {
    3046           0 :     SolarMutexGuard aSolarGuard;
    3047           0 :     return mdUserPaintStrokeWidth;
    3048             : }
    3049             : 
    3050             : 
    3051             : 
    3052           0 : void SAL_CALL SlideshowImpl::setPenWidth( double dStrokeWidth ) throw (RuntimeException, std::exception)
    3053             : {
    3054           0 :     SolarMutexGuard aSolarGuard;
    3055           0 :     mdUserPaintStrokeWidth = dStrokeWidth;
    3056           0 :     setUsePen( true ); // enable pen mode, update color and width
    3057           0 : }
    3058             : 
    3059             : 
    3060             : 
    3061           0 : sal_Int32 SAL_CALL SlideshowImpl::getPenColor() throw (RuntimeException, std::exception)
    3062             : {
    3063           0 :     SolarMutexGuard aSolarGuard;
    3064           0 :     return mnUserPaintColor;
    3065             : }
    3066             : 
    3067             : 
    3068             : 
    3069           0 : void SAL_CALL SlideshowImpl::setPenColor( sal_Int32 nColor ) throw (RuntimeException, std::exception)
    3070             : {
    3071           0 :     SolarMutexGuard aSolarGuard;
    3072           0 :     mnUserPaintColor = nColor;
    3073           0 :     setUsePen( true ); // enable pen mode, update color
    3074           0 : }
    3075             : 
    3076             : 
    3077             : 
    3078           0 : void SAL_CALL SlideshowImpl::setUseEraser( sal_Bool /*_usepen*/ ) throw (css::uno::RuntimeException)
    3079             : {
    3080           0 : }
    3081             : 
    3082             : 
    3083             : 
    3084           0 : void SAL_CALL SlideshowImpl::setPenMode( bool bSwitchPenMode ) throw (RuntimeException)
    3085             : {
    3086           0 :     SolarMutexGuard aSolarGuard;
    3087           0 :     setUsePen( bSwitchPenMode ); // SwitchPen Mode
    3088             : 
    3089           0 : }
    3090             : 
    3091             : 
    3092           0 : void SAL_CALL SlideshowImpl::setPointerMode( bool bSwitchPointerMode ) throw (css::uno::RuntimeException)
    3093             : {
    3094           0 :     SolarMutexGuard aSolarGuard;
    3095           0 :     if (mxShow.is()) try
    3096             :     {
    3097           0 :         mxShow->setProperty(
    3098             :                     beans::PropertyValue( "PointerVisible" ,
    3099             :                         -1,
    3100             :                         makeAny( bSwitchPointerMode ),
    3101           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    3102             :     }
    3103           0 :     catch ( Exception& )
    3104             :     {
    3105             :         SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerMode(), "
    3106             :             "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
    3107           0 :     }
    3108           0 : }
    3109             : 
    3110             : 
    3111           0 : void SAL_CALL SlideshowImpl::setPointerPosition( const ::com::sun::star::geometry::RealPoint2D& pos ) throw (css::uno::RuntimeException)
    3112             : {
    3113           0 :     SolarMutexGuard aSolarGuard;
    3114           0 :     if (mxShow.is()) try
    3115             :     {
    3116           0 :         mxShow->setProperty(
    3117             :                     beans::PropertyValue( "PointerPosition" ,
    3118             :                         -1,
    3119             :                         makeAny( pos ),
    3120           0 :                         beans::PropertyState_DIRECT_VALUE ) );
    3121             :     }
    3122           0 :     catch ( Exception& )
    3123             :     {
    3124             :         SAL_WARN( "sd.slideshow", "sd::SlideShowImpl::setPointerPosition(), "
    3125             :             "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
    3126           0 :     }
    3127           0 : }
    3128             : 
    3129             : 
    3130           0 : void SAL_CALL SlideshowImpl::setEraseAllInk(bool bEraseAllInk) throw (RuntimeException)
    3131             : {
    3132           0 :     if( bEraseAllInk )
    3133             :     {
    3134           0 :         SolarMutexGuard aSolarGuard;
    3135           0 :         if( mxShow.is() ) try
    3136             :         {
    3137           0 :             beans::PropertyValue aPenPropEraseAllInk;
    3138           0 :             aPenPropEraseAllInk.Name = "EraseAllInk";
    3139           0 :             aPenPropEraseAllInk.Value <<= bEraseAllInk;
    3140           0 :             mxShow->setProperty( aPenPropEraseAllInk );
    3141             :         }
    3142           0 :         catch( Exception& )
    3143             :         {
    3144             :             SAL_WARN( "sd.slideshow", "sd::SlideshowImpl::setEraseAllInk(), "
    3145             :                 "exception caught: " << comphelper::anyToString( cppu::getCaughtException() ));
    3146           0 :         }
    3147             :     }
    3148           0 : }
    3149             : 
    3150           0 : void SAL_CALL SlideshowImpl::setEraseInk( sal_Int32 /*nEraseInkSize*/ ) throw (css::uno::RuntimeException)
    3151             : {
    3152           0 : }
    3153             : 
    3154           0 : void SAL_CALL SlideshowImpl::setEraserMode( bool /*bSwitchEraserMode*/ ) throw (css::uno::RuntimeException)
    3155             : {
    3156           0 : }
    3157             : 
    3158             : 
    3159             : // XSlideShowController Methods
    3160             : 
    3161             : 
    3162           0 : sal_Bool SAL_CALL SlideshowImpl::isRunning(  ) throw (RuntimeException, std::exception)
    3163             : {
    3164           0 :     SolarMutexGuard aSolarGuard;
    3165           0 :     return mxShow.is();
    3166             : }
    3167             : 
    3168             : 
    3169             : 
    3170           0 : void SAL_CALL SlideshowImpl::gotoNextEffect(  ) throw (RuntimeException, std::exception)
    3171             : {
    3172           0 :     SolarMutexGuard aSolarGuard;
    3173             : 
    3174           0 :     if( mxShow.is() && mpSlideController.get() && mpShowWindow )
    3175             :     {
    3176           0 :         if( mbIsPaused )
    3177           0 :             resume();
    3178             : 
    3179           0 :         const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    3180           0 :         if( eMode == SHOWWINDOWMODE_END )
    3181             :         {
    3182           0 :             endPresentation();
    3183             :         }
    3184           0 :         else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    3185             :         {
    3186           0 :             mpShowWindow->RestartShow();
    3187             :         }
    3188             :         else
    3189             :         {
    3190           0 :             mxShow->nextEffect();
    3191           0 :             update();
    3192             :         }
    3193           0 :     }
    3194           0 : }
    3195             : 
    3196             : 
    3197             : 
    3198           0 : void SAL_CALL SlideshowImpl::gotoPreviousEffect(  ) throw (RuntimeException, std::exception)
    3199             : {
    3200           0 :     SolarMutexGuard aSolarGuard;
    3201             : 
    3202           0 :     if( mxShow.is() && mpSlideController.get() && mpShowWindow )
    3203             :     {
    3204           0 :         if( mbIsPaused )
    3205           0 :             resume();
    3206             : 
    3207           0 :         const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    3208           0 :         if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    3209             :         {
    3210           0 :             mpShowWindow->RestartShow();
    3211             :         }
    3212             :         else
    3213             :         {
    3214           0 :             mxShow->previousEffect();
    3215           0 :             update();
    3216             :         }
    3217           0 :     }
    3218           0 : }
    3219             : 
    3220             : 
    3221             : 
    3222           0 : void SAL_CALL SlideshowImpl::gotoFirstSlide(  ) throw (RuntimeException, std::exception)
    3223             : {
    3224           0 :     SolarMutexGuard aSolarGuard;
    3225             : 
    3226           0 :     if( mpShowWindow && mpSlideController.get() )
    3227             :     {
    3228           0 :         if( mbIsPaused )
    3229           0 :             resume();
    3230             : 
    3231           0 :         if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
    3232             :         {
    3233           0 :             if( mpSlideController->getSlideIndexCount() )
    3234           0 :                 mpShowWindow->RestartShow( 0);
    3235             :         }
    3236             :         else
    3237             :         {
    3238           0 :             displaySlideIndex( 0 );
    3239             :         }
    3240           0 :     }
    3241           0 : }
    3242             : 
    3243             : 
    3244             : 
    3245           0 : void SAL_CALL SlideshowImpl::gotoNextSlide(  ) throw (RuntimeException, std::exception)
    3246             : {
    3247           0 :     SolarMutexGuard aSolarGuard;
    3248             : 
    3249           0 :     if( mbIsPaused )
    3250           0 :         resume();
    3251             : 
    3252           0 :     const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    3253           0 :     if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    3254             :     {
    3255           0 :         mpShowWindow->RestartShow();
    3256             :     }
    3257             :     else
    3258             :     {
    3259             :         // if this is a show, ignore user inputs and
    3260             :         // start 20ms timer to reenable inputs to fiter
    3261             :         // buffered inputs during slide transition
    3262           0 :         if( meAnimationMode == ANIMATIONMODE_SHOW )
    3263             :         {
    3264           0 :             mbInputFreeze = true;
    3265           0 :             maInputFreezeTimer.Start();
    3266             :         }
    3267             : 
    3268           0 :         if( mpSlideController.get() )
    3269             :         {
    3270           0 :             if( mpSlideController->nextSlide() )
    3271             :             {
    3272           0 :                 displayCurrentSlide();
    3273             :             }
    3274             :             else
    3275             :             {
    3276           0 :                 stopSound();
    3277             : 
    3278           0 :                 if( meAnimationMode == ANIMATIONMODE_PREVIEW )
    3279             :                 {
    3280           0 :                     endPresentation();
    3281             :                 }
    3282           0 :                 else if( maPresSettings.mbEndless )
    3283             :                 {
    3284           0 :                     if( maPresSettings.mnPauseTimeout )
    3285             :                     {
    3286           0 :                         if( mpShowWindow )
    3287             :                         {
    3288           0 :                             if ( maPresSettings.mbShowPauseLogo )
    3289             :                             {
    3290           0 :                                 Graphic aGraphic(SfxApplication::GetApplicationLogo(360));
    3291           0 :                                 mpShowWindow->SetPauseMode( 0, maPresSettings.mnPauseTimeout, &aGraphic );
    3292             :                             }
    3293             :                             else
    3294           0 :                                 mpShowWindow->SetPauseMode( 0, maPresSettings.mnPauseTimeout );
    3295             :                         }
    3296             :                     }
    3297             :                     else
    3298             :                     {
    3299           0 :                         displaySlideIndex( 0 );
    3300             :                     }
    3301             :                 }
    3302             :                 else
    3303             :                 {
    3304           0 :                     if( mpShowWindow )
    3305             :                     {
    3306           0 :                         mpShowWindow->SetEndMode();
    3307           0 :                         if( !mpViewShell->GetDoc()->IsStartWithPresentation() )
    3308           0 :                             pause();
    3309             :                     }
    3310             :                 }
    3311             :             }
    3312             :         }
    3313           0 :     }
    3314           0 : }
    3315             : 
    3316             : 
    3317             : 
    3318           0 : void SAL_CALL SlideshowImpl::gotoPreviousSlide(  ) throw (RuntimeException, std::exception)
    3319             : {
    3320           0 :     gotoPreviousSlide(false);
    3321           0 : }
    3322             : 
    3323           0 : void SlideshowImpl::gotoPreviousSlide (const bool bSkipAllMainSequenceEffects)
    3324             : {
    3325           0 :     SolarMutexGuard aSolarGuard;
    3326             : 
    3327           0 :     if( mxShow.is() && mpSlideController.get() ) try
    3328             :     {
    3329           0 :         if( mbIsPaused )
    3330           0 :             resume();
    3331             : 
    3332           0 :         const ShowWindowMode eMode = mpShowWindow->GetShowWindowMode();
    3333           0 :         if( eMode == SHOWWINDOWMODE_END )
    3334             :         {
    3335           0 :             mpShowWindow->RestartShow( mpSlideController->getCurrentSlideIndex() );
    3336             :         }
    3337           0 :         else if( (eMode == SHOWWINDOWMODE_PAUSE) || (eMode == SHOWWINDOWMODE_BLANK) )
    3338             :         {
    3339           0 :             mpShowWindow->RestartShow();
    3340             :         }
    3341             :         else
    3342             :         {
    3343           0 :             if( mpSlideController->previousSlide())
    3344           0 :                 displayCurrentSlide(bSkipAllMainSequenceEffects);
    3345           0 :             else if (bSkipAllMainSequenceEffects)
    3346             :             {
    3347             :                 // We could not go to the previous slide (probably because
    3348             :                 // the current slide is already the first one).  We still
    3349             :                 // have to call displayCurrentSlide because the calling
    3350             :                 // slideshow can not determine whether there is a previous
    3351             :                 // slide or not and has already prepared for a slide change.
    3352             :                 // This slide change has to be completed now, even when
    3353             :                 // changing to the same slide.
    3354             :                 // Note that in this special case we do NOT pass
    3355             :                 // bSkipAllMainSequenceEffects because we display the same
    3356             :                 // slide as before and do not want to show all its effects.
    3357           0 :                 displayCurrentSlide(false);
    3358             :             }
    3359             :         }
    3360             :     }
    3361           0 :     catch( Exception& )
    3362             :     {
    3363             :         OSL_FAIL(
    3364             :             OString(OString("sd::SlideshowImpl::gotoPreviousSlide(), "
    3365             :                     "exception caught: ") +
    3366             :             OUStringToOString(
    3367             :                 comphelper::anyToString( cppu::getCaughtException() ),
    3368             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    3369           0 :     }
    3370           0 : }
    3371             : 
    3372             : 
    3373             : 
    3374           0 : void SAL_CALL SlideshowImpl::gotoLastSlide() throw (RuntimeException, std::exception)
    3375             : {
    3376           0 :     SolarMutexGuard aSolarGuard;
    3377             : 
    3378           0 :     if( mpSlideController.get() )
    3379             :     {
    3380           0 :         if( mbIsPaused )
    3381           0 :             resume();
    3382             : 
    3383           0 :         const sal_Int32 nLastSlideIndex = mpSlideController->getSlideIndexCount() - 1;
    3384           0 :         if( nLastSlideIndex >= 0 )
    3385             :         {
    3386           0 :             if( mpShowWindow->GetShowWindowMode() == SHOWWINDOWMODE_END )
    3387             :             {
    3388           0 :                 mpShowWindow->RestartShow( nLastSlideIndex );
    3389             :             }
    3390             :             else
    3391             :             {
    3392           0 :                 displaySlideIndex( nLastSlideIndex );
    3393             :             }
    3394             :         }
    3395           0 :     }
    3396           0 : }
    3397             : 
    3398             : 
    3399             : 
    3400           0 : void SAL_CALL SlideshowImpl::gotoBookmark( const OUString& rBookmark ) throw (RuntimeException, std::exception)
    3401             : {
    3402           0 :     SolarMutexGuard aSolarGuard;
    3403             : 
    3404           0 :     if( mbIsPaused )
    3405           0 :         resume();
    3406             : 
    3407           0 :     sal_Int32 nSlideNumber = getSlideNumberForBookmark( rBookmark );
    3408           0 :     if( nSlideNumber != -1 )
    3409           0 :         displaySlideNumber( nSlideNumber );
    3410           0 : }
    3411             : 
    3412             : 
    3413             : 
    3414           0 : void SAL_CALL SlideshowImpl::gotoSlide( const Reference< XDrawPage >& xSlide )
    3415             :     throw(IllegalArgumentException, RuntimeException, std::exception)
    3416             : {
    3417           0 :     SolarMutexGuard aSolarGuard;
    3418             : 
    3419           0 :     if( mpSlideController.get() && xSlide.is() )
    3420             :     {
    3421           0 :         if( mbIsPaused )
    3422           0 :             resume();
    3423             : 
    3424           0 :         const sal_Int32 nSlideCount = mpSlideController->getSlideNumberCount();
    3425           0 :         for( sal_Int32 nSlide = 0; nSlide < nSlideCount; nSlide++ )
    3426             :         {
    3427           0 :             if( mpSlideController->getSlideByNumber( nSlide ) == xSlide )
    3428             :             {
    3429           0 :                 displaySlideNumber( nSlide );
    3430             :             }
    3431             :         }
    3432           0 :     }
    3433           0 : }
    3434             : 
    3435             : 
    3436             : 
    3437           0 : void SAL_CALL SlideshowImpl::gotoSlideIndex( sal_Int32 nIndex ) throw (RuntimeException, std::exception)
    3438             : {
    3439           0 :     SolarMutexGuard aSolarGuard;
    3440             : 
    3441           0 :     if( mbIsPaused )
    3442           0 :         resume();
    3443             : 
    3444           0 :     displaySlideIndex( nIndex );
    3445           0 : }
    3446             : 
    3447             : 
    3448             : 
    3449           0 : void SAL_CALL SlideshowImpl::stopSound(  ) throw (RuntimeException, std::exception)
    3450             : {
    3451           0 :     SolarMutexGuard aSolarGuard;
    3452             : 
    3453             :     try
    3454             :     {
    3455           0 :         if( mxPlayer.is() )
    3456             :         {
    3457           0 :             mxPlayer->stop();
    3458           0 :             mxPlayer.clear();
    3459             :         }
    3460             :     }
    3461           0 :     catch( Exception& )
    3462             :     {
    3463             :         OSL_FAIL(
    3464             :             OString(OString("sd::SlideshowImpl::stopSound(), "
    3465             :                     "exception caught: ") +
    3466             :             OUStringToOString(
    3467             :                 comphelper::anyToString( cppu::getCaughtException() ),
    3468             :                 RTL_TEXTENCODING_UTF8 )).getStr() );
    3469           0 :     }
    3470           0 : }
    3471             : 
    3472             : 
    3473             : // XIndexAccess
    3474             : 
    3475             : 
    3476           0 : ::sal_Int32 SAL_CALL SlideshowImpl::getCount(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3477             : {
    3478           0 :     return getSlideCount();
    3479             : }
    3480             : 
    3481             : 
    3482             : 
    3483           0 : ::com::sun::star::uno::Any SAL_CALL SlideshowImpl::getByIndex( ::sal_Int32 Index ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception)
    3484             : {
    3485           0 :     return Any( getSlideByIndex( Index ) );
    3486             : }
    3487             : 
    3488             : 
    3489             : 
    3490           0 : ::com::sun::star::uno::Type SAL_CALL SlideshowImpl::getElementType(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3491             : {
    3492           0 :     return cppu::UnoType<XDrawPage>::get();
    3493             : }
    3494             : 
    3495             : 
    3496             : 
    3497           0 : sal_Bool SAL_CALL SlideshowImpl::hasElements(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3498             : {
    3499           0 :     return getSlideCount() != 0;
    3500             : }
    3501             : 
    3502             : 
    3503             : 
    3504           0 : Reference< XSlideShow > SAL_CALL SlideshowImpl::getSlideShow() throw (RuntimeException, std::exception)
    3505             : {
    3506           0 :     return mxShow;
    3507             : }
    3508             : 
    3509             : 
    3510             : 
    3511             : 
    3512           0 : PresentationSettingsEx::PresentationSettingsEx( const PresentationSettingsEx& r )
    3513             : : PresentationSettings( r )
    3514             : , mbRehearseTimings(r.mbRehearseTimings)
    3515             : , mbPreview(r.mbPreview)
    3516           0 : , mpParentWindow( 0 )
    3517             : {
    3518           0 : }
    3519             : 
    3520           0 : PresentationSettingsEx::PresentationSettingsEx( PresentationSettings& r )
    3521             : : PresentationSettings( r )
    3522             : , mbRehearseTimings(sal_False)
    3523             : , mbPreview(sal_False)
    3524           0 : , mpParentWindow(0)
    3525             : {
    3526           0 : }
    3527             : 
    3528           0 : void PresentationSettingsEx::SetArguments( const Sequence< PropertyValue >& rArguments ) throw (IllegalArgumentException)
    3529             : {
    3530           0 :     sal_Int32 nArguments = rArguments.getLength();
    3531           0 :     const PropertyValue* pValue = rArguments.getConstArray();
    3532             : 
    3533           0 :     while( nArguments-- )
    3534             :     {
    3535           0 :         SetPropertyValue( pValue->Name, pValue->Value );
    3536           0 :         pValue++;
    3537             :     }
    3538           0 : }
    3539             : 
    3540           0 : void PresentationSettingsEx::SetPropertyValue( const OUString& rProperty, const Any& rValue ) throw (IllegalArgumentException)
    3541             : {
    3542           0 :     if ( rProperty == "RehearseTimings" )
    3543             :     {
    3544           0 :         if( rValue >>= mbRehearseTimings )
    3545           0 :             return;
    3546             :     }
    3547           0 :     else if ( rProperty == "Preview" )
    3548             :     {
    3549           0 :         if( rValue >>= mbPreview )
    3550           0 :             return;
    3551             :     }
    3552           0 :     else if ( rProperty == "AnimationNode" )
    3553             :     {
    3554           0 :         if( rValue >>= mxAnimationNode )
    3555           0 :             return;
    3556             :     }
    3557           0 :     else if ( rProperty == "ParentWindow" )
    3558             :     {
    3559           0 :         Reference< XWindow > xWindow;
    3560           0 :         if( rValue >>= xWindow )
    3561             :         {
    3562           0 :             mpParentWindow = xWindow.is() ? VCLUnoHelper::GetWindow( xWindow ) : 0;
    3563           0 :             return;
    3564           0 :         }
    3565             :     }
    3566           0 :     else if ( rProperty == "AllowAnimations" )
    3567             :     {
    3568           0 :         if( rValue >>= mbAnimationAllowed )
    3569           0 :             return;
    3570             :     }
    3571           0 :     else if ( rProperty == "FirstPage" )
    3572             :     {
    3573           0 :         OUString aPresPage;
    3574           0 :         if( rValue >>= aPresPage )
    3575             :         {
    3576           0 :             maPresPage = getUiNameFromPageApiNameImpl(aPresPage);
    3577           0 :             mbCustomShow = sal_False;
    3578           0 :             mbAll = sal_False;
    3579           0 :             return;
    3580             :         }
    3581             :         else
    3582             :         {
    3583           0 :             if( rValue >>= mxStartPage )
    3584           0 :                 return;
    3585           0 :         }
    3586             :     }
    3587           0 :     else if ( rProperty == "IsAlwaysOnTop" )
    3588             :     {
    3589           0 :         if( rValue >>= mbAlwaysOnTop )
    3590           0 :             return;
    3591             :     }
    3592           0 :     else if ( rProperty == "IsAutomatic" )
    3593             :     {
    3594           0 :         if( rValue >>= mbManual )
    3595           0 :             return;
    3596             :     }
    3597           0 :     else if ( rProperty == "IsEndless" )
    3598             :     {
    3599           0 :         if( rValue >>= mbEndless )
    3600           0 :             return;
    3601             :     }
    3602           0 :     else if ( rProperty == "IsFullScreen" )
    3603             :     {
    3604           0 :         if( rValue >>= mbFullScreen )
    3605           0 :             return;
    3606             :     }
    3607           0 :     else if ( rProperty == "IsMouseVisible" )
    3608             :     {
    3609           0 :         if( rValue >>= mbMouseVisible )
    3610           0 :             return;
    3611             :     }
    3612           0 :     else if ( rProperty == "Pause" )
    3613             :     {
    3614           0 :         sal_Int32 nPause = -1;
    3615           0 :         if( (rValue >>= nPause) && (nPause >= 0) )
    3616             :         {
    3617           0 :             mnPauseTimeout = nPause;
    3618           0 :             return;
    3619             :         }
    3620             :     }
    3621           0 :     else if ( rProperty == "StartWithNavigator" )
    3622             :     {
    3623           0 :         if( rValue >>= mbStartWithNavigator )
    3624           0 :             return;
    3625             :     }
    3626           0 :     else if ( rProperty == "UsePen" )
    3627             :     {
    3628           0 :         if( rValue >>= mbMouseAsPen )
    3629           0 :             return;
    3630             :     }
    3631           0 :     throw IllegalArgumentException();
    3632             : }
    3633             : 
    3634             : 
    3635             : 
    3636             : 
    3637             : // XAnimationListener
    3638             : 
    3639             : 
    3640           0 : SlideShowListenerProxy::SlideShowListenerProxy( const rtl::Reference< SlideshowImpl >& xController, const css::uno::Reference< css::presentation::XSlideShow >& xSlideShow )
    3641             : : maListeners( m_aMutex )
    3642             : , mxController( xController )
    3643           0 : , mxSlideShow( xSlideShow )
    3644             : {
    3645           0 : }
    3646             : 
    3647             : 
    3648             : 
    3649           0 : SlideShowListenerProxy::~SlideShowListenerProxy()
    3650             : {
    3651           0 : }
    3652             : 
    3653             : 
    3654             : 
    3655           0 : void SlideShowListenerProxy::addAsSlideShowListener()
    3656             : {
    3657           0 :     if( mxSlideShow.is() )
    3658             :     {
    3659           0 :         Reference< XSlideShowListener > xSlideShowListener( this );
    3660           0 :         mxSlideShow->addSlideShowListener( xSlideShowListener );
    3661             :     }
    3662           0 : }
    3663             : 
    3664             : 
    3665             : 
    3666           0 : void SlideShowListenerProxy::removeAsSlideShowListener()
    3667             : {
    3668           0 :     if( mxSlideShow.is() )
    3669             :     {
    3670           0 :         Reference< XSlideShowListener > xSlideShowListener( this );
    3671           0 :         mxSlideShow->removeSlideShowListener( xSlideShowListener );
    3672             :     }
    3673           0 : }
    3674             : 
    3675             : 
    3676             : 
    3677           0 : void SlideShowListenerProxy::addShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
    3678             : {
    3679           0 :     if( mxSlideShow.is() )
    3680             :     {
    3681           0 :         Reference< XShapeEventListener > xListener( this );
    3682           0 :         mxSlideShow->addShapeEventListener( xListener, xShape );
    3683             :     }
    3684           0 : }
    3685             : 
    3686             : 
    3687             : 
    3688           0 : void SlideShowListenerProxy::removeShapeEventListener( const css::uno::Reference< css::drawing::XShape >& xShape )
    3689             : {
    3690           0 :     if( mxSlideShow.is() )
    3691             :     {
    3692           0 :         Reference< XShapeEventListener > xListener( this );
    3693           0 :         mxSlideShow->removeShapeEventListener( xListener, xShape );
    3694             :     }
    3695           0 : }
    3696             : 
    3697             : 
    3698             : 
    3699           0 : void SlideShowListenerProxy::addSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
    3700             : {
    3701           0 :     maListeners.addInterface(xListener);
    3702           0 : }
    3703             : 
    3704             : 
    3705             : 
    3706           0 : void SlideShowListenerProxy::removeSlideShowListener( const css::uno::Reference< css::presentation::XSlideShowListener >& xListener )
    3707             : {
    3708           0 :     maListeners.removeInterface(xListener);
    3709           0 : }
    3710             : 
    3711             : 
    3712             : 
    3713           0 : void SAL_CALL SlideShowListenerProxy::beginEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException, std::exception)
    3714             : {
    3715           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3716             : 
    3717           0 :     if( maListeners.getLength() >= 0 )
    3718           0 :         maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::beginEvent, _1,  boost::cref(xNode) ));
    3719           0 : }
    3720             : 
    3721             : 
    3722             : 
    3723           0 : void SAL_CALL SlideShowListenerProxy::endEvent( const Reference< XAnimationNode >& xNode ) throw (RuntimeException, std::exception)
    3724             : {
    3725           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3726             : 
    3727           0 :     if( maListeners.getLength() >= 0 )
    3728           0 :         maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::endEvent, _1, boost::cref(xNode) ));
    3729           0 : }
    3730             : 
    3731             : 
    3732             : 
    3733           0 : void SAL_CALL SlideShowListenerProxy::repeat( const Reference< XAnimationNode >& xNode, ::sal_Int32 nRepeat ) throw (RuntimeException, std::exception)
    3734             : {
    3735           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3736             : 
    3737           0 :     if( maListeners.getLength() >= 0 )
    3738           0 :         maListeners.forEach<XSlideShowListener>( boost::bind( &XAnimationListener::repeat, _1,  boost::cref(xNode), boost::cref(nRepeat) ));
    3739           0 : }
    3740             : 
    3741             : 
    3742             : // ::com::sun::star::presentation::XSlideShowListener:
    3743             : 
    3744             : 
    3745           0 : void SAL_CALL SlideShowListenerProxy::paused(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3746             : {
    3747           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3748             : 
    3749           0 :     if( maListeners.getLength() >= 0 )
    3750           0 :         maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::paused ) );
    3751           0 : }
    3752             : 
    3753             : 
    3754             : 
    3755           0 : void SAL_CALL SlideShowListenerProxy::resumed(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3756             : {
    3757           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3758             : 
    3759           0 :     if( maListeners.getLength() >= 0 )
    3760           0 :         maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::resumed ) );
    3761           0 : }
    3762             : 
    3763             : 
    3764             : 
    3765           0 : void SAL_CALL SlideShowListenerProxy::slideTransitionStarted( ) throw (RuntimeException, std::exception)
    3766             : {
    3767           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3768             : 
    3769           0 :     if( maListeners.getLength() >= 0 )
    3770           0 :         maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionStarted ) );
    3771           0 : }
    3772             : 
    3773             : 
    3774             : 
    3775           0 : void SAL_CALL SlideShowListenerProxy::slideTransitionEnded( ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3776             : {
    3777           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3778             : 
    3779           0 :     if( maListeners.getLength() >= 0 )
    3780           0 :         maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideTransitionEnded ) );
    3781           0 : }
    3782             : 
    3783             : 
    3784             : 
    3785           0 : void SAL_CALL SlideShowListenerProxy::slideAnimationsEnded(  ) throw (::com::sun::star::uno::RuntimeException, std::exception)
    3786             : {
    3787           0 :     ::osl::MutexGuard aGuard( m_aMutex );
    3788             : 
    3789           0 :     if( maListeners.getLength() >= 0 )
    3790           0 :         maListeners.forEach<XSlideShowListener>( boost::mem_fn( &XSlideShowListener::slideAnimationsEnded ) );
    3791           0 : }
    3792             : 
    3793             : 
    3794             : 
    3795           0 : void SlideShowListenerProxy::slideEnded(sal_Bool bReverse) throw (RuntimeException, std::exception)
    3796             : {
    3797             :     {
    3798           0 :         ::osl::MutexGuard aGuard( m_aMutex );
    3799             : 
    3800           0 :         if( maListeners.getLength() >= 0 )
    3801             :             maListeners.forEach<XSlideShowListener>(
    3802           0 :                 boost::bind( &XSlideShowListener::slideEnded, _1, bReverse) );
    3803             :     }
    3804             : 
    3805             :     {
    3806           0 :         SolarMutexGuard aSolarGuard;
    3807           0 :         if( mxController.is() )
    3808           0 :             mxController->slideEnded(bReverse);
    3809             :     }
    3810           0 : }
    3811             : 
    3812             : 
    3813             : 
    3814           0 : void SlideShowListenerProxy::hyperLinkClicked( OUString const& aHyperLink ) throw (RuntimeException, std::exception)
    3815             : {
    3816             :     {
    3817           0 :         ::osl::MutexGuard aGuard( m_aMutex );
    3818             : 
    3819           0 :         if( maListeners.getLength() >= 0 )
    3820           0 :             maListeners.forEach<XSlideShowListener>( boost::bind( &XSlideShowListener::hyperLinkClicked, _1, boost::cref(aHyperLink) ));
    3821             :     }
    3822             : 
    3823             :     {
    3824           0 :         SolarMutexGuard aSolarGuard;
    3825           0 :         if( mxController.is() )
    3826           0 :             mxController->hyperLinkClicked(aHyperLink);
    3827             :     }
    3828           0 : }
    3829             : 
    3830             : 
    3831             : // XEventListener
    3832             : 
    3833             : 
    3834           0 : void SAL_CALL SlideShowListenerProxy::disposing( const ::com::sun::star::lang::EventObject& aDisposeEvent ) throw (RuntimeException, std::exception)
    3835             : {
    3836           0 :     maListeners.disposeAndClear( aDisposeEvent );
    3837           0 :     mxController.clear();
    3838           0 :     mxSlideShow.clear();
    3839           0 : }
    3840             : 
    3841             : 
    3842             : // XShapeEventListener
    3843             : 
    3844             : 
    3845           0 : void SAL_CALL SlideShowListenerProxy::click( const Reference< XShape >& xShape, const ::com::sun::star::awt::MouseEvent& aOriginalEvent ) throw (RuntimeException, std::exception)
    3846             : {
    3847           0 :     SolarMutexGuard aSolarGuard;
    3848           0 :     if( mxController.is() )
    3849           0 :         mxController->click(xShape, aOriginalEvent );
    3850           0 : }
    3851             : 
    3852          48 : } // namespace ::sd
    3853             : 
    3854             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10