LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/tools - IdleDetection.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 36 0.0 %
Date: 2012-12-27 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : 
      21             : #include "tools/IdleDetection.hxx"
      22             : 
      23             : #include "ViewShell.hxx"
      24             : #include "slideshow.hxx"
      25             : #include "ViewShellBase.hxx"
      26             : 
      27             : #include <vcl/window.hxx>
      28             : #include <sfx2/viewfrm.hxx>
      29             : 
      30             : #include <com/sun/star/frame/XFrame.hpp>
      31             : #include <vcl/svapp.hxx>
      32             : 
      33             : using namespace ::com::sun::star;
      34             : 
      35             : namespace sd { namespace tools {
      36             : 
      37             : 
      38           0 : sal_Int32 IdleDetection::GetIdleState (const ::Window* pWindow)
      39             : {
      40           0 :     sal_Int32 nResult (CheckInputPending() | CheckSlideShowRunning());
      41           0 :     if (pWindow != NULL)
      42           0 :         nResult |= CheckWindowPainting(*pWindow);
      43           0 :     return nResult;
      44             : }
      45             : 
      46             : 
      47             : 
      48             : 
      49           0 : sal_Int32 IdleDetection::CheckInputPending (void)
      50             : {
      51           0 :     if (GetpApp()->AnyInput(VCL_INPUT_MOUSE | VCL_INPUT_KEYBOARD | VCL_INPUT_PAINT))
      52           0 :         return IDET_SYSTEM_EVENT_PENDING;
      53             :     else
      54           0 :         return IDET_IDLE;
      55             : }
      56             : 
      57             : 
      58             : 
      59             : 
      60           0 : sal_Int32 IdleDetection::CheckSlideShowRunning (void)
      61             : {
      62           0 :     sal_Int32 eResult (IDET_IDLE);
      63             : 
      64           0 :     bool bIsSlideShowShowing = false;
      65             : 
      66             :     // Iterate over all view frames.
      67           0 :     SfxViewFrame* pViewFrame = SfxViewFrame::GetFirst();
      68           0 :     for (pViewFrame = SfxViewFrame::GetFirst();
      69           0 :          pViewFrame!=NULL && !bIsSlideShowShowing;
      70             :          pViewFrame = SfxViewFrame::GetNext(*pViewFrame))
      71             :     {
      72             :         // Ignore the current frame when it does not exist, is not valid, or
      73             :         // is not active.
      74           0 :         bool bIgnoreFrame (true);
      75           0 :         uno::Reference<frame::XFrame> xFrame (pViewFrame->GetFrame().GetFrameInterface());
      76             :         try
      77             :         {
      78           0 :             if (xFrame.is() && xFrame->isActive())
      79           0 :                 bIgnoreFrame = false;
      80             :         }
      81           0 :         catch (const uno::RuntimeException&)
      82             :         {
      83             :         }
      84           0 :         if (bIgnoreFrame)
      85           0 :             continue;
      86             : 
      87             :         // Get sd::ViewShell from active frame.
      88           0 :         ViewShellBase* pBase = ViewShellBase::GetViewShellBase(pViewFrame);
      89           0 :         if (pBase != NULL)
      90             :         {
      91           0 :             rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( *pBase ) );
      92           0 :             if( xSlideShow.is() && xSlideShow->isRunning() )
      93             :             {
      94           0 :                 if (xSlideShow->isFullScreen())
      95           0 :                     eResult |= IDET_FULL_SCREEN_SHOW_ACTIVE;
      96             :                 else
      97           0 :                     eResult |= IDET_WINDOW_SHOW_ACTIVE;
      98           0 :             }
      99             :         }
     100           0 :     }
     101             : 
     102           0 :     return eResult;
     103             : }
     104             : 
     105             : 
     106             : 
     107             : 
     108           0 : sal_Int32 IdleDetection::CheckWindowPainting (const ::Window& rWindow)
     109             : {
     110           0 :     if (rWindow.IsInPaint())
     111           0 :         return IDET_WINDOW_PAINTING;
     112             :     else
     113           0 :         return IDET_IDLE;
     114             : }
     115             : 
     116             : } } // end of namespace ::sd::tools
     117             : 
     118             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10