2012-07-11 17:44:41 +01:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
2012-07-09 10:57:32 +01:00
|
|
|
*
|
2012-07-11 17:44:41 +01:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*/
|
2012-07-09 10:57:32 +01:00
|
|
|
#include "Receiver.hxx"
|
2012-07-11 17:44:41 +01:00
|
|
|
#include <string.h>
|
2012-07-17 17:48:07 +02:00
|
|
|
#include <com/sun/star/presentation/XSlideShowController.hpp>
|
|
|
|
#include <com/sun/star/presentation/XPresentationSupplier.hpp>
|
|
|
|
#include <com/sun/star/presentation/XPresentation2.hpp>
|
2012-07-09 15:53:03 +01:00
|
|
|
#include <com/sun/star/frame/XFramesSupplier.hpp>
|
2012-07-10 16:36:04 +01:00
|
|
|
#include <com/sun/star/uno/RuntimeException.hpp>
|
2012-07-19 18:43:18 +02:00
|
|
|
|
2012-07-11 17:44:41 +01:00
|
|
|
|
2012-07-09 15:53:03 +01:00
|
|
|
#include <comphelper/processfactory.hxx>
|
2012-07-11 17:44:41 +01:00
|
|
|
#include <osl/file.hxx>
|
|
|
|
#include <xmlsec/base64.h>
|
|
|
|
#include <rtl/ustrbuf.hxx>
|
|
|
|
#include <sax/tools/converter.hxx>
|
2012-07-13 17:34:49 +01:00
|
|
|
#include <rtl/strbuf.hxx>
|
2012-07-12 17:59:08 +01:00
|
|
|
|
2012-07-09 15:53:03 +01:00
|
|
|
using namespace sd;
|
2012-07-12 17:59:08 +01:00
|
|
|
using namespace ::com::sun::star;
|
2012-07-11 17:44:41 +01:00
|
|
|
using rtl::OUString;
|
|
|
|
using rtl::OString;
|
|
|
|
using namespace ::osl;
|
2012-07-12 22:10:33 +01:00
|
|
|
using namespace std;
|
2012-07-11 17:44:41 +01:00
|
|
|
|
2012-07-13 17:34:49 +01:00
|
|
|
Receiver::Receiver( Transmitter *aTransmitter )
|
2012-07-09 10:57:32 +01:00
|
|
|
{
|
2012-07-18 16:14:52 +02:00
|
|
|
pTransmitter = aTransmitter;
|
2012-07-09 10:57:32 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Receiver::~Receiver()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-07-13 17:34:49 +01:00
|
|
|
void Receiver::parseCommand( std::vector<OString> aCommand )
|
2012-07-09 10:57:32 +01:00
|
|
|
{
|
2012-07-12 22:10:33 +01:00
|
|
|
uno::Reference<presentation::XSlideShowController> xSlideShowController;
|
2012-07-15 16:37:26 +01:00
|
|
|
uno::Reference<presentation::XPresentation2> xPresentation;
|
2012-07-10 16:36:04 +01:00
|
|
|
try {
|
2012-07-12 22:10:33 +01:00
|
|
|
uno::Reference< lang::XMultiServiceFactory > xServiceManager(
|
|
|
|
::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
|
|
|
|
uno::Reference< frame::XFramesSupplier > xFramesSupplier( xServiceManager->createInstance(
|
|
|
|
"com.sun.star.frame.Desktop" ) , 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);
|
2012-07-15 16:37:26 +01:00
|
|
|
xPresentation = uno::Reference<presentation::XPresentation2>(
|
|
|
|
xPS->getPresentation(), uno::UNO_QUERY_THROW);
|
2012-07-10 16:36:04 +01:00
|
|
|
// Throws an exception if now slideshow running
|
2012-07-12 22:10:33 +01:00
|
|
|
xSlideShowController = uno::Reference<presentation::XSlideShowController>(
|
|
|
|
xPresentation->getController(), uno::UNO_QUERY_THROW );
|
2012-07-10 16:36:04 +01:00
|
|
|
}
|
|
|
|
catch ( com::sun::star::uno::RuntimeException &e )
|
|
|
|
{
|
2012-07-18 22:04:09 +02:00
|
|
|
fprintf( stderr, "Error in retrieving Controller\n" );
|
2012-07-15 16:37:26 +01:00
|
|
|
//return;
|
2012-07-10 16:36:04 +01:00
|
|
|
}
|
2012-07-09 15:53:03 +01:00
|
|
|
|
2012-07-15 16:37:26 +01:00
|
|
|
if ( aCommand[0].equals( "transition_next" ) )
|
2012-07-12 22:10:33 +01:00
|
|
|
{
|
2012-07-15 16:37:26 +01:00
|
|
|
if ( xSlideShowController.is() )
|
|
|
|
xSlideShowController->gotoNextEffect();
|
2012-07-12 22:10:33 +01:00
|
|
|
}
|
2012-07-15 16:37:26 +01:00
|
|
|
else if ( aCommand[0].equals( "transition_previous" ) )
|
2012-07-12 22:10:33 +01:00
|
|
|
{
|
2012-07-15 16:37:26 +01:00
|
|
|
if ( xSlideShowController.is() )
|
|
|
|
xSlideShowController->gotoPreviousEffect();
|
2012-07-12 22:10:33 +01:00
|
|
|
}
|
2012-07-15 16:37:26 +01:00
|
|
|
else if ( aCommand[0].equals( "goto_slide" ) )
|
2012-07-12 22:10:33 +01:00
|
|
|
{
|
|
|
|
// FIXME: if 0 returned, then not a valid number
|
|
|
|
sal_Int32 aSlide = aCommand[1].toInt32();
|
2012-07-15 16:37:26 +01:00
|
|
|
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();
|
|
|
|
}
|
2012-07-09 10:57:32 +01:00
|
|
|
}
|
2012-07-11 17:44:41 +01:00
|
|
|
}
|
2012-07-10 16:36:04 +01:00
|
|
|
|
2012-07-12 17:59:08 +01:00
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|