Added additional commands and parsing.
Change-Id: Iae099aeb07d25435115514e1bf0c4efb31613d50
This commit is contained in:
committed by
Michael Meeks
parent
4b8a3e4f4c
commit
e697fd2de4
@@ -1,5 +1,7 @@
|
|||||||
package org.libreoffice.impressremote.communication;
|
package org.libreoffice.impressremote.communication;
|
||||||
|
|
||||||
|
import android.graphics.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to send commands to the server.
|
* Interface to send commands to the server.
|
||||||
*
|
*
|
||||||
@@ -26,4 +28,30 @@ public class Transmitter {
|
|||||||
mClient.sendCommand("goto_slide\n" + slide + "\n\n");
|
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
|
||||||
|
* <code> blankScreen( colour ) </code>.
|
||||||
|
*/
|
||||||
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -45,6 +45,7 @@ void Receiver::parseCommand( std::vector<OString> aCommand )
|
|||||||
fprintf( stderr, "%s\n", aCommand[i].getStr() );}
|
fprintf( stderr, "%s\n", aCommand[i].getStr() );}
|
||||||
fprintf( stderr, "End parse\n" );
|
fprintf( stderr, "End parse\n" );
|
||||||
uno::Reference<presentation::XSlideShowController> xSlideShowController;
|
uno::Reference<presentation::XSlideShowController> xSlideShowController;
|
||||||
|
uno::Reference<presentation::XPresentation2> xPresentation;
|
||||||
try {
|
try {
|
||||||
uno::Reference< lang::XMultiServiceFactory > xServiceManager(
|
uno::Reference< lang::XMultiServiceFactory > xServiceManager(
|
||||||
::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
|
::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
|
||||||
@@ -52,31 +53,64 @@ void Receiver::parseCommand( std::vector<OString> aCommand )
|
|||||||
"com.sun.star.frame.Desktop" ) , uno::UNO_QUERY_THROW );
|
"com.sun.star.frame.Desktop" ) , uno::UNO_QUERY_THROW );
|
||||||
uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW );
|
uno::Reference< frame::XFrame > xFrame ( xFramesSupplier->getActiveFrame(), uno::UNO_QUERY_THROW );
|
||||||
uno::Reference<presentation::XPresentationSupplier> xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW);
|
uno::Reference<presentation::XPresentationSupplier> xPS ( xFrame->getController()->getModel(), uno::UNO_QUERY_THROW);
|
||||||
uno::Reference<presentation::XPresentation2> xPresentation(xPS->getPresentation(), uno::UNO_QUERY_THROW);
|
xPresentation = uno::Reference<presentation::XPresentation2>(
|
||||||
|
xPS->getPresentation(), uno::UNO_QUERY_THROW);
|
||||||
// Throws an exception if now slideshow running
|
// Throws an exception if now slideshow running
|
||||||
xSlideShowController = uno::Reference<presentation::XSlideShowController>(
|
xSlideShowController = uno::Reference<presentation::XSlideShowController>(
|
||||||
xPresentation->getController(), uno::UNO_QUERY_THROW );
|
xPresentation->getController(), uno::UNO_QUERY_THROW );
|
||||||
}
|
}
|
||||||
catch ( com::sun::star::uno::RuntimeException &e )
|
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
|
// FIXME: if 0 returned, then not a valid number
|
||||||
sal_Int32 aSlide = aCommand[1].toInt32();
|
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
|
// FIXME: remove later, this is just to test functionality
|
||||||
//sendPreview( 0, xSlideShowController, mTransmitter );
|
//sendPreview( 0, xSlideShowController, mTransmitter );
|
||||||
|
|
||||||
|
@@ -20,8 +20,6 @@
|
|||||||
|
|
||||||
#include <com/sun/star/presentation/XSlideShowListener.hpp>
|
#include <com/sun/star/presentation/XSlideShowListener.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The port for use for the main communication between LibO and remote control app.
|
* The port for use for the main communication between LibO and remote control app.
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user