LCOV - code coverage report
Current view: top level - sd/source/ui/slideshow - showwin.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 309 0.0 %
Date: 2012-08-25 Functions: 0 32 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 447 0.0 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include <com/sun/star/awt/Key.hpp>
      31                 :            : 
      32                 :            : #include "showwindow.hxx"
      33                 :            : 
      34                 :            : #include <unotools/syslocale.hxx>
      35                 :            : #include <sfx2/viewfrm.hxx>
      36                 :            : 
      37                 :            : 
      38                 :            : #include "res_bmp.hrc"
      39                 :            : #include "slideshow.hxx"
      40                 :            : #include "ViewShellBase.hxx"
      41                 :            : #include "sdresid.hxx"
      42                 :            : #include "helpids.h"
      43                 :            : #include "strings.hrc"
      44                 :            : #include <vcl/virdev.hxx>
      45                 :            : 
      46                 :            : using namespace ::com::sun::star;
      47                 :            : 
      48                 :            : namespace sd {
      49                 :            : 
      50                 :            : static const sal_uLong HIDE_MOUSE_TIMEOUT = 10000;
      51                 :            : static const sal_uLong SHOW_MOUSE_TIMEOUT = 1000;
      52                 :            : 
      53                 :            : // =============================================================================
      54                 :            : 
      55                 :          0 : ShowWindow::ShowWindow( const ::rtl::Reference< SlideshowImpl >& xController, ::Window* pParent )
      56                 :            : : ::sd::Window( pParent )
      57                 :            : , mnPauseTimeout( SLIDE_NO_TIMEOUT )
      58                 :            : , mnRestartPageIndex( PAGE_NO_END )
      59                 :            : , meShowWindowMode(SHOWWINDOWMODE_NORMAL)
      60                 :            : , mbShowNavigatorAfterSpecialMode( false )
      61                 :            : , mbMouseAutoHide(true)
      62                 :            : , mbMouseCursorHidden(false)
      63                 :            : , mnFirstMouseMove(0)
      64 [ #  # ][ #  # ]:          0 : , mxController( xController )
         [ #  # ][ #  # ]
                 [ #  # ]
      65                 :            : {
      66                 :          0 :     SetOutDevViewType( OUTDEV_VIEWTYPE_SLIDESHOW );
      67                 :            : 
      68                 :            :     // Do never mirror the preview window.  This explicitly includes right
      69                 :            :     // to left writing environments.
      70         [ #  # ]:          0 :     EnableRTL (sal_False);
      71                 :            : 
      72         [ #  # ]:          0 :     MapMode aMap(GetMapMode());
      73         [ #  # ]:          0 :     aMap.SetMapUnit(MAP_100TH_MM);
      74         [ #  # ]:          0 :     SetMapMode(aMap);
      75                 :            : 
      76                 :            :     // HelpId setzen
      77         [ #  # ]:          0 :     SetHelpId( HID_SD_WIN_PRESENTATION );
      78         [ #  # ]:          0 :     SetUniqueId( HID_SD_WIN_PRESENTATION );
      79                 :            : 
      80         [ #  # ]:          0 :     maPauseTimer.SetTimeoutHdl( LINK( this, ShowWindow, PauseTimeoutHdl ) );
      81         [ #  # ]:          0 :     maPauseTimer.SetTimeout( 1000 );
      82         [ #  # ]:          0 :     maMouseTimer.SetTimeoutHdl( LINK( this, ShowWindow, MouseTimeoutHdl ) );
      83         [ #  # ]:          0 :     maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
      84                 :            : 
      85 [ #  # ][ #  # ]:          0 :     maShowBackground = Wallpaper( Color( COL_BLACK ) );
                 [ #  # ]
      86         [ #  # ]:          0 :     SetBackground(); // avoids that VCL paints any background!
      87 [ #  # ][ #  # ]:          0 :     GetParent()->Show();
      88 [ #  # ][ #  # ]:          0 :     AddEventListener( LINK( this, ShowWindow, EventHdl ) );
                 [ #  # ]
      89                 :          0 : }
      90                 :            : 
      91 [ #  # ][ #  # ]:          0 : ShowWindow::~ShowWindow(void)
         [ #  # ][ #  # ]
      92                 :            : {
      93         [ #  # ]:          0 :     maPauseTimer.Stop();
      94         [ #  # ]:          0 :     maMouseTimer.Stop();
      95         [ #  # ]:          0 : }
      96                 :            : 
      97                 :            : /*************************************************************************
      98                 :            : |*
      99                 :            : |* Keyboard event
     100                 :            : |*
     101                 :            : \************************************************************************/
     102                 :            : 
     103                 :          0 : void ShowWindow::KeyInput(const KeyEvent& rKEvt)
     104                 :            : {
     105                 :          0 :     bool bReturn = false;
     106                 :            : 
     107         [ #  # ]:          0 :     if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
     108                 :            :     {
     109                 :          0 :         TerminateShow();
     110                 :          0 :         bReturn = true;
     111                 :            :     }
     112         [ #  # ]:          0 :     else if( SHOWWINDOWMODE_END == meShowWindowMode )
     113                 :            :     {
     114                 :          0 :         const int nKeyCode = rKEvt.GetKeyCode().GetCode();
     115         [ #  # ]:          0 :         switch( nKeyCode )
     116                 :            :         {
     117                 :            :         case KEY_PAGEUP:
     118                 :            :         case KEY_LEFT:
     119                 :            :         case KEY_UP:
     120                 :            :         case KEY_P:
     121                 :            :         case KEY_HOME:
     122                 :            :         case KEY_END:
     123                 :            :         case awt::Key::CONTEXTMENU:
     124                 :            :             // these keys will be handled by the slide show even
     125                 :            :             // while in end mode
     126                 :          0 :             break;
     127                 :            :         default:
     128                 :          0 :             TerminateShow();
     129                 :          0 :             bReturn = true;
     130                 :            :         }
     131                 :            :     }
     132         [ #  # ]:          0 :     else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
     133                 :            :     {
     134                 :          0 :         RestartShow();
     135                 :          0 :         bReturn = true;
     136                 :            :     }
     137         [ #  # ]:          0 :     else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
     138                 :            :     {
     139                 :          0 :         const int nKeyCode = rKEvt.GetKeyCode().GetCode();
     140      [ #  #  # ]:          0 :         switch( nKeyCode )
     141                 :            :         {
     142                 :            :         case KEY_ESCAPE:
     143                 :          0 :             TerminateShow();
     144                 :          0 :             bReturn = true;
     145                 :          0 :             break;
     146                 :            :         case KEY_PAGEUP:
     147                 :            :         case KEY_RIGHT:
     148                 :            :         case KEY_UP:
     149                 :            :         case KEY_P:
     150                 :            :         case KEY_HOME:
     151                 :            :         case KEY_END:
     152                 :            :         case awt::Key::CONTEXTMENU:
     153                 :            :             // these keys will be handled by the slide show even
     154                 :            :             // while in end mode
     155                 :          0 :             break;
     156                 :            :         default:
     157                 :          0 :             RestartShow();
     158                 :          0 :             bReturn = true;
     159                 :          0 :             break;
     160                 :            :         }
     161                 :            :     }
     162                 :            : 
     163         [ #  # ]:          0 :     if( !bReturn )
     164                 :            :     {
     165         [ #  # ]:          0 :         if( mxController.is() )
     166                 :          0 :             bReturn = mxController->keyInput(rKEvt);
     167                 :            : 
     168         [ #  # ]:          0 :         if( !bReturn )
     169                 :            :         {
     170         [ #  # ]:          0 :             if( mpViewShell )
     171                 :            :             {
     172                 :          0 :                 mpViewShell->KeyInput(rKEvt,this);
     173                 :            :             }
     174                 :            :             else
     175                 :            :             {
     176                 :          0 :                 Window::KeyInput(rKEvt);
     177                 :            :             }
     178                 :            :         }
     179                 :            :     }
     180                 :            : 
     181         [ #  # ]:          0 :     if( mpViewShell )
     182                 :          0 :         mpViewShell->SetActiveWindow( this );
     183                 :          0 : }
     184                 :            : 
     185                 :            : /*************************************************************************
     186                 :            : |*
     187                 :            : |* MouseButtonDown event
     188                 :            : |*
     189                 :            : \************************************************************************/
     190                 :            : 
     191                 :          0 : void ShowWindow::MouseButtonDown(const MouseEvent& /*rMEvt*/)
     192                 :            : {
     193         [ #  # ]:          0 :     if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
     194                 :            :     {
     195                 :          0 :         TerminateShow();
     196                 :            :     }
     197         [ #  # ]:          0 :     else if( mpViewShell )
     198                 :            :     {
     199                 :          0 :         mpViewShell->SetActiveWindow( this );
     200                 :            :     }
     201                 :          0 : }
     202                 :            : 
     203                 :            : /*************************************************************************
     204                 :            : |*
     205                 :            : |* MouseMove event
     206                 :            : |*
     207                 :            : \************************************************************************/
     208                 :            : 
     209                 :          0 : void ShowWindow::MouseMove(const MouseEvent& /*rMEvt*/)
     210                 :            : {
     211         [ #  # ]:          0 :     if( mbMouseAutoHide )
     212                 :            :     {
     213         [ #  # ]:          0 :         if( mbMouseCursorHidden )
     214                 :            :         {
     215         [ #  # ]:          0 :             if( mnFirstMouseMove )
     216                 :            :             {
     217                 :            :                 // if this is not the first mouse move while hidden, see if
     218                 :            :                 // enough time has pasted to show mouse pointer again
     219                 :          0 :                 sal_uLong nTime = Time::GetSystemTicks();
     220         [ #  # ]:          0 :                 if( (nTime - mnFirstMouseMove) >= SHOW_MOUSE_TIMEOUT )
     221                 :            :                 {
     222                 :          0 :                     ShowPointer( sal_True );
     223                 :          0 :                     mnFirstMouseMove = 0;
     224                 :          0 :                     mbMouseCursorHidden = false;
     225                 :          0 :                     maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
     226                 :          0 :                     maMouseTimer.Start();
     227                 :            :                 }
     228                 :            :             }
     229                 :            :             else
     230                 :            :             {
     231                 :            :                 // if this is the first mouse move, note current
     232                 :            :                 // time and start idle timer to cancel show mouse pointer
     233                 :            :                 // again if not enough mouse movement is measured
     234                 :          0 :                 mnFirstMouseMove = Time::GetSystemTicks();
     235                 :          0 :                 maMouseTimer.SetTimeout( 2*SHOW_MOUSE_TIMEOUT );
     236                 :          0 :                 maMouseTimer.Start();
     237                 :            :             }
     238                 :            :         }
     239                 :            :         else
     240                 :            :         {
     241                 :            :             // current mousemove restarts the idle timer to hide the mouse
     242                 :          0 :             maMouseTimer.Start();
     243                 :            :         }
     244                 :            :     }
     245                 :            : 
     246         [ #  # ]:          0 :     if( mpViewShell )
     247                 :          0 :         mpViewShell->SetActiveWindow( this );
     248                 :          0 : }
     249                 :            : 
     250                 :            : /*************************************************************************
     251                 :            : |*
     252                 :            : |* MouseButtonUp event
     253                 :            : |*
     254                 :            : \************************************************************************/
     255                 :            : 
     256                 :          0 : void ShowWindow::MouseButtonUp(const MouseEvent& rMEvt)
     257                 :            : {
     258         [ #  # ]:          0 :     if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode )
     259                 :            :     {
     260                 :          0 :         TerminateShow();
     261                 :            :     }
     262 [ #  # ][ #  # ]:          0 :     else if( (SHOWWINDOWMODE_END == meShowWindowMode) && !rMEvt.IsRight() )
                 [ #  # ]
     263                 :            :     {
     264                 :          0 :         TerminateShow();
     265                 :            :     }
     266         [ #  # ]:          0 :     else if( (( SHOWWINDOWMODE_BLANK == meShowWindowMode ) || ( SHOWWINDOWMODE_PAUSE == meShowWindowMode ))
           [ #  #  #  # ]
                 [ #  # ]
     267                 :          0 :              && !rMEvt.IsRight() )
     268                 :            :     {
     269                 :          0 :         RestartShow();
     270                 :            :     }
     271                 :            :     else
     272                 :            :     {
     273         [ #  # ]:          0 :         if( mxController.is() )
     274                 :          0 :             mxController->mouseButtonUp( rMEvt );
     275                 :            :     }
     276                 :          0 : }
     277                 :            : 
     278                 :            : /*************************************************************************
     279                 :            : |*
     280                 :            : |* Paint-Event: wenn FuSlideShow noch erreichbar ist, weiterleiten
     281                 :            : |*
     282                 :            : \************************************************************************/
     283                 :            : 
     284                 :          0 : void ShowWindow::Paint(const Rectangle& rRect)
     285                 :            : {
     286 [ #  # ][ #  # ]:          0 :     if( (meShowWindowMode == SHOWWINDOWMODE_NORMAL) || (meShowWindowMode == SHOWWINDOWMODE_PREVIEW) )
     287                 :            :     {
     288         [ #  # ]:          0 :         if( mxController.is() )
     289                 :            :         {
     290                 :          0 :             mxController->paint(rRect);
     291                 :            :         }
     292         [ #  # ]:          0 :         else if(mpViewShell )
     293                 :            :         {
     294                 :          0 :             mpViewShell->Paint(rRect, this);
     295                 :            :         }
     296                 :            :     }
     297                 :            :     else
     298                 :            :     {
     299                 :          0 :         DrawWallpaper( rRect, maShowBackground );
     300                 :            : 
     301         [ #  # ]:          0 :         if( SHOWWINDOWMODE_END == meShowWindowMode )
     302                 :            :         {
     303                 :          0 :             DrawEndScene();
     304                 :            :         }
     305         [ #  # ]:          0 :         else if( SHOWWINDOWMODE_PAUSE == meShowWindowMode )
     306                 :            :         {
     307                 :          0 :             DrawPauseScene( false );
     308                 :            :         }
     309         [ #  # ]:          0 :         else if( SHOWWINDOWMODE_BLANK == meShowWindowMode )
     310                 :            :         {
     311                 :          0 :             DrawBlankScene();
     312                 :            :         }
     313                 :            :     }
     314                 :          0 : }
     315                 :            : 
     316                 :            : /*************************************************************************
     317                 :            : |*
     318                 :            : |* Notify
     319                 :            : |*
     320                 :            : \************************************************************************/
     321                 :            : 
     322                 :          0 : long ShowWindow::Notify(NotifyEvent& rNEvt)
     323                 :            : {
     324                 :          0 :     long nOK = sal_False;
     325         [ #  # ]:          0 :     if (!nOK)
     326                 :          0 :         nOK = Window::Notify(rNEvt);
     327                 :            : 
     328                 :          0 :     return nOK;
     329                 :            : }
     330                 :            : 
     331                 :            : 
     332                 :            : // -----------------------------------------------------------------------------
     333                 :            : 
     334                 :          0 : void ShowWindow::GetFocus()
     335                 :            : {
     336                 :            :     // Basisklasse
     337                 :          0 :     Window::GetFocus();
     338                 :          0 : }
     339                 :            : 
     340                 :            : // -----------------------------------------------------------------------------
     341                 :            : 
     342                 :          0 : void ShowWindow::LoseFocus()
     343                 :            : {
     344                 :          0 :     Window::LoseFocus();
     345                 :            : 
     346         [ #  # ]:          0 :     if( SHOWWINDOWMODE_PREVIEW == meShowWindowMode)
     347                 :          0 :         TerminateShow();
     348                 :          0 : }
     349                 :            : 
     350                 :            : // -----------------------------------------------------------------------------
     351                 :            : 
     352                 :          0 : void ShowWindow::Resize()
     353                 :            : {
     354                 :          0 :     ::sd::Window::Resize();
     355                 :          0 : }
     356                 :            : 
     357                 :            : // -----------------------------------------------------------------------------
     358                 :            : 
     359                 :          0 : void ShowWindow::Move()
     360                 :            : {
     361                 :          0 :     ::sd::Window::Move();
     362                 :          0 : }
     363                 :            : 
     364                 :            : // -----------------------------------------------------------------------------
     365                 :            : 
     366                 :          0 : bool ShowWindow::SetEndMode()
     367                 :            : {
     368 [ #  # ][ #  # ]:          0 :     if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
         [ #  # ][ #  # ]
     369                 :            :     {
     370                 :          0 :         DeleteWindowFromPaintView();
     371                 :          0 :         meShowWindowMode = SHOWWINDOWMODE_END;
     372 [ #  # ][ #  # ]:          0 :         maShowBackground = Wallpaper( Color( COL_BLACK ) );
                 [ #  # ]
     373                 :            : 
     374                 :            :         // hide navigator if it is visible
     375         [ #  # ]:          0 :         if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
     376                 :            :         {
     377                 :          0 :             mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
     378                 :          0 :             mbShowNavigatorAfterSpecialMode = true;
     379                 :            :         }
     380                 :            : 
     381                 :          0 :         Invalidate();
     382                 :            :     }
     383                 :            : 
     384                 :          0 :     return( SHOWWINDOWMODE_END == meShowWindowMode );
     385                 :            : }
     386                 :            : 
     387                 :            : // -----------------------------------------------------------------------------
     388                 :            : 
     389                 :          0 : bool ShowWindow::SetPauseMode( sal_Int32 nPageIndexToRestart, sal_Int32 nTimeout, Graphic* pLogo )
     390                 :            : {
     391                 :          0 :     rtl::Reference< SlideShow > xSlideShow;
     392                 :            : 
     393         [ #  # ]:          0 :     if( mpViewShell )
     394 [ #  # ][ #  # ]:          0 :         xSlideShow = SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() );
                 [ #  # ]
     395                 :            : 
     396 [ #  # ][ #  # ]:          0 :     if( xSlideShow.is() && !nTimeout )
                 [ #  # ]
     397                 :            :     {
     398         [ #  # ]:          0 :         xSlideShow->jumpToPageIndex( nPageIndexToRestart );
     399                 :            :     }
     400 [ #  # ][ #  # ]:          0 :     else if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
         [ #  # ][ #  # ]
     401                 :            :     {
     402         [ #  # ]:          0 :         DeleteWindowFromPaintView();
     403                 :          0 :         mnPauseTimeout = nTimeout;
     404                 :          0 :         mnRestartPageIndex = nPageIndexToRestart;
     405                 :          0 :         meShowWindowMode = SHOWWINDOWMODE_PAUSE;
     406 [ #  # ][ #  # ]:          0 :         maShowBackground = Wallpaper( Color( COL_BLACK ) );
                 [ #  # ]
     407                 :            : 
     408                 :            :         // hide navigator if it is visible
     409 [ #  # ][ #  # ]:          0 :         if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
                 [ #  # ]
     410                 :            :         {
     411 [ #  # ][ #  # ]:          0 :             mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
     412                 :          0 :             mbShowNavigatorAfterSpecialMode = true;
     413                 :            :         }
     414                 :            : 
     415         [ #  # ]:          0 :         if( pLogo )
     416         [ #  # ]:          0 :             maLogo = *pLogo;
     417                 :            : 
     418         [ #  # ]:          0 :         Invalidate();
     419                 :            : 
     420         [ #  # ]:          0 :         if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
     421         [ #  # ]:          0 :             maPauseTimer.Start();
     422                 :            :     }
     423                 :            : 
     424                 :          0 :     return( SHOWWINDOWMODE_PAUSE == meShowWindowMode );
     425                 :            : }
     426                 :            : 
     427                 :            : // -----------------------------------------------------------------------------
     428                 :            : 
     429                 :          0 : bool ShowWindow::SetBlankMode( sal_Int32 nPageIndexToRestart, const Color& rBlankColor )
     430                 :            : {
     431 [ #  # ][ #  # ]:          0 :     if( ( SHOWWINDOWMODE_NORMAL == meShowWindowMode ) && mpViewShell && mpViewShell->GetView() )
         [ #  # ][ #  # ]
     432                 :            :     {
     433                 :          0 :         DeleteWindowFromPaintView();
     434                 :          0 :         mnRestartPageIndex = nPageIndexToRestart;
     435                 :          0 :         meShowWindowMode = SHOWWINDOWMODE_BLANK;
     436         [ #  # ]:          0 :         maShowBackground = Wallpaper( rBlankColor );
     437                 :            : 
     438                 :            :         // hide navigator if it is visible
     439         [ #  # ]:          0 :         if( mpViewShell->GetViewFrame()->GetChildWindow( SID_NAVIGATOR ) )
     440                 :            :         {
     441                 :          0 :             mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_False );
     442                 :          0 :             mbShowNavigatorAfterSpecialMode = true;
     443                 :            :         }
     444                 :            : 
     445                 :          0 :         Invalidate();
     446                 :            :     }
     447                 :            : 
     448                 :          0 :     return( SHOWWINDOWMODE_BLANK == meShowWindowMode );
     449                 :            : }
     450                 :            : 
     451                 :            : // -----------------------------------------------------------------------------
     452                 :            : 
     453                 :          0 : void ShowWindow::SetPreviewMode()
     454                 :            : {
     455                 :          0 :     meShowWindowMode = SHOWWINDOWMODE_PREVIEW;
     456                 :          0 : }
     457                 :            : 
     458                 :            : // -----------------------------------------------------------------------------
     459                 :            : 
     460                 :          0 : void ShowWindow::TerminateShow()
     461                 :            : {
     462                 :          0 :     maLogo.Clear();
     463                 :          0 :     maPauseTimer.Stop();
     464                 :          0 :     maMouseTimer.Stop();
     465                 :          0 :     Erase();
     466 [ #  # ][ #  # ]:          0 :     maShowBackground = Wallpaper( Color( COL_BLACK ) );
                 [ #  # ]
     467                 :          0 :     meShowWindowMode = SHOWWINDOWMODE_NORMAL;
     468                 :          0 :     mnPauseTimeout = SLIDE_NO_TIMEOUT;
     469                 :            : 
     470         [ #  # ]:          0 :     if( mpViewShell )
     471                 :            :     {
     472                 :            :         // show navigator?
     473         [ #  # ]:          0 :         if( mbShowNavigatorAfterSpecialMode )
     474                 :            :         {
     475                 :          0 :             mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
     476                 :          0 :             mbShowNavigatorAfterSpecialMode = false;
     477                 :            :         }
     478                 :            :     }
     479                 :            : 
     480         [ #  # ]:          0 :     if( mxController.is() )
     481                 :          0 :         mxController->endPresentation();
     482                 :            : 
     483                 :          0 :     mnRestartPageIndex = PAGE_NO_END;
     484                 :          0 : }
     485                 :            : 
     486                 :            : // -----------------------------------------------------------------------------
     487                 :            : 
     488                 :          0 : void ShowWindow::RestartShow()
     489                 :            : {
     490                 :          0 :     RestartShow( mnRestartPageIndex );
     491                 :          0 : }
     492                 :            : 
     493                 :            : // -----------------------------------------------------------------------------
     494                 :            : 
     495                 :          0 : void ShowWindow::RestartShow( sal_Int32 nPageIndexToRestart )
     496                 :            : 
     497                 :            : {
     498                 :          0 :     ShowWindowMode eOldShowWindowMode = meShowWindowMode;
     499                 :            : 
     500                 :          0 :     maLogo.Clear();
     501                 :          0 :     maPauseTimer.Stop();
     502                 :          0 :     Erase();
     503 [ #  # ][ #  # ]:          0 :     maShowBackground = Wallpaper( Color( COL_BLACK ) );
                 [ #  # ]
     504                 :          0 :     meShowWindowMode = SHOWWINDOWMODE_NORMAL;
     505                 :          0 :     mnPauseTimeout = SLIDE_NO_TIMEOUT;
     506                 :            : 
     507         [ #  # ]:          0 :     if( mpViewShell )
     508                 :            :     {
     509 [ #  # ][ #  # ]:          0 :         rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( mpViewShell->GetViewShellBase() ) );
     510                 :            : 
     511         [ #  # ]:          0 :          if( xSlideShow.is() )
     512                 :            :         {
     513         [ #  # ]:          0 :             AddWindowToPaintView();
     514                 :            : 
     515         [ #  # ]:          0 :             if( SHOWWINDOWMODE_BLANK == eOldShowWindowMode )
     516                 :            :             {
     517         [ #  # ]:          0 :                 xSlideShow->pause(false);
     518         [ #  # ]:          0 :                 Invalidate();
     519                 :            :             }
     520                 :            :             else
     521                 :            :             {
     522         [ #  # ]:          0 :                 xSlideShow->jumpToPageIndex( nPageIndexToRestart );
     523                 :            :             }
     524                 :          0 :         }
     525                 :            :     }
     526                 :            : 
     527                 :          0 :     mnRestartPageIndex = PAGE_NO_END;
     528                 :            : 
     529                 :            :     // show navigator?
     530         [ #  # ]:          0 :     if( mbShowNavigatorAfterSpecialMode )
     531                 :            :     {
     532                 :          0 :         mpViewShell->GetViewFrame()->ShowChildWindow( SID_NAVIGATOR, sal_True );
     533                 :          0 :         mbShowNavigatorAfterSpecialMode = false;
     534                 :            :     }
     535                 :          0 : }
     536                 :            : 
     537                 :            : // -----------------------------------------------------------------------------
     538                 :            : 
     539                 :          0 : void ShowWindow::DrawPauseScene( bool bTimeoutOnly )
     540                 :            : {
     541                 :          0 :     const MapMode&  rMap = GetMapMode();
     542         [ #  # ]:          0 :     const Point     aOutOrg( PixelToLogic( Point() ) );
     543         [ #  # ]:          0 :     const Size      aOutSize( GetOutputSize() );
     544 [ #  # ][ #  # ]:          0 :     const Size      aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, rMap ) );
                 [ #  # ]
     545 [ #  # ][ #  # ]:          0 :     const Size      aOffset( LogicToLogic( Size( 1000, 1000 ), MAP_100TH_MM, rMap ) );
                 [ #  # ]
     546 [ #  # ][ #  # ]:          0 :     String          aText( SdResId( STR_PRES_PAUSE ) );
     547                 :          0 :     bool            bDrawn = false;
     548                 :            : 
     549         [ #  # ]:          0 :     Font            aFont( GetSettings().GetStyleSettings().GetMenuFont() );
     550         [ #  # ]:          0 :     const Font      aOldFont( GetFont() );
     551                 :            : 
     552         [ #  # ]:          0 :     aFont.SetSize( aTextSize );
     553         [ #  # ]:          0 :     aFont.SetColor( COL_WHITE );
     554 [ #  # ][ #  # ]:          0 :     aFont.SetCharSet( aOldFont.GetCharSet() );
     555 [ #  # ][ #  # ]:          0 :     aFont.SetLanguage( aOldFont.GetLanguage() );
     556                 :            : 
     557 [ #  # ][ #  # ]:          0 :     if( !bTimeoutOnly && ( maLogo.GetType() != GRAPHIC_NONE ) )
         [ #  # ][ #  # ]
     558                 :            :     {
     559                 :          0 :         Size aGrfSize;
     560                 :            : 
     561 [ #  # ][ #  # ]:          0 :         if( maLogo.GetPrefMapMode() == MAP_PIXEL )
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     562 [ #  # ][ #  # ]:          0 :             aGrfSize = PixelToLogic( maLogo.GetPrefSize() );
     563                 :            :         else
     564 [ #  # ][ #  # ]:          0 :             aGrfSize = LogicToLogic( maLogo.GetPrefSize(), maLogo.GetPrefMapMode(), rMap );
         [ #  # ][ #  # ]
     565                 :            : 
     566                 :          0 :         const Point aGrfPos( Max( aOutOrg.X() + aOutSize.Width() - aGrfSize.Width() - aOffset.Width(), aOutOrg.X() ),
     567                 :          0 :                              Max( aOutOrg.Y() + aOutSize.Height() - aGrfSize.Height() - aOffset.Height(), aOutOrg.Y() ) );
     568                 :            : 
     569 [ #  # ][ #  # ]:          0 :         if( maLogo.IsAnimated() )
     570         [ #  # ]:          0 :             maLogo.StartAnimation( this, aGrfPos, aGrfSize, (long) this );
     571                 :            :         else
     572         [ #  # ]:          0 :             maLogo.Draw( this, aGrfPos, aGrfSize );
     573                 :            :     }
     574                 :            : 
     575         [ #  # ]:          0 :     if( SLIDE_NO_TIMEOUT != mnPauseTimeout )
     576                 :            :     {
     577         [ #  # ]:          0 :         MapMode         aVMap( rMap );
     578         [ #  # ]:          0 :         VirtualDevice   aVDev( *this );
     579                 :            : 
     580         [ #  # ]:          0 :         aVMap.SetOrigin( Point() );
     581         [ #  # ]:          0 :         aVDev.SetMapMode( aVMap );
     582 [ #  # ][ #  # ]:          0 :         aVDev.SetBackground( Wallpaper( Color( COL_BLACK ) ) );
                 [ #  # ]
     583                 :            : 
     584                 :            :         // set font first, to determine real output height
     585         [ #  # ]:          0 :         aVDev.SetFont( aFont );
     586                 :            : 
     587         [ #  # ]:          0 :         const Size aVDevSize( aOutSize.Width(), aVDev.GetTextHeight() );
     588                 :            : 
     589 [ #  # ][ #  # ]:          0 :         if( aVDev.SetOutputSize( aVDevSize ) )
     590                 :            :         {
     591                 :            :             // Note: if performance gets an issue here, we can use NumberFormatter directly
     592         [ #  # ]:          0 :             SvtSysLocale                aSysLocale;
     593         [ #  # ]:          0 :             const LocaleDataWrapper&    aLocaleData = aSysLocale.GetLocaleData();
     594                 :            : 
     595         [ #  # ]:          0 :             aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " ( " ));
     596 [ #  # ][ #  # ]:          0 :             aText += aLocaleData.getDuration( Time( 0, 0, mnPauseTimeout ) );
                 [ #  # ]
     597         [ #  # ]:          0 :             aText.AppendAscii( RTL_CONSTASCII_STRINGPARAM( " )" ));
     598         [ #  # ]:          0 :             aVDev.DrawText( Point( aOffset.Width(), 0 ), aText );
     599         [ #  # ]:          0 :             DrawOutDev( Point( aOutOrg.X(), aOffset.Height() ), aVDevSize, Point(), aVDevSize, aVDev );
     600         [ #  # ]:          0 :             bDrawn = true;
     601 [ #  # ][ #  # ]:          0 :         }
     602                 :            :     }
     603                 :            : 
     604         [ #  # ]:          0 :     if( !bDrawn )
     605                 :            :     {
     606         [ #  # ]:          0 :         SetFont( aFont );
     607         [ #  # ]:          0 :         DrawText( Point( aOutOrg.X() + aOffset.Width(), aOutOrg.Y() + aOffset.Height() ), aText );
     608         [ #  # ]:          0 :         SetFont( aOldFont );
     609 [ #  # ][ #  # ]:          0 :     }
                 [ #  # ]
     610                 :          0 : }
     611                 :            : 
     612                 :            : // -----------------------------------------------------------------------------
     613                 :            : 
     614                 :          0 : void ShowWindow::DrawEndScene()
     615                 :            : {
     616         [ #  # ]:          0 :     const Font      aOldFont( GetFont() );
     617         [ #  # ]:          0 :     Font            aFont( GetSettings().GetStyleSettings().GetMenuFont() );
     618                 :            : 
     619         [ #  # ]:          0 :     const Point     aOutOrg( PixelToLogic( Point() ) );
     620 [ #  # ][ #  # ]:          0 :     const Size      aTextSize( LogicToLogic( Size( 0, 14 ), MAP_POINT, GetMapMode() ) );
                 [ #  # ]
     621 [ #  # ][ #  # ]:          0 :     const String    aText( SdResId( STR_PRES_SOFTEND ) );
     622                 :            : 
     623         [ #  # ]:          0 :     aFont.SetSize( aTextSize );
     624         [ #  # ]:          0 :     aFont.SetColor( COL_WHITE );
     625 [ #  # ][ #  # ]:          0 :     aFont.SetCharSet( aOldFont.GetCharSet() );
     626 [ #  # ][ #  # ]:          0 :     aFont.SetLanguage( aOldFont.GetLanguage() );
     627         [ #  # ]:          0 :     SetFont( aFont );
     628         [ #  # ]:          0 :     DrawText( Point( aOutOrg.X() + aTextSize.Height(), aOutOrg.Y() + aTextSize.Height() ), aText );
     629 [ #  # ][ #  # ]:          0 :     SetFont( aOldFont );
         [ #  # ][ #  # ]
     630                 :          0 : }
     631                 :            : 
     632                 :            : // -----------------------------------------------------------------------------
     633                 :            : 
     634                 :          0 : void ShowWindow::DrawBlankScene()
     635                 :            : {
     636                 :            :     // just blank through background color => nothing to be done here
     637                 :          0 : }
     638                 :            : 
     639                 :            : // -----------------------------------------------------------------------------
     640                 :            : 
     641                 :          0 : IMPL_LINK( ShowWindow, PauseTimeoutHdl, Timer*, pTimer )
     642                 :            : {
     643         [ #  # ]:          0 :     if( !( --mnPauseTimeout ) )
     644                 :          0 :         RestartShow();
     645                 :            :     else
     646                 :            :     {
     647                 :          0 :         DrawPauseScene( true );
     648                 :          0 :         pTimer->Start();
     649                 :            :     }
     650                 :            : 
     651                 :          0 :     return 0L;
     652                 :            : }
     653                 :            : 
     654                 :          0 : IMPL_LINK_NOARG(ShowWindow, MouseTimeoutHdl)
     655                 :            : {
     656         [ #  # ]:          0 :     if( mbMouseCursorHidden )
     657                 :            :     {
     658                 :            :         // not enough mouse movements since first recording so
     659                 :            :         // cancle show mouse pointer for now
     660                 :          0 :         mnFirstMouseMove = 0;
     661                 :            :     }
     662                 :            :     else
     663                 :            :     {
     664                 :            :         // mouse has been idle to long, hide pointer
     665                 :          0 :         ShowPointer( sal_False );
     666                 :          0 :         mbMouseCursorHidden = true;
     667                 :            :     }
     668                 :          0 :     return 0L;
     669                 :            : }
     670                 :            : 
     671                 :          0 : IMPL_LINK( ShowWindow, EventHdl, VclWindowEvent*, pEvent )
     672                 :            : {
     673         [ #  # ]:          0 :     if( mbMouseAutoHide )
     674                 :            :     {
     675         [ #  # ]:          0 :         if (pEvent->GetId() == VCLEVENT_WINDOW_SHOW)
     676                 :            :         {
     677                 :          0 :             maMouseTimer.SetTimeout( HIDE_MOUSE_TIMEOUT );
     678                 :          0 :             maMouseTimer.Start();
     679                 :            :         }
     680                 :            :     }
     681                 :          0 :     return 0L;
     682                 :            : }
     683                 :            : 
     684                 :          0 : void ShowWindow::SetPresentationArea( const Rectangle& rPresArea )
     685                 :            : {
     686                 :          0 :     maPresArea = rPresArea;
     687                 :          0 : }
     688                 :            : 
     689                 :          0 : void ShowWindow::DeleteWindowFromPaintView()
     690                 :            : {
     691         [ #  # ]:          0 :     if( mpViewShell->GetView() )
     692                 :          0 :         mpViewShell->GetView()->DeleteWindowFromPaintView( this );
     693                 :            : 
     694                 :          0 :     sal_uInt16 nChild = GetChildCount();
     695         [ #  # ]:          0 :     while( nChild-- )
     696                 :          0 :         GetChild( nChild )->Show( sal_False );
     697                 :          0 : }
     698                 :            : 
     699                 :          0 : void ShowWindow::AddWindowToPaintView()
     700                 :            : {
     701         [ #  # ]:          0 :     if( mpViewShell->GetView() )
     702                 :          0 :         mpViewShell->GetView()->AddWindowToPaintView( this );
     703                 :            : 
     704                 :          0 :     sal_uInt16 nChild = GetChildCount();
     705         [ #  # ]:          0 :     while( nChild-- )
     706                 :          0 :         GetChild( nChild )->Show( sal_True );
     707                 :          0 : }
     708                 :            : 
     709                 :            : } // end of namespace sd
     710                 :            : 
     711                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10