LCOV - code coverage report
Current view: top level - libreoffice/sd/source/ui/remotecontrol - Receiver.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 41 0.0 %
Date: 2012-12-27 Functions: 0 3 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             : #include "Receiver.hxx"
      10             : #include <string.h>
      11             : #include <com/sun/star/presentation/XSlideShowController.hpp>
      12             : #include <com/sun/star/presentation/XPresentationSupplier.hpp>
      13             : #include <com/sun/star/presentation/XPresentation2.hpp>
      14             : #include <com/sun/star/frame/Desktop.hpp>
      15             : #include <com/sun/star/frame/XFramesSupplier.hpp>
      16             : #include <com/sun/star/uno/RuntimeException.hpp>
      17             : 
      18             : 
      19             : #include <comphelper/processfactory.hxx>
      20             : #include <osl/file.hxx>
      21             : #include <rtl/ustrbuf.hxx>
      22             : #include <rtl/strbuf.hxx>
      23             : 
      24             : using namespace sd;
      25             : using namespace ::com::sun::star;
      26             : using rtl::OUString;
      27             : using rtl::OString;
      28             : using namespace ::osl;
      29             : using namespace std;
      30             : 
      31           0 : Receiver::Receiver( Transmitter *aTransmitter )
      32             : {
      33           0 :     pTransmitter = aTransmitter;
      34           0 : }
      35             : 
      36           0 : Receiver::~Receiver()
      37             : {
      38           0 : }
      39             : 
      40           0 : void Receiver::parseCommand( std::vector<OString> aCommand )
      41             : {
      42           0 :     uno::Reference<presentation::XSlideShowController> xSlideShowController;
      43           0 :     uno::Reference<presentation::XPresentation2> xPresentation;
      44             :     try {
      45           0 :         uno::Reference< frame::XDesktop2 > xFramesSupplier = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
      46           0 :         uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW );
      47           0 :         uno::Reference<presentation::XPresentationSupplier> xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW);
      48             :         xPresentation = uno::Reference<presentation::XPresentation2>(
      49           0 :             xPS->getPresentation(), uno::UNO_QUERY_THROW);
      50             :         // Throws an exception if now slideshow running
      51             :         xSlideShowController =  uno::Reference<presentation::XSlideShowController>(
      52           0 :            xPresentation->getController(), uno::UNO_QUERY_THROW );
      53             :     }
      54           0 :     catch (uno::RuntimeException &)
      55             :     {
      56             :     }
      57             : 
      58           0 :     if ( aCommand[0].equals( "transition_next" ) )
      59             :     {
      60           0 :         if ( xSlideShowController.is() )
      61           0 :             xSlideShowController->gotoNextEffect();
      62             :     }
      63           0 :     else if ( aCommand[0].equals( "transition_previous" ) )
      64             :     {
      65           0 :         if ( xSlideShowController.is() )
      66           0 :             xSlideShowController->gotoPreviousEffect();
      67             :     }
      68           0 :     else if ( aCommand[0].equals( "goto_slide" ) )
      69             :     {
      70             :         // FIXME: if 0 returned, then not a valid number
      71           0 :         sal_Int32 aSlide = aCommand[1].toInt32();
      72           0 :         if ( xSlideShowController.is() &&
      73           0 :             xSlideShowController->getCurrentSlideIndex() != aSlide )
      74             :         {
      75           0 :             xSlideShowController->gotoSlideIndex( aSlide );
      76             :         }
      77             :     }
      78           0 :     else if ( aCommand[0].equals( "presentation_start" ) )
      79             :     {
      80           0 :         if ( xPresentation.is() )
      81           0 :             xPresentation->start();
      82             :     }
      83           0 :     else if ( aCommand[0].equals( "presentation_stop" ) )
      84             :     {
      85           0 :         if ( xPresentation.is() )
      86           0 :             xPresentation->end();
      87             :     }
      88           0 :     else if ( aCommand[0].equals( "presentation_blank_screen" ) )
      89             :     {
      90           0 :         sal_Int32 aColour = 0; // Default is black
      91           0 :         if ( aCommand.size() > 1 )
      92             :         {
      93             : //             aColour = FIXME: get the colour in some format from this string
      94             : //              Determine the formatting first.
      95             :         }
      96           0 :         if ( xSlideShowController.is() )
      97             :         {
      98           0 :             xSlideShowController->blankScreen( aColour );
      99             :         }
     100             :     }
     101           0 :     else if ( aCommand[0].equals( "presentation_resume" ) )
     102             :     {
     103           0 :         if ( xSlideShowController.is() )
     104             :         {
     105           0 :             xSlideShowController->resume();
     106             :         }
     107           0 :     }
     108           0 : }
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10