diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java index 40bb9183f6ee..679b287cf7dc 100644 --- a/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java +++ b/android/sdremote/src/org/libreoffice/impressremote/communication/Transmitter.java @@ -1,5 +1,7 @@ package org.libreoffice.impressremote.communication; +import android.graphics.Color; + /** * Interface to send commands to the server. * @@ -26,4 +28,30 @@ public class Transmitter { mClient.sendCommand("goto_slide\n" + slide + "\n\n"); } + /** + * Blank the screen to the default colour (set server-side), which is + * generally black. This is slightly faster than using + * blankScreen( colour ) . + */ + public void blankScreen() { + mClient.sendCommand("presentation_blank_screen\n\n"); + } + + /** + * Set the screen to a specific colour. Only use if a non default colour is + * needed. + * @param aColor + */ + public void blankScreen(Color aColor) { + // Fixme: check how to get colour in integer form. + mClient.sendCommand("presentation_blank_screen\n" + aColor + "\n\n"); + } + + public void startPresentation() { + mClient.sendCommand("presentation_start\n\n"); + } + + public void stopPresentation() { + mClient.sendCommand("presentation_stop\n\n"); + } } diff --git a/sd/source/ui/remotecontrol/Receiver.cxx b/sd/source/ui/remotecontrol/Receiver.cxx index fa78954af8da..fce380f77ec7 100644 --- a/sd/source/ui/remotecontrol/Receiver.cxx +++ b/sd/source/ui/remotecontrol/Receiver.cxx @@ -45,6 +45,7 @@ void Receiver::parseCommand( std::vector aCommand ) fprintf( stderr, "%s\n", aCommand[i].getStr() );} fprintf( stderr, "End parse\n" ); uno::Reference xSlideShowController; + uno::Reference xPresentation; try { uno::Reference< lang::XMultiServiceFactory > xServiceManager( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); @@ -52,31 +53,64 @@ void Receiver::parseCommand( std::vector aCommand ) "com.sun.star.frame.Desktop" ) , uno::UNO_QUERY_THROW ); uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW ); uno::Reference xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW); - uno::Reference xPresentation(xPS->getPresentation(), uno::UNO_QUERY_THROW); + xPresentation = uno::Reference( + xPS->getPresentation(), uno::UNO_QUERY_THROW); // Throws an exception if now slideshow running xSlideShowController = uno::Reference( xPresentation->getController(), uno::UNO_QUERY_THROW ); } catch ( com::sun::star::uno::RuntimeException &e ) { - return; + //return; } - if ( aCommand[0].compareTo( "transition_next" ) == 0 ) + if ( aCommand[0].equals( "transition_next" ) ) { - xSlideShowController->gotoNextEffect(); + if ( xSlideShowController.is() ) + xSlideShowController->gotoNextEffect(); } - else if ( aCommand[0].compareTo( "transition_previous" ) == 0 ) + else if ( aCommand[0].equals( "transition_previous" ) ) { - xSlideShowController->gotoPreviousEffect(); + if ( xSlideShowController.is() ) + xSlideShowController->gotoPreviousEffect(); } - else if ( aCommand[0].compareTo( "goto_slide" ) == 0 ) + else if ( aCommand[0].equals( "goto_slide" ) ) { // FIXME: if 0 returned, then not a valid number sal_Int32 aSlide = aCommand[1].toInt32(); - xSlideShowController->gotoSlideIndex( aSlide ); + if ( xSlideShowController.is() ) + xSlideShowController->gotoSlideIndex( aSlide ); + } + else if ( aCommand[0].equals( "presentation_start" ) ) + { + if ( xPresentation.is() ) + xPresentation->start(); + } + else if ( aCommand[0].equals( "presentation_stop" ) ) + { + if ( xPresentation.is() ) + xPresentation->end(); + } + else if ( aCommand[0].equals( "presentation_blank_screen" ) ) + { + sal_Int32 aColour = 0; // Default is black + if ( aCommand.size() > 1 ) + { +// aColour = FIXME: get the colour in some format from this string +// Determine the formatting first. + } + if ( xSlideShowController.is() ) + { + xSlideShowController->blankScreen( aColour ); + } + } + else if ( aCommand[0].equals( "presentation_resume" ) ) + { + if ( xSlideShowController.is() ) + { + xSlideShowController->resume(); + } } - // FIXME: remove later, this is just to test functionality //sendPreview( 0, xSlideShowController, mTransmitter ); diff --git a/sd/source/ui/remotecontrol/Server.hxx b/sd/source/ui/remotecontrol/Server.hxx index 2b3c706215f1..bc2de65042d7 100644 --- a/sd/source/ui/remotecontrol/Server.hxx +++ b/sd/source/ui/remotecontrol/Server.hxx @@ -20,8 +20,6 @@ #include - - /** * The port for use for the main communication between LibO and remote control app. */